Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp37754lqs; Mon, 4 Mar 2024 14:13:08 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXv1zcIp4pMkncEtBZW6npgsi9W7OVDFBLDmi18RFnn/ueDOCR2Z2hy5/+0kXMaf/KXKp5CqYZYWt/efgx91KniftqH2dTN3n+0X7R9Yw== X-Google-Smtp-Source: AGHT+IEJPOt0JVz4DNGN0nPAr3o8n9Dt7oJfxgB0ATvvCcmoccZSAmjsCjdDD89619et7JJgnk5G X-Received: by 2002:a17:902:7806:b0:1dd:151b:faa3 with SMTP id p6-20020a170902780600b001dd151bfaa3mr70344pll.19.1709590387976; Mon, 04 Mar 2024 14:13:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709590387; cv=pass; d=google.com; s=arc-20160816; b=gOUQsrZUJdrDGMt+FMyIxMOmrT8M00pJpavv0nHa2nETXoosp7tJYG7TdWTBsJk0Ak 1H8toh9WIhl18UtXOdHyLTulYPzuh0qfL6IwxelgccuSfHW7JE5kXy7PQkSHDIZPtL4Z UUt/6lI1jAupH5sZ0+N4dfUK7ON3Ur4sbs6nxvYIesj+2opPPPgU7XC/pUioWb3n1HPx UkM9CFPJqy5tqNc4kJ5JQqjRwIhZN5ZettBvhILSHXy9PQDHzt2tIdQ79Wy1HViJmyqT +0rJGrE/ZudvbvuwlXfAjX0xZEy0SUgn0mv1jrTwawr4o3B8eXxWebDWB/WAXhWo+qLd cYFw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=sEcJlGiIaDa1Ol2wtmmAtLXdnRpFU6JHbDWQ947LyTg=; fh=rVTB9++5xMIecOv+XPWpkq5YZaJRcF05li6wpGIZteI=; b=tANRG0r4t0xRYYSn7qW6A6/1IPqyAlgRvi3sqzzUutAVWCHaHEZ628d/VXqEp6+pi8 G7/zotQuP+QGSTn6GWNEMqr148EuDnstkG0mRyEkJhf4IKjnsp7UP6NIYaEndEbKkbfm 0E9+k5KWh8p0dnOiJlnksBqV4mPF/HJLcCeV7aAhird8K3lZbBcZudMzK/gb+GrTjhc3 /5Z78x4Oi8So8LHTXMb2AyXreK2sHHAS4uQqS6QVrGa9WcUxl4PUJqJQcidoEVy/lAmO UE3+6KZR5nduz4Sn7nZpTI0dJMAdBCGCYj22OMy+SXHddDHyBy/SVGSiHrm64wgc4xiM 09eQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=VBsCel6Y; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=vf5y0E5N; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-91349-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91349-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id lm6-20020a170903298600b001d9f2674003si8825467plb.121.2024.03.04.14.13.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 14:13:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-91349-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=VBsCel6Y; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=vf5y0E5N; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-91349-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91349-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id A37BE28221D for ; Mon, 4 Mar 2024 22:13:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 662B97FBBF; Mon, 4 Mar 2024 22:09:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="VBsCel6Y"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="vf5y0E5N" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC8207C086; Mon, 4 Mar 2024 22:09:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709590146; cv=none; b=mbjAGXR4CtevlRv0xg5i6oi08C5nT+rwUr0HF1gozQ3yQ1+/JUZe4nwQ9tYr/J192kfvsOmxP0PxBdyVfkDMIcj77Eck3MDBXLLqFufEw+8gJhKx6ziclCNbSQW9nAA0Og6jmw0Ysfl3YQhzRqphBPuw0enWniOrt4vnJUdcLP4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709590146; c=relaxed/simple; bh=47xWTnLRqahBzjZQF5TOdnDWtBrVJUCGzxcg+cC2IZQ=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=etkiZfo5DEOaXnStpaIucpTYodGFlZgzp6RAaKxgdxPQ+KxKBWmHBloovVlS4KYDlHHQ0OZTOVVxKYg87XGlDcRxNPiLChW1K8WdACcBjDcuSYkFvU0y6WRV6/3WcQC1O+jYPuv46PT2A/qVNAT67Ol+zr2MNV8AA2hTUyR0QhA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=VBsCel6Y; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=vf5y0E5N; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Mon, 04 Mar 2024 22:09:01 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1709590142; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sEcJlGiIaDa1Ol2wtmmAtLXdnRpFU6JHbDWQ947LyTg=; b=VBsCel6YlY43lT9QbH015kUG8u4nAzxeyAXhKTj4RZ1OjD1PFB9DiaXXaKfX2inIIuY2XC GghjNXzvvngrJYpz6B/pNL8OaTn59T0F/03lZSp6R/JB2+pzsIM4X2N5rBer9vOPJIPVfr OgUfI0ROG98yEc/boeFQiVRMLcRXLedn3MDnlynhIx3SG58ZHoaM5iyplIgvquCx1Eev70 xMYnLvxMW7ZuiTs9cFnOaHfsoK8uiIgIWBq4RfnhBt570zrl831DqTWMf+dEEpSX0Gicwq USdaiMgwRUACMW5eyVUR/krYJyAn23jp5nySaQw94P1ZIJvQYxaCp8kb5rpH1g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1709590142; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sEcJlGiIaDa1Ol2wtmmAtLXdnRpFU6JHbDWQ947LyTg=; b=vf5y0E5NuQo9MeemU+eXuWpOi+B7Ar56xPRm7QRcA8jZQNSnxAmoqoYb08XMfFKfzh16Rf uxe30MBtiseJ8jCg== From: "tip-bot2 for Ard Biesheuvel" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/boot] efi/libstub: Add generic support for parsing mem_encrypt= Cc: Ard Biesheuvel , "Borislav Petkov (AMD)" , Tom Lendacky , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240227151907.387873-16-ardb+git@google.com> References: <20240227151907.387873-16-ardb+git@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <170959014157.398.1604703266552857019.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit The following commit has been merged into the x86/boot branch of tip: Commit-ID: 7205f06e847422b66c1506eee01b9998ffc75d76 Gitweb: https://git.kernel.org/tip/7205f06e847422b66c1506eee01b9998ffc75d76 Author: Ard Biesheuvel AuthorDate: Tue, 27 Feb 2024 16:19:13 +01:00 Committer: Borislav Petkov (AMD) CommitterDate: Mon, 04 Mar 2024 18:12:24 +01:00 efi/libstub: Add generic support for parsing mem_encrypt= 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 Signed-off-by: Borislav Petkov (AMD) Tested-by: Tom Lendacky Link: https://lore.kernel.org/r/20240227151907.387873-16-ardb+git@google.com --- 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 bfa3062..3dc2f9a 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 c04b82e..fc18fd6 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;