Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1766903imm; Sun, 15 Jul 2018 16:41:18 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfE6Z2cjBsJpoXFn/wF5FMRszNehu75i/GTRBasRV/jbYd07M+dLIutHB80Y3JeOgVIHvKL X-Received: by 2002:a63:b504:: with SMTP id y4-v6mr13235033pge.247.1531698078565; Sun, 15 Jul 2018 16:41:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531698078; cv=none; d=google.com; s=arc-20160816; b=Ik7bHI6tAcgkyXbutvUpw5tsS/743WD/8IzROVGbvThre1feCNrWpY1T5eKlnbpFW7 ZTkSc+TQBfEefOHccVrrvk0APHD3DpuT0Cfnv3rRI6wEkmKDzp0+L/qEVBrNpt23zOoV 5YoWl1lV2fzuox0W+bZdyDwOx0GKJF4132Fdj0FCdRU/AOwu3dUwmffYIAGA2MMz8R0K h9VWgiUxIshtCDydo+Ue1BuCabpSTisTAyvj1oKJMDiAlRhQ+3wFiBZMFSkz3JyMFpmj Gcx/dsy4c6MKWyUsY9DCQhS6lQI73AZ2mcVtyKhLlDgXQCFhBmiWu468Y24JVABLPU7v xXsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=ZR9cBZwY6KeXHdZ9HFaIVcex71uQf9POzY0BUBuZ7F8=; b=K2vzQKmqmviSlY0pjJE+akmK77enO1MzbBWA3gb7OinB4mLR6U3LufwMKrXOQz5ZjD IqtDsXzwPk7+IeFqoqeLau6qIPyPzklJzzFH4izzHOV2S3OEaPluVpR1tHSpktzuYBCY d6wwzPt2mWrRWvkCLiBf6KobkEGzNR/a1TZHh31n2lng+wbQtGgP2gQDrQNoX9Px1aqP urdL3XQMpnaE7eF54kaSXs98FiSchFrRL+QM1R89kfj8YunNYDompTGeod6UMDcG1rS0 4JzSnDPxy6IayZDaP7+0Fyn3Ewv400EjeHMK/Qw6UnKl6uBHEXc4JuUXfYtzaS3Sq3kq AxIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t5-v6si29509752plz.286.2018.07.15.16.41.04; Sun, 15 Jul 2018 16:41:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727594AbeGPAEZ (ORCPT + 99 others); Sun, 15 Jul 2018 20:04:25 -0400 Received: from terminus.zytor.com ([198.137.202.136]:54779 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727260AbeGPAEZ (ORCPT ); Sun, 15 Jul 2018 20:04:25 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w6FNdN2R922972 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 15 Jul 2018 16:39:23 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w6FNdMVR922969; Sun, 15 Jul 2018 16:39:22 -0700 Date: Sun, 15 Jul 2018 16:39:22 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Ard Biesheuvel Message-ID: Cc: torvalds@linux-foundation.org, tglx@linutronix.de, ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, peterz@infradead.org, agraf@suse.de, mingo@kernel.org, linux-kernel@vger.kernel.org, hpa@zytor.com Reply-To: hpa@zytor.com, linux-kernel@vger.kernel.org, mingo@kernel.org, peterz@infradead.org, agraf@suse.de, tglx@linutronix.de, torvalds@linux-foundation.org, leif.lindholm@linaro.org, ard.biesheuvel@linaro.org In-Reply-To: <20180711094040.12506-7-ard.biesheuvel@linaro.org> References: <20180711094040.12506-7-ard.biesheuvel@linaro.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:efi/core] efi/libstub/arm: Add opt-in Kconfig option for the DTB loader Git-Commit-ID: 3d7ee348aa4127a7893c11261da9b76371a970e6 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, T_DATE_IN_FUTURE_96_Q autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 3d7ee348aa4127a7893c11261da9b76371a970e6 Gitweb: https://git.kernel.org/tip/3d7ee348aa4127a7893c11261da9b76371a970e6 Author: Ard Biesheuvel AuthorDate: Wed, 11 Jul 2018 11:40:38 +0200 Committer: Ingo Molnar CommitDate: Mon, 16 Jul 2018 00:43:12 +0200 efi/libstub/arm: Add opt-in Kconfig option for the DTB loader There are various ways a platform can provide a device tree binary to the kernel, with different levels of sophistication: - ideally, the UEFI firmware, which is tightly coupled with the platform, provides a device tree image directly as a UEFI configuration table, and typically permits the contents to be manipulated either via menu options or via UEFI environment variables that specify a replacement image, - GRUB for ARM has a 'devicetree' directive which allows a device tree image to be loaded from any location accessible to GRUB, and supersede the one provided by the firmware, - the EFI stub implements a dtb= command line option that allows a device tree image to be loaded from a file residing in the same file system as the one the kernel image was loaded from. The dtb= command line option was never intended to be more than a development feature, to allow the other options to be implemented in parallel. So let's make it an opt-in feature that is disabled by default, but can be re-enabled at will. Note that we already disable the dtb= command line option when we detect that we are running with UEFI Secure Boot enabled. Signed-off-by: Ard Biesheuvel Reviewed-by: Alexander Graf Acked-by: Leif Lindholm Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: linux-efi@vger.kernel.org Link: http://lkml.kernel.org/r/20180711094040.12506-7-ard.biesheuvel@linaro.org Signed-off-by: Ingo Molnar --- drivers/firmware/efi/Kconfig | 12 ++++++++++++ drivers/firmware/efi/libstub/arm-stub.c | 7 ++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/firmware/efi/Kconfig b/drivers/firmware/efi/Kconfig index 781a4a337557..d8e159feb573 100644 --- a/drivers/firmware/efi/Kconfig +++ b/drivers/firmware/efi/Kconfig @@ -87,6 +87,18 @@ config EFI_RUNTIME_WRAPPERS config EFI_ARMSTUB bool +config EFI_ARMSTUB_DTB_LOADER + bool "Enable the DTB loader" + depends on EFI_ARMSTUB + help + Select this config option to add support for the dtb= command + line parameter, allowing a device tree blob to be loaded into + memory from the EFI System Partition by the stub. + + The device tree is typically provided by the platform or by + the bootloader, so this option is mostly for development + purposes only. + config EFI_BOOTLOADER_CONTROL tristate "EFI Bootloader Control" depends on EFI_VARS diff --git a/drivers/firmware/efi/libstub/arm-stub.c b/drivers/firmware/efi/libstub/arm-stub.c index 01a9d78ee415..c98b1856fc3d 100644 --- a/drivers/firmware/efi/libstub/arm-stub.c +++ b/drivers/firmware/efi/libstub/arm-stub.c @@ -202,9 +202,10 @@ unsigned long efi_entry(void *handle, efi_system_table_t *sys_table, * 'dtb=' unless UEFI Secure Boot is disabled. We assume that secure * boot is enabled if we can't determine its state. */ - if (secure_boot != efi_secureboot_mode_disabled && - strstr(cmdline_ptr, "dtb=")) { - pr_efi(sys_table, "Ignoring DTB from command line.\n"); + if (!IS_ENABLED(CONFIG_EFI_ARMSTUB_DTB_LOADER) || + secure_boot != efi_secureboot_mode_disabled) { + if (strstr(cmdline_ptr, "dtb=")) + pr_efi(sys_table, "Ignoring DTB from command line.\n"); } else { status = handle_cmdline_files(sys_table, image, cmdline_ptr, "dtb=",