logo

live-bootstrap

Mirror of <https://github.com/fosslinux/live-bootstrap>

ddfd117714014cebe7b5d008fdec8eaec620cba1.patch (2435B)


  1. SPDX-FileCopyrightText: 2022 Sean Christopherson <seanjc@google.com>
  2. SPDX-License-Identifier: GPL-2.0-only
  3. Revert the following patch:
  4. From ddfd117714014cebe7b5d008fdec8eaec620cba1 Mon Sep 17 00:00:00 2001
  5. From: Sean Christopherson <seanjc@google.com>
  6. Date: Wed, 30 Nov 2022 23:36:48 +0000
  7. Subject: [PATCH] x86/virt: Force GIF=1 prior to disabling SVM (for reboot
  8. flows)
  9. commit 6a3236580b0b1accc3976345e723104f74f6f8e6 upstream.
  10. Set GIF=1 prior to disabling SVM to ensure that INIT is recognized if the
  11. kernel is disabling SVM in an emergency, e.g. if the kernel is about to
  12. jump into a crash kernel or may reboot without doing a full CPU RESET.
  13. If GIF is left cleared, the new kernel (or firmware) will be unabled to
  14. awaken APs. Eat faults on STGI (due to EFER.SVME=0) as it's possible
  15. that SVM could be disabled via NMI shootdown between reading EFER.SVME
  16. and executing STGI.
  17. Link: https://lore.kernel.org/all/cbcb6f35-e5d7-c1c9-4db9-fe5cc4de579a@amd.com
  18. Cc: stable@vger.kernel.org
  19. Cc: Andrew Cooper <Andrew.Cooper3@citrix.com>
  20. Cc: Tom Lendacky <thomas.lendacky@amd.com>
  21. Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
  22. Link: https://lore.kernel.org/r/20221130233650.1404148-3-seanjc@google.com
  23. Signed-off-by: Sean Christopherson <seanjc@google.com>
  24. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  25. ---
  26. arch/x86/include/asm/virtext.h | 16 +++++++++++++++-
  27. 1 file changed, 15 insertions(+), 1 deletion(-)
  28. diff --git a/arch/x86/include/asm/virtext.h b/arch/x86/include/asm/virtext.h
  29. index 0116b2ee9e64f..4699acd602af4 100644
  30. --- linux-4.14.336/arch/x86/include/asm/virtext.h
  31. +++ linux-4.14.336/arch/x86/include/asm/virtext.h
  32. @@ -114,21 +114,7 @@ static inline void cpu_svm_disable(void)
  33. wrmsrl(MSR_VM_HSAVE_PA, 0);
  34. rdmsrl(MSR_EFER, efer);
  35. - if (efer & EFER_SVME) {
  36. - /*
  37. - * Force GIF=1 prior to disabling SVM to ensure INIT and NMI
  38. - * aren't blocked, e.g. if a fatal error occurred between CLGI
  39. - * and STGI. Note, STGI may #UD if SVM is disabled from NMI
  40. - * context between reading EFER and executing STGI. In that
  41. - * case, GIF must already be set, otherwise the NMI would have
  42. - * been blocked, so just eat the fault.
  43. - */
  44. - asm_volatile_goto("1: stgi\n\t"
  45. - _ASM_EXTABLE(1b, %l[fault])
  46. - ::: "memory" : fault);
  47. -fault:
  48. - wrmsrl(MSR_EFER, efer & ~EFER_SVME);
  49. - }
  50. + wrmsrl(MSR_EFER, efer & ~EFER_SVME);
  51. }
  52. /** Makes sure SVM is disabled, if it is supported on the CPU