Re: [PATCHv8 00/11] Linear Address Masking enabling
From: Jason Gunthorpe
Date: Fri Sep 23 2022 - 10:42:52 EST
On Fri, Sep 23, 2022 at 07:18:42AM -0700, Dave Hansen wrote:
> On 9/23/22 04:46, Jason Gunthorpe wrote:
> > On Fri, Sep 23, 2022 at 12:38:26PM +0300, Kirill A. Shutemov wrote:
> >>> So I would assume an untagged pointer should just be fine for the IOMMU
> >>> to walk. IOMMU currently wants canonical addresses for VA.
> >> Right. But it means that LAM compatibility can be block on two layers:
> >> IOMMU and device. IOMMU is not the only HW entity that has to be aware of
> >> tagged pointers.
> > Why does a device need to care about this? What do you imagine a
> > device doing with it?
> >
> > The userspace should program the device with the tagged address, the
> > device should present the tagged address on the bus, the IOMMU should
> > translate the tagged address the same as the CPU by ignoring the upper
> > bits.
>
> Is this how *every* access works? Every single device access to the
> address space goes through the IOMMU?
>
> I thought devices also cached address translation responses from the
> IOMMU and stashed them in their own device-local TLB.
Ah, you are worried about invalidation.
There is an optional PCI feature called ATS that is this caching, and
it is mandatory if the IOMMU will use the CPU page table.
In ATS the invalidation is triggered by the iommu driver in a device
agnostic way.
The PCI spec has no provision to invalidate with a mask, only linear
chunks of address space can be invalidated.
Presumably when someone wants to teach the iommu to process LAM they
will also have to teach the the PCI spec how to do LAM too.
I would not like to see a world where drivers have to deal with this.
ATS is completely transparent to the driver, it should stay that
way. Devices should handle LAM through some PCI SIG agnostic approach
and that will be contained entirely in the iommu driver.
Jason