From: Greg Kroah-Hartman Date: Sat, 20 Mar 2021 11:39:50 +0000 (+0100) Subject: 5.11-stable patches X-Git-Tag: v4.4.263~79 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=47d27c50671d83485b11bcf5880fd5beb3efb8ca;p=thirdparty%2Fkernel%2Fstable-queue.git 5.11-stable patches added patches: iommu-amd-don-t-call-early_amd_iommu_init-when-amd-iommu-is-disabled.patch iommu-amd-keep-track-of-amd_iommu_irq_remap-state.patch iommu-amd-move-stoney-ridge-check-to-detect_ivrs.patch --- diff --git a/queue-5.11/iommu-amd-don-t-call-early_amd_iommu_init-when-amd-iommu-is-disabled.patch b/queue-5.11/iommu-amd-don-t-call-early_amd_iommu_init-when-amd-iommu-is-disabled.patch new file mode 100644 index 00000000000..5e5d8e42027 --- /dev/null +++ b/queue-5.11/iommu-amd-don-t-call-early_amd_iommu_init-when-amd-iommu-is-disabled.patch @@ -0,0 +1,42 @@ +From 9f81ca8d1fd68f5697c201f26632ed622e9e462f Mon Sep 17 00:00:00 2001 +From: Joerg Roedel +Date: Wed, 17 Mar 2021 10:10:36 +0100 +Subject: iommu/amd: Don't call early_amd_iommu_init() when AMD IOMMU is disabled + +From: Joerg Roedel + +commit 9f81ca8d1fd68f5697c201f26632ed622e9e462f upstream. + +Don't even try to initialize the AMD IOMMU hardware when amd_iommu=off has been +passed on the kernel command line. + +References: https://bugzilla.kernel.org/show_bug.cgi?id=212133 +References: https://bugzilla.suse.com/show_bug.cgi?id=1183132 +Cc: stable@vger.kernel.org # v5.11 +Signed-off-by: Joerg Roedel +Link: https://lore.kernel.org/r/20210317091037.31374-3-joro@8bytes.org +Acked-by: Huang Rui +Signed-off-by: Greg Kroah-Hartman +--- + drivers/iommu/amd/init.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/drivers/iommu/amd/init.c ++++ b/drivers/iommu/amd/init.c +@@ -2917,12 +2917,12 @@ static int __init state_next(void) + } + break; + case IOMMU_IVRS_DETECTED: +- ret = early_amd_iommu_init(); +- init_state = ret ? IOMMU_INIT_ERROR : IOMMU_ACPI_FINISHED; +- if (init_state == IOMMU_ACPI_FINISHED && amd_iommu_disabled) { +- pr_info("AMD IOMMU disabled\n"); ++ if (amd_iommu_disabled) { + init_state = IOMMU_CMDLINE_DISABLED; + ret = -EINVAL; ++ } else { ++ ret = early_amd_iommu_init(); ++ init_state = ret ? IOMMU_INIT_ERROR : IOMMU_ACPI_FINISHED; + } + break; + case IOMMU_ACPI_FINISHED: diff --git a/queue-5.11/iommu-amd-keep-track-of-amd_iommu_irq_remap-state.patch b/queue-5.11/iommu-amd-keep-track-of-amd_iommu_irq_remap-state.patch new file mode 100644 index 00000000000..c89d20c0edd --- /dev/null +++ b/queue-5.11/iommu-amd-keep-track-of-amd_iommu_irq_remap-state.patch @@ -0,0 +1,40 @@ +From 4b8ef157ca832f812b3302b1800548bd92c207de Mon Sep 17 00:00:00 2001 +From: Joerg Roedel +Date: Wed, 17 Mar 2021 10:10:37 +0100 +Subject: iommu/amd: Keep track of amd_iommu_irq_remap state + +From: Joerg Roedel + +commit 4b8ef157ca832f812b3302b1800548bd92c207de upstream. + +The amd_iommu_irq_remap variable is set to true in amd_iommu_prepare(). +But if initialization fails it is not set to false. Fix that and +correctly keep track of whether irq remapping is enabled or not. + +References: https://bugzilla.kernel.org/show_bug.cgi?id=212133 +References: https://bugzilla.suse.com/show_bug.cgi?id=1183132 +Fixes: b34f10c2dc59 ("iommu/amd: Stop irq_remapping_select() matching when remapping is disabled") +Cc: stable@vger.kernel.org # v5.11 +Signed-off-by: Joerg Roedel +Link: https://lore.kernel.org/r/20210317091037.31374-4-joro@8bytes.org +Acked-by: Huang Rui +Signed-off-by: Greg Kroah-Hartman +--- + drivers/iommu/amd/init.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/drivers/iommu/amd/init.c ++++ b/drivers/iommu/amd/init.c +@@ -3000,8 +3000,11 @@ int __init amd_iommu_prepare(void) + amd_iommu_irq_remap = true; + + ret = iommu_go_to_state(IOMMU_ACPI_FINISHED); +- if (ret) ++ if (ret) { ++ amd_iommu_irq_remap = false; + return ret; ++ } ++ + return amd_iommu_irq_remap ? 0 : -ENODEV; + } + diff --git a/queue-5.11/iommu-amd-move-stoney-ridge-check-to-detect_ivrs.patch b/queue-5.11/iommu-amd-move-stoney-ridge-check-to-detect_ivrs.patch new file mode 100644 index 00000000000..995b7d4ccb9 --- /dev/null +++ b/queue-5.11/iommu-amd-move-stoney-ridge-check-to-detect_ivrs.patch @@ -0,0 +1,76 @@ +From 072a03e0a0b1bc22eb5970727877264657c61fd3 Mon Sep 17 00:00:00 2001 +From: Joerg Roedel +Date: Wed, 17 Mar 2021 10:10:35 +0100 +Subject: iommu/amd: Move Stoney Ridge check to detect_ivrs() + +From: Joerg Roedel + +commit 072a03e0a0b1bc22eb5970727877264657c61fd3 upstream. + +The AMD IOMMU will not be enabled on AMD Stoney Ridge systems. Bail +out even earlier and refuse to even detect the IOMMU there. + +References: https://bugzilla.kernel.org/show_bug.cgi?id=212133 +References: https://bugzilla.suse.com/show_bug.cgi?id=1183132 +Cc: stable@vger.kernel.org # v5.11 +Signed-off-by: Joerg Roedel +Link: https://lore.kernel.org/r/20210317091037.31374-2-joro@8bytes.org +Acked-by: Huang Rui +Signed-off-by: Greg Kroah-Hartman +--- + drivers/iommu/amd/init.c | 23 ++++++++++++----------- + 1 file changed, 12 insertions(+), 11 deletions(-) + +--- a/drivers/iommu/amd/init.c ++++ b/drivers/iommu/amd/init.c +@@ -2712,7 +2712,6 @@ static int __init early_amd_iommu_init(v + struct acpi_table_header *ivrs_base; + acpi_status status; + int i, remap_cache_sz, ret = 0; +- u32 pci_id; + + if (!amd_iommu_detected) + return -ENODEV; +@@ -2802,16 +2801,6 @@ static int __init early_amd_iommu_init(v + if (ret) + goto out; + +- /* Disable IOMMU if there's Stoney Ridge graphics */ +- for (i = 0; i < 32; i++) { +- pci_id = read_pci_config(0, i, 0, 0); +- if ((pci_id & 0xffff) == 0x1002 && (pci_id >> 16) == 0x98e4) { +- pr_info("Disable IOMMU on Stoney Ridge\n"); +- amd_iommu_disabled = true; +- break; +- } +- } +- + /* Disable any previously enabled IOMMUs */ + if (!is_kdump_kernel() || amd_iommu_disabled) + disable_iommus(); +@@ -2879,6 +2868,7 @@ static bool detect_ivrs(void) + { + struct acpi_table_header *ivrs_base; + acpi_status status; ++ int i; + + status = acpi_get_table("IVRS", 0, &ivrs_base); + if (status == AE_NOT_FOUND) +@@ -2891,6 +2881,17 @@ static bool detect_ivrs(void) + + acpi_put_table(ivrs_base); + ++ /* Don't use IOMMU if there is Stoney Ridge graphics */ ++ for (i = 0; i < 32; i++) { ++ u32 pci_id; ++ ++ pci_id = read_pci_config(0, i, 0, 0); ++ if ((pci_id & 0xffff) == 0x1002 && (pci_id >> 16) == 0x98e4) { ++ pr_info("Disable IOMMU on Stoney Ridge\n"); ++ return false; ++ } ++ } ++ + /* Make sure ACS will be enabled during PCI probe */ + pci_request_acs(); + diff --git a/queue-5.11/series b/queue-5.11/series index 09648516e00..fce24db276f 100644 --- a/queue-5.11/series +++ b/queue-5.11/series @@ -23,3 +23,6 @@ vhost-vdpa-set-v-config_ctx-to-null-if-eventfd_ctx_fdget-fails.patch drm-amd-display-copy-over-soc-values-before-bounding-box-creation.patch drm-amd-display-correct-algorithm-for-reversed-gamma.patch drm-amd-display-remove-mpc-gamut-remap-logic-for-dcn30.patch +iommu-amd-don-t-call-early_amd_iommu_init-when-amd-iommu-is-disabled.patch +iommu-amd-keep-track-of-amd_iommu_irq_remap-state.patch +iommu-amd-move-stoney-ridge-check-to-detect_ivrs.patch