From: Zhenzhong Duan <zhenzhong.duan@intel.com>
To: qemu-devel@nongnu.org, qemu-arm@nongnu.org
Cc: eric.auger@redhat.com, jean-philippe@linaro.org,
alex.williamson@redhat.com, clg@redhat.com, peterx@redhat.com,
jasowang@redhat.com, mst@redhat.com, yi.l.liu@intel.com,
chao.p.peng@intel.com, Zhenzhong Duan <zhenzhong.duan@intel.com>,
Peter Maydell <peter.maydell@linaro.org>
Subject: [PATCH v2 2/2] smmu: Clear SMMUPciBus pointer cache when system reset
Date: Thu, 25 Jan 2024 15:37:06 +0800 [thread overview]
Message-ID: <20240125073706.339369-3-zhenzhong.duan@intel.com> (raw)
In-Reply-To: <20240125073706.339369-1-zhenzhong.duan@intel.com>
s->smmu_pcibus_by_bus_num is a SMMUPciBus pointer cache 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 smmu_iommu_mr() providing the wrong iommu MR.
Suggested-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
---
hw/arm/smmu-common.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
index 9a8ac45431..f58261bb81 100644
--- a/hw/arm/smmu-common.c
+++ b/hw/arm/smmu-common.c
@@ -675,6 +675,8 @@ static void smmu_base_reset_hold(Object *obj)
{
SMMUState *s = ARM_SMMU(obj);
+ memset(s->smmu_pcibus_by_bus_num, 0, sizeof(s->smmu_pcibus_by_bus_num));
+
g_hash_table_remove_all(s->configs);
g_hash_table_remove_all(s->iotlb);
}
--
2.34.1
next prev parent reply other threads:[~2024-01-25 7:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-25 7:37 [PATCH v2 0/2] Two minor fixes on virtio-iommu and smmu Zhenzhong Duan
2024-01-25 7:37 ` [PATCH v2 1/2] virtio_iommu: Clear IOMMUPciBus pointer cache when system reset Zhenzhong Duan
2024-01-25 7:37 ` Zhenzhong Duan [this message]
2024-01-29 9:27 ` [PATCH v2 0/2] Two minor fixes on virtio-iommu and smmu Eric Auger
2024-01-29 9:41 ` 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=20240125073706.339369-3-zhenzhong.duan@intel.com \
--to=zhenzhong.duan@intel.com \
--cc=alex.williamson@redhat.com \
--cc=chao.p.peng@intel.com \
--cc=clg@redhat.com \
--cc=eric.auger@redhat.com \
--cc=jasowang@redhat.com \
--cc=jean-philippe@linaro.org \
--cc=mst@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=peterx@redhat.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=yi.l.liu@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).