This is a note to let you know that I've just added the patch titled [PATCH 2/2] Revert "iommu/vt-d: Preset Access/Dirty bits for IOVA to the 5.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: revert-iommu-vt-d-preset-access-dirty-bits-for-iova.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 8952a89a415093d1a79140b5c59df2f6b5760966 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Date: Mon, 17 May 2021 11:54:48 +0200 Subject: [PATCH 2/2] Revert "iommu/vt-d: Preset Access/Dirty bits for IOVA over FL" This reverts commit 416fa531c8160151090206a51b829b9218b804d9 which is commit a8ce9ebbecdfda3322bbcece6b3b25888217f8e3 upstream as it was backported incorrectly and is causing problems for some systems. Reported-by: Wolfgang Müller <wolf@oriole.systems> Reported-by: Charles Wright <charles@xxxxxxxxxxxxxxxx> Reported-by: Christoph Biedl <linux-kernel.bfrz@xxxxxxxxxxxxxxxxxx> Cc: Ashok Raj <ashok.raj@xxxxxxxxx> Cc: Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx> Cc: Joerg Roedel <jroedel@xxxxxxx> Cc: Sasha Levin <sashal@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/iommu/intel/iommu.c | 17 +++++------------ include/linux/intel-iommu.h | 2 -- 2 files changed, 5 insertions(+), 14 deletions(-) --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -1028,11 +1028,8 @@ static struct dma_pte *pfn_to_dma_pte(st domain_flush_cache(domain, tmp_page, VTD_PAGE_SIZE); pteval = ((uint64_t)virt_to_dma_pfn(tmp_page) << VTD_PAGE_SHIFT) | DMA_PTE_READ | DMA_PTE_WRITE; - if (domain_use_first_level(domain)) { + if (domain_use_first_level(domain)) pteval |= DMA_FL_PTE_XD | DMA_FL_PTE_US; - if (domain->domain.type == IOMMU_DOMAIN_DMA) - pteval |= DMA_FL_PTE_ACCESS; - } if (cmpxchg64(&pte->val, 0ULL, pteval)) /* Someone else set it while we were thinking; use theirs. */ free_pgtable_page(tmp_page); @@ -2362,18 +2359,14 @@ static int __domain_mapping(struct dmar_ return -EINVAL; attr = prot & (DMA_PTE_READ | DMA_PTE_WRITE | DMA_PTE_SNP); - if (domain_use_first_level(domain)) { + if (domain_use_first_level(domain)) attr |= DMA_FL_PTE_PRESENT | DMA_FL_PTE_XD | DMA_FL_PTE_US; - if (domain->domain.type == IOMMU_DOMAIN_DMA) { - attr |= DMA_FL_PTE_ACCESS; - if (prot & DMA_PTE_WRITE) - attr |= DMA_FL_PTE_DIRTY; - } + if (!sg) { + sg_res = nr_pages; + pteval = ((phys_addr_t)phys_pfn << VTD_PAGE_SHIFT) | attr; } - pteval = ((phys_addr_t)phys_pfn << VTD_PAGE_SHIFT) | attr; - while (nr_pages > 0) { uint64_t tmp; --- a/include/linux/intel-iommu.h +++ b/include/linux/intel-iommu.h @@ -42,8 +42,6 @@ #define DMA_FL_PTE_PRESENT BIT_ULL(0) #define DMA_FL_PTE_US BIT_ULL(2) -#define DMA_FL_PTE_ACCESS BIT_ULL(5) -#define DMA_FL_PTE_DIRTY BIT_ULL(6) #define DMA_FL_PTE_XD BIT_ULL(63) #define ADDR_WIDTH_5LEVEL (57) Patches currently in stable-queue which might be from gregkh@xxxxxxxxxxxxxxxxxxx are queue-5.10/cdc-wdm-untangle-a-circular-dependency-between-callback-and-softint.patch queue-5.10/usb-core-hub-fix-race-condition-about-trsmrcy-of-resume.patch queue-5.10/iommu-vt-d-remove-wo-permissions-on-second-level-paging-entries.patch queue-5.10/kasan-fix-unit-tests-with-config_ubsan_local_bounds-enabled.patch queue-5.10/hfsplus-prevent-corruption-in-shrinking-truncate.patch queue-5.10/powerpc-64s-fix-crashes-when-toggling-stf-barrier.patch queue-5.10/kvm-vmx-disable-preemption-when-probing-user-return-msrs.patch queue-5.10/pm-runtime-fix-unpaired-parent-child_count-for-force_resume.patch queue-5.10/kernel-resource-make-walk_system_ram_res-find-all-bu.patch queue-5.10/cpufreq-intel_pstate-use-hwp-if-enabled-by-platform-firmware.patch queue-5.10/xen-gntdev-fix-gntdev_mmap-error-exit-path.patch queue-5.10/xhci-pci-allow-host-runtime-pm-as-default-for-intel-alder-lake-xhci.patch queue-5.10/usb-dwc3-omap-improve-extcon-initialization.patch queue-5.10/revert-iommu-vt-d-remove-wo-permissions-on-second-level.patch queue-5.10/tpm-fix-error-return-code-in-tpm2_get_cc_attrs_tbl.patch queue-5.10/tpm-tpm_tis-reserve-locality-in-tpm_tis_resume.patch queue-5.10/arc-mm-pae-use-40-bit-physical-page-mask.patch queue-5.10/arm64-mte-initialize-rgsr_el1.seed-in-__cpu_setup.patch queue-5.10/usb-xhci-increase-timeout-for-hc-halt.patch queue-5.10/acpi-pm-add-acpi-id-of-alder-lake-fan.patch queue-5.10/usb-fotg210-hcd-fix-an-error-message.patch queue-5.10/kvm-vmx-do-not-advertise-rdpid-if-enable_rdtscp-control-is-unsupported.patch queue-5.10/squashfs-fix-divide-error-in-calculate_skip.patch queue-5.10/arm64-fix-race-condition-on-pg_dcache_clean-in-__sync_icache_dcache.patch queue-5.10/usb-dwc3-gadget-enable-suspend-events.patch queue-5.10/powerpc-64s-fix-crashes-when-toggling-entry-flush-barrier.patch queue-5.10/usb-dwc3-gadget-free-gadget-structure-only-after-fre.patch queue-5.10/drm-radeon-dpm-disable-sclk-switching-on-oland-when-two-4k-60hz-monitors-are-connected.patch queue-5.10/drm-i915-avoid-div-by-zero-on-gen2.patch queue-5.10/kvm-cap-halt-polling-at-kvm-max_halt_poll_ns.patch queue-5.10/xhci-add-reset-resume-quirk-for-amd-xhci-controller.patch queue-5.10/mm-hugetlb-fix-f_seal_future_write.patch queue-5.10/arc-mm-use-max_high_pfn-as-a-highmem-zone-border.patch queue-5.10/tpm-tpm_tis-extend-locality-handling-to-tpm2-in-tpm_tis_gen_interrupt.patch queue-5.10/usb-dwc2-fix-gadget-dma-unmap-direction.patch queue-5.10/kvm-vmx-invoke-nmi-non-ist-entry-instead-of-ist-entry.patch queue-5.10/iio-tsl2583-fix-division-by-a-zero-lux_val.patch queue-5.10/kernel-resource-make-walk_mem_res-find-all-busy-iore.patch queue-5.10/blk-iocost-fix-weight-updates-of-inner-active-iocgs.patch queue-5.10/kvm-x86-mmu-remove-the-defunct-update_pte-paging-hook.patch queue-5.10/usb-typec-ucsi-retrieve-all-the-pdos-instead-of-just-the-first-4.patch queue-5.10/usb-typec-ucsi-put-fwnode-in-any-case-during-probe.patch queue-5.10/usb-dwc3-pci-enable-usb2-gadget-lpm-disable-for-intel-merrifield.patch queue-5.10/kvm-nvmx-always-make-an-attempt-to-map-evmcs-after-migration.patch queue-5.10/iio-gyro-mpu3050-fix-reported-temperature-value.patch queue-5.10/usb-musb-fix-an-error-message.patch queue-5.10/usb-dwc3-gadget-return-success-always-for-kick-transfer-in-ep-queue.patch queue-5.10/revert-iommu-vt-d-preset-access-dirty-bits-for-iova.patch queue-5.10/kvm-exit-halt-polling-on-need_resched-as-well.patch queue-5.10/btrfs-fix-race-leading-to-unpersisted-data-and-metadata-on-fsync.patch queue-5.10/iommu-vt-d-preset-access-dirty-bits-for-iova-over-fl.patch queue-5.10/xhci-do-not-use-gfp_kernel-in-potentially-atomic-context.patch queue-5.10/drm-amd-display-initialize-attribute-for-hdcp_srm-sysfs-file.patch queue-5.10/kvm-x86-move-rdpid-emulation-intercept-to-its-own-enum.patch queue-5.10/arc-entry-fix-off-by-one-error-in-syscall-number-validation.patch queue-5.10/userfaultfd-release-page-in-error-path-to-avoid-bug_on.patch queue-5.10/keys-trusted-fix-memory-leak-on-object-td.patch queue-5.10/kvm-x86-emulate-rdpid-only-if-rdtscp-is-supported.patch