[PATCH v2 4/4] vPCI/DomU: really no ext-caps without extended config space

Jan Beulich posted 4 patches 6 days, 16 hours ago
[PATCH v2 4/4] vPCI/DomU: really no ext-caps without extended config space
Posted by Jan Beulich 6 days, 16 hours ago
Whether to emulate accesses to the first 32 bits of extended config space
as read-as-zero or read-as-all-ones depends on whether a device actually
has extended config space. If it doesn't, read-as-zero isn't correct; not
getting this right may confuse functions like Linux 6.19-rc's
pci_ext_cfg_is_aliased().

Fixes: a845b50c12f3 ("vpci/header: Emulate extended capability list for dom0")
Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/drivers/vpci/header.c
+++ b/xen/drivers/vpci/header.c
@@ -830,9 +830,14 @@ static int vpci_init_ext_capability_list
     unsigned int pos = PCI_CFG_SPACE_SIZE;
 
     if ( !is_hardware_domain(pdev->domain) )
+    {
+        if ( !pdev->ext_cfg )
+            return 0;
+
         /* Extended capabilities read as zero, write ignore for DomU */
         return vpci_add_register(pdev->vpci, vpci_read_val, NULL,
                                  pos, 4, (void *)0);
+    }
 
     do
     {