* [PATCH 0/1] [PULL REQUEST] iommu/vt-d: Fixes for v6.18-rc1
@ 2025-09-26 2:41 Lu Baolu
2025-09-26 2:41 ` [PATCH 1/1] iommu/vt-d: Disallow dirty tracking if incoherent page walk Lu Baolu
2025-09-26 8:03 ` [PATCH 0/1] [PULL REQUEST] iommu/vt-d: Fixes for v6.18-rc1 Joerg Roedel
0 siblings, 2 replies; 7+ messages in thread
From: Lu Baolu @ 2025-09-26 2:41 UTC (permalink / raw)
To: Joerg Roedel; +Cc: iommu, linux-kernel
Hi Joerg,
The following fix has been queued for the Intel iommu driver. It aims to
solve the following problem:
- Disallow dirty tracking if page walk is incoherent
This fix is not so critical for v6.17-rc. Considering the upcoming merge
window, it would be fine to include them with other patches for v6.18.
Please consider it.
Best regards,
baolu
Lu Baolu (1):
iommu/vt-d: Disallow dirty tracking if incoherent page walk
drivers/iommu/intel/iommu.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--
2.43.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/1] iommu/vt-d: Disallow dirty tracking if incoherent page walk
2025-09-26 2:41 [PATCH 0/1] [PULL REQUEST] iommu/vt-d: Fixes for v6.18-rc1 Lu Baolu
@ 2025-09-26 2:41 ` Lu Baolu
2025-09-26 8:03 ` [PATCH 0/1] [PULL REQUEST] iommu/vt-d: Fixes for v6.18-rc1 Joerg Roedel
1 sibling, 0 replies; 7+ messages in thread
From: Lu Baolu @ 2025-09-26 2:41 UTC (permalink / raw)
To: Joerg Roedel; +Cc: iommu, linux-kernel
Dirty page tracking relies on the IOMMU atomically updating the dirty bit
in the paging-structure entry. For this operation to succeed, the paging-
structure memory must be coherent between the IOMMU and the CPU. In
another word, if the iommu page walk is incoherent, dirty page tracking
doesn't work.
The Intel VT-d specification, Section 3.10 "Snoop Behavior" states:
"Remapping hardware encountering the need to atomically update A/EA/D bits
in a paging-structure entry that is not snooped will result in a non-
recoverable fault."
To prevent an IOMMU from being incorrectly configured for dirty page
tracking when it is operating in an incoherent mode, mark SSADS as
supported only when both ecap_slads and ecap_smpwc are supported.
Fixes: f35f22cc760e ("iommu/vt-d: Access/Dirty bit support for SS domains")
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/20250924083447.123224-1-baolu.lu@linux.intel.com
---
drivers/iommu/intel/iommu.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/intel/iommu.h b/drivers/iommu/intel/iommu.h
index d09b92871659..2c261c069001 100644
--- a/drivers/iommu/intel/iommu.h
+++ b/drivers/iommu/intel/iommu.h
@@ -541,7 +541,8 @@ enum {
#define pasid_supported(iommu) (sm_supported(iommu) && \
ecap_pasid((iommu)->ecap))
#define ssads_supported(iommu) (sm_supported(iommu) && \
- ecap_slads((iommu)->ecap))
+ ecap_slads((iommu)->ecap) && \
+ ecap_smpwc(iommu->ecap))
#define nested_supported(iommu) (sm_supported(iommu) && \
ecap_nest((iommu)->ecap))
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 0/1] [PULL REQUEST] iommu/vt-d: Fixes for v6.18-rc1
2025-09-26 2:41 [PATCH 0/1] [PULL REQUEST] iommu/vt-d: Fixes for v6.18-rc1 Lu Baolu
2025-09-26 2:41 ` [PATCH 1/1] iommu/vt-d: Disallow dirty tracking if incoherent page walk Lu Baolu
@ 2025-09-26 8:03 ` Joerg Roedel
1 sibling, 0 replies; 7+ messages in thread
From: Joerg Roedel @ 2025-09-26 8:03 UTC (permalink / raw)
To: Lu Baolu; +Cc: iommu, linux-kernel
On Fri, Sep 26, 2025 at 10:41:29AM +0800, Lu Baolu wrote:
> Lu Baolu (1):
> iommu/vt-d: Disallow dirty tracking if incoherent page walk
Applied, thanks Baolu.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/1] iommu/vt-d: Disallow dirty tracking if incoherent page walk
@ 2025-09-24 8:34 Lu Baolu
2025-09-24 12:04 ` Jason Gunthorpe
2025-09-26 2:42 ` Baolu Lu
0 siblings, 2 replies; 7+ messages in thread
From: Lu Baolu @ 2025-09-24 8:34 UTC (permalink / raw)
To: Joerg Roedel, Will Deacon, Robin Murphy, Kevin Tian,
Jason Gunthorpe
Cc: iommu, linux-kernel, Lu Baolu
Dirty page tracking relies on the IOMMU atomically updating the dirty bit
in the paging-structure entry. For this operation to succeed, the paging-
structure memory must be coherent between the IOMMU and the CPU. In
another word, if the iommu page walk is incoherent, dirty page tracking
doesn't work.
The Intel VT-d specification, Section 3.10 "Snoop Behavior" states:
"Remapping hardware encountering the need to atomically update A/EA/D bits
in a paging-structure entry that is not snooped will result in a non-
recoverable fault."
To prevent an IOMMU from being incorrectly configured for dirty page
tracking when it is operating in an incoherent mode, mark SSADS as
supported only when both ecap_slads and ecap_smpwc are supported.
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
---
drivers/iommu/intel/iommu.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/intel/iommu.h b/drivers/iommu/intel/iommu.h
index d09b92871659..2c261c069001 100644
--- a/drivers/iommu/intel/iommu.h
+++ b/drivers/iommu/intel/iommu.h
@@ -541,7 +541,8 @@ enum {
#define pasid_supported(iommu) (sm_supported(iommu) && \
ecap_pasid((iommu)->ecap))
#define ssads_supported(iommu) (sm_supported(iommu) && \
- ecap_slads((iommu)->ecap))
+ ecap_slads((iommu)->ecap) && \
+ ecap_smpwc(iommu->ecap))
#define nested_supported(iommu) (sm_supported(iommu) && \
ecap_nest((iommu)->ecap))
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 1/1] iommu/vt-d: Disallow dirty tracking if incoherent page walk
2025-09-24 8:34 [PATCH 1/1] iommu/vt-d: Disallow dirty tracking if incoherent page walk Lu Baolu
@ 2025-09-24 12:04 ` Jason Gunthorpe
2025-09-25 3:01 ` Baolu Lu
2025-09-26 2:42 ` Baolu Lu
1 sibling, 1 reply; 7+ messages in thread
From: Jason Gunthorpe @ 2025-09-24 12:04 UTC (permalink / raw)
To: Lu Baolu
Cc: Joerg Roedel, Will Deacon, Robin Murphy, Kevin Tian, iommu,
linux-kernel
On Wed, Sep 24, 2025 at 04:34:46PM +0800, Lu Baolu wrote:
> Dirty page tracking relies on the IOMMU atomically updating the dirty bit
> in the paging-structure entry. For this operation to succeed, the paging-
> structure memory must be coherent between the IOMMU and the CPU. In
> another word, if the iommu page walk is incoherent, dirty page tracking
> doesn't work.
>
> The Intel VT-d specification, Section 3.10 "Snoop Behavior" states:
>
> "Remapping hardware encountering the need to atomically update A/EA/D bits
> in a paging-structure entry that is not snooped will result in a non-
> recoverable fault."
>
> To prevent an IOMMU from being incorrectly configured for dirty page
> tracking when it is operating in an incoherent mode, mark SSADS as
> supported only when both ecap_slads and ecap_smpwc are supported.
>
> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
> ---
> drivers/iommu/intel/iommu.h | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Basically due to the above spec the IOMMU implementation would be
invalid to set slads and !smpwc ?
Jason
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/1] iommu/vt-d: Disallow dirty tracking if incoherent page walk
2025-09-24 12:04 ` Jason Gunthorpe
@ 2025-09-25 3:01 ` Baolu Lu
0 siblings, 0 replies; 7+ messages in thread
From: Baolu Lu @ 2025-09-25 3:01 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: Joerg Roedel, Will Deacon, Robin Murphy, Kevin Tian, iommu,
linux-kernel
On 9/24/25 20:04, Jason Gunthorpe wrote:
> On Wed, Sep 24, 2025 at 04:34:46PM +0800, Lu Baolu wrote:
>> Dirty page tracking relies on the IOMMU atomically updating the dirty bit
>> in the paging-structure entry. For this operation to succeed, the paging-
>> structure memory must be coherent between the IOMMU and the CPU. In
>> another word, if the iommu page walk is incoherent, dirty page tracking
>> doesn't work.
>>
>> The Intel VT-d specification, Section 3.10 "Snoop Behavior" states:
>>
>> "Remapping hardware encountering the need to atomically update A/EA/D bits
>> in a paging-structure entry that is not snooped will result in a non-
>> recoverable fault."
>>
>> To prevent an IOMMU from being incorrectly configured for dirty page
>> tracking when it is operating in an incoherent mode, mark SSADS as
>> supported only when both ecap_slads and ecap_smpwc are supported.
>>
>> Signed-off-by: Lu Baolu<baolu.lu@linux.intel.com>
>> ---
>> drivers/iommu/intel/iommu.h | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
> Reviewed-by: Jason Gunthorpe<jgg@nvidia.com>
Thank you!
> Basically due to the above spec the IOMMU implementation would be
> invalid to set slads and !smpwc ?
I suppose so.
But even if smpwc is set to 1, software could still configure an
incoherent page walk by clearing the Page Walk Snoop bit in the PASID
entry. (The current Intel IOMMU driver always sets that bit as long as
the capability exists). In that case, the hardware might encounter the
situation mentioned above.
Thanks,
baolu
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/1] iommu/vt-d: Disallow dirty tracking if incoherent page walk
2025-09-24 8:34 [PATCH 1/1] iommu/vt-d: Disallow dirty tracking if incoherent page walk Lu Baolu
2025-09-24 12:04 ` Jason Gunthorpe
@ 2025-09-26 2:42 ` Baolu Lu
1 sibling, 0 replies; 7+ messages in thread
From: Baolu Lu @ 2025-09-26 2:42 UTC (permalink / raw)
To: Joerg Roedel, Will Deacon, Robin Murphy, Kevin Tian,
Jason Gunthorpe
Cc: iommu, linux-kernel
On 9/24/25 16:34, Lu Baolu wrote:
> Dirty page tracking relies on the IOMMU atomically updating the dirty bit
> in the paging-structure entry. For this operation to succeed, the paging-
> structure memory must be coherent between the IOMMU and the CPU. In
> another word, if the iommu page walk is incoherent, dirty page tracking
> doesn't work.
>
> The Intel VT-d specification, Section 3.10 "Snoop Behavior" states:
>
> "Remapping hardware encountering the need to atomically update A/EA/D bits
> in a paging-structure entry that is not snooped will result in a non-
> recoverable fault."
>
> To prevent an IOMMU from being incorrectly configured for dirty page
> tracking when it is operating in an incoherent mode, mark SSADS as
> supported only when both ecap_slads and ecap_smpwc are supported.
>
> Signed-off-by: Lu Baolu<baolu.lu@linux.intel.com>
> ---
> drivers/iommu/intel/iommu.h | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
Queued for v6.18-rc1.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-09-26 8:03 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-26 2:41 [PATCH 0/1] [PULL REQUEST] iommu/vt-d: Fixes for v6.18-rc1 Lu Baolu
2025-09-26 2:41 ` [PATCH 1/1] iommu/vt-d: Disallow dirty tracking if incoherent page walk Lu Baolu
2025-09-26 8:03 ` [PATCH 0/1] [PULL REQUEST] iommu/vt-d: Fixes for v6.18-rc1 Joerg Roedel
-- strict thread matches above, loose matches on Subject: below --
2025-09-24 8:34 [PATCH 1/1] iommu/vt-d: Disallow dirty tracking if incoherent page walk Lu Baolu
2025-09-24 12:04 ` Jason Gunthorpe
2025-09-25 3:01 ` Baolu Lu
2025-09-26 2:42 ` Baolu Lu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox