]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virpci: Allow greater PCI domain value in virPCIDeviceAddressIsValid
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 30 Jul 2019 14:37:20 +0000 (16:37 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 5 Aug 2019 17:42:15 +0000 (19:42 +0200)
There is no restriction on maximum value of PCI domain. In fact,
Linux kernel uses plain atomic inc when assigning PCI domains:

drivers/pci/pci.c:static int pci_get_new_domain_nr(void)
drivers/pci/pci.c-{
drivers/pci/pci.c-      return atomic_inc_return(&__domain_nr);
drivers/pci/pci.c-}

Of course, this function is called only if kernel was compiled
without PCI domain support or ACPI did not provide PCI domain.

However, QEMU still has the same restriction as us: in
set_pci_host_devaddr() QEMU checks if domain isn't greater than
0xffff. But one can argue that that's a QEMU limitation. We still
want to be able to cope with other hypervisors that don't have
this limitation (possibly).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
docs/schemas/basictypes.rng
src/util/virpci.c
tests/qemuxml2argvdata/pci-domain-invalid.xml

index 70d2101b78c47c7514931455f7283a55314f61f7..81465273c8bd9bf43d2d230d7235dfb1c158998a 100644 (file)
   </define>
 
   <define name="pciDomain">
-    <ref name="uint16"/>
+    <ref name="uint32"/>
   </define>
   <define name="pciBus">
     <ref name="uint8"/>
index 36b7f8b4241f9804b18cf6f79b7b96a5d5f3b188..bc7ff461947e6f9315b6e674a3527c52d4dbcbd1 100644 (file)
@@ -1668,7 +1668,7 @@ bool
 virPCIDeviceAddressIsValid(virPCIDeviceAddressPtr addr,
                            bool report)
 {
-    if (addr->domain > 0xFFFF) {
+    if (addr->domain > 0xFFFFFFFF) {
         if (report)
             virReportError(VIR_ERR_XML_ERROR,
                            _("Invalid PCI address domain='0x%x', "
index 1ac56fc70321a6c456f78b4f82ce1c048e5c46ab..21f1dc98af0534adc5e75362836fcf25568b6749 100644 (file)
@@ -26,7 +26,7 @@
     <interface type='user'>
       <mac address='00:11:22:33:44:55'/>
       <model type='rtl8139'/>
-      <address type='pci' domain='0x10000' bus='0x00' slot='0x05' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x100' slot='0x05' function='0x0'/>
     </interface>
     <memballoon model='none'/>
   </devices>