]> xenbits.xensource.com Git - xen.git/commitdiff
pci: fix pci_get_pdev_by_domain() to always account for the segment
authorRoger Pau Monné <roger.pau@citrix.com>
Tue, 23 May 2023 13:03:41 +0000 (15:03 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 23 May 2023 13:03:41 +0000 (15:03 +0200)
When a domain parameter is provided to pci_get_pdev_by_domain() the
search function would match against bus and devfn, without taking the
segment into account.

Fix this and also account for the passed segment.

Fixes: 8cf6e0738906 ('PCI: simplify (and thus correct) pci_get_pdev{,_by_domain}()')
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
master commit: c7908869ac26961a3919491705e521179ad3fc0e
master date: 2023-05-22 16:11:55 +0200

xen/drivers/passthrough/pci.c

index da4ecda814f90eabb0ac674db43971031d909bac..a9da7367c29c72e9b7fca6f822fa48a25906612a 100644 (file)
@@ -570,7 +570,7 @@ struct pci_dev *pci_get_pdev_by_domain(const struct domain *d, uint16_t seg,
     }
     else
         list_for_each_entry ( pdev, &d->pdev_list, domain_list )
-            if ( pdev->bus == bus && pdev->devfn == devfn )
+            if ( pdev->seg == seg && pdev->bus == bus && pdev->devfn == devfn )
                 return pdev;
 
     return NULL;