Message ID | 20240213124143.1484862-20-ardb+git@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-63528-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp507689dyb; Tue, 13 Feb 2024 04:44:38 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW1dji8ZhNwlGnHpZsULfwxaW0wEBYL/zjs3hQqrvnQuqATQzuOUL3zAX0udTXZbQvQDJeNKz9sAFHcn20APRH48qeY1Q== X-Google-Smtp-Source: AGHT+IFc3g24UiTN+pUsv+EBi199OJhO9d5JUKZeeFwJRk/Prvg5r0VTuWomvUCN/WUkXMQbqwFc X-Received: by 2002:aa7:c890:0:b0:560:5c58:dfc4 with SMTP id p16-20020aa7c890000000b005605c58dfc4mr6849038eds.1.1707828278236; Tue, 13 Feb 2024 04:44:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707828278; cv=pass; d=google.com; s=arc-20160816; b=wbd4HXDF6osu2P8d4AcIHqzQyIx6IA2EX5HqgWDc4v98sNZjXQA9uBeIy4B5+RRYg+ 27gfkVckqWx+AginlYOqRofXRfb4BXo14xMbAAI3FKunhnsDoN9lyDDwLptKOdvy2lVQ 7GP0acqyzIEQSkXkdKJV7zIljpVL1vZRz0zLbWWeZmEY9AzlFDjHqHR5PGsMU0Ug+EAW KtzekOb2gJC0RL9KwXd+YUJKPfWfK+0nhgIZGN2NIP+bqCEjecL/hMDqljKA5kCxl5cX CzbZwFTueoACaj06cIF3A0pd/8HwA7oGuf6QxcmxL/7yb8IeGxNRbiZiXau1CWaxNiWB ynoQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=tmJq7yGJtig/x243U4iqbWlHcuxPy6IsUUTLst4tAO8=; fh=QW7hIY1X2EJnS71asFIGzt0qltcBJKclWfhAKj8y0M4=; b=R1HEvFCMcv5F8wyZRoVI6Xh2/BimzUlldgA4juBVBwzP8ox4YCnPwYh7WVmmTO2xzq ix0ZijqHidym0LVZPmh8XZR3U6wwvYnZqJS+l9QdCaNibfeY6fmFyCtbls+gpgqn6UAV yyQLRxwbpnY6CJBDuWbOwV8uCSrf6IzbgKxAiDieSIYvO9ZvX2o2SG8wXmz7KcjSMwNR vXRSfz0nJAagLdJbuzXd/ZgWu2f5AZa5Funepo7BbqzuXFZzIXplqza+q4i+TDQeHciR If9124+M1QN9RD4ALY6I9TA12/9RSDEiHZZUvoQBMPVCzOorkYCw6s+1VeS/Q5+IQhD1 jEPw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=OBtFeaYy; arc=pass (i=1 spf=pass spfdomain=flex--ardb.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-63528-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63528-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Forwarded-Encrypted: i=2; AJvYcCWtOICW17RGgomJp93ZBFIm26xriiORVQEg4DD0bTZjA05UnlU1v2TfdUEO/LYxMTNKnn7qHYKuzHzJ0Hn6Glgfk5p4iA== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id e5-20020a50fb85000000b0055f43795b28si3807911edq.196.2024.02.13.04.44.38 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 04:44:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63528-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=OBtFeaYy; arc=pass (i=1 spf=pass spfdomain=flex--ardb.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-63528-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63528-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id A3C371F26292 for <ouuuleilei@gmail.com>; Tue, 13 Feb 2024 12:44:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E3BCB5465B; Tue, 13 Feb 2024 12:42:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="OBtFeaYy" Received: from mail-wr1-f73.google.com (mail-wr1-f73.google.com [209.85.221.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4D94253395 for <linux-kernel@vger.kernel.org>; Tue, 13 Feb 2024 12:42:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707828140; cv=none; b=Ctysf7dIAVoHcsBNaslDqlT0BImhtuLp4Wkq7adQD0Wrpr82Ts0N7H0bxGqQp4MaluLvwZxazqaSQA3HDMb6iHzqMVlFhgcc5wKIFNsJ4IvppfAqbrGnPr3/svoCs9ys6JGh/YoKjvG+a1NhvNPCEZ3I6DC3M/uYm349GW31r8o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707828140; c=relaxed/simple; bh=CEh5RLJcC6IgrEQHXZSi19euYte1lfU4DaXYg20d8/k=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=cx3hk2vO2qifpWbfKFsiuZwB2L8LPqCWpwWeZCCgMIOxt5I4G1w2YdFIbC8ptbcbIxQVUA4Ahhhhf7kYFFtL4a4c6PWCO4ank2GQrOjJNTS475pF/xwgzNv/JLnH/C8NgPezQyXuGEzERgKuo2rmbWdKYd0iFL6emgnxIl1dMfQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--ardb.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=OBtFeaYy; arc=none smtp.client-ip=209.85.221.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--ardb.bounces.google.com Received: by mail-wr1-f73.google.com with SMTP id ffacd0b85a97d-33ce09c0644so192889f8f.1 for <linux-kernel@vger.kernel.org>; Tue, 13 Feb 2024 04:42:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707828138; x=1708432938; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=tmJq7yGJtig/x243U4iqbWlHcuxPy6IsUUTLst4tAO8=; b=OBtFeaYyc/GR1Y7iEWhFsoTNTYn1fgVS6z3vXpcwP3xc0GVxIxWjLg5dOiihfO/mrJ S0o0i5Q/XHlFJlILlr2PGigl6d6yDZfdZkzhvZtk+HDbwgXoRxz0XS+PdUw2AXFKIBOM cTsqdOHhIrJKAwotz3j8ROlR8IHiThkG9xNGJYog3pcXA6tAZc8IpSraGhmUTD/cTDjL l/qG83RCgB+wC7sMP1IoYQ2qNA3vAyX3IfqJ+HnCgfPwlVEHkaAEL7ICENDHtvMW1hY1 2SExgSE9jcZYLX6iCuArzXWvLnJjgoHFP/RcQ4p+BjEnYx4RVrRcCFAvDmwLOefY6B4v Jrig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707828138; x=1708432938; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=tmJq7yGJtig/x243U4iqbWlHcuxPy6IsUUTLst4tAO8=; b=gkdwZlXnMepM12T83wdGXZWS+hSoBVMZp+HjS/AMmRMUfnuU3CIx63Tw8iMHEUgBzS 2LCxcu0Oah8ZQAz13njZj44Idbn/GS72jRwYRfWc6tyZnWYvvnfSUUK9UqdWMjpMq4nH vIYSZ7y3gLY4qIf9G/yHOBY9UYoIEDPvhKDyASgMcDITPVYBc+bnloRRMyZs5GlcGLTs Q1WOW2hQ329AW3G1EJev1AR0XbOsKeb1sZ1WtImxHkEYXLfIwYuDqSy8FJYJQ/1MKQZ6 aXzOgj/bCrWi10QnaylUq00aB4QC3bE2oYGpUXEQ8Jb9iS/9wSVlfZdUgV5eDTwBEOma B2Tw== X-Gm-Message-State: AOJu0YyF+2RvpeAJANv0TWUkyoiUpON2HocLOjx4Ke6wGNimnAReL54r aiICNV7KoNlayUyket9Kak1ZlmYQZcc0Bqt0ogdIjF3i68aaGQZoMAx1Mvw1Q6G4eZimpRr8Alf 6fzrtQe78OMZldnbZ/UvH88TS5rZTK9ZrfT50CKAyB+8Qj7k6Jv2XWvwPr555a71TntbTTHKMqc Lq87v5qUieRf7LNlpZh9t6moDMPaFZFQ== X-Received: from palermo.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:118a]) (user=ardb job=sendgmr) by 2002:a05:6000:1e0c:b0:33b:4a51:f0ed with SMTP id bj12-20020a0560001e0c00b0033b4a51f0edmr18827wrb.4.1707828137638; Tue, 13 Feb 2024 04:42:17 -0800 (PST) Date: Tue, 13 Feb 2024 13:41:51 +0100 In-Reply-To: <20240213124143.1484862-13-ardb+git@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> Mime-Version: 1.0 References: <20240213124143.1484862-13-ardb+git@google.com> X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-Developer-Signature: v=1; a=openpgp-sha256; l=2179; i=ardb@kernel.org; h=from:subject; bh=SH5BCZpD7eT9rYWqZ8AiKPxoLpu9BlwPcI3lpvrnWyw=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JIfV0cn/7uaRP4tGTt8a01H99Oak74PEDlrXnFvfZ+AsXH pF9buLQUcrCIMbBICumyCIw+++7nacnStU6z5KFmcPKBDKEgYtTACbycw7Df++Drjf+P264pyab 4jnl+emnm7K3nNr8cPvT223G2e5TkmYxMhw42hws/q71rUN8xDQV3cq5AQunJUxU/O+a+Fn8zG3 +aFYA X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog Message-ID: <20240213124143.1484862-20-ardb+git@google.com> Subject: [PATCH v4 07/11] efi/libstub: Add generic support for parsing mem_encrypt= From: Ard Biesheuvel <ardb+git@google.com> To: linux-kernel@vger.kernel.org Cc: Ard Biesheuvel <ardb@kernel.org>, Kevin Loughlin <kevinloughlin@google.com>, Tom Lendacky <thomas.lendacky@amd.com>, Dionna Glaze <dionnaglaze@google.com>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>, Dave Hansen <dave.hansen@linux.intel.com>, Andy Lutomirski <luto@kernel.org>, Arnd Bergmann <arnd@arndb.de>, Nathan Chancellor <nathan@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, Justin Stitt <justinstitt@google.com>, Kees Cook <keescook@chromium.org>, Brian Gerst <brgerst@gmail.com>, linux-arch@vger.kernel.org, llvm@lists.linux.dev Content-Type: text/plain; charset="UTF-8" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790787744694062087 X-GMAIL-MSGID: 1790787744694062087 |
Series |
x86: Confine early 1:1 mapped startup code
|
|
Commit Message
Ard Biesheuvel
Feb. 13, 2024, 12:41 p.m. UTC
From: Ard Biesheuvel <ardb@kernel.org> Parse the mem_encrypt= command line parameter from the EFI stub if CONFIG_ARCH_HAS_MEM_ENCRYPT=y, so that it can be passed to the early boot code by the arch code in the stub. This avoids the need for the core kernel to do any string parsing very early in the boot. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> --- drivers/firmware/efi/libstub/efi-stub-helper.c | 8 ++++++++ drivers/firmware/efi/libstub/efistub.h | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-)
Comments
On 2/13/24 06:41, Ard Biesheuvel wrote: > From: Ard Biesheuvel <ardb@kernel.org> > > Parse the mem_encrypt= command line parameter from the EFI stub if > CONFIG_ARCH_HAS_MEM_ENCRYPT=y, so that it can be passed to the early > boot code by the arch code in the stub. > > This avoids the need for the core kernel to do any string parsing very > early in the boot. > > Signed-off-by: Ard Biesheuvel <ardb@kernel.org> > --- > drivers/firmware/efi/libstub/efi-stub-helper.c | 8 ++++++++ > drivers/firmware/efi/libstub/efistub.h | 2 +- > 2 files changed, 9 insertions(+), 1 deletion(-) > > diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c > index bfa30625f5d0..3dc2f9aaf08d 100644 > --- a/drivers/firmware/efi/libstub/efi-stub-helper.c > +++ b/drivers/firmware/efi/libstub/efi-stub-helper.c > @@ -24,6 +24,8 @@ static bool efi_noinitrd; > static bool efi_nosoftreserve; > static bool efi_disable_pci_dma = IS_ENABLED(CONFIG_EFI_DISABLE_PCI_DMA); > > +int efi_mem_encrypt; > + > bool __pure __efi_soft_reserve_enabled(void) > { > return !efi_nosoftreserve; > @@ -75,6 +77,12 @@ efi_status_t efi_parse_options(char const *cmdline) > efi_noinitrd = true; > } else if (IS_ENABLED(CONFIG_X86_64) && !strcmp(param, "no5lvl")) { > efi_no5lvl = true; > + } else if (IS_ENABLED(CONFIG_ARCH_HAS_MEM_ENCRYPT) && > + !strcmp(param, "mem_encrypt") && val) { > + if (parse_option_str(val, "on")) > + efi_mem_encrypt = 1; > + else if (parse_option_str(val, "off")) > + efi_mem_encrypt = -1; With CONFIG_AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT having recently been removed, I'm not sure what parsing for mem_encrypt=off does. (Same thing in the next patch.) Thanks, Tom > } else if (!strcmp(param, "efi") && val) { > efi_nochunk = parse_option_str(val, "nochunk"); > efi_novamap |= parse_option_str(val, "novamap"); > diff --git a/drivers/firmware/efi/libstub/efistub.h b/drivers/firmware/efi/libstub/efistub.h > index 212687c30d79..a1c6ab24cd99 100644 > --- a/drivers/firmware/efi/libstub/efistub.h > +++ b/drivers/firmware/efi/libstub/efistub.h > @@ -37,8 +37,8 @@ extern bool efi_no5lvl; > extern bool efi_nochunk; > extern bool efi_nokaslr; > extern int efi_loglevel; > +extern int efi_mem_encrypt; > extern bool efi_novamap; > - > extern const efi_system_table_t *efi_system_table; > > typedef union efi_dxe_services_table efi_dxe_services_table_t;
On Mon, 19 Feb 2024 at 18:00, Tom Lendacky <thomas.lendacky@amd.com> wrote: > > On 2/13/24 06:41, Ard Biesheuvel wrote: > > From: Ard Biesheuvel <ardb@kernel.org> > > > > Parse the mem_encrypt= command line parameter from the EFI stub if > > CONFIG_ARCH_HAS_MEM_ENCRYPT=y, so that it can be passed to the early > > boot code by the arch code in the stub. > > > > This avoids the need for the core kernel to do any string parsing very > > early in the boot. > > > > Signed-off-by: Ard Biesheuvel <ardb@kernel.org> > > --- > > drivers/firmware/efi/libstub/efi-stub-helper.c | 8 ++++++++ > > drivers/firmware/efi/libstub/efistub.h | 2 +- > > 2 files changed, 9 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c > > index bfa30625f5d0..3dc2f9aaf08d 100644 > > --- a/drivers/firmware/efi/libstub/efi-stub-helper.c > > +++ b/drivers/firmware/efi/libstub/efi-stub-helper.c > > @@ -24,6 +24,8 @@ static bool efi_noinitrd; > > static bool efi_nosoftreserve; > > static bool efi_disable_pci_dma = IS_ENABLED(CONFIG_EFI_DISABLE_PCI_DMA); > > > > +int efi_mem_encrypt; > > + > > bool __pure __efi_soft_reserve_enabled(void) > > { > > return !efi_nosoftreserve; > > @@ -75,6 +77,12 @@ efi_status_t efi_parse_options(char const *cmdline) > > efi_noinitrd = true; > > } else if (IS_ENABLED(CONFIG_X86_64) && !strcmp(param, "no5lvl")) { > > efi_no5lvl = true; > > + } else if (IS_ENABLED(CONFIG_ARCH_HAS_MEM_ENCRYPT) && > > + !strcmp(param, "mem_encrypt") && val) { > > + if (parse_option_str(val, "on")) > > + efi_mem_encrypt = 1; > > + else if (parse_option_str(val, "off")) > > + efi_mem_encrypt = -1; > > With CONFIG_AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT having recently been > removed, I'm not sure what parsing for mem_encrypt=off does. > > (Same thing in the next patch.) > We have to deal with both mem_encrypt=on and mem_encrypt=off occurring on the command line. efi_parse_options() may be called more than once, i.e., when there is a default command line baked into the image that can be overridden at runtime. So if the baked in one has mem_encrypt=on, mem_encrypt=off appearing later should counter that. The same applies to the next patch, although the decompressor appears to ignore the built-in command line entirely (I made a note of that in the commit log)
On 2/19/24 11:06, Ard Biesheuvel wrote: > On Mon, 19 Feb 2024 at 18:00, Tom Lendacky <thomas.lendacky@amd.com> wrote: >> >> On 2/13/24 06:41, Ard Biesheuvel wrote: >>> From: Ard Biesheuvel <ardb@kernel.org> >>> >>> Parse the mem_encrypt= command line parameter from the EFI stub if >>> CONFIG_ARCH_HAS_MEM_ENCRYPT=y, so that it can be passed to the early >>> boot code by the arch code in the stub. >>> >>> This avoids the need for the core kernel to do any string parsing very >>> early in the boot. >>> >>> Signed-off-by: Ard Biesheuvel <ardb@kernel.org> >>> --- >>> drivers/firmware/efi/libstub/efi-stub-helper.c | 8 ++++++++ >>> drivers/firmware/efi/libstub/efistub.h | 2 +- >>> 2 files changed, 9 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c >>> index bfa30625f5d0..3dc2f9aaf08d 100644 >>> --- a/drivers/firmware/efi/libstub/efi-stub-helper.c >>> +++ b/drivers/firmware/efi/libstub/efi-stub-helper.c >>> @@ -24,6 +24,8 @@ static bool efi_noinitrd; >>> static bool efi_nosoftreserve; >>> static bool efi_disable_pci_dma = IS_ENABLED(CONFIG_EFI_DISABLE_PCI_DMA); >>> >>> +int efi_mem_encrypt; >>> + >>> bool __pure __efi_soft_reserve_enabled(void) >>> { >>> return !efi_nosoftreserve; >>> @@ -75,6 +77,12 @@ efi_status_t efi_parse_options(char const *cmdline) >>> efi_noinitrd = true; >>> } else if (IS_ENABLED(CONFIG_X86_64) && !strcmp(param, "no5lvl")) { >>> efi_no5lvl = true; >>> + } else if (IS_ENABLED(CONFIG_ARCH_HAS_MEM_ENCRYPT) && >>> + !strcmp(param, "mem_encrypt") && val) { >>> + if (parse_option_str(val, "on")) >>> + efi_mem_encrypt = 1; >>> + else if (parse_option_str(val, "off")) >>> + efi_mem_encrypt = -1; >> >> With CONFIG_AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT having recently been >> removed, I'm not sure what parsing for mem_encrypt=off does. >> >> (Same thing in the next patch.) >> > > We have to deal with both mem_encrypt=on and mem_encrypt=off occurring > on the command line. efi_parse_options() may be called more than once, > i.e., when there is a default command line baked into the image that > can be overridden at runtime. So if the baked in one has > mem_encrypt=on, mem_encrypt=off appearing later should counter that. > > The same applies to the next patch, although the decompressor appears > to ignore the built-in command line entirely (I made a note of that in > the commit log) Ah, makes sense. Thanks, Tom
diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c index bfa30625f5d0..3dc2f9aaf08d 100644 --- a/drivers/firmware/efi/libstub/efi-stub-helper.c +++ b/drivers/firmware/efi/libstub/efi-stub-helper.c @@ -24,6 +24,8 @@ static bool efi_noinitrd; static bool efi_nosoftreserve; static bool efi_disable_pci_dma = IS_ENABLED(CONFIG_EFI_DISABLE_PCI_DMA); +int efi_mem_encrypt; + bool __pure __efi_soft_reserve_enabled(void) { return !efi_nosoftreserve; @@ -75,6 +77,12 @@ efi_status_t efi_parse_options(char const *cmdline) efi_noinitrd = true; } else if (IS_ENABLED(CONFIG_X86_64) && !strcmp(param, "no5lvl")) { efi_no5lvl = true; + } else if (IS_ENABLED(CONFIG_ARCH_HAS_MEM_ENCRYPT) && + !strcmp(param, "mem_encrypt") && val) { + if (parse_option_str(val, "on")) + efi_mem_encrypt = 1; + else if (parse_option_str(val, "off")) + efi_mem_encrypt = -1; } else if (!strcmp(param, "efi") && val) { efi_nochunk = parse_option_str(val, "nochunk"); efi_novamap |= parse_option_str(val, "novamap"); diff --git a/drivers/firmware/efi/libstub/efistub.h b/drivers/firmware/efi/libstub/efistub.h index 212687c30d79..a1c6ab24cd99 100644 --- a/drivers/firmware/efi/libstub/efistub.h +++ b/drivers/firmware/efi/libstub/efistub.h @@ -37,8 +37,8 @@ extern bool efi_no5lvl; extern bool efi_nochunk; extern bool efi_nokaslr; extern int efi_loglevel; +extern int efi_mem_encrypt; extern bool efi_novamap; - extern const efi_system_table_t *efi_system_table; typedef union efi_dxe_services_table efi_dxe_services_table_t;