Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
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 0/3] x86/e820: Ignore memmap= and mem= in confidential guests
Date: Tue, 24 Nov 2026 07:32:38 -0600	[thread overview]
Message-ID: <20261124133241.221719-1-pankaj.gupta@amd.com> (raw)

In a confidential guest (SEV-SNP, TDX) the EFI stub builds the unaccepted
memory bitmap before the command line is parsed. memmap= and mem= edit
e820_table only afterwards.

accept_memory() accepts whole 2 MiB units. A memmap= hole that is not
unit-aligned is touched when its unit is accepted. On SEV-SNP this faults
early in boot and crashes the guest (e.g. memmap=1M$0x1ffe00000), because
PVALIDATE needs the page mapped and the hole is not. TDX works on
physical addresses, so the hole is accepted and the options work there
today. The same option therefore behaves differently per vendor.

This replaces my earlier fix [1][2], following review feedback from Ard
Biesheuvel and Kiryl Shutsemau: the firmware's view of memory must match
the OS, and a bitmap unit cannot be half accepted. Instead of making the
bitmap follow memmap= and mem=, ignore them in confidential guests.

Patch 1 warns and ignores memmap= in confidential guests.
Patch 2 keeps memmap= in a kdump kernel (elfcorehdr= on the command
        line), as ignoring it would let the kdump kernel use the memory
        of the crashed kernel.
Patch 3 does the same for mem=.

[1] https://lore.kernel.org/all/20261102113127.161823-1-pankaj.gupta@amd.com/
[2] https://lore.kernel.org/all/20261113105554.199912-1-pankaj.gupta@amd.com/

Pankaj Gupta (3):
  x86/e820: Ignore memmap= in confidential guests
  x86/e820: Allow memmap= in a kdump kernel in confidential guests
  x86/e820: Ignore mem= in confidential guests

 arch/x86/kernel/e820.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

-- 
2.34.1



             reply	other threads:[~2026-11-24 13:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 13:32 Pankaj Gupta [this message]
2026-11-24 13:32 ` [PATCH RFC 1/3] x86/e820: Ignore memmap= in confidential guests Pankaj Gupta
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
2026-11-24 16:26         ` Ard Biesheuvel

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-1-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