are recent enough to support 64-bit PCI holes, unless this is disabled
(set to 0). <span class="since">Since 1.1.2 (QEMU only)</span>
</p>
+ <p>
+ PCI controllers also have an optional
+ subelement <code><model></code> with an attribute
+ <code>name</code>. The name attribute holds the name of the
+ specific device that qemu is emulating (e.g. "i82801b11-bridge")
+ rather than simply the class of device ("dmi-to-pci-bridge",
+ "pci-bridge"), which is set in the controller element's
+ model <b>attribute</b>. In almost all cases, you should not
+ manually add a <code><model></code> subelement to a
+ controller, nor should you modify one that is automatically
+ generated by libvirt. <span class="since">Since 1.2.19 (QEMU
+ only).</span>
+ </p>
<p>
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.
<attribute name="type">
<value>pci</value>
</attribute>
+ <optional>
+ <element name="model">
+ <attribute name="name">
+ <choice>
+ <!-- implementations of 'pci-bridge' -->
+ <value>pci-bridge</value>
+ <!-- implementations of 'dmi-to-pci-bridge' -->
+ <value>i82801b11-bridge</value>
+ </choice>
+ </attribute>
+ <empty/>
+ </element>
+ </optional>
<!-- *-root controllers have an optional element "pcihole64"-->
<choice>
<group>
"pci-bridge",
"dmi-to-pci-bridge")
+VIR_ENUM_IMPL(virDomainControllerPCIModelName,
+ VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_LAST,
+ "none",
+ "pci-bridge",
+ "i82801b11-bridge")
+
VIR_ENUM_IMPL(virDomainControllerModelSCSI, VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST,
"auto",
"buslogic",
char *queues = NULL;
char *cmd_per_lun = NULL;
char *max_sectors = NULL;
+ bool processedModel = false;
+ char *modelName = NULL;
xmlNodePtr saved = ctxt->node;
int rc;
queues = virXMLPropString(cur, "queues");
cmd_per_lun = virXMLPropString(cur, "cmd_per_lun");
max_sectors = virXMLPropString(cur, "max_sectors");
+ } else if (xmlStrEqual(cur->name, BAD_CAST "model")) {
+ if (processedModel) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("Multiple <model> elements in "
+ "controller definition not allowed"));
+ goto error;
+ }
+ modelName = virXMLPropString(cur, "name");
+ processedModel = true;
}
}
cur = cur->next;
def->opts.pciopts.pcihole64size = VIR_DIV_UP(bytes, 1024);
}
}
+ if (modelName &&
+ (def->opts.pciopts.modelName
+ = virDomainControllerPCIModelNameTypeFromString(modelName)) <= 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Unknown PCI controller model name '%s'"),
+ modelName);
+ goto error;
+ }
+ break;
default:
break;
VIR_FREE(queues);
VIR_FREE(cmd_per_lun);
VIR_FREE(max_sectors);
+ VIR_FREE(modelName);
return def;
{
const char *type = virDomainControllerTypeToString(def->type);
const char *model = NULL;
- bool pcihole64 = false;
+ const char *modelName = NULL;
+ bool pcihole64 = false, pciModel = false;
if (!type) {
virReportError(VIR_ERR_INTERNAL_ERROR,
case VIR_DOMAIN_CONTROLLER_TYPE_PCI:
if (def->opts.pciopts.pcihole64)
pcihole64 = true;
+ if (def->opts.pciopts.modelName != VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE)
+ pciModel = true;
break;
default:
break;
}
- if (def->queues || def->cmd_per_lun || def->max_sectors ||
+ if (pciModel ||
+ def->queues || def->cmd_per_lun || def->max_sectors ||
virDomainDeviceInfoNeedsFormat(&def->info, flags) || pcihole64) {
virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 2);
+ if (pciModel) {
+ modelName = virDomainControllerPCIModelNameTypeToString(def->opts.pciopts.modelName);
+ if (!modelName) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unexpected model name value %d"),
+ def->opts.pciopts.modelName);
+ return -1;
+ }
+ virBufferAsprintf(buf, "<model name='%s'/>\n", modelName);
+ }
+
if (def->queues || def->cmd_per_lun || def->max_sectors) {
virBufferAddLit(buf, "<driver");
if (def->queues)
VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST
} virDomainControllerModelPCI;
+typedef enum {
+ VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE,
+ VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PCI_BRIDGE,
+ VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_I82801B11_BRIDGE,
+
+ VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_LAST
+} virDomainControllerPCIModelName;
+
typedef enum {
VIR_DOMAIN_CONTROLLER_MODEL_SCSI_AUTO,
VIR_DOMAIN_CONTROLLER_MODEL_SCSI_BUSLOGIC,
struct _virDomainPCIControllerOpts {
bool pcihole64;
unsigned long pcihole64size;
+
+ /* the exact controller name is in the "model" subelement, e.g.:
+ * <controller type='pci' model='pcie-root-port'>
+ * <model name='ioh3420''/>
+ * ...
+ */
+ int modelName; /* the exact name of the device in hypervisor */
};
/* Stores the virtual disk controller configuration */
VIR_ENUM_DECL(virDomainDiskMirrorState)
VIR_ENUM_DECL(virDomainController)
VIR_ENUM_DECL(virDomainControllerModelPCI)
+VIR_ENUM_DECL(virDomainControllerPCIModelName)
VIR_ENUM_DECL(virDomainControllerModelSCSI)
VIR_ENUM_DECL(virDomainControllerModelUSB)
VIR_ENUM_DECL(virDomainFS)
virDomainControllerModelSCSITypeToString;
virDomainControllerModelUSBTypeFromString;
virDomainControllerModelUSBTypeToString;
+virDomainControllerPCIModelNameTypeFromString;
+virDomainControllerPCIModelNameTypeToString;
virDomainControllerRemove;
virDomainControllerTypeToString;
virDomainCpuPlacementModeTypeFromString;
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<controller type='pci' index='0' model='pcie-root'/>
- <controller type='pci' index='1' model='dmi-to-pci-bridge'/>
- <controller type='pci' index='2' model='pci-bridge'/>
+ <controller type='pci' index='1' model='dmi-to-pci-bridge'>
+ <model name='i82801b11-bridge'/>
+ </controller>
+ <controller type='pci' index='2' model='pci-bridge'>
+ <model name='pci-bridge'/>
+ </controller>
<video>
<model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/>
</video>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<controller type='pci' index='0' model='pcie-root'/>
- <controller type='pci' index='1' model='dmi-to-pci-bridge'/>
- <controller type='pci' index='2' model='pci-bridge'/>
+ <controller type='pci' index='1' model='dmi-to-pci-bridge'>
+ <model name='i82801b11-bridge'/>
+ </controller>
+ <controller type='pci' index='2' model='pci-bridge'>
+ <model name='pci-bridge'/>
+ </controller>
<controller type='sata' index='0'/>
<video>
<model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/>