Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
1
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
d54d610
Documentation
LICENSES
arch
alpha
arc
arm
arm64
csky
hexagon
loongarch
m68k
microblaze
mips
nios2
openrisc
parisc
powerpc
riscv
s390
sh
sparc
um
x86
boot
compressed
.gitignore
Makefile
acpi.c
cmdline.c
cpuflags.c
early_serial_console.c
efi.c
efi.h
error.c
error.h
head_32.S
head_64.S
ident_map_64.c
idt_64.c
idt_handlers_64.S
kaslr.c
kernel_info.S
la57toggle.S
mem.c
mem_encrypt.S
misc.c
misc.h
mkpiggy.c
pgtable.h
pgtable_64.c
sev.c
sev.h
string.c
tdcall.S
tdx-shared.c
tdx.c
tdx.h
vmlinux.lds.S
.gitignore
Makefile
a20.c
apm.c
bioscall.S
bitops.h
boot.h
cmdline.c
copy.S
cpu.c
cpucheck.c
cpuflags.c
cpuflags.h
ctype.h
early_serial_console.c
edd.c
genimage.sh
header.S
install.sh
io.h
main.c
memory.c
mkcpustr.c
msr.h
mtools.conf.in
pm.c
pmjump.S
printf.c
regs.c
setup.ld
string.c
string.h
tty.c
version.c
vesa.h
video-bios.c
video-mode.c
video-vesa.c
video-vga.c
video.c
video.h
coco
configs
crypto
entry
events
hyperv
ia32
include
kernel
kvm
lib
math-emu
mm
net
pci
platform
power
purgatory
ras
realmode
tools
um
video
virt
xen
.gitignore
Kbuild
Kconfig
Kconfig.assembler
Kconfig.cpu
Kconfig.cpufeatures
Kconfig.debug
Makefile
Makefile.um
Makefile_32.cpu
xtensa
.gitignore
Kconfig
block
certs
crypto
drivers
fs
include
init
io_uring
ipc
kernel
lib
mm
net
rust
samples
scripts
security
sound
tools
usr
virt
.clang-format
.clippy.toml
.cocciconfig
.editorconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
.rustfmt.toml
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
Breadcrumbs
linux
/
arch
/
x86
/
boot
/
compressed
/
mem.c
Blame
Blame
Latest commit
History
History
89 lines (74 loc) · 2.11 KB
Breadcrumbs
linux
/
arch
/
x86
/
boot
/
compressed
/
mem.c
Top
File metadata and controls
Code
Blame
89 lines (74 loc) · 2.11 KB
Raw
// SPDX-License-Identifier: GPL-2.0-only #include "error.h" #include "misc.h" #include "tdx.h" #include "sev.h" #include <asm/shared/tdx.h> /* * accept_memory() and process_unaccepted_memory() called from EFI stub which * runs before decompressor and its early_tdx_detect(). * * Enumerate TDX directly from the early users. */ static bool early_is_tdx_guest(void) { static bool once; static bool is_tdx; if (!IS_ENABLED(CONFIG_INTEL_TDX_GUEST)) return false; if (!once) { u32 eax, sig[3]; cpuid_count(TDX_CPUID_LEAF_ID, 0, &eax, &sig[0], &sig[2], &sig[1]); is_tdx = !memcmp(TDX_IDENT, sig, sizeof(sig)); once = true; } return is_tdx; } void arch_accept_memory(phys_addr_t start, phys_addr_t end) { static bool sevsnp; /* Platform-specific memory-acceptance call goes here */ if (early_is_tdx_guest()) { if (!tdx_accept_memory(start, end)) panic("TDX: Failed to accept memory\n"); } else if (sevsnp || (sev_get_status() & MSR_AMD64_SEV_SNP_ENABLED)) { sevsnp = true; snp_accept_memory(start, end); } else { error("Cannot accept memory: unknown platform\n"); } } bool init_unaccepted_memory(void) { guid_t guid = LINUX_EFI_UNACCEPTED_MEM_TABLE_GUID; struct efi_unaccepted_memory *table; unsigned long cfg_table_pa; unsigned int cfg_table_len; enum efi_type et; int ret; et = efi_get_type(boot_params_ptr); if (et == EFI_TYPE_NONE) return false; ret = efi_get_conf_table(boot_params_ptr, &cfg_table_pa, &cfg_table_len); if (ret) { warn("EFI config table not found."); return false; } table = (void *)efi_find_vendor_table(boot_params_ptr, cfg_table_pa, cfg_table_len, guid); if (!table) return false; if (table->version != 1) error("Unknown version of unaccepted memory table\n"); /* * In many cases unaccepted_table is already set by EFI stub, but it * has to be initialized again to cover cases when the table is not * allocated by EFI stub or EFI stub copied the kernel image with * efi_relocate_kernel() before the variable is set. * * It must be initialized before the first usage of accept_memory(). */ unaccepted_table = table; return true; }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
You can’t perform that action at this time.