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

Re: [PATCH v2] xen/pci: Refactor PCI MSI interrupts related code


  • To: Julien Grall <julien@xxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Wed, 14 Apr 2021 10:05:47 +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=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zsHuwwBdQVd57mVYD2uKxQIAG8SOmWmvcteKsfY3zCc=; b=ag1WbcXVj8Qh3+qKY4GYuV2KgoqoFhsyvyF6RdR8EwFvqSB3dgMfv3NIzlQjZbomxCxLW6kVf9j9RFtZ0eQTQEI0KMs1/J53hfxVJW8Yugzksb/lLgDRhxMzFEbeCWbI3Iey8jS6pH8GTC1Zuzj/6TwDk3yupjQZka/Yrq3r246PZ9+kLtGSxwLmik8y1rrAaMEJnzsxWp3iFidp6ieLUmCg0p51ZHoWciOfFyTVYWA1BHVecLQmQGdBW2CH3TK3N+XDNNyccD2INF8uZ0KYw/cTlHzWnSaxfqww1/5/t4I8mGg2o94ZRmIo0a75Fsp949gCvOT9HRkMCo4eGfqzXg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gY9J5RibPtcF1iAJk82u3bac+PG+BnraYTgCan/2SwIOHF2h4tloEgWPz0IT6HDGEXpC0IYjm0l1G5xHRplrKcjW1bQ346DgqkIe1dTrxygD+3QpDIEUrnnkJQkuTz+JV/JfreSAIcv0JaSSJB9mp58xw7hwJwOdCKsfsV7bTfY8Y1u6vYdvt9RntP/MeylFUszXr2Q/mm21evBVnzk3BpprlPKrm3hD5DpX9VzlLEcqafXNouY/4dadYZ1Wx4bsAto2tuaRwijdTWniNYJVqmT59QovdOK0CXYz2gpQ9H9CGQv1uceDDKl77eoUFHzXssW2EtjlMiOpkeyNKvm7SQ==
  • Authentication-results: esa4.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Rahul Singh <rahul.singh@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>, <bertrand.marquis@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
  • Delivery-date: Wed, 14 Apr 2021 08:06:15 +0000
  • Ironport-hdrordr: A9a23:gba91K704OtKBjWrqwPXwAfXdLJzesId70hD6mlaTxtJfsuE0/ 2/hfhz726StB89elEF3f+BPbSNWhrnn/FIyKQYILvKZmfbkUSyKoUK1+rf6hnBPwG7yeJHz6 dndMFFebnNJHx3l9zz7gX9M/tI+qjkzImSie3Tz2hgQGhRAskKgmtEIz2WC0hnADRBbKBYKL On+sFFqzC8EE5nC/iTO39tZZmhm+H2
  • Ironport-sdr: qI3sCWQeWxujgC8S1+OZwG8NyMOgZVCYLb0C+LLLKqo7FO0Mac8WbvMP2gJwoN0DpHwRADdpKm RwswCuOl3+i6yEgYgpmqTptqXP6hPjihuPpLYcILKkt1Q8pJOQRBldstubfHVHibc/DPdhNM4k hC1SX2X01MYRus+AQl2F4XBzjglJF6EG6i3T3lRfLA001jYvTkEP7iVlLVCT9e4lmy5Eb65VnW DUfUKy/U5RFS4cz/znG7oUQf2mi3kG/1uDxaE4AbU/3C/5uegmY3+emN8UYJe0UIGt/5Eupos/ z5U=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Tue, Apr 13, 2021 at 06:12:10PM +0100, Julien Grall wrote:
> Hi Roger,
> 
> On 12/04/2021 11:49, Roger Pau Monné wrote:
> > On Fri, Apr 09, 2021 at 05:00:41PM +0100, Rahul Singh wrote:
> > > diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
> > > index 705137f8be..1b473502a1 100644
> > > --- a/xen/drivers/passthrough/pci.c
> > > +++ b/xen/drivers/passthrough/pci.c
> > > @@ -1303,12 +1279,15 @@ static int __init setup_dump_pcidevs(void)
> > >   }
> > >   __initcall(setup_dump_pcidevs);
> > > +
> > > +#ifdef CONFIG_PCI_MSI_INTERCEPT
> > >   int iommu_update_ire_from_msi(
> > >       struct msi_desc *msi_desc, struct msi_msg *msg)
> > >   {
> > >       return iommu_intremap
> > >              ? iommu_call(&iommu_ops, update_ire_from_msi, msi_desc, msg) 
> > > : 0;
> > >   }
> > > +#endif
> > 
> > This is not exactly related to MSI intercepts, the IOMMU interrupt
> > remapping table will also be used for interrupt entries for devices
> > being used by Xen directly, where no intercept is required.
> 
> On Arm, this is not tie to the IOMMU. Instead, this handled is a separate
> MSI controller (such as the ITS).
> 
> > 
> > And then you also want to gate the hook from iommu_ops itself with
> > CONFIG_PCI_MSI_INTERCEPT, if we want to got this route.
> 
> 
> All the callers are in the x86 code. So how about moving the function in an
> x86 specific file?

Yes, that seems fine. Just place it in asm-x86/iommu.h. I wonder why
update_ire_from_msi wasn't moved when the rest of the x86 specific
functions where moved there. Was there an aim to use that in other
arches?

The hook in iommu_ops also need to be moved inside the x86 region.
Please do this iommu change in a separate patch.

> > > diff --git a/xen/include/xen/vpci.h b/xen/include/xen/vpci.h
> > > index 9f5b5d52e1..a6b12717b1 100644
> > > --- a/xen/include/xen/vpci.h
> > > +++ b/xen/include/xen/vpci.h
> > > @@ -91,6 +91,7 @@ struct vpci {
> > >           /* FIXME: currently there's no support for SR-IOV. */
> > >       } header;
> > > +#ifdef CONFIG_PCI_MSI_INTERCEPT
> > >       /* MSI data. */
> > >       struct vpci_msi {
> > >         /* Address. */
> > > @@ -136,6 +137,7 @@ struct vpci {
> > >               struct vpci_arch_msix_entry arch;
> > >           } entries[];
> > >       } *msix;
> > > +#endif /* CONFIG_PCI_MSI_INTERCEPT */
> > 
> > Note that here you just remove two pointers from the struct, not that
> > I'm opposed to it, but it's not that much space that's saved anyway.
> > Ie: it might also be fine to just leave them as NULL unconditionally
> > on Arm.
> 
> Can the two pointers be NULL on x86?

Yes, they can be NULL on x86.

> If not, then I would prefer if they
> disappear on Arm so there is less chance to make any mistake (such as
> unconditionally accessing the pointer in common code).

Any access to them needs to be protected anyway, or else we would be
in trouble. I don't think Xen ever accesses them based on the PCI
capabilities of the device.

Thanks, Roger.



 


Rackspace

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