[PATCH RFC 3/3] x86/e820: Ignore mem= in confidential guests
From: Pankaj Gupta
Date: Tue Nov 24 2026 - 08:33:19 EST
mem= also only edits the E820 table, after the firmware and the EFI stub
have set up the unaccepted memory bitmap. It removes the RAM above the
given limit, but the bitmap bits for it stay set.
accept_memory() accepts whole units, and one more unit when the range ends
on a unit boundary. Memory below the limit can therefore pull in a unit
that is no longer in the E820 table. On SEV-SNP that memory is not mapped
and PVALIDATE faults.
Warn and ignore mem= in confidential guests, for the same reason as
memmap=.
Signed-off-by: Pankaj Gupta <pankaj.gupta@xxxxxxx>
---
arch/x86/kernel/e820.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index 9c206ad4369c..c7b86267a480 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -940,6 +940,9 @@ __init static int parse_memopt(char *p)
#endif
}
+ if (cc_ignore_cmdline_mem("mem"))
+ return 0;
+
userdef = 1;
mem_size = memparse(p, &p);
--
2.34.1