1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-26 14:03:49 +03:00

conf: add PCI controllers

Add new controller type 'pci' with models 'pci-root' and 'pci-bridge'.
This commit is contained in:
Ján Tomko 2013-04-17 17:05:15 +02:00
parent 024e9af3e5
commit df0ebf6b38
4 changed files with 67 additions and 2 deletions

View File

@ -2124,7 +2124,7 @@
<p>
Each controller has a mandatory attribute <code>type</code>,
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 <code>index</code> which is the decimal integer
describing in which order the bus controller is encountered (for
use in <code>controller</code> attributes
@ -2179,6 +2179,31 @@
&lt;/controller&gt;
...
&lt;/devices&gt;
...</pre>
<p>
PCI controllers have an optional <code>model</code> attribute with
possible values <code>pci-root</code> or <code>pci-bridge</code>.
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.
(<span class="since">since 1.0.5</span>)
</p>
<pre>
...
&lt;devices&gt;
&lt;controller type='pci' index='0' model='pci-root'/&gt;
&lt;controller type='pci' index='1' model='pci-bridge'&gt;
&lt;address type='pci' domain='0' bus='0' slot='5' function='0' multifunction=off'/&gt;
&lt;/controller&gt;
&lt;/devices&gt;
...</pre>
<h4><a name="elementsLease">Device leases</a></h4>

View File

@ -1470,6 +1470,18 @@
<ref name="usbmaster"/>
</optional>
</group>
<!-- pci has an optional attribute "model" -->
<group>
<attribute name="type">
<value>pci</value>
</attribute>
<attribute name="model">
<choice>
<value>pci-root</value>
<value>pci-bridge</value>
</choice>
</attribute>
</group>
<!-- virtio-serial has optional "ports" and "vectors" -->
<group>
<attribute name="type">

View File

@ -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;
}

View File

@ -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)