From 1978fac28168bc3e6a66afb9c41ec0f1e8dafa0f Mon Sep 17 00:00:00 2001 From: Jason Gunthorpe Date: Thu, 23 Oct 2025 15:22:34 -0300 Subject: [PATCH] iommupt/x86: Set the dirty bit only for writable PTEs AMD and VTD are historically different here, adopt the VTD version of setting the D bit only on writable PTEs as it makes more sense. Reviewed-by: Lu Baolu Reviewed-by: Kevin Tian Signed-off-by: Jason Gunthorpe Signed-off-by: Joerg Roedel --- drivers/iommu/generic_pt/fmt/x86_64.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/generic_pt/fmt/x86_64.h b/drivers/iommu/generic_pt/fmt/x86_64.h index 18d736d14b2d0..7d01370e4ab0b 100644 --- a/drivers/iommu/generic_pt/fmt/x86_64.h +++ b/drivers/iommu/generic_pt/fmt/x86_64.h @@ -192,9 +192,9 @@ static inline int x86_64_pt_iommu_set_prot(struct pt_common *common, { u64 pte; - pte = X86_64_FMT_U | X86_64_FMT_A | X86_64_FMT_D; + pte = X86_64_FMT_U | X86_64_FMT_A; if (iommu_prot & IOMMU_WRITE) - pte |= X86_64_FMT_RW; + pte |= X86_64_FMT_RW | X86_64_FMT_D; /* * Ideally we'd have an IOMMU_ENCRYPTED flag set by higher levels to -- 2.47.3