All sub-PCI capabilities should be next to each other for clarity.

Signed-off-by: Martin Kletzander <mklet...@redhat.com>
---
 docs/schemas/nodedev.rng                           | 22 +++++++++++-----------
 src/conf/node_device_conf.c                        |  9 ++++-----
 .../pci_0000_00_1c_0_header_type.xml               |  2 +-
 3 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/docs/schemas/nodedev.rng b/docs/schemas/nodedev.rng
index d9375130487c..6b9b54298b21 100644
--- a/docs/schemas/nodedev.rng
+++ b/docs/schemas/nodedev.rng
@@ -149,6 +149,17 @@
     </optional>

     <optional>
+      <element name='capability'>
+        <attribute name='type'>
+          <choice>
+            <value>pci-bridge</value>
+            <value>cardbus-bridge</value>
+          </choice>
+        </attribute>
+      </element>
+    </optional>
+
+    <optional>
       <element name='iommuGroup'>
         <attribute name='number'>
           <ref name='unsignedInt'/>
@@ -170,17 +181,6 @@
     </optional>

     <optional>
-      <element name='capability'>
-        <attribute name='type'>
-          <choice>
-            <value>pci-bridge</value>
-            <value>cardbus-bridge</value>
-          </choice>
-        </attribute>
-      </element>
-    </optional>
-
-    <optional>
       <element name='pci-express'>
         <zeroOrMore>
           <element name='link'>
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index e7e4bbd390fa..96ec6a003714 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -383,6 +383,10 @@ char *virNodeDeviceDefFormat(const virNodeDeviceDef *def)
                     virBufferAddLit(&buf, "</capability>\n");
                 }
             }
+            if (data->pci_dev.hdrType) {
+                virBufferAsprintf(&buf, "<capability type='%s'/>\n",
+                                  
virPCIHeaderTypeToString(data->pci_dev.hdrType));
+            }
             if (data->pci_dev.nIommuGroupDevices) {
                 virBufferAsprintf(&buf, "<iommuGroup number='%d'>\n",
                                   data->pci_dev.iommuGroupNumber);
@@ -403,11 +407,6 @@ char *virNodeDeviceDefFormat(const virNodeDeviceDef *def)
                 virBufferAsprintf(&buf, "<numa node='%d'/>\n",
                                   data->pci_dev.numa_node);

-            if (data->pci_dev.hdrType) {
-                virBufferAsprintf(&buf, "<capability type='%s'/>\n",
-                                  
virPCIHeaderTypeToString(data->pci_dev.hdrType));
-            }
-
             if (data->pci_dev.flags & VIR_NODE_DEV_CAP_FLAG_PCIE)
                 virPCIEDeviceInfoFormat(&buf, data->pci_dev.pci_express);
             break;
diff --git a/tests/nodedevschemadata/pci_0000_00_1c_0_header_type.xml 
b/tests/nodedevschemadata/pci_0000_00_1c_0_header_type.xml
index dea5f05237ff..c1be9f7d9cc0 100644
--- a/tests/nodedevschemadata/pci_0000_00_1c_0_header_type.xml
+++ b/tests/nodedevschemadata/pci_0000_00_1c_0_header_type.xml
@@ -8,10 +8,10 @@
     <function>0</function>
     <product id='0x8c10'>8 Series/C220 Series Chipset Family PCI Express Root 
Port #1</product>
     <vendor id='0x8086'>Intel Corporation</vendor>
+    <capability type='pci-bridge'/>
     <iommuGroup number='8'>
       <address domain='0x0000' bus='0x00' slot='0x1c' function='0x0'/>
     </iommuGroup>
-    <capability type='pci-bridge'/>
     <pci-express>
       <link validity='cap' port='1' speed='5' width='1'/>
       <link validity='sta' speed='2.5' width='1'/>
-- 
2.8.1

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

Reply via email to