]> Gentwo Git Trees - linux/.git/commitdiff
iommupt/x86: Set the dirty bit only for writable PTEs
authorJason Gunthorpe <jgg@nvidia.com>
Thu, 23 Oct 2025 18:22:34 +0000 (15:22 -0300)
committerJoerg Roedel <joerg.roedel@amd.com>
Wed, 5 Nov 2025 08:50:19 +0000 (09:50 +0100)
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 <baolu.lu@linux.intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
drivers/iommu/generic_pt/fmt/x86_64.h

index 18d736d14b2d0d9d83adfc8665d9f129e5a3b448..7d01370e4ab0ba9a121feda4741bf3bb4daabdbb 100644 (file)
@@ -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