All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: xen-devel@lists.xenproject.org,
	"George Dunlap" <george.dunlap@citrix.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	"Anthony PERARD" <anthony.perard@citrix.com>
Subject: Re: Design session "MSI-X support with Linux stubdomain" notes
Date: Mon, 26 Sep 2022 14:43:15 +0200	[thread overview]
Message-ID: <YzGeY8L6Op7n8pip@mail-itl> (raw)
In-Reply-To: <f24b9e06-f9ed-aa0f-0d69-abb8f0d7560f@suse.com>

[-- Attachment #1: Type: text/plain, Size: 2813 bytes --]

On Thu, Sep 22, 2022 at 08:00:00PM +0200, Jan Beulich wrote:
> On 22.09.2022 18:05, Anthony PERARD wrote:
> > WARNING: Notes missing at the beginning of the meeting.
> > 
> > session description:
> >> Currently a HVM with PCI passthrough and Qemu Linux stubdomain doesn’t
> >> support MSI-X. For the device to (partially) work, Qemu needs a patch masking
> >> MSI-X from the PCI config space. Some drivers are not happy about that, which
> >> is understandable (device natively supports MSI-X, so fallback path are
> >> rarely tested).
> >>
> >> This is mostly (?) about qemu accessing /dev/mem directly (here:
> >> https://github.com/qemu/qemu/blob/master/hw/xen/xen_pt_msi.c#L579) - lets
> >> discuss alternative interface that stubdomain could use.
> > 
> > 
> > 
> > when qemu forward interrupt,
> >     for correct mask bit, it read physical mask bit.
> >     an hypercall would make sense.
> >     -> benefit, mask bit in hardware will be what hypervisor desire, and device model desire.
> >     from guest point of view, interrupt should be unmask.
> > 
> > interrupt request are first forwarded to qemu, so xen have to do some post processing once request comes back from qemu.
> >     it's weird..
> > 
> > someone should have a look, and rationalize this weird path.
> > 
> > Xen tries to not forward everything to qemu.
> > 
> > why don't we do that in xen.
> >     there's already code in xen for that.
> 
> So what I didn't pay enough attention to when talking was that the
> completion logic in Xen is for writes only. Maybe something similar
> can be had for reads as well, but that's to be checked ...

I spent some time trying to follow that part of qemu, and I think it
reads vector control only on the write path, to keep some bits
unchanged, and also detect whether Xen masked it behind qemu's back.
My understanding is, since 484d7c852e "x86/MSI-X: track host and guest
mask-all requests separately" it is unnecessary, because Xen will
remember guest's intention, so qemu can simply use its own internal
state and act on that (guest writes will go through qemu, so it should
have up to date view from guest's point of view).

As for PBA access, it is read by qemu only to pass it to the guest. I'm
not sure whether qemu should use hypercall to retrieve it, or maybe
Xen should fixup value itself on the read path.

I did some preliminary patch here:
https://github.com/marmarek/qubes-vmm-xen-stubdom-linux/commit/80cf769f3659aa0d7f2b5598bf862d83da28807e

but it does not work yet. It seems I haven't undo MSI-X hiding enough
(lspci inside the guest doesn't report MSI-X at all). This I will figure
out, but I'd appreciate comments about how to handle PBA best.

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2022-09-26 12:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-22 16:05 Design session "MSI-X support with Linux stubdomain" notes Anthony PERARD
2022-09-22 18:00 ` Jan Beulich
2022-09-26 12:43   ` Marek Marczykowski-Górecki [this message]
2022-09-26 12:47     ` Jan Beulich
2022-09-29 10:57       ` Marek Marczykowski-Górecki
2022-09-29 11:44         ` Jan Beulich
2022-09-29 11:52           ` Roger Pau Monné
2022-09-29 12:48             ` Juergen Gross

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=YzGeY8L6Op7n8pip@mail-itl \
    --to=marmarek@invisiblethingslab.com \
    --cc=anthony.perard@citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=roger.pau@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /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.