Re: [v2 PATCH] iommu/arm-smmu-v3: Fix L1 stream table index calculation for 32-bit sid size

From: Jason Gunthorpe
Date: Wed Oct 02 2024 - 14:15:14 EST


On Wed, Oct 02, 2024 at 10:55:14AM -0700, Yang Shi wrote:

> Using 64 bit immediate when doing shift can solve the problem. The
> disassembly after the fix looks like:
> ldr w20, [x19, 828] //, smmu_7(D)->sid_bits
> mov x0, 1
> lsl x0, x0, x20
>
> There are a couple of problematic places, extracted the shift into a helper.
>
> [1] https://lore.kernel.org/lkml/d4b53bbb-333a-45b9-9eb0-23ddd0820a14@xxxxxxx/
> Fixes: ce410410f1a7 ("iommu/arm-smmu-v3: Add arm_smmu_strtab_l1/2_idx()")
> Tested-by: James Morse <james.morse@xxxxxxx>
> Signed-off-by: Yang Shi <yang@xxxxxxxxxxxxxxxxxxxxxx>
> ---
> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 8 +++++---
> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 5 +++++
> 2 files changed, 10 insertions(+), 3 deletions(-)

Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx>

Jason