From 2ad21cd97f52c4aa81c7a9e0956719d1d4039804 Mon Sep 17 00:00:00 2001 From: Andrea Bolognani Date: Fri, 11 Jul 2025 15:38:37 +0200 Subject: [PATCH] qemu: Validate presence of PCI support MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The qemuValidateDomainDeviceDefControllerPCI() function is called if PCI controllers are present in the domain configuration, which shouldn't happen if the machine type doesn't support PCI. If we somehow find ourselves in that scenario, reporting an error would be the right thing to do. Signed-off-by: Andrea Bolognani Reviewed-by: Michal Privoznik Reviewed-by: Peter Krempa Reviewed-by: Ján Tomko --- src/qemu/qemu_validate.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index c7ecb467a3..456f9ee2f2 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -3983,6 +3983,13 @@ qemuValidateDomainDeviceDefControllerPCI(const virDomainControllerDef *cont, return -1; } + if (!qemuDomainSupportsPCI(def)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Machine type '%1$s' does not support PCI"), + def->os.machine); + return -1; + } + /* modelName */ switch ((virDomainControllerModelPCI) cont->model) { case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE: -- 2.47.3