[PATCH v7 05/24] iommu/arm-smmu-v3: Move IDR parsing to common functions

Jason Gunthorpe jgg at nvidia.com
Wed Aug 26 05:41:34 PDT 2026


On Wed, Aug 26, 2026 at 09:44:20AM +0000, Mostafa Saleh wrote:
> > 
> > 	reg = readl_relaxed(smmu->base + ARM_SMMU_IDR0);
> > 
> > 	smmu->features |= smmu_idr0_features(reg);
> > 	if (!(smmu->features & (ARM_SMMU_FEAT_TT_LE | ARM_SMMU_FEAT_TT_BE))) {
> > 		dev_err(smmu->dev, "unknown/unsupported TT endianness!\n");
> > 		return -ENXIO;
> > 	}
> > 
> > vs
> > 
> > 	reg = readl_relaxed(smmu->base + ARM_SMMU_IDR0);
> > 
> > 	smmu->features |= smmu_idr0_features(reg);
> > 	if (!(smmu->features & (ARM_SMMU_FEAT_TT_LE | ARM_SMMU_FEAT_TT_BE)))
> > 		return -ENXIO;
> 
> I am not sure I get this, the only difference is the printk?

My point is there is alot of lines that only differ by a prinkt or
something minor like that.

> We can do more with that, but as discussed last time, I am worried that
> re-defining structs using macros just makes things harder for
> maintenance and more fragile to changes, causing build failures,
> and mismatch in types between the 2 structs.

It looks easy to build test with pkvm enabled in the build, I don't
see an issue. It signficantly simplifies things going forward if we
don't have to have these careful break ups and splits of everything
that doesn't need it.

I prefer to see pkvm use the driver code unmodified as much as
possible, that will be easier to keep together long term, I think.

Jason



More information about the linux-arm-kernel mailing list