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

[PATCH for-4.{19,20}] xen/vpci: fix backport of 53859596c0d3


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Wed, 22 Oct 2025 09:59:09 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cQ1xQgksZ9QFJl/KHo9ye+YP1I9gi0PFi1GsQ1K6tXY=; b=UYw9q3++rtjUgwIS3JZ98QLCLDVdxcvLLERfOHIY0tRSGOn1/84o+5oMdFNxbb36ztFgMipbRPrgK7G8+4gAb+hENppsBo3tf4AMhSdUIoCMC0Iig+vBGBf0KAUYCHgbG9QDXEQwt7bECK2INjW2aBbffu//k+XmkQ+4JQQjmSJwV+oPMPZ/c6xsGo9IPQxhrnzc5irPRzoYoq+DE60DhiuYXcdJfu6Oq6MaPCKczPhmQ5pmdYctzxy7WaqtwM1oLgPFl9hc8MIir2A8MDwRK5unfyFuVoStH0LhON/jy7PnZC1QpPnbCtvXFzhrfkm5yfAmv+ABu4/lkA+qvb7qSw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BgsO1s9UYQ58X2OjzRFobpkR7gOwyd3asxIgfSbd725Ynq/2KtnZcO9ozHXX0zNLK33zaFt91ieIWFk77v+E4yqdLelR7+85hh3tARUKKVc57JEzWRSBm4wTeU2lVqedulCGJE8Mh2cXVS9kgXEHgTlxjT3iThElmzOiRjoYIcvOs8MPAAtY/kO2lzGH560Huw00e6PIZa4/QEqLE7byv6oP17PbcLvB9UWUEwkwWv36E6SCIPEbyAH2s7qij1vp8RYTxdQmAR8WfVQgl3sIHLysa+HnKS1ac36lHH4FqUbhL696F1lzyC3lVGrgCcFg8PmC/aOw9cVC61KJ9Wgamw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>, jbeulich@xxxxxxxx, stewart.hildebrand@xxxxxxx
  • Delivery-date: Wed, 22 Oct 2025 09:00:12 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Commit 53859596c0d3 depends on the behavioral change introduced in
ee2eb6849d50 that inverted the initialization of the MSI-X and header vPCI
handlers.  53859596c0d3 requires the header to be initialized before MSI-X.

Change the order of initialization and adjust init_msix() to carve holes
for the MSI-X tables if necessary, since it will now run after the BARs
have been possibly mapped into the domain p2m.

Fixes: f9aea52a9747 ("vpci/msix: improve handling of bogus MSI-X capabilities")
Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
Cc: jbeulich@xxxxxxxx
Cc: stewart.hildebrand@xxxxxxx
---
 xen/drivers/vpci/header.c | 2 +-
 xen/drivers/vpci/msix.c   | 9 +++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c
index 1f48f2aac64e..b002eb207243 100644
--- a/xen/drivers/vpci/header.c
+++ b/xen/drivers/vpci/header.c
@@ -1016,7 +1016,7 @@ static int cf_check init_header(struct pci_dev *pdev)
     pci_conf_write16(pdev->sbdf, PCI_COMMAND, cmd);
     return rc;
 }
-REGISTER_VPCI_INIT(init_header, VPCI_PRIORITY_MIDDLE);
+REGISTER_VPCI_INIT(init_header, VPCI_PRIORITY_HIGH);
 
 /*
  * Local variables:
diff --git a/xen/drivers/vpci/msix.c b/xen/drivers/vpci/msix.c
index faa7c1cd494a..94fb645377e5 100644
--- a/xen/drivers/vpci/msix.c
+++ b/xen/drivers/vpci/msix.c
@@ -792,9 +792,14 @@ static int cf_check init_msix(struct pci_dev *pdev)
     pdev->vpci->msix = msix;
     list_add(&msix->next, &d->arch.hvm.msix_tables);
 
-    return 0;
+    /*
+     * vPCI header initialization will have mapped the whole BAR into the
+     * p2m, as MSI-X capability was not yet initialized.  Crave a hole for
+     * the MSI-X table here, so that Xen can trap accesses.
+     */
+    return vpci_make_msix_hole(pdev);
 }
-REGISTER_VPCI_INIT(init_msix, VPCI_PRIORITY_HIGH);
+REGISTER_VPCI_INIT(init_msix, VPCI_PRIORITY_MIDDLE);
 
 /*
  * Local variables:
-- 
2.51.0




 


Rackspace

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