From: "Cédric Le Goater" <clg@redhat.com>
To: Zhenzhong Duan <zhenzhong.duan@intel.com>,
qemu-devel@nongnu.org, qemu-arm@nongnu.org
Cc: eric.auger@redhat.com, jean-philippe@linaro.org,
alex.williamson@redhat.com, peterx@redhat.com,
jasowang@redhat.com, mst@redhat.com, yi.l.liu@intel.com,
chao.p.peng@intel.com
Subject: Re: [PATCH 1/3] virtio_iommu: Clear IOMMUPciBus pointer cache when system reset
Date: Tue, 23 Jan 2024 10:41:39 +0100 [thread overview]
Message-ID: <c47b95f9-ca42-4f8e-85d1-8fc72404e441@redhat.com> (raw)
In-Reply-To: <20240122064015.94630-2-zhenzhong.duan@intel.com>
On 1/22/24 07:40, Zhenzhong Duan wrote:
> IOMMUPciBus pointer cache is indexed by bus number, bus number
> may not always be a fixed value, i.e., guest reboot to different
> kernel which set bus number with different algorithm.
>
> This could lead to endpoint binding to wrong iommu MR in
> virtio_iommu_get_endpoint(), then vfio device setup wrong
> mapping from other device.
>
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
> ---
> hw/virtio/virtio-iommu.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c
> index 8a4bd933c6..bfce3237f3 100644
> --- a/hw/virtio/virtio-iommu.c
> +++ b/hw/virtio/virtio-iommu.c
> @@ -1264,6 +1264,8 @@ static void virtio_iommu_system_reset(void *opaque)
>
> trace_virtio_iommu_system_reset();
>
> + memset(s->iommu_pcibus_by_bus_num, 0, sizeof(s->iommu_pcibus_by_bus_num));
> +
> /*
> * config.bypass is sticky across device reset, but should be restored on
> * system reset
you could remove the memset in virtio_iommu_device_realize() then ?
Thanks,
C.
next prev parent reply other threads:[~2024-01-23 9:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-22 6:40 [PATCH 0/3] Two minor fixes on virtio-iommu Zhenzhong Duan
2024-01-22 6:40 ` [PATCH 1/3] virtio_iommu: Clear IOMMUPciBus pointer cache when system reset Zhenzhong Duan
2024-01-23 9:41 ` Cédric Le Goater [this message]
2024-01-23 10:03 ` Duan, Zhenzhong
2024-01-24 21:04 ` Eric Auger
2024-01-25 2:46 ` Duan, Zhenzhong
2024-01-22 6:40 ` [PATCH 2/3] hw/pci: Add two parameters to get_address_space Zhenzhong Duan
2024-01-22 6:40 ` [PATCH 3/3] virtio-iommu: Support PCI device aliases Zhenzhong Duan
2024-01-24 20:55 ` Eric Auger
2024-01-25 5:58 ` Duan, Zhenzhong
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=c47b95f9-ca42-4f8e-85d1-8fc72404e441@redhat.com \
--to=clg@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=chao.p.peng@intel.com \
--cc=eric.auger@redhat.com \
--cc=jasowang@redhat.com \
--cc=jean-philippe@linaro.org \
--cc=mst@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=yi.l.liu@intel.com \
--cc=zhenzhong.duan@intel.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).