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

From: Suthikulpanit, Suravee
Date: Fri Oct 11 2024 - 01:25:54 EST




On 10/7/2024 9:06 PM, Jason Gunthorpe wrote:
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

You are correct.

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

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

This will require moving a lot of other functions as well. We will consider this in overall clean up later.

Thanks,
Suravee

Looks fine otherwise

Jason