From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795694790; b=cMhYRVRQ+jbWrxHizQKX2hwUEk26QpJKsGfDa4HXHgZGrSVHv3et0Z9hzQiAgVNdAh7/ WFT7nStnjNuoK6tjZqfNP9vWaOi5Rwd5T5LDZLiHPJJp1WSpdSCFtvokG52jEPh/E8HQN m10n5nzjK8FOVphXZmjOXDsrpmWnDs6tGb01TPBf3sC2vvH/jRg5oTSAGrhuE/TD/J6Dj bYdcubWNKubm1V3B/cxv3i5bmShjEf3XDUdqwhEH/o00KhdRHflnhNQIzaSAREu11YIUi hJQUm5QecyZtuynFbZsGfy80tnyCHBs2nIZFmZMDNjuX+H/rmFyw2NBp242PrFO4gYQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795694790; h=Received:DKIM-Signature:Received:Received:X-ME-Sender:X-ME-Received: X-ME-Proxy-Cause:X-ME-Proxy:Feedback-ID:Received:Date:From:To:Cc: Subject:Message-ID:References:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; bh=EDJEdQ1TjvzunefynkN28sXQqGJbavrI+88Tql9ZN6s=; b=LZv2GDkc0OMwOQiLt6g87rurHeOvolcFwVJ8r6LhJLhsUnn4BmZQ+j++3OKNR/X3rFV8 cJTRJGnaqfaMprqKSPm192rvl+wen30faVXHpfkEh5AQA8o2zwBvBRYqtF0+mwgOKzJTx +EPG9xEekvMsLbb9t0R5nsAZcN4uxqOHbhSoZM7O6r7xUC+DI+loZDDO+5sfoH9xqdGEs 5SehrJboOC2PWaXYeyQvdSN8PDKLdU+kqnEfpZB681J6zZRUsUqr2veliXA6u07HUfhto Xmh/6FInISnnDSChKrIAwRDQr2Vu5sSs2X+u/XxQHKFxn6rnGuIUsYCTdslbSOMpAuw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Gpp6RsL2; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3D5D1606A31C for ; Thu, 26 Nov 2026 12:06:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Gpp6RsL2 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9AFCD1F000D0; Thu, 26 Nov 2026 12:06:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795694789; bh=EDJEdQ1TjvzunefynkN28sXQqGJbavrI+88Tql9ZN6s=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=Gpp6RsL2X4F80fs3wqAw4S3ABgTbzjJVxPoS2lKJFmUMt5hZkrSDh9GT9ZE2tH0Wi c6NLMHO1Nv6ntV0IP8k2Wn5LsxFnUIOIdEFWqmtc3gO59KgZDvKNebR8cUY5dKGvw8 mqWIEKj+CDX/9qdu4G/LTtggxYhBhVCz14TEe2m5+g8B6ikeJRo7StlBnaQaiyYw5E V3Fd3md2D1HRZEXYYRtJLku/9FW50BESdtj56/dRryCgRQPpig335y8vPsIdpO4t3S obxwqogTiDiuNNxQuZEVGcr8SkzZVL035F+Q32fQOz1jLoTR7SbTGkZtFIju0HXZRZ WmEWDr4BVr8+g== Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfauth.ams.internal (Postfix) with ESMTP id 29F261980074; Thu, 26 Nov 2026 07:06:24 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Thu, 26 Nov 2026 07:06:26 -0500 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTEG867qwPubLmy7FicciVJmTUol3Qz1f7B791QDJNbzIPzz4f9uomLjIqOPfvH7yO NxswOWJs4mi6y+Sp1R6QB1dEk6JMugZGnH7Bk4gHz9v+wM/uHUtphmdKRHj2GLnxfQNldv yADJr+1oORV73XEU0XfbBxYVi2EGODCQWC8QKV9J+LCHJimcLfSkJVMxo6xJPRLGwUECfh 1K4q+WTecykqIdZ09/7sDBJwltqu6nEbu+dBNc3vuT0xlv9d3jjahc5qRXUolaQSTMOMJB p+bRouw6vkuelppkWr6Tn7KnHwPtYDBIIcpk3G+QiV+y0Q3eNRfb8apDO5QVoR2HDzemRp bJxtURZak5+r9R5JFqzDvIx/0Kk9PwEMqCOv+PZXbXzM9AtubbFpNosLUF0PHIFlq39hy8 JhESN84RHMhFqs1xxmm/ubbX/eGmKp/fQcEw65PZbJN5kgw2felAiO/Et8I5JqQOt5S4ZN xtoxsIaM1FIuPeLYep2sQ4v6dAMiEmbuHBhN34wNpYEs9pgUUJBtGOFiNT+zkc2xA87myT /lwkrXcEBvn+hrzf4oYt9sI7HRdHz8Un4AELAQJaBaSfa12qo+YHJSSX5lCq/bPM/HN7Je 0uNJW21s1xGdrA1XZ1Ep/zCgxlRe02m5KcduzGA/9c4z7LlN3diKQeAUI4Aw X-ME-Proxy: Feedback-ID: i10464835:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 26 Nov 2026 07:06:22 -0500 (EST) Date: Thu, 26 Nov 2026 12:06:21 +0000 From: "Kiryl Shutsemau (Meta)" To: Ard Biesheuvel Cc: Ilias Apalodimas , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H . Peter Anvin" , Mike Rapoport , Tom Lendacky , Rick Edgecombe , Pankaj Gupta , linux-efi@vger.kernel.org, linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org, kernel-team@meta.com, stable@vger.kernel.org Subject: Re: [PATCH] x86/efi: Handle EFI_UNACCEPTED_MEMORY in do_add_efi_memmap() Message-ID: References: <20261125173338.1250080-1-kas@kernel.org> <2c075daa-978b-4efc-bb36-736909ec5ff6@app.fastmail.com> X-Mailing-List: linux-coco@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2c075daa-978b-4efc-bb36-736909ec5ff6@app.fastmail.com> On Thu, Nov 26, 2026 at 12:29:30PM +0100, Ard Biesheuvel wrote: > > > On Wed, 25 Nov 2026, at 18:33, Kiryl Shutsemau (Meta) wrote: > > The EFI stub reports unaccepted memory to the kernel as E820 RAM. > > do_add_efi_memmap() has no case for EFI_UNACCEPTED_MEMORY and adds the > > same range again as E820_TYPE_RESERVED. e820__update_table() resolves > > the overlap in favour of the reserved type, so the kernel never uses > > the range. > > > > do_add_efi_memmap() runs when soft reservation is enabled and the > > firmware marks any conventional memory EFI_MEMORY_SP; that takes no > > command-line option. It also runs with the add_efi_memmap boot > > parameter. A TDX or SEV-SNP guest booted either way loses the memory the > > firmware left unaccepted, and it does not show up in MemTotal. > > > > Add unaccepted memory as RAM, as the stub does. Without > > CONFIG_UNACCEPTED_MEMORY the kernel cannot accept it, so keep it > > reserved there. > > > > Fixes: 745e3ed85f71 ("efi/libstub: Implement support for unaccepted memory") > > Reported-by: Mike Rapoport > > Cc: stable@vger.kernel.org > > Signed-off-by: Kiryl Shutsemau (Meta) > > --- > > Build-tested only, with and without CONFIG_UNACCEPTED_MEMORY. > > > > arch/x86/platform/efi/efi.c | 6 ++++++ > > 1 file changed, 6 insertions(+) > > > > Reviewed-by: Ard Biesheuvel > > I can take this via efi/urgent if desired. It is not urgent on my part. It can wait the next merge window, unless someone else needs it now. -- Kiryl Shutsemau / Kirill A. Shutemov