[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260115132322.GE961588@nvidia.com>
Date: Thu, 15 Jan 2026 09:23:22 -0400
From: Jason Gunthorpe <jgg@...dia.com>
To: "Tian, Kevin" <kevin.tian@...el.com>
Cc: Baolu Lu <baolu.lu@...ux.intel.com>, Joerg Roedel <joro@...tes.org>,
Will Deacon <will@...nel.org>, Robin Murphy <robin.murphy@....com>,
Dmytro Maluka <dmaluka@...omium.org>,
Samiullah Khawaja <skhawaja@...gle.com>,
"iommu@...ts.linux.dev" <iommu@...ts.linux.dev>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/3] iommu/vt-d: Use 128-bit atomic updates for context
entries
On Thu, Jan 15, 2026 at 05:59:56AM +0000, Tian, Kevin wrote:
> > From: Baolu Lu <baolu.lu@...ux.intel.com>
> > Sent: Thursday, January 15, 2026 11:27 AM
> >
> > On 1/14/26 15:54, Tian, Kevin wrote:
> > >
> > > Then this may be split into three patches:
> > >
> > > - change context_clear_entry() to be atomic, to fix the teardown path
> > > - add present bit check in other functions in this patch, to scrutinize the
> > > attach path
> > > - change those functions to be atomic, as a clean up
> >
> > Perhaps this also paves the way for enabling hitless replace in the
> > attach_dev path?
> >
>
> I didn't get it. attach/replace are different paths and iommu core will
> reject an attach request for a device which is already attached...
>From a driver perspective there should be no such thing as
repalce. vt-d has gone wrong by having special replace flows inside
itself.
Drivers do attach and should try to make it hitless, that's it.
Meaning drivers do the whole attach sequence in a robust way:
- Manage invalidation lists so that old/new domains continue to
generate invalidations while transitioning
- Updating HW data structures without making them non-present
- Managing ATS enable/disable in the right order
It is alot to think about, but if you follow the ARM sequence it is
all written out there..
So this series should be about the 2nd one, making HW updates go from
something on the stack to something in the HW, and if Balou is going
to use entry_set then use entry_set for *everything* and it will deal
with things like using the 128 bit store or making things non-present
temporarily. Even if the thing has only 128 bits used you may as well
stick with it.
Remember also that the 128 bit store is a CPU optional feature. AMD
investigated and found all their CPUs with IOMMUs have the store
feature so they could use it unconditionally (IIRC they check at
driver probe and fail probe without 128 bit store). VTD needs to do
the same thing, and if 128 bit store is actually sometimes not
available it needs to fall back to the 64 bit entry set, for
eveything.
Jason
Powered by blists - more mailing lists