Re: [PATCH 1/1] iommu/amd: Preserve default DTE fields when updating Host Page Table Root
From: Jason Gunthorpe
Date: Tue Jan 07 2025 - 13:02:07 EST
On Tue, Jan 07, 2025 at 05:45:38PM +0530, Vasant Hegde wrote:
> > @@ -2052,12 +2052,12 @@ static void set_dte_entry(struct amd_iommu *iommu,
> > make_clear_dte(dev_data, dte, &new);
>
> This fix is fine. But with all changes we have done in this code does, do we
> really need make_clear_dte()?
> How about removing `make_clear_dte()` and moving DTE_FLAG_V to
> write_dte_lower128() ?
The V flag should just be set by the functions building the DTE,
write_dte_lower() should accept a fully formed dte as a matter of
layering.
I'm hopefull Suravee will come with something like this:
https://lore.kernel.org/linux-iommu/20241016142237.GP3559746@xxxxxxxxxx/
And then I'd expect to drop make_clear_dte() and sprinkle the V into
the individual settings that already have bitflags for entry 0.
The one place outside that call chain using make_clear_dte() is
clear_dte_entry() which should call a set_dte_blocked() with the above
break up.
Then the set_dte() functions are called by the attach functions and
you can get hitless replace.
Jason