From aed28d5a22d9163966dd2bea52a01fd534da2d2c Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 1 Mar 2021 12:42:44 +0100 Subject: [PATCH] 4.19-stable patches added patches: media-ipu3-cio2-fix-mbus_code-processing-in-cio2_subdev_set_fmt.patch x86-reboot-force-all-cpus-to-exit-vmx-root-if-vmx-is-supported.patch --- ...de-processing-in-cio2_subdev_set_fmt.patch | 35 ++++++++++ queue-4.19/series | 2 + ...to-exit-vmx-root-if-vmx-is-supported.patch | 70 +++++++++++++++++++ 3 files changed, 107 insertions(+) create mode 100644 queue-4.19/media-ipu3-cio2-fix-mbus_code-processing-in-cio2_subdev_set_fmt.patch create mode 100644 queue-4.19/x86-reboot-force-all-cpus-to-exit-vmx-root-if-vmx-is-supported.patch diff --git a/queue-4.19/media-ipu3-cio2-fix-mbus_code-processing-in-cio2_subdev_set_fmt.patch b/queue-4.19/media-ipu3-cio2-fix-mbus_code-processing-in-cio2_subdev_set_fmt.patch new file mode 100644 index 00000000000..01c66493dbc --- /dev/null +++ b/queue-4.19/media-ipu3-cio2-fix-mbus_code-processing-in-cio2_subdev_set_fmt.patch @@ -0,0 +1,35 @@ +From 334de4b45892f7e67074e1b1b2ac36fd3e091118 Mon Sep 17 00:00:00 2001 +From: Pavel Machek +Date: Wed, 30 Dec 2020 13:55:50 +0100 +Subject: media: ipu3-cio2: Fix mbus_code processing in cio2_subdev_set_fmt() + +From: Pavel Machek + +commit 334de4b45892f7e67074e1b1b2ac36fd3e091118 upstream. + +Loop was useless as it would always exit on the first iteration. Fix +it with right condition. + +Signed-off-by: Pavel Machek (CIP) +Fixes: a86cf9b29e8b ("media: ipu3-cio2: Validate mbus format in setting subdev format") +Tested-by: Laurent Pinchart +Reviewed-by: Laurent Pinchart +Cc: stable@vger.kernel.org # v4.16 and up +Signed-off-by: Sakari Ailus +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Greg Kroah-Hartman +--- + drivers/media/pci/intel/ipu3/ipu3-cio2.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c ++++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c +@@ -1290,7 +1290,7 @@ static int cio2_subdev_set_fmt(struct v4 + fmt->format.code = formats[0].mbus_code; + + for (i = 0; i < ARRAY_SIZE(formats); i++) { +- if (formats[i].mbus_code == fmt->format.code) { ++ if (formats[i].mbus_code == mbus_code) { + fmt->format.code = mbus_code; + break; + } diff --git a/queue-4.19/series b/queue-4.19/series index ba6914eda54..e6e4b826233 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -209,3 +209,5 @@ dts64-mt7622-fix-slow-sd-card-access.patch staging-mt7621-dma-mtk-hsdma.c-hsdma-mt7621.c.patch staging-gdm724x-fix-dma-from-stack.patch staging-rtl8188eu-add-edimax-ew-7811un-v2-to-device-table.patch +media-ipu3-cio2-fix-mbus_code-processing-in-cio2_subdev_set_fmt.patch +x86-reboot-force-all-cpus-to-exit-vmx-root-if-vmx-is-supported.patch diff --git a/queue-4.19/x86-reboot-force-all-cpus-to-exit-vmx-root-if-vmx-is-supported.patch b/queue-4.19/x86-reboot-force-all-cpus-to-exit-vmx-root-if-vmx-is-supported.patch new file mode 100644 index 00000000000..d8f308b513f --- /dev/null +++ b/queue-4.19/x86-reboot-force-all-cpus-to-exit-vmx-root-if-vmx-is-supported.patch @@ -0,0 +1,70 @@ +From ed72736183c45a413a8d6974dd04be90f514cb6b Mon Sep 17 00:00:00 2001 +From: Sean Christopherson +Date: Wed, 30 Dec 2020 16:26:55 -0800 +Subject: x86/reboot: Force all cpus to exit VMX root if VMX is supported + +From: Sean Christopherson + +commit ed72736183c45a413a8d6974dd04be90f514cb6b upstream. + +Force all CPUs to do VMXOFF (via NMI shootdown) during an emergency +reboot if VMX is _supported_, as VMX being off on the current CPU does +not prevent other CPUs from being in VMX root (post-VMXON). This fixes +a bug where a crash/panic reboot could leave other CPUs in VMX root and +prevent them from being woken via INIT-SIPI-SIPI in the new kernel. + +Fixes: d176720d34c7 ("x86: disable VMX on all CPUs on reboot") +Cc: stable@vger.kernel.org +Suggested-by: Sean Christopherson +Signed-off-by: David P. Reed +[sean: reworked changelog and further tweaked comment] +Signed-off-by: Sean Christopherson +Message-Id: <20201231002702.2223707-3-seanjc@google.com> +Signed-off-by: Paolo Bonzini +Signed-off-by: Greg Kroah-Hartman +--- + arch/x86/kernel/reboot.c | 29 ++++++++++------------------- + 1 file changed, 10 insertions(+), 19 deletions(-) + +--- a/arch/x86/kernel/reboot.c ++++ b/arch/x86/kernel/reboot.c +@@ -538,29 +538,20 @@ static void emergency_vmx_disable_all(vo + local_irq_disable(); + + /* +- * We need to disable VMX on all CPUs before rebooting, otherwise +- * we risk hanging up the machine, because the CPU ignore INIT +- * signals when VMX is enabled. ++ * Disable VMX on all CPUs before rebooting, otherwise we risk hanging ++ * the machine, because the CPU blocks INIT when it's in VMX root. + * +- * We can't take any locks and we may be on an inconsistent +- * state, so we use NMIs as IPIs to tell the other CPUs to disable +- * VMX and halt. ++ * We can't take any locks and we may be on an inconsistent state, so ++ * use NMIs as IPIs to tell the other CPUs to exit VMX root and halt. + * +- * For safety, we will avoid running the nmi_shootdown_cpus() +- * stuff unnecessarily, but we don't have a way to check +- * if other CPUs have VMX enabled. So we will call it only if the +- * CPU we are running on has VMX enabled. +- * +- * We will miss cases where VMX is not enabled on all CPUs. This +- * shouldn't do much harm because KVM always enable VMX on all +- * CPUs anyway. But we can miss it on the small window where KVM +- * is still enabling VMX. ++ * Do the NMI shootdown even if VMX if off on _this_ CPU, as that ++ * doesn't prevent a different CPU from being in VMX root operation. + */ +- if (cpu_has_vmx() && cpu_vmx_enabled()) { +- /* Disable VMX on this CPU. */ +- cpu_vmxoff(); ++ if (cpu_has_vmx()) { ++ /* Safely force _this_ CPU out of VMX root operation. */ ++ __cpu_emergency_vmxoff(); + +- /* Halt and disable VMX on the other CPUs */ ++ /* Halt and exit VMX root operation on the other CPUs. */ + nmi_shootdown_cpus(vmxoff_nmi); + + } -- 2.47.3