From patchwork Thu Feb 3 11:53:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 12734064 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 C9029C433EF for ; Thu, 3 Feb 2022 11:56:03 +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=hySXCl4ApFDI9wqQ4rIaCpuKydqllMA3AcHyo+21hIg=; b=AwE1RjOzrxPYo6 ZV5WEiuUEwV6qjzrPI4PQ1ZOFiEgvHxlqlxeTmt8JCBp4gqfXSWxYN7h/20BSvzUx5Z4Pk/y3khAT sNbewc46pviqnP0U14w2ZUNxfL/CSN7bFh6Xm1T/PK13h9iTvF3xJAR25cAgJ79lEkTarZ1UlE7+g ChLn8TNZ9Ziuj9GnFm87GSksSHrLskY8udq5RnWqdgOk/ebEDrDZB/e9Nh92oUL5FI1o6IpLT5Ewe Ug+iEaqvA6RJ7EyZ8m06uTyylQevsep4beX27hY2JpKGQlydV+THT63EbD6HU/gKnxuFLtEAbNPZp WISXAQAcGq0II7xuBrrQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFahS-0013mt-Dz; Thu, 03 Feb 2022 11:54:54 +0000 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFagh-0013VH-PE for linux-arm-kernel@lists.infradead.org; Thu, 03 Feb 2022 11:54:09 +0000 Received: by mail-pg1-x534.google.com with SMTP id v3so2101561pgc.1 for ; Thu, 03 Feb 2022 03:54:07 -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=GYksfqXaPV/dh2hqgLls7NY6zYw6qDongmSSBZKsfsc=; b=BjG3aUuaDcR15UUUbWnRHZMmAfImhR37OOfIAEbDVyEBG3bMLKPk0AMcZE709hkDmC wrCKej65+toxCE+wJdzgUF5XTyrA748FK9AxG2OmmfbOTDcv5Bhyzovi2BmsPUHYKRle ggzENsYakkmYRtuxOc1oxcGJDkIZJfXdRmjJM1/F0+G16m7/X3TuYo5cyWYFyIfduX4N /K0S7U+/BiohQf4LLkUZnMhwEfP3FkpZTn1JJe+lzi5wdvazzZf49aLs7CKPfH7tdI/4 WtOUGysft1QKT8VES0RtPg0l9QTamPNmFOJ7a4zQ+5PTu441LZBfHrAIwyAa1sS9pV/0 Zn3Q== 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=GYksfqXaPV/dh2hqgLls7NY6zYw6qDongmSSBZKsfsc=; b=3cunIPkvLPBnKrCMGKEATSVpWnnBflrgtjmkU0xfa9aBTzA0ODos5LPjNklQ9N9x82 qlirmAJqlI1sBAlVkcfi3Vmm/QFZpR2aZIyQDXIMR1xGr7KkGThqP8Y3gvtyIQLawPTk rBN0Pp9Q4A3MwT0tAtpZJWebaSUNtRcBR8bbmOdBhVYKp6+iW1tpYYgjgTDh5lLzzsRR kwf8OagbE7HlfXgaxuz6CvYnS2C8HxVr0KApzVLuWlUjaYTJoyt89EySBQiYfVqoaMrx vLyM2GVHibDw1q3M1/G9Z845DfpP3Ldp/WnysGo4gybKM9+zmb3HRZuM19nYEFimLETJ UFzA== X-Gm-Message-State: AOAM53162rTtqb+9leEGkYV1UlPBI3Tr7Mkoq+Xv/9OH2ltorczLS93B AXxrpWJx+evFzv5OLpteITw= X-Google-Smtp-Source: ABdhPJypXHtSz1IUsmMH9S/+owRsut30+8ayH1fpDzvTpQE50paUnOxndIO3XEwgBjUCoguuAArtmg== X-Received: by 2002:a63:80c8:: with SMTP id j191mr20235458pgd.8.1643889247028; Thu, 03 Feb 2022 03:54:07 -0800 (PST) Received: from voyager.lan ([45.124.203.14]) by smtp.gmail.com with ESMTPSA id mp22sm9586389pjb.28.2022.02.03.03.54.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Feb 2022 03:54:06 -0800 (PST) From: Joel Stanley To: Arnd Bergmann , Andrew Jeffery , Greg Kroah-Hartman , "Rafael J . Wysocki" Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org Subject: [PATCH v2 3/3] x86/setup: Populate bootinfo with secure boot status Date: Thu, 3 Feb 2022 22:23:44 +1030 Message-Id: <20220203115344.267159-4-joel@jms.id.au> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220203115344.267159-1-joel@jms.id.au> References: <20220203115344.267159-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_035407_844714_191652B1 X-CRM114-Status: GOOD ( 12.28 ) 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 --- 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();