From: chunming <chunming_li1234@163.com>
To: eric.auger@redhat.com, peter.maydell@linaro.org
Cc: renwei.liu@verisilicon.com, qemu-arm@nongnu.org,
jianxian.wen@verisilicon.com, qemu-devel@nongnu.org,
chunming <chunming.li@verisilicon.com>
Subject: [PATCH v6 2/4] hw/arm/smmuv3: Update CFGI commands to support non PCI/PCIe devices
Date: Thu, 2 Sep 2021 16:14:27 +0800 [thread overview]
Message-ID: <20210902081429.140293-3-chunming_li1234@163.com> (raw)
In-Reply-To: <20210902081429.140293-1-chunming_li1234@163.com>
From: chunming <chunming.li@verisilicon.com>
"smmu_iommu_mr" function can't get MR according to SID for non PCI/PCIe devices.
Look up in the platform device list: peri_sdev_list for non PCI/PCIe devices.
Signed-off-by: chunming <chunming.li@verisilicon.com>
---
hw/arm/smmuv3.c | 29 ++++++++++++++++++-----------
include/hw/arm/smmu-common.h | 5 ++++-
2 files changed, 22 insertions(+), 12 deletions(-)
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
index 557d24ec6..615a6c904 100644
--- a/hw/arm/smmuv3.c
+++ b/hw/arm/smmuv3.c
@@ -985,14 +985,17 @@ static int smmuv3_cmdq_consume(SMMUv3State *s)
break;
}
- if (!mr) {
- break;
+ if (mr) {
+ trace_smmuv3_cmdq_cfgi_ste(sid);
+ sdev = container_of(mr, SMMUDevice, iommu);
+ smmuv3_flush_config(sdev);
}
- trace_smmuv3_cmdq_cfgi_ste(sid);
- sdev = container_of(mr, SMMUDevice, iommu);
- smmuv3_flush_config(sdev);
-
+ sdev = smmu_find_peri_sdev(bs, sid);
+ if (sdev) {
+ trace_smmuv3_cmdq_cfgi_ste(sid);
+ smmuv3_flush_config(sdev);
+ }
break;
}
case SMMU_CMD_CFGI_STE_RANGE: /* same as SMMU_CMD_CFGI_ALL */
@@ -1027,13 +1030,17 @@ static int smmuv3_cmdq_consume(SMMUv3State *s)
break;
}
- if (!mr) {
- break;
+ if (mr) {
+ trace_smmuv3_cmdq_cfgi_cd(sid);
+ sdev = container_of(mr, SMMUDevice, iommu);
+ smmuv3_flush_config(sdev);
}
- trace_smmuv3_cmdq_cfgi_cd(sid);
- sdev = container_of(mr, SMMUDevice, iommu);
- smmuv3_flush_config(sdev);
+ sdev = smmu_find_peri_sdev(bs, sid);
+ if (sdev) {
+ trace_smmuv3_cmdq_cfgi_cd(sid);
+ smmuv3_flush_config(sdev);
+ }
break;
}
case SMMU_CMD_TLBI_NH_ASID:
diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h
index 2902eb13c..be12b93c5 100644
--- a/include/hw/arm/smmu-common.h
+++ b/include/hw/arm/smmu-common.h
@@ -161,7 +161,10 @@ int smmu_ptw(SMMUTransCfg *cfg, dma_addr_t iova, IOMMUAccessFlags perm,
*/
SMMUTransTableInfo *select_tt(SMMUTransCfg *cfg, dma_addr_t iova);
-/* Return the iommu mr associated to @sid, or NULL if none */
+/**
+ * Return the iommu mr associated to @sid, or NULL if none
+ * Only for PCI device, check smmu_find_peri_sdev for peripheral device
+ */
IOMMUMemoryRegion *smmu_iommu_mr(SMMUState *s, uint32_t sid);
#define SMMU_IOTLB_MAX_SIZE 256
--
2.30.2
next prev parent reply other threads:[~2021-09-02 8:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-02 8:14 [PATCH v6 0/4] hw/arm/smmuv3: Support non PCI/PCIe devices chunming
2021-09-02 8:14 ` [PATCH v6 1/4] hw/arm/smmuv3: Support non PCI/PCIe device connect with SMMU v3 chunming
2021-09-02 8:14 ` chunming [this message]
2021-09-02 8:14 ` [PATCH v6 3/4] hw/arm/virt: Update SMMU v3 creation to support non PCI/PCIe device connection chunming
2021-09-02 8:14 ` [PATCH v6 4/4] hw/arm/virt: Add PL330 DMA controller and connect with SMMU v3 chunming
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=20210902081429.140293-3-chunming_li1234@163.com \
--to=chunming_li1234@163.com \
--cc=chunming.li@verisilicon.com \
--cc=eric.auger@redhat.com \
--cc=jianxian.wen@verisilicon.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=renwei.liu@verisilicon.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).