Commit 12643565 authored by hanliyang's avatar hanliyang
Browse files

x86/mm: Print CSV info into the kernel log

hygon inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I98NP1


CVE: NA

---------------------------

Add CSV and CSV2 to the list of memory encryption features. Also
print CPU vendor while printing CSV infos.

Signed-off-by: default avatarhanliyang <hanliyang@hygon.cn>
parent 4ecb66b3
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -114,6 +114,12 @@ void add_encrypt_protection_map(void);

extern char __start_bss_decrypted[], __end_bss_decrypted[], __start_bss_decrypted_unused[];

#ifdef CONFIG_HYGON_CSV
extern void print_hygon_cc_feature_info(void);
#else	/* !CONFIG_HYGON_CSV */
static inline void print_hygon_cc_feature_info(void) { }
#endif	/* CONFIG_HYGON_CSV */

#endif	/* __ASSEMBLY__ */

#endif	/* __X86_MEM_ENCRYPT_H__ */
+7 −0
Original line number Diff line number Diff line
@@ -13,6 +13,8 @@
#include <linux/cc_platform.h>
#include <linux/mem_encrypt.h>

#include <asm/processor-hygon.h>

/* Override for DMA direct allocation check - ARCH_HAS_FORCE_DMA_UNENCRYPTED */
bool force_dma_unencrypted(struct device *dev)
{
@@ -48,6 +50,11 @@ static void print_mem_encrypt_feature_info(void)
		return;
	}

	if (is_x86_vendor_hygon()) {
		print_hygon_cc_feature_info();
		return;
	}

	pr_cont(" AMD");

	/* Secure Memory Encryption */
+23 −0
Original line number Diff line number Diff line
@@ -14,3 +14,26 @@
#define DISABLE_BRANCH_PROFILING

#include <linux/cc_platform.h>
#include <linux/mem_encrypt.h>
#include <linux/printk.h>

void print_hygon_cc_feature_info(void)
{
	/* Secure Memory Encryption */
	if (cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT)) {
		/*
		 * HYGON SME is mutually exclusive with any of the
		 * HYGON CSV features below.
		 */
		pr_info(" HYGON SME");
		return;
	}

	/* Secure Encrypted Virtualization */
	if (cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT))
		pr_info(" HYGON CSV");

	/* Encrypted Register State */
	if (cc_platform_has(CC_ATTR_GUEST_STATE_ENCRYPT))
		pr_info(" HYGON CSV2");
}