On 03/14/2017 12:58 PM, Andrea Bolognani wrote:
ioh3420 is emulated Intel hardware, so it always looked
quite out of place in aarch64/virt guests.
If pcie-root-port is available in QEMU, use that device
instead.
---
It was mentioned somewhere, at some point, that we might
want to switch to generic PCIe Root Ports for x86/q35
guests as well.
It sounds like a good idea to me, and in fact QEMU's sample
configuration files for x86/q35 (docs/q35-virtio-*.cfg)
already push in that direction; however, I didn't want to
risk holding up the aarch64/virt change, which we
unquestionably want, because of that, so I will propose it
as a separate patch further down the line.
Personally I'm fine with making it the default for new root ports on any
machinetype that has it in the capabilities - if anything doesn't work,
it's a bug and needs to be fixed, and we can't find the things that
don't work if people aren't using it. In other words "the sooner the
better". (Aside from that is the fact that the generic root port is
going to have IO space turned off by default, and we should all be
switching to that as soon as possible).
ACK to this patch as it is, and also ACK to this patch with the
"MachineIsVirt()" qualifier removed (or to a separate patch that removes
it).
src/qemu/qemu_domain_address.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 64aa4ef..bd2f718 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -1846,13 +1846,16 @@ qemuDomainSupportsPCI(virDomainDefPtr def,
static void
-qemuDomainPCIControllerSetDefaultModelName(virDomainControllerDefPtr cont)
+qemuDomainPCIControllerSetDefaultModelName(virDomainControllerDefPtr cont,
+ virDomainDefPtr def,
+ virQEMUCapsPtr qemuCaps)
{
int *modelName = &cont->opts.pciopts.modelName;
/* make sure it's not already set */
if (*modelName != VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE)
return;
+
switch ((virDomainControllerModelPCI)cont->model) {
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE:
*modelName = VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PCI_BRIDGE;
@@ -1861,7 +1864,13 @@
qemuDomainPCIControllerSetDefaultModelName(virDomainControllerDefPtr cont)
*modelName = VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_I82801B11_BRIDGE;
break;
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT:
- *modelName = VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_IOH3420;
+ /* Use generic PCIe Root Ports for mach-virt guests, if available */
+ if (qemuDomainMachineIsVirt(def) &&
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PCIE_ROOT_PORT)) {
+ *modelName = VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PCIE_ROOT_PORT;
+ } else {
+ *modelName = VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_IOH3420;
+ }
break;
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT:
*modelName = VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_X3130_UPSTREAM;
@@ -2143,7 +2152,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
* device in qemu) for any controller that doesn't yet
* have it set.
*/
- qemuDomainPCIControllerSetDefaultModelName(cont);
+ qemuDomainPCIControllerSetDefaultModelName(cont, def, qemuCaps);
/* set defaults for any other auto-generated config
* options for this controller that haven't been