All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Juergen Gross <jgross@suse.com>
Cc: Jiqian Chen <Jiqian.Chen@amd.com>,
	Jan Beulich <jbeulich@suse.com>, Wei Liu <wl@xen.org>,
	Anthony PERARD <anthony.perard@citrix.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	xen-devel@lists.xenproject.org,
	Stewart Hildebrand <Stewart.Hildebrand@amd.com>,
	Alex Deucher <Alexander.Deucher@amd.com>,
	Xenia Ragiadakou <xenia.ragiadakou@amd.com>,
	Stefano Stabellini <stefano.stabellini@amd.com>,
	Huang Rui <Ray.Huang@amd.com>,
	Honglei Huang <Honglei1.Huang@amd.com>,
	Julia Zhang <Julia.Zhang@amd.com>
Subject: Re: [RFC XEN PATCH v2 3/3] tools: Add new function to get gsi from irq
Date: Tue, 28 Nov 2023 17:11:10 +0100	[thread overview]
Message-ID: <ZWYRHqie0oVuawmc@macbook> (raw)
In-Reply-To: <6ee9c6e2-7ebf-42c6-a923-57f9da093160@suse.com>

On Tue, Nov 28, 2023 at 03:42:31PM +0100, Juergen Gross wrote:
> On 28.11.23 15:25, Roger Pau Monné wrote:
> > On Fri, Nov 24, 2023 at 06:41:36PM +0800, Jiqian Chen wrote:
> > > In PVH dom0, it uses the linux local interrupt mechanism,
> > > when it allocs irq for a gsi, it is dynamic, and follow
> > > the principle of applying first, distributing first. And
> > > if you debug the kernel codes, you will find the irq
> > > number is alloced from small to large, but the applying
> > > gsi number is not, may gsi 38 comes before gsi 28, that
> > > causes the irq number is not equal with the gsi number.
> > > And when we passthrough a device, QEMU will use its gsi
> > > number to do mapping actions, see xen_pt_realize->
> > > xc_physdev_map_pirq, but the gsi number is got from file
> > > /sys/bus/pci/devices/xxxx:xx:xx.x/irq in current code,
> > > so it will fail when mapping.
> > > And in current codes, there is no method to translate
> > > irq to gsi for userspace.
> > 
> > I think it would be cleaner to just introduce a new sysfs node that
> > contains the gsi if a device is using one (much like the irq sysfs
> > node)?
> > 
> > Such ioctl to translate from IRQ to GSI has nothing to do with Xen, so
> > placing it in privcmd does seem quite strange to me.  I understand
> > that for passthrough we need the GSI, but such translation layer from
> > IRQ to GSI is all Linux internal, and it would be much simpler to just
> > expose the GSI in sysfs IMO.
> 
> You are aware that we have a Xen specific variant of acpi_register_gsi()?
> 
> It is the Xen event channel driver being responsible for the GSI<->IRQ
> mapping.

I'm kind of lost, this translation function is specifically needed for
PVH which doesn't use the Xen specific variant of acpi_register_gsi(),
and hence the IRQ <-> GSI relation is whatever the Linux kernel does
on native.

I do understand that on a PV dom0 the proposed sysfs gsi node would
match the irq node, but that doesn't seem like an issue to me.

Note also that PVH doesn't use acpi_register_gsi_xen_hvm() because
XENFEAT_hvm_pirqs feature is not exposed to PVH, so I expect it uses
the x86 acpi_register_gsi_ioapic().

Thanks, Roger.


  reply	other threads:[~2023-11-28 16:11 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-24 10:41 [RFC XEN PATCH v2 0/3] Support device passthrough when dom0 is PVH on Xen Jiqian Chen
2023-11-24 10:41 ` [RFC XEN PATCH v2 1/3] xen/vpci: Clear all vpci status of device Jiqian Chen
2023-11-28 14:08   ` Roger Pau Monné
2023-11-30  6:22     ` Chen, Jiqian
2023-11-30 11:52       ` Roger Pau Monné
2023-11-30 11:55         ` Chen, Jiqian
2023-11-30 12:25       ` Daniel P. Smith
2023-11-30 12:39         ` Daniel P. Smith
2023-11-30 14:52           ` Roger Pau Monné
2023-12-04  6:57             ` Chen, Jiqian
2023-12-04 11:10               ` Roger Pau Monné
2023-12-05  5:49                 ` Chen, Jiqian
2023-12-07  1:11                 ` Daniel P. Smith
2023-11-30 13:03         ` Chen, Jiqian
2023-11-24 10:41 ` [RFC XEN PATCH v2 2/3] x86/pvh: Open PHYSDEVOP_map_pirq for PVH dom0 Jiqian Chen
2023-11-28 14:17   ` Roger Pau Monné
2023-11-30  6:32     ` Chen, Jiqian
2023-11-30 15:13       ` Roger Pau Monné
2023-11-28 15:14   ` Jan Beulich
2023-11-30  6:44     ` Chen, Jiqian
2023-11-30  8:38       ` Chen, Jiqian
2023-11-30  9:00       ` Jan Beulich
2023-11-30  9:43         ` Chen, Jiqian
2023-11-24 10:41 ` [RFC XEN PATCH v2 3/3] tools: Add new function to get gsi from irq Jiqian Chen
2023-11-28 14:25   ` Roger Pau Monné
2023-11-28 14:42     ` Juergen Gross
2023-11-28 16:11       ` Roger Pau Monné [this message]
2023-11-28 16:22         ` Juergen Gross
2023-11-30  6:57         ` Chen, Jiqian
2023-11-30  3:38     ` Stefano Stabellini
2023-11-30  4:02       ` Stefano Stabellini
2023-11-30 10:06         ` Roger Pau Monné
2023-12-01  3:09           ` Stefano Stabellini
2023-12-01  9:03             ` Roger Pau Monné
2023-12-04  5:38               ` Chen, Jiqian
2023-12-04 11:12                 ` Roger Pau Monné
2023-11-30  6:53     ` Chen, Jiqian

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=ZWYRHqie0oVuawmc@macbook \
    --to=roger.pau@citrix.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Honglei1.Huang@amd.com \
    --cc=Jiqian.Chen@amd.com \
    --cc=Julia.Zhang@amd.com \
    --cc=Ray.Huang@amd.com \
    --cc=Stewart.Hildebrand@amd.com \
    --cc=anthony.perard@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=jgross@suse.com \
    --cc=sstabellini@kernel.org \
    --cc=stefano.stabellini@amd.com \
    --cc=wl@xen.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.