Re: [PATCH v5 2/6] iommu/amd: Introduce helper function to update 256-bit DTE

From: Jason Gunthorpe
Date: Mon Oct 07 2024 - 10:07:08 EST


On Mon, Oct 07, 2024 at 04:13:49AM +0000, Suravee Suthikulpanit wrote:
> +static void write_dte_upper128(struct dev_table_entry *ptr, struct dev_table_entry *new)
> +{
> + struct dev_table_entry old = {};
> +
> + do {
> + old.data128[1] = ptr->data128[1];
> + new->data[2] &= ~DTE_DATA2_INTR_MASK;
> + new->data[2] |= old.data[2] & (DTE_DATA2_INTR_MASK | DTE_DATA2_RESV_MASK);

Why preserve the reserved bits? Shouldn't they be reserved by forced
to 0? Should have a comment explaining this

> +static void iommu_flush_dte_sync(struct amd_iommu *iommu, u16 devid)
> +{

You might consider re-ordering to avoid the function forward
declaration.

Looks fine otherwise

Jason