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

[xen stable-4.16] vpci/header: cope with devices not having vpci allocated



commit c15221e45c0ffafdbb9faafd1a07ffb054b2cde3
Author:     Roger Pau Monné <roger.pau@xxxxxxxxxx>
AuthorDate: Mon Jul 17 08:32:34 2023 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Jul 17 08:32:34 2023 +0200

    vpci/header: cope with devices not having vpci allocated
    
    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@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
    master commit: ee045f3a4a6dddb09f5aa96a50cceaae97d3245f
    master date: 2023-05-26 09:18:37 +0200
---
 xen/drivers/vpci/header.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c
index 40ff79c33f..d59056fb18 100644
--- a/xen/drivers/vpci/header.c
+++ b/xen/drivers/vpci/header.c
@@ -269,6 +269,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 )
         {
             /*
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.