From: Pankaj Gupta <pankaj.gupta@amd.com>
To: Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>, <x86@kernel.org>
Cc: "H . Peter Anvin" <hpa@zytor.com>,
Tom Lendacky <thomas.lendacky@amd.com>,
Ard Biesheuvel <ardb@kernel.org>,
Kiryl Shutsemau <kas@kernel.org>,
"Ilias Apalodimas" <ilias.apalodimas@linaro.org>,
<linux-kernel@vger.kernel.org>, Mike Rapoport <rppt@kernel.org>,
<linux-mm@kvack.org>, <linux-efi@vger.kernel.org>,
<Pankaj.gupta.linux@gmail.com>,
Pankaj Gupta <pankaj.gupta@amd.com>
Subject: [PATCH RFC 1/3] x86/e820: Ignore memmap= in confidential guests
Date: Tue, 24 Nov 2026 07:32:39 -0600 [thread overview]
Message-ID: <20261124133241.221719-2-pankaj.gupta@amd.com> (raw)
In-Reply-To: <20261124133241.221719-1-pankaj.gupta@amd.com>
In a confidential guest the memory layout, including the EFI unaccepted
memory bitmap, is set up by the firmware and the EFI stub before the
command line is parsed. memmap= only edits the E820 table afterwards, so
the two no longer match.
The bitmap has one bit per unit and a unit cannot be partly accepted. A
memmap= hole that does not start and end on unit boundaries splits a unit.
Accepting that unit touches the hole, which faults early in boot on
SEV-SNP. A kexec kernel gets an E820 table in which the hole is still RAM.
Ard suggested to avoid such command line hacks in confidential VMs, as the
firmware's view of memory should be in sync with the OS [1]. The
discussion of the unaccepted memory fix [2] showed that the bitmap
cannot represent this case.
Warn and ignore memmap= in confidential guests.
[1] https://lore.kernel.org/all/deb5ea81-70bd-463d-8d98-ed51c316cf75@app.fastmail.com/
[2] https://lore.kernel.org/all/20261113105554.199912-1-pankaj.gupta@amd.com/
Suggested-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Pankaj Gupta <pankaj.gupta@amd.com>
---
arch/x86/kernel/e820.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index 0967b485f38b..142657be690d 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -15,6 +15,7 @@
#include <linux/firmware-map.h>
#include <linux/sort.h>
#include <linux/kvm_types.h>
+#include <linux/cc_platform.h>
#include <asm/e820/api.h>
#include <asm/setup.h>
@@ -905,6 +906,15 @@ __init unsigned long e820__end_of_low_ram_pfn(void)
__initdata static int userdef;
+__init static bool cc_ignore_cmdline_mem(const char *opt)
+{
+ if (!cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT))
+ return false;
+
+ pr_warn("%s= is not supported in confidential guests, ignoring\n", opt);
+ return true;
+}
+
/* The "mem=nopentium" boot option disables 4MB page tables on 32-bit kernels: */
__init static int parse_memopt(char *p)
{
@@ -997,6 +1007,9 @@ __init static int parse_memmap_one(char *p)
__init static int parse_memmap_opt(char *str)
{
+ if (cc_ignore_cmdline_mem("memmap"))
+ return 0;
+
while (str) {
char *k = strchr(str, ',');
--
2.34.1
next prev parent reply other threads:[~2026-11-24 13:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 13:32 [PATCH RFC 0/3] x86/e820: Ignore memmap= and mem= in confidential guests Pankaj Gupta
2026-11-24 13:32 ` Pankaj Gupta [this message]
2026-11-24 13:32 ` [PATCH RFC 2/3] x86/e820: Allow memmap= in a kdump kernel " Pankaj Gupta
2026-11-24 13:32 ` [PATCH RFC 3/3] x86/e820: Ignore mem= " Pankaj Gupta
2026-11-24 15:09 ` [PATCH RFC 0/3] x86/e820: Ignore memmap= and " Dave Hansen
2026-11-24 15:56 ` Mike Rapoport
2026-11-24 15:58 ` Dave Hansen
2026-11-24 16:14 ` Mike Rapoport
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261124133241.221719-2-pankaj.gupta@amd.com \
--to=pankaj.gupta@amd.com \
--cc=Pankaj.gupta.linux@gmail.com \
--cc=ardb@kernel.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=ilias.apalodimas@linaro.org \
--cc=kas@kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mingo@redhat.com \
--cc=rppt@kernel.org \
--cc=tglx@kernel.org \
--cc=thomas.lendacky@amd.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox