• L
    qemu: set/use proper pciConnectFlags during hotplug · abb7a4bd
    Laine Stump 提交于
    Before now, all the qemu hotplug functions assumed that all devices to
    be hotplugged were legacy PCI endpoint devices
    (VIR_PCI_CONNECT_TYPE_PCI_DEVICE). This worked out "okay", because all
    devices *are* legacy PCI endpoint devices on x86/440fx machinetypes,
    and hotplug didn't work properly on machinetypes using PCIe anyway
    (hotplugging onto a legacy PCI slot doesn't work, and until commit
    b87703cf any attempt to manually specify a PCIe address for a
    hotplugged device would be erroneously rejected).
    
    This patch makes all qemu hotplug operations honor the pciConnectFlags
    set by the single all-knowing function
    qemuDomainDeviceCalculatePCIConnectFlags(). This is done in 3 steps,
    but in a single commit since we would have to touch the other points
    at each step anyway:
    
    1) add a flags argument to the hypervisor-agnostic
    virDomainPCIAddressEnsureAddr() (previously it hardcoded
    ..._PCI_DEVICE)
    
    2) add a new qemu-specific function qemuDomainEnsurePCIAddress() which
    gets the correct pciConnectFlags for the device from
    qemuDomainDeviceConnectFlags(), then calls
    virDomainPCIAddressEnsureAddr().
    
    3) in qemu_hotplug.c replace all calls to
    virDomainPCIAddressEnsureAddr() with calls to
    qemuDomainEnsurePCIAddress()
    
    So in effect, we're putting a "shim" on top of all calls to
    virDomainPCIAddressEnsureAddr() that sets the right pciConnectFlags.
    abb7a4bd
qemu_hotplug.c 167.6 KB