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 17:41:25 +0100	[thread overview]
Message-ID: <Z8ctNa9WFwYxnKuE@macbook.local> (raw)
In-Reply-To: <3bd7ff2b-5f26-496b-a067-c6c1f79e7515@amd.com>

On Tue, Mar 04, 2025 at 10:15:21AM -0500, Jason Andryuk wrote:
> On 2025-03-04 05:23, Roger Pau Monné wrote:
> > 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.
> 
> From the QEMU part of the vfio hack:
> * We therefore come up with a really crude quirk that looks for values
> * written to the ATH11K_PCI_WINDOW (defined in Linux driver as starting
> * at 0x80000 with an 18-bit mask, ie. 256k) that match the guest MSI
> * address.  When found we replace the data with the host physical
> * address and set a cookie to match the MSI data write, again replacing
> * with the host value and clearing the cookie.
> 
> https://lore.kernel.org/ath11k/20240812170045.1584000-1-alex.williamson@redhat.com/
> 
> This is inside BAR0, AIUI.  I'm guessing, but I think the driver puts them
> into a command ring, so it's not a fixed location.  The large area, and
> since we won't normally intercept BAR access, made me not want to pursue
> this.

Oh, I see, it's not a fixed register, but something like a command
queue.  Great, that makes it way worse to deal with.  It would also
imply that Xen would need to possibly map the whole 256k ring in order
to forward requests to the hardware.

I would like for a solution that covers both Intel and AMD, but I
don't have the card myself to test or develop any of those solutions,
so I think having a solution that works on AMD is likely better than
having no solution at all.  Whoever wants to use the card on Intel
will have to come up with a solution there.

Thanks, Roger.


  reply	other threads:[~2025-03-04 16:41 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é
2025-03-04 15:15           ` Jason Andryuk
2025-03-04 16:41             ` Roger Pau Monné [this message]
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=Z8ctNa9WFwYxnKuE@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.