[PATCH v5 06/27] iommu/arm-smmu-v3: Consolidate clearing a CD table entry

Jason Gunthorpe jgg at nvidia.com
Mon Mar 25 07:14:33 PDT 2024


On Fri, Mar 22, 2024 at 06:36:17PM +0000, Mostafa Saleh wrote:
> > +void arm_smmu_clear_cd(struct arm_smmu_master *master, ioasid_t ssid)
> > +{
> > +	struct arm_smmu_cd target = {};
> > +	struct arm_smmu_cd *cdptr;
> > +
> > +	if (!master->cd_table.cdtab)
> > +		return;
> > +	cdptr = arm_smmu_get_cd_ptr(master, ssid);
> > +	if (WARN_ON(!cdptr))
> > +		return;
> 
> I don’t understand the SVA code enough, but AFAICT, arm_smmu_sva_set_dev_pasid
> can allocate the L2 CD table through arm_smmu_write_ctx_desc. 

Yes

> And if it failed
> before allocating the CD table, then remove_dev_pasid would be
> called, 

If it fails the core code should not call remove_dev_pasid() on a
domain that was never attached. There is an obscure error unwinding
issue in the core code Yi is looking to fix regarding multi-device
PASID groups, but it is not a driver issue..

> which warns here, the previous code would tolerate that, but that
> might regress on systems with panic_on_warn, so I am not sure if
> that is necessary.

Right, if it does hit it signals there is some error unwinding bug in
the core code that should be resolved.

> Otherwise, Reviewed-by: Mostafa Saleh <smostafa at google.com>

Thanks,
Jason



More information about the linux-arm-kernel mailing list