On 03/17/2017 05:06 AM, Andrea Bolognani wrote:
On Thu, 2017-03-16 at 18:30 -0400, Laine Stump wrote:
>> @@ -1861,7 +1863,12 @@
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 if available, falling back to
>> + * ioh3420 otherwise */
>> + if (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;
>
> I wonder if we should check caps for IOH3420 here just to be consistent
> (and log an error if neither is available). I realize that's not the way
> it worked before (existing code only checks the caps for a particular
> device at the time we generate the commandline), but I'll be the first
> to admit my original code was, err, "less than ideal".
>
> It's up to you though, add it or not.
We already check when building the QEMU command line, which
is the appropriate place IMHO. I'd rather not duplicate the
check here as well.
It all depends on whether you want to get an error when you define the
domain, or not until you try to start it. I prefer the latter, but in
this case it's all just academic, since we know that all qemu binaries
we recognize as having a PCIe root bus also support the ioh3420.