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

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


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Wed, 22 Oct 2025 18:14:19 +0200
  • 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=EIbqXo1tC881QVNAHQMGyj+F4ltBbM0TK8naUtJLPtY=; b=VwBB1BoiGHDnVDRSYue8mnGK7eRWG4D45UsxhKxj4PB/UvcFJirVqOfX6yOnjVHOTX+S3aCfXbYGbZlW+0/I/lHL4jLtk//zSoIpYlTxFKL5PsSnqr0gDfROuDDtqeqdlJRAou1tOUaMEOLPeRTklfqJSCimqSPanTcCzE6Tpgfir+8VHLzSCdgEYBxe/YFL/+CYrkRYHVFmdN8b4/Plyvy4FLQQBkDollyca4ylpfkYY1uz0T8/mfRzsDGq3UJdZrggf6PDFazL4oP8LRne2Dl0Y8Txjc1LHWgGCLOjyEkP7TRZXDUeGeH0uH+0F0Djlt7gwxhlhBg+x9PuKeZdMA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=iJKk7hzK7XqI9RIWXCXmFQG8kKte3gnyKHxLIphKzDTeYzNtuq/37atiXSOJpMDUeodRGYGjLqtbV8JGOAnXMPLK2nlKNYzsiYJnd+wSo2M7oodZryEYvZnEra98LaE8lyEU3rEzG8DcpITWmjofydZYQ3onTqtDjGv3WqcEocuNrq+Es3ox2f097uNYvKzsxz7Qgz+gRvhNtMq4PjLkQUth/MmOJPfTtSBph5PM4fjSe4NlhkaW5d5Fs1Gv5SlD21c4w8lz9KUZxEdaivToIyDo2VpS4mBWr8IZNqjvNisuGVVIZ6qajfIJdTUP3ENEFmK4X0miUqWAAFZA/t8+fA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: stewart.hildebrand@xxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 22 Oct 2025 16:14:43 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Wed, Oct 22, 2025 at 11:28:42AM +0200, Jan Beulich wrote:
> On 22.10.2025 10:59, Roger Pau Monne wrote:
> > 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>
> 
> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>

Thanks.

> > --- 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:
> > --- 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);
> 
> Aiui this could as well be VPCI_PRIORITY_LOW now, much like in staging init
> order between MSI, MSI-X, and ReBar isn't enforced anymore?

Yes, that's my understating also, I however didn't want to make that
change to avoid any surprises.  This way MSI-X and header are still
the first ones to initialize.  Also that would render
VPCI_PRIORITY_MIDDLE effectively unused in the code, which might be
confusing for readers.

Roger.



 


Rackspace

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