From 6e94086a86b8f246c754f50cb9f4adcbf02ce1b2 Mon Sep 17 00:00:00 2001 From: Oleksandr Tyshchenko Date: Mon, 20 Dec 2021 23:15:53 +0200 Subject: [PATCH] iommu/ipmmu-vmsa: Add utlb_offset_base MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This is a non-verbatim port of corresponding Linux upsteam commit: 1289f7f15001c7ed36be6d23cb145c1d5feacdc8 Original commit message: commit 1289f7f15001c7ed36be6d23cb145c1d5feacdc8 Author: Yoshihiro Shimoda Date: Wed Nov 6 11:35:50 2019 +0900 iommu/ipmmu-vmsa: Add utlb_offset_base Since we will have changed memory mapping of the IPMMU in the future, this patch adds a utlb_offset_base into struct ipmmu_features for IMUCTR and IMUASID registers. No behavior change. Signed-off-by: Yoshihiro Shimoda Reviewed-by: Niklas Söderlund Signed-off-by: Joerg Roedel ********** This is a prereq work needed to add support for S4 series easily in the future. Almost the same change as original commit makes, but without updating struct ipmmu_features_default which Xen driver doesn't have (there is no support of old Arm32 based Gen2 SoCs). No change in behavior. Signed-off-by: Oleksandr Tyshchenko Reviewed-by: Yoshihiro Shimoda Acked-by: Julien Grall --- xen/drivers/passthrough/arm/ipmmu-vmsa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xen/drivers/passthrough/arm/ipmmu-vmsa.c b/xen/drivers/passthrough/arm/ipmmu-vmsa.c index ca33456ac2..d8f96fcd3d 100644 --- a/xen/drivers/passthrough/arm/ipmmu-vmsa.c +++ b/xen/drivers/passthrough/arm/ipmmu-vmsa.c @@ -111,6 +111,7 @@ struct ipmmu_features { unsigned int num_utlbs; unsigned int ctx_offset_base; unsigned int ctx_offset_stride; + unsigned int utlb_offset_base; }; /* Root/Cache IPMMU device's information */ @@ -374,7 +375,7 @@ static void ipmmu_ctx_write_all(struct ipmmu_vmsa_domain *domain, static uint32_t ipmmu_utlb_reg(struct ipmmu_vmsa_device *mmu, uint32_t reg) { - return reg; + return mmu->features->utlb_offset_base + reg; } static void ipmmu_imuasid_write(struct ipmmu_vmsa_device *mmu, @@ -738,6 +739,7 @@ static const struct ipmmu_features ipmmu_features_rcar_gen3 = { .num_utlbs = 48, .ctx_offset_base = 0, .ctx_offset_stride = 0x40, + .utlb_offset_base = 0, }; static void ipmmu_device_reset(struct ipmmu_vmsa_device *mmu) -- 2.30.2