Re: [PATCH v6 5/9] iommu/amd: Modify set_dte_entry() to use 256-bit DTE helpers

From: Jason Gunthorpe
Date: Wed Oct 16 2024 - 10:07:43 EST


On Wed, Oct 16, 2024 at 05:17:52AM +0000, Suravee Suthikulpanit wrote:
> + if (dev_data->ats_enabled)
> + new.data[1] |= DTE_FLAG_IOTLB;
> + else
> + new.data[1] &= ~DTE_FLAG_IOTLB;

No need to clear, it is already 0

> - tmp = DTE_GCR3_VAL_C(gcr3) << DTE_GCR3_SHIFT_C;
> - flags |= tmp;
> + old_domid = READ_ONCE(dte->data[1]) & DEV_DOMID_MASK;
> + new.data[1] &= ~DEV_DOMID_MASK;
> + new.data[1] |= domid;

Also no need to clear, it is already zero.

Jason