Re: [PATCH v3 2/5] iommu/amd: Fix DTE clearing and rename iommu_ignore_device()
From: Jason Gunthorpe
Date: Tue Aug 25 2026 - 07:49:42 EST
On Tue, Aug 25, 2026 at 10:32:07AM +0000, Pranjal Shrivastava wrote:
> On Mon, Aug 24, 2026 at 03:13:21PM -0300, Jason Gunthorpe wrote:
> > > [ ... 52 lines skipped ... ]
> > > +/*
> > > + * Invalidate a DTE by clearing the Valid bit first.
> > > + * Note: Lockless; Not to be used on a fully probed
> > > + * device with live dev_data.
> > > + */
> > > +static void amd_iommu_disable_dte(struct dev_table_entry *ptr)
> > > +{
> > > + struct dev_table_entry new = {};
> > > +
> > > + write_dte_lower128(ptr, &new);
> > > + write_dte_upper128(ptr, &new);
> > > +}
> >
> > No need just call update_dte256() with a 0'd new. This is how all the
> > update flows work, and it flushes the DTE which this looks like it has
> > been missing all long.
>
> I originally considered using update_dte256(), but iommu_disable_device
> is called from the early probe error path (err_deinit).
There is no reason to do that, the DTE isn't written by
amd_iommu_probe_device(), so there is no reason to clear it on an
error path.
It is wrong to write to the DTE table without flushing the
HW cache.
Jason