Merge tag 'zonefs-6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal...
[sfrench/cifs-2.6.git] / arch / x86 / mm / mem_encrypt.c
index c290c55b632bd76e99385831c45748b7c7ada891..6f3b3e028718556667c1d86e8f56442eafc78dcc 100644 (file)
@@ -14,6 +14,8 @@
 #include <linux/mem_encrypt.h>
 #include <linux/virtio_anchor.h>
 
+#include <asm/sev.h>
+
 /* Override for DMA direct allocation check - ARCH_HAS_FORCE_DMA_UNENCRYPTED */
 bool force_dma_unencrypted(struct device *dev)
 {
@@ -42,38 +44,45 @@ bool force_dma_unencrypted(struct device *dev)
 
 static void print_mem_encrypt_feature_info(void)
 {
-       pr_info("Memory Encryption Features active:");
-
-       if (cpu_feature_enabled(X86_FEATURE_TDX_GUEST)) {
-               pr_cont(" Intel TDX\n");
-               return;
-       }
+       pr_info("Memory Encryption Features active: ");
 
-       pr_cont(" AMD");
+       switch (cc_vendor) {
+       case CC_VENDOR_INTEL:
+               pr_cont("Intel TDX\n");
+               break;
+       case CC_VENDOR_AMD:
+               pr_cont("AMD");
 
-       /* Secure Memory Encryption */
-       if (cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT)) {
+               /* Secure Memory Encryption */
+               if (cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT)) {
                /*
                 * SME is mutually exclusive with any of the SEV
                 * features below.
-                */
-               pr_cont(" SME\n");
-               return;
-       }
+               */
+                       pr_cont(" SME\n");
+                       return;
+               }
 
-       /* Secure Encrypted Virtualization */
-       if (cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT))
-               pr_cont(" SEV");
+               /* Secure Encrypted Virtualization */
+               if (cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT))
+                       pr_cont(" SEV");
+
+               /* Encrypted Register State */
+               if (cc_platform_has(CC_ATTR_GUEST_STATE_ENCRYPT))
+                       pr_cont(" SEV-ES");
 
-       /* Encrypted Register State */
-       if (cc_platform_has(CC_ATTR_GUEST_STATE_ENCRYPT))
-               pr_cont(" SEV-ES");
+               /* Secure Nested Paging */
+               if (cc_platform_has(CC_ATTR_GUEST_SEV_SNP))
+                       pr_cont(" SEV-SNP");
 
-       /* Secure Nested Paging */
-       if (cc_platform_has(CC_ATTR_GUEST_SEV_SNP))
-               pr_cont(" SEV-SNP");
+               pr_cont("\n");
 
-       pr_cont("\n");
+               sev_show_status();
+
+               break;
+       default:
+               pr_cont("Unknown\n");
+       }
 }
 
 /* Architecture __weak replacement functions */