]> xenbits.xensource.com Git - xen.git/commitdiff
vpci/header: cope with devices not having vpci allocated
authorRoger Pau Monné <roger.pau@citrix.com>
Fri, 26 May 2023 07:18:37 +0000 (09:18 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 26 May 2023 07:18:37 +0000 (09:18 +0200)
When traversing the list of pci devices assigned to a domain cope with
some of them not having the vpci struct allocated. It should be
possible for the hardware domain to have read-only devices assigned
that are not handled by vPCI, such support will be added by further
patches.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/drivers/vpci/header.c

index ec2e978a4e6b16706f1c6ad61e4648b56c15f009..766fd98b21969944bb63cec2f5a465fec086bf03 100644 (file)
@@ -289,6 +289,14 @@ static int modify_bars(const struct pci_dev *pdev, uint16_t cmd, bool rom_only)
      */
     for_each_pdev ( pdev->domain, tmp )
     {
+        if ( !tmp->vpci )
+            /*
+             * For the hardware domain it's possible to have devices assigned
+             * to it that are not handled by vPCI, either because those are
+             * read-only devices, or because vPCI setup has failed.
+             */
+            continue;
+
         if ( tmp == pdev )
         {
             /*