public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Baolu Lu <baolu.lu@linux.intel.com>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Kevin Tian <kevin.tian@intel.com>,
	iommu@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] iommu/vt-d: Disallow dirty tracking if incoherent page walk
Date: Thu, 25 Sep 2025 11:01:50 +0800	[thread overview]
Message-ID: <515e2b1a-cef8-47be-a89c-de7b73367ff9@linux.intel.com> (raw)
In-Reply-To: <20250924120431.GF2617119@nvidia.com>

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

  reply	other threads:[~2025-09-25  3:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2025-09-26  2:42 ` Baolu Lu
  -- strict thread matches above, loose matches on Subject: below --
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=515e2b1a-cef8-47be-a89c-de7b73367ff9@linux.intel.com \
    --to=baolu.lu@linux.intel.com \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@nvidia.com \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox