From patchwork Fri Feb 4 07:22:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 12734859 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F2274C433EF for ; Fri, 4 Feb 2022 07:24:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=D2qfRACOqiGegzqZ2IgIXdvSra5KsLtIzaiWpozDVes=; b=sTWaNAFdhoYn5t +0qK1XMiu7PPyk0lNgJfKgAlERzgIuvm4krflfBUuBpLdS+lbk0LbLfhKzMzK+SK/wEO+QJdPrc0D 6yPce/2OL8Om7HnYg62Sy61A/mPLQxEGRKG3M6FN6N8FXRTWxKczzOhqDmBB93s9wSoYnxWPlDjNU q9HhmT44Dh/7OhpT+SJBIOPLBrvXPeLUIKCjQ7bS0me1/bpRHmaEMTxE2mESQvA8ur/74QjvwOM0W DLZyMPTewscwKilAa2D7BUCNmI/y6jkA8GNEJ/9+nVMRs6A8y0tmcHAPtZyvf2MOQgo5iW61+v44a iQ6KN6Q0tj8zrG9GH4rg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFswA-003dXc-MZ; Fri, 04 Feb 2022 07:23:18 +0000 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFsvo-003dSX-HO for linux-arm-kernel@lists.infradead.org; Fri, 04 Feb 2022 07:22:57 +0000 Received: by mail-pl1-x635.google.com with SMTP id x11so4411026plg.6 for ; Thu, 03 Feb 2022 23:22:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3NAuZUPwGF81ONxppx1B9B6iTuR1QuOpDIcTSst0sx0=; b=HmUyqiwJMKWnR7xJD07p4oXeNj9NB7fxabIkBU7eUvnS7cgvXWWegTDLLCfxRsQO0L bDTv0BDUlmGtIsho04tQU1mS+fFZs0lOi4IXKWd4u4jiaFmxFO1v6Uy5ykagjn1FfFkY ooJR2M+k3Ad2jnFTbCJzpLDQLmy8ctJ0d1cZASvSOVAMPqBYsT2rx6OIq8Wo+L3yZXJf HEE14JFihc1dS7hY07KRN2s3iv0iSOkvaS4TEAAjSULEjOuf0sbT8DSwqrP2AhTpoFoP li3jYYBBInfYPeEGtJS1Y8Q88AslwT6YmvKI7otNQFTjM30Mr1y/Cw8CixxwV40SbOoD cVWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=3NAuZUPwGF81ONxppx1B9B6iTuR1QuOpDIcTSst0sx0=; b=YkjvBKRTKlOSjGCde4D8ErAxrwh4VTFU4ndj4QjAjaTv1N0J0Cfji/F5G+kMTAZ1KU vWCLBMsNtbK5W6Z5Z7LhSYrbBTq0S9iedTYPi9/r+9x6juFEBgtDJtVaCRS2ycxJfDX3 UenspNMKYRQ6PY0xyIp0qUUgMfi90SyLsMGQ+pcuD1Pcx4UCqmfFKWpaTOgEpdrSfTOf h+xSQ55UjqAusXuouV9eHEPbFLYn8I4S1lFeCPC1FW1KcR72NIl3fD6qy9/GwFrPLVpl j3PEQmMZGDFhhwCfNKclmsS1zqOW/otpbBKrA/l4DWwUsZipKc7L8WzKn3HVSUUyNeM+ KmGg== X-Gm-Message-State: AOAM5330s8CzMKT2oSkBnHHgbgB89t41a885fDr0zJukO3nyGSovWmnT q3pgY2UxSCHP72FAtFy+9+M= X-Google-Smtp-Source: ABdhPJyVz5qfJzssRkzORV9t582XmgGtNGjvXlTFsPohRi5IjyDvNmGF+qtghzsEor7vO69s2ZW/Fg== X-Received: by 2002:a17:90a:6a4e:: with SMTP id d14mr1695587pjm.177.1643959375746; Thu, 03 Feb 2022 23:22:55 -0800 (PST) Received: from voyager.lan ([45.124.203.14]) by smtp.gmail.com with ESMTPSA id t14sm11665328pjd.6.2022.02.03.23.22.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Feb 2022 23:22:54 -0800 (PST) From: Joel Stanley To: Arnd Bergmann , Andrew Jeffery , Greg Kroah-Hartman , "Rafael J . Wysocki" , Robin Murphy Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org Subject: [PATCH v3 3/3] x86/setup: Populate bootinfo with secure boot status Date: Fri, 4 Feb 2022 17:52:34 +1030 Message-Id: <20220204072234.304543-4-joel@jms.id.au> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220204072234.304543-1-joel@jms.id.au> References: <20220204072234.304543-1-joel@jms.id.au> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220203_232256_601457_96852B8A X-CRM114-Status: GOOD ( 11.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org bootinfo indicates to userspace that firmware is configured to boot with secure boot. Signed-off-by: Joel Stanley --- v2: new v3: no change --- arch/x86/kernel/setup.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index f7a132eb794d..b805b758478f 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -23,6 +23,7 @@ #include #include #include +#include #include @@ -1100,17 +1101,22 @@ void __init setup_arch(char **cmdline_p) setup_log_buf(1); if (efi_enabled(EFI_BOOT)) { + struct bootinfo bootinfo = {}; + switch (boot_params.secure_boot) { case efi_secureboot_mode_disabled: pr_info("Secure boot disabled\n"); + BOOTINFO_SET(bootinfo, secure_boot, false); break; case efi_secureboot_mode_enabled: pr_info("Secure boot enabled\n"); + BOOTINFO_SET(bootinfo, secure_boot, true); break; default: pr_info("Secure boot could not be determined\n"); break; } + firmware_bootinfo_init(&bootinfo); } reserve_initrd();