diff options
Diffstat (limited to 'kernel-5.10')
-rw-r--r-- | kernel-5.10/patches/sys-kernel/gentoo-sources-5.10.37/0001-iommu-vt-d-Fix-kernel-panic-on-boot.patch | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/kernel-5.10/patches/sys-kernel/gentoo-sources-5.10.37/0001-iommu-vt-d-Fix-kernel-panic-on-boot.patch b/kernel-5.10/patches/sys-kernel/gentoo-sources-5.10.37/0001-iommu-vt-d-Fix-kernel-panic-on-boot.patch new file mode 100644 index 0000000..fe1285c --- /dev/null +++ b/kernel-5.10/patches/sys-kernel/gentoo-sources-5.10.37/0001-iommu-vt-d-Fix-kernel-panic-on-boot.patch @@ -0,0 +1,71 @@ +From c2f99461fbdc8412052e526a7c998408543a8d2d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Wolfgang=20M=C3=BCller?= <wolf@oriole.systems> +Date: Mon, 17 May 2021 10:27:49 +0200 +Subject: [PATCH] iommu/vt-d: Fix kernel panic on boot + +The LTS release 5.10.37 would panic immediately on boot with the +following backtrace: + +Call Trace: + domain_mapping+0x16/0x90 + __iommu_map+0xcd/0x120 + iommu_create_device_direct_mappins.isra.0+0x175/0x210 + bus_iommu_probe+0x15a/0x290 + bus_set_iommu+0x7e/0xd0 + intel_iommu_init+0xf84/0x112b + ? e820__memblock_setup+0x76/0x76 + pci_iommu_init+0x11/0x3a + do_one_initcall+0x5a/0x190 + kernel_init_freeable+0x140/0x185 + ? rest_init+0xa4/0xa4 + kernel_init+0x5/0xfc + ret_from_fork+0x22/0x30 +Modules linked in: +CR2: 0000000000000000 +---[ end trace 0904a2a0169baf8a ]-- +RIP: 0010:__domain_mapping+0xa1/0x3a0 + +Commit 416fa531c816 (iommu/vt-d: Preset Access/Dirty bits for IOVA over +FL, 2021-01-15) seemed to have introduced this problem by changing the +conditional: + +if (!sg) { ... + sg_res = nr_pages; + pteval = ((phys_addr_t)phys_pfn << VTD_PAGE_SHIFT) | attr; +} + +to an unconditional: + +pteval = ((phys_addr_t)phys_pfn << VTD_PAGE_SHIFT) | attr; + +Whilst we do not know exactly what went wrong, this patch was proposed +in [1] and then reworked into fixing the original commit in [2]. + +See also [3] for our initial report. + +[1] https://bugzilla.kernel.org/show_bug.cgi?id=213077#c7 +[2] https://lore.kernel.org/lkml/20210517034913.3432-1-baolu.lu@linux.intel.com/ +[3] https://lore.kernel.org/lkml/20210515132855.4bn7ve2ozvdhpnj4@nabokov.fritz.box/ +--- + drivers/iommu/intel/iommu.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c +index db9bf5ac0722..eececdeaa40f 100644 +--- a/drivers/iommu/intel/iommu.c ++++ b/drivers/iommu/intel/iommu.c +@@ -2373,7 +2373,10 @@ static int __domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn, + } + } + +- pteval = ((phys_addr_t)phys_pfn << VTD_PAGE_SHIFT) | attr; ++ if (!sg) { ++ sg_res = nr_pages; ++ pteval = ((phys_addr_t)phys_pfn << VTD_PAGE_SHIFT) | attr; ++ } + + while (nr_pages > 0) { + uint64_t tmp; +-- +2.31.1 + |