xref: /linux/arch/x86/include/asm/unaccepted_memory.h (revision 34dc1baba215b826e454b8d19e4f24adbeb7d00d)
1 #ifndef _ASM_X86_UNACCEPTED_MEMORY_H
2 #define _ASM_X86_UNACCEPTED_MEMORY_H
3 
4 #include <linux/efi.h>
5 #include <asm/tdx.h>
6 #include <asm/sev.h>
7 
8 static inline void arch_accept_memory(phys_addr_t start, phys_addr_t end)
9 {
10 	/* Platform-specific memory-acceptance call goes here */
11 	if (cpu_feature_enabled(X86_FEATURE_TDX_GUEST)) {
12 		if (!tdx_accept_memory(start, end))
13 			panic("TDX: Failed to accept memory\n");
14 	} else if (cc_platform_has(CC_ATTR_GUEST_SEV_SNP)) {
15 		snp_accept_memory(start, end);
16 	} else {
17 		panic("Cannot accept memory: unknown platform\n");
18 	}
19 }
20 
21 static inline struct efi_unaccepted_memory *efi_get_unaccepted_table(void)
22 {
23 	if (efi.unaccepted == EFI_INVALID_TABLE_ADDR)
24 		return NULL;
25 	return __va(efi.unaccepted);
26 }
27 #endif
28