summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2021-03-25 10:19:37 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2021-03-25 10:19:37 +0200
commita02b2bc891b2d734d33e6bb11c76e62e34fe886a (patch)
tree59e8f7f9610f96374b373a93c3fd9835c330cd1a
parentUpdate to 5.11.6 (diff)
downloadlinux-ck-a02b2bc891b2d734d33e6bb11c76e62e34fe886a.tar.xz
Update to 5.11.9
-rw-r--r--0002-iommu-amd-Dont-initialise-remapping-irqdomain-if-IOMMU-is-disabled.patch70
-rw-r--r--PKGBUILD7
2 files changed, 75 insertions, 2 deletions
diff --git a/0002-iommu-amd-Dont-initialise-remapping-irqdomain-if-IOMMU-is-disabled.patch b/0002-iommu-amd-Dont-initialise-remapping-irqdomain-if-IOMMU-is-disabled.patch
new file mode 100644
index 0000000..c1cf8b6
--- /dev/null
+++ b/0002-iommu-amd-Dont-initialise-remapping-irqdomain-if-IOMMU-is-disabled.patch
@@ -0,0 +1,70 @@
+From cf3924542f2ddfcb6e33a5af274d08836ca9c27a Mon Sep 17 00:00:00 2001
+From: David Woodhouse <dwmw@amazon.co.uk>
+Date: Mon, 15 Mar 2021 11:15:02 +0000
+Subject: iommu/amd: Don't initialise remapping irqdomain if IOMMU is disabled
+
+When the IOMMU is disabled, the driver still enumerates and initialises
+the hardware in order to turn it off. Because IRQ remapping setup is
+done early, the irqdomain is set up opportunistically.
+
+In commit b34f10c2dc59 ("iommu/amd: Stop irq_remapping_select() matching
+when remapping is disabled") I already make the irq_remapping_select()
+function check the amd_iommu_irq_setup flag because that might get
+cleared only after the irqdomain setup is done, when the IVRS is parsed.
+
+However, in the case where 'amd_iommu=off' is passed on the command line,
+the IRQ remapping setup isn't done but the amd_iommu_irq_setup flag is
+still set by the early IRQ remap init code. Stop it doing that, by
+bailing out of amd_iommu_prepare() early when it's disabled.
+
+This avoids the crash in irq_remapping_select() as it dereferences the
+NULL amd_iommu_rlookup_table[]:
+
+[ 0.243659] Switched APIC routing to physical x2apic.
+[ 0.262206] BUG: kernel NULL pointer dereference, address: 0000000000000500
+[ 0.262927] #PF: supervisor read access in kernel mode
+[ 0.263390] #PF: error_code(0x0000) - not-present page
+[ 0.263844] PGD 0 P4D 0
+[ 0.264135] Oops: 0000 [#1] SMP PTI
+[ 0.264460] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.12.0-rc3 #831
+[ 0.265069] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-1.fc33 04/01/2014
+[ 0.265825] RIP: 0010:irq_remapping_select+0x57/0xb0
+[ 0.266327] Code: 4b 0c 48 3d 30 e0 a7 9e 75 0d eb 35 48 8b 00 48 3d 30 e0 a7 9e 74 2a 0f b6 50 10 39 d1 75 ed 0f b7 40 12 48 8b 15 69 e3 d2 01 <48> 8b 14 c2 48 85 d2 74 0e b8 01 00 00 00 48 3b aa 90 04 00 00 74
+[ 0.268412] RSP: 0000:ffffffff9e803db0 EFLAGS: 00010246
+[ 0.268919] RAX: 00000000000000a0 RBX: ffffffff9e803df8 RCX: 0000000000000000
+[ 0.269550] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff98120112fe79
+[ 0.270245] RBP: ffff9812011c8218 R08: 0000000000000001 R09: 000000000000000a
+[ 0.270922] R10: 000000000000000a R11: f000000000000000 R12: ffff9812011c8218
+[ 0.271549] R13: ffff98120181ed88 R14: 0000000000000000 R15: 0000000000000000
+[ 0.272221] FS: 0000000000000000(0000) GS:ffff98127dc00000(0000) knlGS:0000000000000000
+[ 0.272997] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
+[ 0.273508] CR2: 0000000000000500 CR3: 0000000030810000 CR4: 00000000000006b0
+[ 0.274178] Call Trace:
+[ 0.274416] irq_find_matching_fwspec+0x41/0xc0
+[ 0.274812] mp_irqdomain_create+0x65/0x150
+[ 0.275251] setup_IO_APIC+0x70/0x811
+
+Fixes: a1a785b57242 ("iommu/amd: Implement select() method on remapping irqdomain")
+Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=212017
+Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
+---
+ drivers/iommu/amd/init.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
+index 01da76dc1caa..3ea395ef4929 100644
+--- a/drivers/iommu/amd/init.c
++++ b/drivers/iommu/amd/init.c
+@@ -2997,6 +2997,9 @@ int __init amd_iommu_prepare(void)
+ {
+ int ret;
+
++ if (amd_iommu_disabled)
++ return -ENODEV;
++
+ amd_iommu_irq_remap = true;
+
+ ret = iommu_go_to_state(IOMMU_ACPI_FINISHED);
+--
+cgit v1.2.3-1-gf6bb5
+
diff --git a/PKGBUILD b/PKGBUILD
index 5ef8fe3..974ca3e 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -23,7 +23,7 @@ _custom=1
pkgbase=linux-ck
_supver=5
_majver=11
-_minver=6
+_minver=9
_gccpatchver='20210309'
_gccpatchger='10'
_gccpatchker='5.8'
@@ -51,6 +51,7 @@ source=(
config # the main kernel config file
linux-ck-patch-${_supver}.${_majver}-${_ckpatchversion}.xz::http://ck.kolivas.org/patches/${_supver}.0/${_supver}.${_majver}/${_supver}.${_majver}-${_ckpatchversion}/patch-${_supver}.${_majver}-${_ckpatchversion}.xz
0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch
+ 0002-iommu-amd-Dont-initialise-remapping-irqdomain-if-IOMMU-is-disabled.patch
kernel_gcc_patch-${_gccpatchver}.tar.gz::https://github.com/graysky2/kernel_gcc_patch/archive/${_gccpatchver}.tar.gz
ath9k-regdom-hack.patch
raid6-default-algo.patch
@@ -60,11 +61,12 @@ validpgpkeys=(
'647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman
)
# https://www.kernel.org/pub/linux/kernel/v5.x/sha256sums.asc
-b2sums=('c94885a274c835ce13e109aed4307831a1e57283c2e475dca1fc9c3c0cce97ad599e485b0413dabd182c5d48f9e5e30d071c3f9dcd0d6954e1affe0014279024'
+b2sums=('356efa4629b2d9e9ab6ddcbc832a336e399e3aa20f26490633f0bf90cb9b67b94695035617fbc8b4f0f78f42f1d8fab10198871dfe76cb8fc7a7f5e4f6fcca54'
'SKIP'
'926ec7985fea53a4b95485dd43acc7bb6ac3d5084e47a7866c4c83f8dcab22e73dd7d1ea8a08d13cffa56dc196768e0de3b9153090ffe801d9b6afd13b8ed6ab'
'81d948aef4423255ebb4fa9b12c96207af8d14e225cf95d631dfbb1c0e88d31f60f81c2aff63046a78d8daf2601270ebb1d9cfaeccc3e3fdb08dbc430b53aff5'
'2f9195675270d79d735a3aaec25887c2f80b76eae98be8fcc5fd59ab71d925c5ee20ec5e2a015deb68b61bc2cc7f56f546a22cb96ee038e2e24c2c9dd5c3f79f'
+ '9a00d496c6208bb7a5ffd9b64ef82cf3697ae86113a395be3f508402a99e9a1d46163614059e8e9bb58a66726b79fe5dbbab9ce9274d1508188f61f84ff3078b'
'04351f264bf9ec12b5acdc13546531f38b6fee9f2eca55eb7aec28dbff6a45a5e29a0603d52b4a7dc89ed86e401fb18625ef8d91073ff4732e1d03a135339413'
'b6ef77035611139fa9a6d5b8d30570e2781bb4da483bb569884b0bd0129b62e0b82a5a6776fefe43fee801c70d39de1ea4d4c177f7cedd5ac135e3c64f7b895a'
'fde132f3705d908e6f2147c78a2193289916d72304ca5efa2229d79fc3e57a857314ce94e71425caef2f7f7b6cf87f05ef86335dc8bd4be78e7035afe608005a')
@@ -86,6 +88,7 @@ prepare() {
# Hotfixes
echo "Applying hotfixes"
patch -p1 -i ../0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch
+ patch -p1 -i ../0002-iommu-amd-Dont-initialise-remapping-irqdomain-if-IOMMU-is-disabled.patch
# ck patch