[PATCH v2 08/11] conf: add PCI controllers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add new controller type 'pci' with models 'pci-root' and 'pci-bridge'.
---
 docs/schemas/domaincommon.rng |  3 +++
 src/conf/domain_conf.c        | 21 ++++++++++++++++++++-
 src/conf/domain_conf.h        |  9 +++++++++
 3 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 468c49c..a66a289 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1413,6 +1413,7 @@
                 <value>sata</value>
                 <value>ccid</value>
                 <value>usb</value>
+                <value>pci</value>
               </choice>
             </attribute>
           </optional>
@@ -1459,6 +1460,8 @@
             <value>pci-ohci</value>
             <value>nec-xhci</value>
             <value>none</value>
+            <value>pci-root</value>
+            <value>pci-bridge</value>
           </choice>
         </attribute>
       </optional>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index cf0f1c4..a5764fb 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -300,7 +300,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",
@@ -5144,6 +5149,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;
 }
@@ -5261,6 +5268,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;
@@ -13487,6 +13504,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 f1f01fa..e2fd079 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -696,11 +696,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,
@@ -2420,6 +2428,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)
-- 
1.8.1.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]