[PATCH v6 05/25] iommu/arm-smmu-v3: Move IDR parsing to common functions
Mostafa Saleh
smostafa at google.com
Mon May 4 05:16:13 PDT 2026
On Fri, May 01, 2026 at 09:47:16AM -0300, Jason Gunthorpe wrote:
> On Fri, May 01, 2026 at 11:19:07AM +0000, Mostafa Saleh wrote:
> > Move parsing of IDRs to functions so that it can be re-used
> > +unsigned long smmu_idr5_to_pgsize(u32 reg)
> > +{
> > + unsigned long pgsize_bitmap = 0;
> > +
> > + if (reg & IDR5_GRAN64K)
> > + pgsize_bitmap |= SZ_64K | SZ_512M;
> > + if (reg & IDR5_GRAN16K)
> > + pgsize_bitmap |= SZ_16K | SZ_32M;
> > + if (reg & IDR5_GRAN4K)
> > + pgsize_bitmap |= SZ_4K | SZ_2M | SZ_1G;
> > + return pgsize_bitmap;
> > +}
>
> I think this should include:
>
> > + smmu->oas = smmu_idr5_to_oas(reg);
> > + if (smmu->oas == 52)
> > smmu->pgsize_bitmap |= 1ULL << 42; /* 4TB */
> > - break;
>
> ie it should return the supported page sizes by inspecting all the
> idrs and don't leave this tricky bit to be open coded..
This way was easier as each function only returns one thing, otherwise
we have to pass stuff by address as we can’t pass the smmu struct as it
is not shared between the drivers.
But no strong opinion, I can change that.
Thanks,
Mostafa
>
> Jason
More information about the linux-arm-kernel
mailing list