libvirt/src/conf
Laine Stump 0702f48ef4 qemu: auto-add pcie-root-port/dmi-to-pci-bridge controllers as needed
Previously libvirt would only add pci-bridge devices automatically
when an address was requested for a device that required a legacy PCI
slot and none was available. This patch expands that support to
dmi-to-pci-bridge (which is needed in order to add a pci-bridge on a
machine with a pcie-root), and pcie-root-port (which is needed to add
a hotpluggable PCIe device). It does *not* automatically add
pcie-switch-upstream-ports or pcie-switch-downstream-ports (and
currently there are no plans for that).

Given the existing code to auto-add pci-bridge devices, automatically
adding pcie-root-ports is fairly straightforward. The
dmi-to-pci-bridge support is a bit tricky though, for a few reasons:

1) Although the only reason to add a dmi-to-pci-bridge is so that
   there is a reasonable place to plug in a pci-bridge controller,
   most of the time it's not the presence of a pci-bridge *in the
   config* that triggers the requirement to add a dmi-to-pci-bridge.
   Rather, it is the presence of a legacy-PCI device in the config,
   which triggers auto-add of a pci-bridge, which triggers auto-add of
   a dmi-to-pci-bridge (this is handled in
   virDomainPCIAddressSetGrow() - if there's a request to add a
   pci-bridge we'll check if there is a suitable bus to plug it into;
   if not, we first add a dmi-to-pci-bridge).

2) Once there is already a single dmi-to-pci-bridge on the system,
   there won't be a need for any more, even if it's full, as long as
   there is a pci-bridge with an open slot - you can also plug
   pci-bridges into existing pci-bridges. So we have to make sure we
   don't add a dmi-to-pci-bridge unless there aren't any
   dmi-to-pci-bridges *or* any pci-bridges.

3) Although it is strongly discouraged, it is legal for a pci-bridge
   to be directly plugged into pcie-root, and we don't want to
   auto-add a dmi-to-pci-bridge if there is already a pci-bridge
   that's been forced directly into pcie-root.

Although libvirt will now automatically create a dmi-to-pci-bridge
when it's needed, the code still remains for now that forces a
dmi-to-pci-bridge on all domains with pcie-root (in
qemuDomainDefAddDefaultDevices()). That will be removed in a future
patch.

For now, the pcie-root-ports are added one to a slot, which is a bit
wasteful and means it will fail after 31 total PCIe devices (30 if
there are also some PCI devices), but helps keep the changeset down
for this patch. A future patch will have 8 pcie-root-ports sharing the
functions on a single slot.
2016-11-14 14:19:36 -05:00
..
capabilities.c
capabilities.h headers: Remove unnecessary keyword extern from function declaration 2016-05-11 09:06:32 +02:00
cpu_conf.c conf: Introduce virCPUDefCopyModelFilter 2016-09-22 15:40:08 +02:00
cpu_conf.h conf: Introduce virCPUDefCopyModelFilter 2016-09-22 15:40:08 +02:00
device_conf.c util: move virInterface(State|Link)/virNetDevFeature from conf to util 2016-06-26 19:33:07 -04:00
device_conf.h qemu: new functions to calculate/set device pciConnectFlags 2016-11-14 14:05:03 -05:00
domain_addr.c qemu: auto-add pcie-root-port/dmi-to-pci-bridge controllers as needed 2016-11-14 14:19:36 -05:00
domain_addr.h qemu: set/use proper pciConnectFlags during hotplug 2016-11-14 14:09:10 -05:00
domain_audit.c conf: Use virDomainChrSourceDefPtr for _virDomainSmartcardDef 'passthru' 2016-10-24 06:44:23 -04:00
domain_audit.h audit: Audit information about shmem devices 2016-09-12 19:41:43 +02:00
domain_capabilities.c Show host model in domain capabilities 2016-09-22 15:40:08 +02:00
domain_capabilities.h Show host model in domain capabilities 2016-09-22 15:40:08 +02:00
domain_conf.c Cleanup switch statements on the hostdev subsystem type 2016-11-11 16:58:56 -05:00
domain_conf.h conf, qemu: Add newer shmem models 2016-11-02 16:05:39 +01:00
domain_event.c events: Add explicit lookup 'key' value 2016-07-01 07:15:38 -04:00
domain_event.h Add VIR_DOMAIN_EVENT_ID_DEVICE_REMOVAL_FAILED event 2016-04-13 13:26:29 +02:00
domain_nwfilter.c
domain_nwfilter.h
interface_conf.c global: consistently use IP rather than Ip in identifiers 2016-06-26 19:33:07 -04:00
interface_conf.h global: consistently use IP rather than Ip in identifiers 2016-06-26 19:33:07 -04:00
netdev_bandwidth_conf.c
netdev_bandwidth_conf.h
netdev_vlan_conf.c
netdev_vlan_conf.h
netdev_vport_profile_conf.c
netdev_vport_profile_conf.h
network_conf.c network: Use new util function to check name 2016-10-20 19:09:14 +08:00
network_conf.h network: allow limiting a <forwarder> element to certain domains 2016-08-19 21:34:51 -04:00
network_event.c events: Add explicit lookup 'key' value 2016-07-01 07:15:38 -04:00
network_event.h
networkcommon_conf.c util: move IP route & address object-related functions to virnetdevip.c 2016-06-26 19:33:09 -04:00
networkcommon_conf.h util: move IP route & address object-related functions to virnetdevip.c 2016-06-26 19:33:09 -04:00
node_device_conf.c conf: Fix initialization value of 'multi' in PCI address 2016-09-02 16:43:00 +02:00
node_device_conf.h tests: fix segfault in objecteventtest 2016-08-29 13:51:56 +03:00
node_device_event.c Introduce node device update event as top level event 2016-08-15 08:30:56 -04:00
node_device_event.h Introduce node device update event as top level event 2016-08-15 08:30:56 -04:00
numa_conf.c Remove separator argument from virBitmapParse 2016-06-20 12:09:52 +02:00
numa_conf.h
nwfilter_conf.c Use virDirOpenIfExists 2016-06-24 14:20:57 +02:00
nwfilter_conf.h nwfilter: Save config to disk if we generated a UUID 2016-05-02 10:06:04 -04:00
nwfilter_ipaddrmap.c
nwfilter_ipaddrmap.h
nwfilter_params.c
nwfilter_params.h
object_event_private.h conf: events: Fix coverity warning 2016-08-03 18:45:50 -04:00
object_event.c Clean timer in virObjectEventStateFlush 2016-10-12 12:54:47 +02:00
object_event.h Change virDomainEventState to virObjectLockable 2016-10-12 12:54:47 +02:00
secret_conf.c conf: Add new secret type "tls" 2016-09-09 08:20:05 -04:00
secret_conf.h conf: Add new secret type "tls" 2016-09-09 08:20:05 -04:00
snapshot_conf.c virDomainDefParseNode: Introduce @parseOpaque argument 2016-09-26 16:50:12 +02:00
snapshot_conf.h
storage_conf.c Fix Multiple Typos 2016-09-22 13:55:09 -04:00
storage_conf.h storage: implement storage lifecycle event APIs 2016-06-16 12:22:11 -04:00
storage_event.c events: Add explicit lookup 'key' value 2016-07-01 07:15:38 -04:00
storage_event.h Promote storage pool refresh lifecycle event to top level event 2016-06-24 18:26:11 +01:00
virchrdev.c
virchrdev.h
virdomainobjlist.c virDomainDefParse{File,String}: Introduce @parseOpaque argument 2016-09-26 16:50:12 +02:00
virdomainobjlist.h libxl: fix vm lock overwritten bug 2016-06-13 13:34:37 +02:00
virsecretobj.c conf: Add new secret type "tls" 2016-09-09 08:20:05 -04:00
virsecretobj.h secret: Introduce virSecretObjGetValue and virSecretObjGetValueSize 2016-04-25 15:45:29 -04:00