[PATCH v5 10/27] iommu/arm-smmu-v3: Move the CD generation for SVA into a function

Jason Gunthorpe jgg at nvidia.com
Wed Mar 20 06:09:16 PDT 2024


On Fri, Mar 15, 2024 at 10:19:45PM -0700, Nicolin Chen wrote:
> On Mon, Mar 04, 2024 at 07:43:58PM -0400, Jason Gunthorpe wrote:
> > @@ -1070,8 +1062,7 @@ static u8 arm_smmu_entry_qword_diff(struct arm_smmu_entry_writer *writer,
> >  		 * Each bit indicates that a used bit in a qword needs to be
> >  		 * changed after unused_update is applied.
> >  		 */
> > -		if ((unused_update[i] & target_used[i]) !=
> > -		    (target[i] & target_used[i]))
> > +		if ((unused_update[i] & target_used[i]) != target[i])
> >  			used_qword_diff |= 1 << i;
> 
> Would you mind elaborating why we drop this "& target_used[i]"
> against the target[i] on the right?

It is undoning the temporary code a few patches before did and
bringing it back to the way it was in part 1.

It is ugly, the programmer requires that the target be properly
constructed but the way I migrated the CD code over doesn't guarentee
proper construction until we reach this patch because it edits the
current CD..

So there is this inbetween step where the programming code has to fix
an improperly constructed thing.

I didn't try too hard to simplify this, let me look again.

Jason



More information about the linux-arm-kernel mailing list