Re: [PATCH] iommu/vt-d: avoid sending explicit ATS invalidation request to released device

From: Ethan Zhao
Date: Sun Mar 03 2024 - 20:52:31 EST


On 3/2/2024 5:56 AM, Bjorn Helgaas wrote:
On Fri, Mar 01, 2024 at 09:50:36AM +0800, Ethan Zhao wrote:
On 3/1/2024 5:06 AM, Bjorn Helgaas wrote:
On Wed, Feb 28, 2024 at 10:31:38PM -0500, Ethan Zhao wrote:
The introduction of per iommu device rbtree also defines the lifetime of
interoperation between iommu and devices, if the device has been released
from device rbtree, no need to send ATS invalidation request to it anymore,
thus avoid the possibility of later ITE fault to be triggered.

This is part of the followup of prior proposed patchset

https://do-db2.lkml.org/lkml/2024/2/22/350
Please use https://lore.kernel.org/ URLs instead. This one looks like
https://lore.kernel.org/r/20240222090251.2849702-1-haifeng.zhao@xxxxxxxxxxxxxxx/

To make sure all the devTLB entries to be invalidated in the device release
path, do implict invalidation by fapping the E bit of ATS control register.
see PCIe spec v6.2, sec 10.3.7 implicit invalidation events.
s/implict/implicit/

s/fapping/?/ (no idea :) "flipping"? Oh, probably "flapping" per the
comment below. But I think "flapping" is ambiguous; "setting" would be
better)
Yup, like the memory bit flipping, no idea what is the right word,
setting one bit to 0, then 1, then back to 0. perhaps details the
setting action 0-->1-->0 ?
In PCIe spec-speak, "Set" means "assign 1 to this", and "Clear" means
"assign 0 to this".

Maybe you could copy the spec language like this:

Invalidate all ATC entries by changing the E field in the ATS
Capability from Clear to Set, which causes an implicit invalidation
event.

Fair enough.

Thanks,
Ethan


Bjorn