mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
qemu: Validate PCI controller options (numaNode)
This change catches an invalid use of the option in our test suite. https://bugzilla.redhat.com/show_bug.cgi?id=1483816 Signed-off-by: Andrea Bolognani <abologna@redhat.com> Reviewed-by: Laine Stump <laine@laine.org>
This commit is contained in:
parent
5bd8764ee0
commit
c651cdbce6
@ -4723,6 +4723,50 @@ qemuDomainDeviceDefValidateControllerPCI(const virDomainControllerDef *cont,
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* numaNode */
|
||||
switch ((virDomainControllerModelPCI) cont->model) {
|
||||
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS:
|
||||
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_EXPANDER_BUS:
|
||||
/* numaNode can be used for these controllers, but it's not set
|
||||
* automatically so it can be missing */
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT:
|
||||
/* Only PHBs support numaNode */
|
||||
if (pciopts->numaNode != -1 &&
|
||||
pciopts->modelName != VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_SPAPR_PCI_HOST_BRIDGE) {
|
||||
virReportControllerInvalidOption(cont, model, modelName, "numaNode");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* However, the default PHB doesn't support numaNode */
|
||||
if (pciopts->numaNode != -1 &&
|
||||
pciopts->modelName == VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_SPAPR_PCI_HOST_BRIDGE &&
|
||||
pciopts->targetIndex == 0) {
|
||||
virReportControllerInvalidOption(cont, model, modelName, "numaNode");
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE:
|
||||
case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE:
|
||||
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT:
|
||||
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT:
|
||||
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT:
|
||||
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT:
|
||||
if (pciopts->numaNode != -1) {
|
||||
virReportControllerInvalidOption(cont, model, modelName, "numaNode");
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_DEFAULT:
|
||||
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST:
|
||||
default:
|
||||
virReportEnumRangeError(virDomainControllerModelPCI, cont->model);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return qemuDomainDeviceDefValidateControllerPCIOld(cont, def, qemuCaps);
|
||||
}
|
||||
|
||||
|
@ -35,9 +35,6 @@
|
||||
<address type='pci' bus='0x00' slot='4'/>
|
||||
</controller>
|
||||
<controller type='pci' index='2' model='pcie-root-port'>
|
||||
<target>
|
||||
<node>1</node>
|
||||
</target>
|
||||
<address type='pci' bus='0x01'/>
|
||||
</controller>
|
||||
<controller type='pci' index='3' model='pcie-switch-upstream-port'>
|
||||
|
@ -36,9 +36,7 @@
|
||||
</controller>
|
||||
<controller type='pci' index='2' model='pcie-root-port'>
|
||||
<model name='ioh3420'/>
|
||||
<target chassis='2' port='0x0'>
|
||||
<node>1</node>
|
||||
</target>
|
||||
<target chassis='2' port='0x0'/>
|
||||
<address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
|
||||
</controller>
|
||||
<controller type='pci' index='3' model='pcie-switch-upstream-port'>
|
||||
|
Loading…
Reference in New Issue
Block a user