All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jason Andryuk <jason.andryuk@amd.com>
Cc: xen-devel@lists.xenproject.org, Jan Beulich <jbeulich@suse.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Anthony PERARD <anthony.perard@vates.tech>,
	Michal Orzel <michal.orzel@amd.com>,
	Julien Grall <julien@xen.org>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Xenia Ragiadakou <xenia.ragiadakou@amd.com>
Subject: Re: [RFC PATCH] xen/amd-iommu: Add interrupt remapping quirk for ath11k
Date: Tue, 4 Mar 2025 11:23:37 +0100	[thread overview]
Message-ID: <Z8bUqTKSJ8rpMX8R@macbook.local> (raw)
In-Reply-To: <09a8e9dd-2839-49d5-9fff-d2c12c0dd3ed@amd.com>

On Fri, Feb 28, 2025 at 03:25:52PM -0500, Jason Andryuk wrote:
> On 2025-02-28 04:36, Roger Pau Monné wrote:
> > On Thu, Feb 27, 2025 at 01:28:11PM -0500, Jason Andryuk wrote:
> > > On 2025-02-27 05:23, Roger Pau Monné wrote:
> > > > On Wed, Feb 26, 2025 at 04:11:25PM -0500, Jason Andryuk wrote:
> > > > > To work around this, we can, for per-device IRTs, program the hardware
> > > > > to use the guest data & associated IRTE.  The address doesn't matter
> > > > > since the IRTE handles that, and the Xen address & vector can be used as
> > > > > expected.
> > > > 
> > > > All this work on AMD because when interrupt remapping is enabled all
> > > > MSIs are handled by the remapping table, while on Intel there's still
> > > > a bit in the MSI address field to signal whether the MSI is using a
> > > > remapping entry, or is using the "compatibility" format (iow: no
> > > > remapping).
> > > 
> > > So, on Intel, if the guest hands the device the MSI address, it can decided
> > > to bypass remapping?
> > > 
> > > Thanks for providing insight into the Intel inner workings.  That's why I am
> > > asking.
> > 
> > Yes, sorry, I'm afraid I don't have any good solution for Intel, at
> > least not anything similar to what you propose to do on AMD-Vi.  I
> > guess we could take a partial solution for AMD-Vi only, but it's
> > sub-optimal from Xen perspective to have a piece of hardware working
> > fine on AMD and not on Intel.
> 
> I only need AMD to work ;)
> 
> But yeah, I thought I should make an effort to get both working.

Kind of tangential to this approach.  Do you know which register(s)
are used to store the non-architectural MSI address and data fields?

I'm wondering if it simply would be easier to introduce a quirk for
this device in vPCI (and possibly QEMU?) that intercepts writes to the
out of band MSI registers.  That should work for both Intel and AMD,
but would have the side effect that Xen would need to intercept
accesses to at least a full page, and possibly forward accesses to
adjacent registers.

> > > > > e.g. Replace amd_iommu_perdev_intremap with something generic.
> > > > > 
> > > > > The ath11k device supports and tries to enable 32 MSIs.  Linux in PVH
> > > > > dom0 and HVM domU fails enabling 32 and falls back to just 1, so that is
> > > > > all that has been tested.
> > > > 
> > > > DYK why it fails to enable 32?
> > > 
> > > Not exactly - someone else had the card.  msi_capability_init() failed. If
> > > it ends up in arch_setup_msi_irqs(), only 1 MSI is supported.  But precisely
> > > where the mutiple nvecs was denied was not tracked down.
> > 
> > Does it also fail on native?  I'm mostly asking because it would be
> > good to get to the bottom of this, so that we don't come up with a
> > partial solution that will break if multi-msi is used later in Linux.
> 
> My understanding is native and PV dom0 work with 32, and it's Linux deciding
> not to use multiple MSI.
> 
> It might be this:
> static int xen_hvm_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
> {
>         int irq, pirq;
>         struct msi_desc *msidesc;
>         struct msi_msg msg;
> 
>         if (type == PCI_CAP_ID_MSI && nvec > 1)
>                 return 1;
> 
> I'll have to look into this more.

That shouldn't apply to PVH because it never exposes
XENFEAT_hvm_pirqs, and I would expect xen_hvm_setup_msi_irqs() to not
get used (otherwise we have a bug somewhere).

Thanks, Roger.


  reply	other threads:[~2025-03-04 10:23 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-26 21:11 [RFC PATCH] xen/amd-iommu: Add interrupt remapping quirk for ath11k Jason Andryuk
2025-02-27  8:54 ` Jan Beulich
2025-02-27 16:49   ` Jason Andryuk
2025-03-05  8:09     ` Jan Beulich
2025-02-27 10:23 ` Roger Pau Monné
2025-02-27 18:28   ` Jason Andryuk
2025-02-27 19:00     ` Andrew Cooper
2025-02-28  9:36     ` Roger Pau Monné
2025-02-28 20:25       ` Jason Andryuk
2025-03-04 10:23         ` Roger Pau Monné [this message]
2025-03-04 15:15           ` Jason Andryuk
2025-03-04 16:41             ` Roger Pau Monné
2025-03-05  8:41     ` Jan Beulich
2025-03-13 15:30   ` Jason Andryuk
2025-03-13 15:47     ` Roger Pau Monné
2025-03-13 16:02       ` Andrew Cooper
2025-03-13 16:07         ` Jan Beulich
2025-03-13 16:24           ` Andrew Cooper
2025-03-13 18:03             ` Jason Andryuk
2025-02-27 11:14 ` Andrew Cooper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z8bUqTKSJ8rpMX8R@macbook.local \
    --to=roger.pau@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@vates.tech \
    --cc=jason.andryuk@amd.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=michal.orzel@amd.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    --cc=xenia.ragiadakou@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.