Re: drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c:1122:38: sparse: sparse: cast from restricted __le64
From: Will Deacon
Date: Fri Jun 19 2026 - 10:32:55 EST
On Mon, Jun 15, 2026 at 10:27:16AM +0800, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 8cd9520d35a6c38db6567e97dd93b1f11f185dc6
> commit: 7cad800485956a263318930613f8f4a084af8c70 iommu/arm-smmu-v3: Mark EATS_TRANS safe when computing the update sequence
> date: 5 months ago
> config: arm64-randconfig-r123-20260614 (https://download.01.org/0day-ci/archive/20260615/202606151017.QU0evpH9-lkp@xxxxxxxxx/config)
> compiler: aarch64-linux-gcc (GCC) 13.4.0
> sparse: v0.6.5-rc1
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260615/202606151017.QU0evpH9-lkp@xxxxxxxxx/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Fixes: 7cad80048595 ("iommu/arm-smmu-v3: Mark EATS_TRANS safe when computing the update sequence")
> | Reported-by: kernel test robot <lkp@xxxxxxxxx>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202606151017.QU0evpH9-lkp@xxxxxxxxx/
>
> sparse warnings: (new ones prefixed by >>)
> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c:1101:17: sparse: sparse: incorrect type in initializer (different base types) @@ expected restricted __le64 const [usertype] eats_s1chk @@ got unsigned long long @@
> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c:1101:17: sparse: expected restricted __le64 const [usertype] eats_s1chk
> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c:1101:17: sparse: got unsigned long long
> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c:1103:17: sparse: sparse: incorrect type in initializer (different base types) @@ expected restricted __le64 const [usertype] eats_trans @@ got unsigned long long @@
> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c:1103:17: sparse: expected restricted __le64 const [usertype] eats_trans
> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c:1103:17: sparse: got unsigned long long
> >> 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
> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c: note: in included file (through arch/arm64/include/asm/atomic.h, include/linux/atomic.h, include/asm-generic/bitops/atomic.h, ...):
> arch/arm64/include/asm/cmpxchg.h:168:1: sparse: sparse: cast truncates bits from constant value (ffffffff80000000 becomes 0)
> arch/arm64/include/asm/cmpxchg.h:168:1: sparse: sparse: cast truncates bits from constant value (ffffffff80000000 becomes 0)
>
> vim +1122 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
>
> 1095
> 1096 VISIBLE_IF_KUNIT
> 1097 void arm_smmu_get_ste_update_safe(const __le64 *cur, const __le64 *target,
> 1098 __le64 *safe_bits)
> 1099 {
> 1100 const __le64 eats_s1chk =
> 1101 FIELD_PREP(STRTAB_STE_1_EATS, STRTAB_STE_1_EATS_S1CHK);
> 1102 const __le64 eats_trans =
> 1103 FIELD_PREP(STRTAB_STE_1_EATS, STRTAB_STE_1_EATS_TRANS);
I guess neither of these ^^^ should be __le64?
Will