[PATCH 2/7] iommu/arm-smmu-v3: Do not zero the strtab twice

Jason Gunthorpe jgg at nvidia.com
Wed Jun 5 14:22:52 PDT 2024


On Tue, Jun 04, 2024 at 03:56:04PM +0000, Mostafa Saleh wrote:

> > arm_smmu_init_l1_strtab() goes through and calls
> > arm_smmu_write_strtab_l1_desc() on the newly allocated (and zero'd) struct
> > arm_smmu_strtab_l1_desc, which ends up computing 'val = 0' and zeroing it
> > again.
> > 
> > Remove arm_smmu_init_l1_strtab() and just call devm_kcalloc() from
> > arm_smmu_init_strtab_2lvl to allocate the companion struct.
> > 
> > Signed-off-by: Jason Gunthorpe <jgg at nvidia.com>
> 
> Looking at the code for dmam_alloc_coherent(basically dma_alloc_coherent)
> I see that the memory is zeroed for both DMA direct and IOMMU, however
> I don’t see that documented (in DMA-API.txt).

> Assuming that’s guaranteed to be zeroed (maybe we should update the docs
> if I am not missing something)

Yeah, people have been sending clean ups removing zeroing and GFP_ZERO's
in this space for a bit now. There are many places that rely on it.

Thanks,
Jason



More information about the linux-arm-kernel mailing list