From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jiqian Chen <Jiqian.Chen@amd.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
Anthony Perard <anthony.perard@citrix.com>,
Paul Durrant <paul@xen.org>,
qemu-devel@nongnu.org, xen-devel@lists.xenproject.org,
Xenia Ragiadakou <xenia.ragiadakou@amd.com>,
Stewart Hildebrand <Stewart.Hildebrand@amd.com>,
Alex Deucher <Alexander.Deucher@amd.com>,
Huang Rui <Ray.Huang@amd.com>,
Honglei Huang <Honglei1.Huang@amd.com>,
Julia Zhang <Julia.Zhang@amd.com>
Subject: Re: [RFC QEMU PATCH v3 1/1] xen: Use gsi instead of irq for mapping pirq
Date: Mon, 11 Dec 2023 16:33:58 +0100 [thread overview]
Message-ID: <ZXcr5v43dsJAx8aK@macbook> (raw)
In-Reply-To: <20231210165240.1551450-2-Jiqian.Chen@amd.com>
On Mon, Dec 11, 2023 at 12:52:40AM +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
> 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 passthrough a device, qemu wants to use
> gsi to map pirq, xen_pt_realize->xc_physdev_map_pirq, but
> the gsi number is got from file
> /sys/bus/pci/devices/<sbdf>/irq in current code, so it
> will fail when mapping.
>
> Use real gsi number read from gsi sysfs.
>
> Co-developed-by: Huang Rui <ray.huang@amd.com>
> Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com>
> ---
> hw/xen/xen-host-pci-device.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/xen/xen-host-pci-device.c b/hw/xen/xen-host-pci-device.c
> index 8c6e9a1716..e270ac2631 100644
> --- a/hw/xen/xen-host-pci-device.c
> +++ b/hw/xen/xen-host-pci-device.c
> @@ -364,7 +364,7 @@ void xen_host_pci_device_get(XenHostPCIDevice *d, uint16_t domain,
> }
> d->device_id = v;
>
> - xen_host_pci_get_dec_value(d, "irq", &v, errp);
> + xen_host_pci_get_dec_value(d, "gsi", &v, errp);
Don't you need to fallthrough to use the irq number on failure?
Otherwise passthrough won't work on older Linux versions that don't
expose the gsi node.
Thanks, Roger.
next prev parent reply other threads:[~2023-12-11 15:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-10 16:52 [RFC QEMU PATCH v3 0/1] Support device passthrough when dom0 is PVH on Xen Jiqian Chen
2023-12-10 16:52 ` [RFC QEMU PATCH v3 1/1] xen: Use gsi instead of irq for mapping pirq Jiqian Chen
2023-12-11 15:33 ` Roger Pau Monné [this message]
2023-12-12 6:37 ` 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=ZXcr5v43dsJAx8aK@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=paul@xen.org \
--cc=qemu-devel@nongnu.org \
--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 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).