diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 6d6cfb6dc44b1c940c59e7326842973b579a4906..0c0506b4a44e5ee79e8ff9e60616cccc9cfdb66f 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2124,7 +2124,7 @@
Each controller has a mandatory attribute type
,
which must be one of "ide", "fdc", "scsi", "sata", "usb",
- "ccid", or "virtio-serial", and a mandatory
+ "ccid", "virtio-serial" or "pci", and a mandatory
attribute index
which is the decimal integer
describing in which order the bus controller is encountered (for
use in controller
attributes
@@ -2179,6 +2179,31 @@
</controller>
...
</devices>
+ ...
+
+
+ PCI controllers have an optional model
attribute with
+ possible values pci-root
or pci-bridge
.
+ For machine types which provide an implicit pci bus, the pci-root
+ controller with index=0 is auto-added and required to use PCI devices.
+ PCI root has no address.
+ PCI bridges are auto-added if there are too many devices to fit on
+ the one bus provided by pci-root, or a PCI bus number greater than zero
+ was specified.
+ PCI bridges can also be specified manually, but their addresses should
+ only refer to PCI buses provided by already specified PCI controllers.
+ Leaving gaps in the PCI controller indexes might lead to an invalid
+ configuration.
+ (since 1.0.5)
+
+
+ ...
+ <devices>
+ <controller type='pci' index='0' model='pci-root'/>
+ <controller type='pci' index='1' model='pci-bridge'>
+ <address type='pci' domain='0' bus='0' slot='5' function='0' multifunction=off'/>
+ </controller>
+ </devices>
...
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 0c1b76aea0276d052b82d24da31a5034f8784e6e..97859e71e98de972ed20e27d85482bb55d2cf113 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1470,6 +1470,18 @@
+
+
+
+ pci
+
+
+
+ pci-root
+ pci-bridge
+
+
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b38f48938b8ddbc5d2bd7a96fa06e3de81596bcb..cc0e63746fdb347ef18470063e6db44fabdf47ff 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -301,7 +301,12 @@ VIR_ENUM_IMPL(virDomainController, VIR_DOMAIN_CONTROLLER_TYPE_LAST,
"sata",
"virtio-serial",
"ccid",
- "usb")
+ "usb",
+ "pci")
+
+VIR_ENUM_IMPL(virDomainControllerModelPCI, VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST,
+ "pci-root",
+ "pci-bridge")
VIR_ENUM_IMPL(virDomainControllerModelSCSI, VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST,
"auto",
@@ -5164,6 +5169,8 @@ virDomainControllerModelTypeFromString(const virDomainControllerDefPtr def,
return virDomainControllerModelSCSITypeFromString(model);
else if (def->type == VIR_DOMAIN_CONTROLLER_TYPE_USB)
return virDomainControllerModelUSBTypeFromString(model);
+ else if (def->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI)
+ return virDomainControllerModelPCITypeFromString(model);
return -1;
}
@@ -5289,6 +5296,16 @@ virDomainControllerDefParseXML(xmlNodePtr node,
}
break;
}
+ case VIR_DOMAIN_CONTROLLER_TYPE_PCI:
+ switch (def->model) {
+ case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT:
+ if (def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("pci-root controller should not "
+ "have an address"));
+ goto error;
+ }
+ }
default:
break;
@@ -13554,6 +13571,8 @@ virDomainControllerModelTypeToString(virDomainControllerDefPtr def,
return virDomainControllerModelSCSITypeToString(model);
else if (def->type == VIR_DOMAIN_CONTROLLER_TYPE_USB)
return virDomainControllerModelUSBTypeToString(model);
+ else if (def->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI)
+ return virDomainControllerModelPCITypeToString(model);
return NULL;
}
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 8d859668444ca308239d8ec5d36d28e918062ccb..946ad206d34b9e223a465f3521dc6d1a8e718f81 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -701,11 +701,19 @@ enum virDomainControllerType {
VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL,
VIR_DOMAIN_CONTROLLER_TYPE_CCID,
VIR_DOMAIN_CONTROLLER_TYPE_USB,
+ VIR_DOMAIN_CONTROLLER_TYPE_PCI,
VIR_DOMAIN_CONTROLLER_TYPE_LAST
};
+enum virDomainControllerModelPCI {
+ VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT,
+ VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE,
+
+ VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST
+};
+
enum virDomainControllerModelSCSI {
VIR_DOMAIN_CONTROLLER_MODEL_SCSI_AUTO,
VIR_DOMAIN_CONTROLLER_MODEL_SCSI_BUSLOGIC,
@@ -2435,6 +2443,7 @@ VIR_ENUM_DECL(virDomainIoEventFd)
VIR_ENUM_DECL(virDomainVirtioEventIdx)
VIR_ENUM_DECL(virDomainDiskCopyOnRead)
VIR_ENUM_DECL(virDomainController)
+VIR_ENUM_DECL(virDomainControllerModelPCI)
VIR_ENUM_DECL(virDomainControllerModelSCSI)
VIR_ENUM_DECL(virDomainControllerModelUSB)
VIR_ENUM_DECL(virDomainFS)