[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210712101232.318589-1-benjamin.gaignard@collabora.com>
Date: Mon, 12 Jul 2021 12:12:32 +0200
From: Benjamin Gaignard <benjamin.gaignard@...labora.com>
To: joro@...tes.org, will@...nel.org, heiko@...ech.de
Cc: iommu@...ts.linux-foundation.org,
linux-arm-kernel@...ts.infradead.org,
linux-rockchip@...ts.infradead.org, linux-kernel@...r.kernel.org,
Benjamin Gaignard <benjamin.gaignard@...labora.com>,
Dan Carpenter <dan.carpenter@...cle.com>
Subject: [PATCH v3] iommu/rockchip: Fix physical address decoding
Restore bits 39 to 32 at correct position.
It reverses the operation done in rk_dma_addr_dte_v2().
Fixes: c55356c534aa ("iommu: rockchip: Add support for iommu v2")
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@...labora.com>
---
version 3:
- change commit header to match with IOMMU tree convention
drivers/iommu/rockchip-iommu.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
index 94b9d8e5b9a40..9febfb7f3025b 100644
--- a/drivers/iommu/rockchip-iommu.c
+++ b/drivers/iommu/rockchip-iommu.c
@@ -544,12 +544,14 @@ static inline u32 rk_dma_addr_dte(dma_addr_t dt_dma)
}
#define DT_HI_MASK GENMASK_ULL(39, 32)
+#define DTE_BASE_HI_MASK GENMASK(11, 4)
#define DT_SHIFT 28
static inline phys_addr_t rk_dte_addr_phys_v2(u32 addr)
{
- return (phys_addr_t)(addr & RK_DTE_PT_ADDRESS_MASK) |
- ((addr & DT_HI_MASK) << DT_SHIFT);
+ u64 addr64 = addr;
+ return (phys_addr_t)(addr64 & RK_DTE_PT_ADDRESS_MASK) |
+ ((addr64 & DTE_BASE_HI_MASK) << DT_SHIFT);
}
static inline u32 rk_dma_addr_dte_v2(dma_addr_t dt_dma)
--
2.25.1
Powered by blists - more mailing lists