Merge tag 'x86_sev_for_v6.9_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 12 Mar 2024 00:44:11 +0000 (17:44 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 12 Mar 2024 00:44:11 +0000 (17:44 -0700)
Pull x86 SEV updates from Borislav Petkov:

 - Add the x86 part of the SEV-SNP host support.

   This will allow the kernel to be used as a KVM hypervisor capable of
   running SNP (Secure Nested Paging) guests. Roughly speaking, SEV-SNP
   is the ultimate goal of the AMD confidential computing side,
   providing the most comprehensive confidential computing environment
   up to date.

   This is the x86 part and there is a KVM part which did not get ready
   in time for the merge window so latter will be forthcoming in the
   next cycle.

 - Rework the early code's position-dependent SEV variable references in
   order to allow building the kernel with clang and -fPIE/-fPIC and
   -mcmodel=kernel

 - The usual set of fixes, cleanups and improvements all over the place

* tag 'x86_sev_for_v6.9_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (36 commits)
  x86/sev: Disable KMSAN for memory encryption TUs
  x86/sev: Dump SEV_STATUS
  crypto: ccp - Have it depend on AMD_IOMMU
  iommu/amd: Fix failure return from snp_lookup_rmpentry()
  x86/sev: Fix position dependent variable references in startup code
  crypto: ccp: Make snp_range_list static
  x86/Kconfig: Remove CONFIG_AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT
  Documentation: virt: Fix up pre-formatted text block for SEV ioctls
  crypto: ccp: Add the SNP_SET_CONFIG command
  crypto: ccp: Add the SNP_COMMIT command
  crypto: ccp: Add the SNP_PLATFORM_STATUS command
  x86/cpufeatures: Enable/unmask SEV-SNP CPU feature
  KVM: SEV: Make AVIC backing, VMSA and VMCB memory allocation SNP safe
  crypto: ccp: Add panic notifier for SEV/SNP firmware shutdown on kdump
  iommu/amd: Clean up RMP entries for IOMMU pages during SNP shutdown
  crypto: ccp: Handle legacy SEV commands when SNP is enabled
  crypto: ccp: Handle non-volatile INIT_EX data when SNP is enabled
  crypto: ccp: Handle the legacy TMR allocation when SNP is enabled
  x86/sev: Introduce an SNP leaked pages list
  crypto: ccp: Provide an API to issue SEV and SNP commands
  ...

14 files changed:
1  2 
Documentation/admin-guide/kernel-parameters.txt
arch/x86/Kconfig
arch/x86/include/asm/coco.h
arch/x86/include/asm/cpufeatures.h
arch/x86/include/asm/disabled-features.h
arch/x86/include/asm/kvm_host.h
arch/x86/include/asm/msr-index.h
arch/x86/kernel/Makefile
arch/x86/kernel/cpu/amd.c
arch/x86/kernel/cpu/common.c
arch/x86/kvm/svm/sev.c
arch/x86/mm/fault.c
drivers/crypto/ccp/sev-dev.c
tools/arch/x86/include/asm/cpufeatures.h

Simple merge
index 76c310b19b11d898db11cf498d7c82449bbf7dc2,21940ef8d2904baaf388228bc39c0fe1ae1b4ded..fb7388bbc212f9b1435b47206ae586cf84505846
@@@ -10,9 -11,15 +11,15 @@@ enum cc_vendor 
        CC_VENDOR_INTEL,
  };
  
 +#ifdef CONFIG_ARCH_HAS_CC_PLATFORM
  extern enum cc_vendor cc_vendor;
- void cc_set_mask(u64 mask);
+ extern u64 cc_mask;
 -#ifdef CONFIG_ARCH_HAS_CC_PLATFORM
+ static inline void cc_set_mask(u64 mask)
+ {
+       RIP_REL_REF(cc_mask) = mask;
+ }
  u64 cc_mkenc(u64 val);
  u64 cc_mkdec(u64 val);
  #else
Simple merge
index f40b29d3abad780bf42c312987e7b4f9b772885c,3332d2940020615229f2dd54863705af58a48c6d..d73fea9c3bf11ede7b438b955b557e1d0d4bafbb
  #define DISABLE_IBT   (1 << (X86_FEATURE_IBT & 31))
  #endif
  
 +#ifdef CONFIG_X86_FRED
 +# define DISABLE_FRED 0
 +#else
 +# define DISABLE_FRED (1 << (X86_FEATURE_FRED & 31))
 +#endif
 +
+ #ifdef CONFIG_KVM_AMD_SEV
+ #define DISABLE_SEV_SNP               0
+ #else
+ #define DISABLE_SEV_SNP               (1 << (X86_FEATURE_SEV_SNP & 31))
+ #endif
  /*
   * Make sure to add features to the correct mask
   */
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index e1ac863964460446ad1f90875f7d10bb6e09e521,859adcd123c9c89214fb180540b1eceb53751127..cdb5045a04285286c0b8c1f761dc6dc8927afdd3
@@@ -34,7 -34,7 +34,8 @@@
  #include <asm/kvm_para.h>             /* kvm_handle_async_pf          */
  #include <asm/vdso.h>                 /* fixup_vdso_exception()       */
  #include <asm/irq_stack.h>
 +#include <asm/fred.h>
+ #include <asm/sev.h>                  /* snp_dump_hva_rmpentry()      */
  
  #define CREATE_TRACE_POINTS
  #include <asm/trace/exceptions.h>
Simple merge