iommu/arm-smmu-v3: Declare eats_s1chk and eats_trans as host-endian u64
Subsystems (2)
PATCH 1/1 iommu/arm-smmu-v3: Declare eats_s1chk and eats_trans as host-endian u64
arm_smmu_get_ste_update_safe() declares the eats_s1chk and eats_trans locals as __le64, but initializes them from FIELD_PREP(), which returns a host-endian value, and passes them through cpu_to_le64() at the use sites.
Sparse reports the following warnings:
Quoted 1 line
Quoted 1 line
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c:1122:38: sparse: sparse: cast from restricted__le64
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c:1124:33: sparse: sparse: cast from restricted __le64
Declare both locals as u64 so the type matches FIELD_PREP() and the existing cpu_to_le64() at the use sites performs the host-to-little-endian conversion. No functional change.
--- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +2 -2
@@ -1240,9 +1240,9 @@ VISIBLE_IF_KUNITvoid arm_smmu_get_ste_update_safe (const __le64 *cur,const __le64 *target,__le64 *safe_bits) { -const __le64 eats_s1chk = +const u64 eats_s1chk =FIELD_PREP (STRTAB_STE_1_EATS ,STRTAB_STE_1_EATS_S1CHK ); -const __le64 eats_trans = +const u64 eats_trans =FIELD_PREP (STRTAB_STE_1_EATS ,STRTAB_STE_1_EATS_TRANS );/*
Signature · 1 line
2.43.0
Quoted 27 lines · Nicolin Chen
arm_smmu_get_ste_update_safe()declares theeats_s1chkandeats_translocals as__le64, but initializes them fromFIELD_PREP(), which returns a host-endian value, and passes them throughcpu_to_le64()at the use sites.Sparse reports the following warnings:
Quoted 1 line
Quoted 1 line
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c:1122:38: sparse: sparse: cast from restricted__le64
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c:1124:33: sparse: sparse: cast from restricted__le64Declare both locals as u64 so the type matches
FIELD_PREP()and the existingcpu_to_le64()at the use sites performs the host-to-little-endian conversion. No functional change.Fixes 7cad80048595 ("iommu/arm-smmu-v3: Mark EATS_TRANS safe when computing the update sequence")Reported-by kernel test robot <[email protected]>Assisted-by Claude:claude-opus-4-8Signed-off-by Nicolin Chen <[email protected]>--- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +0
-0
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c VISIBLE_IF_KUNIT · line 1246
Quoted 9 lines
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +2
-2@@ -1240,9 +1240,9 @@ VISIBLE_IF_KUNITvoid arm_smmu_get_ste_update_safe (const __le64 *cur,const __le64 *target,__le64 *safe_bits) { -const __le64 eats_s1chk = +const u64 eats_s1chk =FIELD_PREP (STRTAB_STE_1_EATS ,STRTAB_STE_1_EATS_S1CHK ); -const __le64 eats_trans = +const u64 eats_trans =FIELD_PREP (STRTAB_STE_1_EATS ,STRTAB_STE_1_EATS_TRANS );
Thanks,
Praan
Quoted 13 lines · Nicolin Chen
arm_smmu_get_ste_update_safe()declares theeats_s1chkandeats_translocals as__le64, but initializes them fromFIELD_PREP(), which returns a host-endian value, and passes them throughcpu_to_le64()at the use sites.Sparse reports the following warnings:
Quoted 1 line
Quoted 1 line
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c:1122:38: sparse: sparse: cast from restricted__le64
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c:1124:33: sparse: sparse: cast from restricted__le64Declare both locals as u64 so the type matches
FIELD_PREP()and the existingcpu_to_le64()at the use sites performs the host-to-little-endian conversion. No functional change.
Quoted 8 lines
Fixes 7cad80048595 ("iommu/arm-smmu-v3: Mark EATS_TRANS safe when computing the update sequence")Reported-by kernel test robot <[email protected]>Assisted-by Claude:claude-opus-4-8Signed-off-by Nicolin Chen <[email protected]>--- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Jason
Will Deacon
maintainerQuoted 27 lines · Nicolin Chen
arm_smmu_get_ste_update_safe()declares theeats_s1chkandeats_translocals as__le64, but initializes them fromFIELD_PREP(), which returns a host-endian value, and passes them throughcpu_to_le64()at the use sites.Sparse reports the following warnings:
Quoted 1 line
Quoted 1 line
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c:1122:38: sparse: sparse: cast from restricted__le64
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c:1124:33: sparse: sparse: cast from restricted__le64Declare both locals as u64 so the type matches
FIELD_PREP()and the existingcpu_to_le64()at the use sites performs the host-to-little-endian conversion. No functional change.Fixes 7cad80048595 ("iommu/arm-smmu-v3: Mark EATS_TRANS safe when computing the update sequence")Reported-by kernel test robot <[email protected]>Assisted-by Claude:claude-opus-4-8Signed-off-by Nicolin Chen <[email protected]>--- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +0
-0
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c VISIBLE_IF_KUNIT · line 1246
Quoted 9 lines
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +2
-2@@ -1240,9 +1240,9 @@ VISIBLE_IF_KUNITvoid arm_smmu_get_ste_update_safe (const __le64 *cur,const __le64 *target,__le64 *safe_bits) { -const __le64 eats_s1chk = +const u64 eats_s1chk =FIELD_PREP (STRTAB_STE_1_EATS ,STRTAB_STE_1_EATS_S1CHK ); -const __le64 eats_trans = +const u64 eats_trans =FIELD_PREP (STRTAB_STE_1_EATS ,STRTAB_STE_1_EATS_TRANS );
Aha, this is the fix for that sparse report from the kbuild robot. Thanks!
Will
Quoted 10 lines · Nicolin Chen
arm_smmu_get_ste_update_safe()declares theeats_s1chkandeats_translocals as__le64, but initializes them fromFIELD_PREP(), which returns a host-endian value, and passes them throughcpu_to_le64()at the use sites.Sparse reports the following warnings:
Quoted 1 line
Quoted 1 line
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c:1122:38: sparse: sparse: cast from restricted__le64
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c:1124:33: sparse: sparse: cast from restricted__le64[...]
Applied to iommu (arm/smmu/updates), thanks!
[1/1] iommu/arm-smmu-v3: Declare eats_s1chk and eats_trans as host-endian u64
https://git.kernel.org/iommu/c/445528627447
Cheers,
Signature · 5 lines
Will https://fixes.arm64.dev https://next.arm64.dev https://will.arm64.dev