Re: [PATCH 01/15] schema: make pci slot and function optional

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

 



On 03/30/2016 05:05 AM, Michal Privoznik wrote:
On 24.03.2016 20:25, Laine Stump wrote:
The pcie-switch-downstream-port and pcie-root-port controllers have
only a single slot, numbered 0, and the greate majority of all guest
s/greate/great/

PCI devices are plugged into function 0 of whatever slot they're
using. The parser makes these optional, setting them to 0 when not
specified, and it's logical for the schema to also make them optional.
---
  docs/schemas/basictypes.rng | 16 ++++++++++------
  1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/docs/schemas/basictypes.rng b/docs/schemas/basictypes.rng
index a83063a..084d403 100644
--- a/docs/schemas/basictypes.rng
+++ b/docs/schemas/basictypes.rng
@@ -75,12 +75,16 @@
      <attribute name="bus">
        <ref name="pciBus"/>
      </attribute>
-    <attribute name="slot">
-      <ref name="pciSlot"/>
-    </attribute>
-    <attribute name="function">
-      <ref name="pciFunc"/>
-    </attribute>
+    <optional>
+      <attribute name="slot">
+        <ref name="pciSlot"/>
+      </attribute>
+    </optional>
+    <optional>
+      <attribute name="function">
+        <ref name="pciFunc"/>
+      </attribute>
+    </optional>
      <optional>
        <attribute name="multifunction">
          <ref name="virOnOff"/>

Well, looking into our PCI address parser, all of the attributes are
optional, even domain and bus.

Right. It's only virsh's validation against the schema that causes problems.

  None of my guests have non-zero domain
actually ;-).

Yep. I'm not sure why we waste so much imaginary ink formatting all those "domain='0x0000'" attributes, especially since there isn't even a way to specify a non-0 domain for the guest-side PCI address of a device. The only thing we (or qemu) support it for is the *host* side PCI address of devices that are being assigned with vfio or legacy KVM device assignment.

Of course it's always possible that it may be supported in the future, but even if that happens, "0" seems like a pretty safe default that could be omitted from the stored/displayed config.

  Your call whether to loosen schema even more or stick with
your approach.

I had done it that way initially (made bus optional as well), then backed off but I don't remember why now. I guess because I couldn't think of a valid reason why someone would need to specify slot or function but leave out bus (and slot 0 of bus 0 is reserved, so can't be used. And Cole used a different method of allowing plain "<address type='pci'/>" in his series to force PCI addresses for devices that may otherwise use virtio-mmio (although he may want to do it by simply making bus optional as you suggest).

--
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]