From: Robin Murphy <robin.murphy@arm.com>
To: Benjamin Gaignard <benjamin.gaignard@collabora.com>,
will@kernel.org, robh+dt@kernel.org, heiko@sntech.de,
xxm@rock-chips.com, joro@8bytes.org, dan.carpenter@oracle.com
Cc: devicetree@vger.kernel.org, iommu@lists.linux-foundation.org,
kernel@collabora.com, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] iommu: rockchip: Fix physical address decoding
Date: Fri, 18 Jun 2021 13:45:52 +0100 [thread overview]
Message-ID: <461d60d8-c81c-dab9-67b7-62216faef288@arm.com> (raw)
In-Reply-To: <20210618114615.443961-1-benjamin.gaignard@collabora.com>
On 2021-06-18 12:46, Benjamin Gaignard wrote:
> 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@oracle.com>
> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
> ---
> drivers/iommu/rockchip-iommu.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
> index 94b9d8e5b9a40..e55482a477080 100644
> --- a/drivers/iommu/rockchip-iommu.c
> +++ b/drivers/iommu/rockchip-iommu.c
> @@ -544,12 +544,13 @@ 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);
> + ((addr & DTE_BASE_HI_MASK) << DT_SHIFT);
I think this still has the problem that you're shifting off the top of
addr *before* the cast takes effect.
Robin.
> }
>
> static inline u32 rk_dma_addr_dte_v2(dma_addr_t dt_dma)
>
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
prev parent reply other threads:[~2021-06-18 12:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-18 11:46 [PATCH] iommu: rockchip: Fix physical address decoding Benjamin Gaignard
2021-06-18 12:45 ` Robin Murphy [this message]
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=461d60d8-c81c-dab9-67b7-62216faef288@arm.com \
--to=robin.murphy@arm.com \
--cc=benjamin.gaignard@collabora.com \
--cc=dan.carpenter@oracle.com \
--cc=devicetree@vger.kernel.org \
--cc=heiko@sntech.de \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--cc=kernel@collabora.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=robh+dt@kernel.org \
--cc=will@kernel.org \
--cc=xxm@rock-chips.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