From 873c3db6d2ea6d03a4f61b36d5a285514eac302a Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Mon, 2 Feb 2026 09:08:17 +0100 Subject: [PATCH] vPCI: really no ext-caps without extended config space MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For DomU-s, 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(). For Dom0 this then simply allows dropping a later conditional. Fixes: a845b50c12f3 ("vpci/header: Emulate extended capability list for dom0") Signed-off-by: Jan Beulich Acked-by: Roger Pau Monné --- xen/drivers/vpci/header.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c index aae663bbf5..739a5f610e 100644 --- a/xen/drivers/vpci/header.c +++ b/xen/drivers/vpci/header.c @@ -829,6 +829,9 @@ static int vpci_init_ext_capability_list(const struct pci_dev *pdev) { unsigned int pos = PCI_CFG_SPACE_SIZE; + if ( !pdev->ext_cfg ) + return 0; + if ( !is_hardware_domain(pdev->domain) ) /* Extended capabilities read as zero, write ignore for DomU */ return vpci_add_register(pdev->vpci, vpci_read_val, NULL, @@ -841,10 +844,9 @@ static int vpci_init_ext_capability_list(const struct pci_dev *pdev) if ( header == 0xffffffffU ) { - if ( pos != PCI_CFG_SPACE_SIZE ) - printk(XENLOG_WARNING - "%pd %pp: broken extended cap list, offset %#x\n", - pdev->domain, &pdev->sbdf, pos); + printk(XENLOG_WARNING + "%pd %pp: broken extended cap list, offset %#x\n", + pdev->domain, &pdev->sbdf, pos); return 0; }