* [PATCH] hw/xen: pass PCI domain to xc_physdev_map_pirq_msi()
@ 2025-10-17 15:51 Roger Pau Monne
2025-10-18 4:50 ` Frediano Ziglio
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Roger Pau Monne @ 2025-10-17 15:51 UTC (permalink / raw)
To: qemu-devel
Cc: Roger Pau Monne, Stefano Stabellini, Anthony PERARD, Paul Durrant,
Edgar E. Iglesias, xen-devel
It's currently impossible for passthrough devices on segment different than
0 to work correctly, as the PCI domain is not provided to
xc_physdev_map_pirq_msi(), and hence it's unconditionally assumed that all
devices are on segment 0.
Adjust the call to xc_physdev_map_pirq_msi() to pass the PCI domain in the
high 16bits of the bus parameter. On versions of Xen where this is not
supported the passed segment will be ignored and assume to be 0, no worse
than the current state.
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Anthony PERARD <anthony@xenproject.org>
Cc: Paul Durrant <paul@xen.org>
Cc: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
Cc: xen-devel@lists.xenproject.org
---
hw/xen/xen_pt_msi.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/xen/xen_pt_msi.c b/hw/xen/xen_pt_msi.c
index e9ba17317aba..df15ccf0d030 100644
--- a/hw/xen/xen_pt_msi.c
+++ b/hw/xen/xen_pt_msi.c
@@ -138,6 +138,7 @@ static int msi_msix_setup(XenPCIPassthroughState *s,
rc = xc_physdev_map_pirq_msi(xen_xc, xen_domid, XEN_PT_AUTO_ASSIGN,
ppirq, PCI_DEVFN(s->real_device.dev,
s->real_device.func),
+ ((uint32_t)s->real_device.domain << 16) |
s->real_device.bus,
msix_entry, table_base);
if (rc) {
--
2.51.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] hw/xen: pass PCI domain to xc_physdev_map_pirq_msi()
2025-10-17 15:51 [PATCH] hw/xen: pass PCI domain to xc_physdev_map_pirq_msi() Roger Pau Monne
@ 2025-10-18 4:50 ` Frediano Ziglio
2025-10-21 13:55 ` Anthony PERARD
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Frediano Ziglio @ 2025-10-18 4:50 UTC (permalink / raw)
To: Roger Pau Monne
Cc: qemu-devel, Stefano Stabellini, Anthony PERARD, Paul Durrant,
Edgar E. Iglesias, xen-devel
On Fri, Oct 17, 2025 at 4:52 PM Roger Pau Monne <roger.pau@citrix.com> wrote:
>
> It's currently impossible for passthrough devices on segment different than
> 0 to work correctly, as the PCI domain is not provided to
> xc_physdev_map_pirq_msi(), and hence it's unconditionally assumed that all
> devices are on segment 0.
>
> Adjust the call to xc_physdev_map_pirq_msi() to pass the PCI domain in the
> high 16bits of the bus parameter. On versions of Xen where this is not
> supported the passed segment will be ignored and assume to be 0, no worse
typo: assumed
> than the current state.
>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> ---
> Cc: Stefano Stabellini <sstabellini@kernel.org>
> Cc: Anthony PERARD <anthony@xenproject.org>
> Cc: Paul Durrant <paul@xen.org>
> Cc: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
> Cc: xen-devel@lists.xenproject.org
> ---
> hw/xen/xen_pt_msi.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/hw/xen/xen_pt_msi.c b/hw/xen/xen_pt_msi.c
> index e9ba17317aba..df15ccf0d030 100644
> --- a/hw/xen/xen_pt_msi.c
> +++ b/hw/xen/xen_pt_msi.c
> @@ -138,6 +138,7 @@ static int msi_msix_setup(XenPCIPassthroughState *s,
> rc = xc_physdev_map_pirq_msi(xen_xc, xen_domid, XEN_PT_AUTO_ASSIGN,
> ppirq, PCI_DEVFN(s->real_device.dev,
> s->real_device.func),
> + ((uint32_t)s->real_device.domain << 16) |
> s->real_device.bus,
> msix_entry, table_base);
> if (rc) {
Reviewed-by: Frediano Ziglio <freddy77@gmail.com>
This was tested on a real machine.
Frediano
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] hw/xen: pass PCI domain to xc_physdev_map_pirq_msi()
2025-10-17 15:51 [PATCH] hw/xen: pass PCI domain to xc_physdev_map_pirq_msi() Roger Pau Monne
2025-10-18 4:50 ` Frediano Ziglio
@ 2025-10-21 13:55 ` Anthony PERARD
2025-10-21 13:58 ` Edgar E. Iglesias
2025-10-21 18:17 ` Philippe Mathieu-Daudé
3 siblings, 0 replies; 6+ messages in thread
From: Anthony PERARD @ 2025-10-21 13:55 UTC (permalink / raw)
To: Roger Pau Monne
Cc: qemu-devel, Stefano Stabellini, Paul Durrant, Edgar E. Iglesias,
xen-devel
On Fri, Oct 17, 2025 at 05:51:36PM +0200, Roger Pau Monne wrote:
> It's currently impossible for passthrough devices on segment different than
> 0 to work correctly, as the PCI domain is not provided to
> xc_physdev_map_pirq_msi(), and hence it's unconditionally assumed that all
> devices are on segment 0.
>
> Adjust the call to xc_physdev_map_pirq_msi() to pass the PCI domain in the
> high 16bits of the bus parameter. On versions of Xen where this is not
> supported the passed segment will be ignored and assume to be 0, no worse
> than the current state.
>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
Thanks,
--
Anthony PERARD
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] hw/xen: pass PCI domain to xc_physdev_map_pirq_msi()
2025-10-17 15:51 [PATCH] hw/xen: pass PCI domain to xc_physdev_map_pirq_msi() Roger Pau Monne
2025-10-18 4:50 ` Frediano Ziglio
2025-10-21 13:55 ` Anthony PERARD
@ 2025-10-21 13:58 ` Edgar E. Iglesias
2025-10-21 18:17 ` Philippe Mathieu-Daudé
3 siblings, 0 replies; 6+ messages in thread
From: Edgar E. Iglesias @ 2025-10-21 13:58 UTC (permalink / raw)
To: Roger Pau Monne
Cc: qemu-devel, Stefano Stabellini, Anthony PERARD, Paul Durrant,
xen-devel
[-- Attachment #1: Type: text/plain, Size: 714 bytes --]
On Fri, Oct 17, 2025 at 5:51 PM Roger Pau Monne <roger.pau@citrix.com>
wrote:
> It's currently impossible for passthrough devices on segment different than
> 0 to work correctly, as the PCI domain is not provided to
> xc_physdev_map_pirq_msi(), and hence it's unconditionally assumed that all
> devices are on segment 0.
>
> Adjust the call to xc_physdev_map_pirq_msi() to pass the PCI domain in the
> high 16bits of the bus parameter. On versions of Xen where this is not
> supported the passed segment will be ignored and assume to be 0, no worse
> than the current state.
>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
[-- Attachment #2: Type: text/html, Size: 1219 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] hw/xen: pass PCI domain to xc_physdev_map_pirq_msi()
2025-10-17 15:51 [PATCH] hw/xen: pass PCI domain to xc_physdev_map_pirq_msi() Roger Pau Monne
` (2 preceding siblings ...)
2025-10-21 13:58 ` Edgar E. Iglesias
@ 2025-10-21 18:17 ` Philippe Mathieu-Daudé
2025-10-23 8:55 ` Roger Pau Monné
3 siblings, 1 reply; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-21 18:17 UTC (permalink / raw)
To: Roger Pau Monne, qemu-devel
Cc: Stefano Stabellini, Anthony PERARD, Paul Durrant,
Edgar E. Iglesias, xen-devel
On 17/10/25 17:51, Roger Pau Monne wrote:
> It's currently impossible for passthrough devices on segment different than
> 0 to work correctly, as the PCI domain is not provided to
> xc_physdev_map_pirq_msi(), and hence it's unconditionally assumed that all
> devices are on segment 0.
>
> Adjust the call to xc_physdev_map_pirq_msi() to pass the PCI domain in the
> high 16bits of the bus parameter. On versions of Xen where this is not
> supported the passed segment will be ignored and assume to be 0, no worse
> than the current state.
>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> ---
> Cc: Stefano Stabellini <sstabellini@kernel.org>
> Cc: Anthony PERARD <anthony@xenproject.org>
> Cc: Paul Durrant <paul@xen.org>
> Cc: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
> Cc: xen-devel@lists.xenproject.org
> ---
> hw/xen/xen_pt_msi.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/hw/xen/xen_pt_msi.c b/hw/xen/xen_pt_msi.c
> index e9ba17317aba..df15ccf0d030 100644
> --- a/hw/xen/xen_pt_msi.c
> +++ b/hw/xen/xen_pt_msi.c
> @@ -138,6 +138,7 @@ static int msi_msix_setup(XenPCIPassthroughState *s,
> rc = xc_physdev_map_pirq_msi(xen_xc, xen_domid, XEN_PT_AUTO_ASSIGN,
> ppirq, PCI_DEVFN(s->real_device.dev,
> s->real_device.func),
> + ((uint32_t)s->real_device.domain << 16) |
> s->real_device.bus,
Alternatively:
deposit32(s->real_device.bus, 16, 16, s->real_device.domain)
> msix_entry, table_base);
> if (rc) {
Patch queued, thanks!
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] hw/xen: pass PCI domain to xc_physdev_map_pirq_msi()
2025-10-21 18:17 ` Philippe Mathieu-Daudé
@ 2025-10-23 8:55 ` Roger Pau Monné
0 siblings, 0 replies; 6+ messages in thread
From: Roger Pau Monné @ 2025-10-23 8:55 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, Stefano Stabellini, Anthony PERARD, Paul Durrant,
Edgar E. Iglesias, xen-devel
On Tue, Oct 21, 2025 at 08:17:37PM +0200, Philippe Mathieu-Daudé wrote:
> On 17/10/25 17:51, Roger Pau Monne wrote:
> > It's currently impossible for passthrough devices on segment different than
> > 0 to work correctly, as the PCI domain is not provided to
> > xc_physdev_map_pirq_msi(), and hence it's unconditionally assumed that all
> > devices are on segment 0.
> >
> > Adjust the call to xc_physdev_map_pirq_msi() to pass the PCI domain in the
> > high 16bits of the bus parameter. On versions of Xen where this is not
> > supported the passed segment will be ignored and assume to be 0, no worse
> > than the current state.
> >
> > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> > ---
> > Cc: Stefano Stabellini <sstabellini@kernel.org>
> > Cc: Anthony PERARD <anthony@xenproject.org>
> > Cc: Paul Durrant <paul@xen.org>
> > Cc: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
> > Cc: xen-devel@lists.xenproject.org
> > ---
> > hw/xen/xen_pt_msi.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/hw/xen/xen_pt_msi.c b/hw/xen/xen_pt_msi.c
> > index e9ba17317aba..df15ccf0d030 100644
> > --- a/hw/xen/xen_pt_msi.c
> > +++ b/hw/xen/xen_pt_msi.c
> > @@ -138,6 +138,7 @@ static int msi_msix_setup(XenPCIPassthroughState *s,
> > rc = xc_physdev_map_pirq_msi(xen_xc, xen_domid, XEN_PT_AUTO_ASSIGN,
> > ppirq, PCI_DEVFN(s->real_device.dev,
> > s->real_device.func),
> > + ((uint32_t)s->real_device.domain << 16) |
> > s->real_device.bus,
>
> Alternatively:
>
> deposit32(s->real_device.bus, 16, 16, s->real_device.domain)
Oh, I have to admit I'm not that well versed in QEMU, so didn't even
knew this existed.
Thanks for picking it up.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-10-23 9:01 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-17 15:51 [PATCH] hw/xen: pass PCI domain to xc_physdev_map_pirq_msi() Roger Pau Monne
2025-10-18 4:50 ` Frediano Ziglio
2025-10-21 13:55 ` Anthony PERARD
2025-10-21 13:58 ` Edgar E. Iglesias
2025-10-21 18:17 ` Philippe Mathieu-Daudé
2025-10-23 8:55 ` Roger Pau Monné
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).