From patchwork Sat Feb 2 09:41:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 157327 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1509795jaa; Sat, 2 Feb 2019 01:41:32 -0800 (PST) X-Google-Smtp-Source: ALg8bN599C6FKP+HOU+rvYQ4tH2vw6PP+Hgds8uFbnXNMkxdhKC+0PuRBW/Q14va3L68afstOr2q X-Received: by 2002:a17:902:7c05:: with SMTP id x5mr42442702pll.273.1549100492702; Sat, 02 Feb 2019 01:41:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549100492; cv=none; d=google.com; s=arc-20160816; b=dJ7fKBoXYx772aPLC7NU77Ss+2LxPgjgPCD+FHIpkeb0JtUjGeYrnFSMXUf10CdQG2 PSMpIWHG6v0XXvUeO4gr0jaq55odQbxyWAnJ70DVGiodnJigg53V6EHk7vDQu9zZNpVV 9qmGnAWl8czHljGlM2HffKUrlOa+TclSLH0Q3wffnzacpHxjfNstQKgm6HDEJZjp0iNa CAq0Vv4lmJ5PkEDQiIvr15xttpczmhEY3GdMPizBivckm9z47d6U6PU0MK6d0FlQRuTr ABHUKmCNmD7bJ7NK0g6mLYELM96J7XSQF5WPgRssfsEAO+s80rNj7kcZPWg7z6NMj6ny 6xsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=5ao+30GUUv3JmbT29dbzmjqtVn+kpmSTNQBPMeuNpw0=; b=IZrZuPr/qoiSpOxVTzoelpXD/BQRiswDwLLT2qhZNXSv7nd5t0mILXAKf9T0IUM7M6 ZuMajhay4e7pdpPAonVLIFmsCIbrqVeNKo9i92PG7sQfqbrR84qXRUfVukYe21hOvnDs OIIdSbcShuycrLT2T9bC86A2sotBnKn2I+lT8LNdomunHUqwCn9ARk68+NXrtOUhO7+G n2Ssf8mrnzFCmd6JI0ZyosazUXWL2g3mvHAVD1NeRQGVwdCdH/Dg6W82BotzhT29NtiY ykMCawrlZJB9ieQ8FF6ZxX2c9IHt7Zg4Vw6qt99WbV8u0cYN+6BcqUu01x3mp7xpdILm ncjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="QtL/btXv"; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b3si3545331pld.282.2019.02.02.01.41.32; Sat, 02 Feb 2019 01:41:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="QtL/btXv"; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725857AbfBBJla (ORCPT + 3 others); Sat, 2 Feb 2019 04:41:30 -0500 Received: from mail-ed1-f65.google.com ([209.85.208.65]:41322 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726761AbfBBJla (ORCPT ); Sat, 2 Feb 2019 04:41:30 -0500 Received: by mail-ed1-f65.google.com with SMTP id a20so7453997edc.8 for ; Sat, 02 Feb 2019 01:41:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5ao+30GUUv3JmbT29dbzmjqtVn+kpmSTNQBPMeuNpw0=; b=QtL/btXv+JQejhbxpnCT/+uaHPxfhK9CQdc/bjQyvOIzCvoxLQ7yjdqOPuu5mnWhG/ TnYWSMZYJv42Lf1xev1Rj0B/OBJ47rUtPxc6KdVrrsk84d2pR8OJ6lbWc5tmL6lbA/dq r/0r6OCF/p5JNkmMo/78bFLebXYKu92zd57Go= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5ao+30GUUv3JmbT29dbzmjqtVn+kpmSTNQBPMeuNpw0=; b=gMtOedFa/s0yuXtSpyUsXxqwapT2LzM/D56jww7N78un88Jb9bQb4AhOyTq0n36eCN nO6CSqwtxEvSEBGjkS/hHStYN/SgHnco3jt+RrT6NB+4cn4ltYUcVQKv6y/+/JOEQL2J jWYrnpTd1qbN5ogGiY+05D8zN4GYpiHe+cX0aALdh5AeMj/fOxDKYN5L3/7J5e8Qee5t 8lCh3SPWvSWPF2Rv0q0SLaepMkKMHGs54jwEIDZqbS2isiu3jdIjEgztSLCCgVWIwQcm R77SKUTMBgEY9bryttYnrDIRqfz4xVpJAMW8i4WujykMlAEZzcQq/PudpGwLZr8wL5Pc iWUg== X-Gm-Message-State: AJcUukccd8SQU9Cy9IfQIp4/p724H59ixbulyV4YY3gwPsse0Tp2wqqH 3pF9HNPpPX5JPV/XmptdiNhXMyuuZvkIUQ== X-Received: by 2002:a50:c9c3:: with SMTP id c3mr42040854edi.56.1549100488380; Sat, 02 Feb 2019 01:41:28 -0800 (PST) Received: from mba13.c.hoisthospitality.com ([109.236.135.164]) by smtp.gmail.com with ESMTPSA id l41sm2608824eda.83.2019.02.02.01.41.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 02 Feb 2019 01:41:27 -0800 (PST) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner Cc: Ard Biesheuvel , linux-kernel@vger.kernel.org, AKASHI Takahiro , Alexander Graf , Bjorn Andersson , Borislav Petkov , Heinrich Schuchardt , Jeffrey Hugo , Lee Jones , Leif Lindholm , Linus Torvalds , Peter Jones , Peter Zijlstra , Sai Praneeth Prakhya Subject: [PATCH 01/10] x86/efi: Mark can_free_region() as an __init function Date: Sat, 2 Feb 2019 10:41:10 +0100 Message-Id: <20190202094119.13230-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190202094119.13230-1-ard.biesheuvel@linaro.org> References: <20190202094119.13230-1-ard.biesheuvel@linaro.org> Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org From: Sai Praneeth Prakhya can_free_region() is called only once during _boot_ by efi_reserve_boot_services(). Hence, mark it as __init function. Signed-off-by: Sai Praneeth Prakhya Signed-off-by: Ard Biesheuvel --- arch/x86/platform/efi/quirks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.1 diff --git a/arch/x86/platform/efi/quirks.c b/arch/x86/platform/efi/quirks.c index 17456a1d3f04..9ce85e605052 100644 --- a/arch/x86/platform/efi/quirks.c +++ b/arch/x86/platform/efi/quirks.c @@ -304,7 +304,7 @@ void __init efi_arch_mem_reserve(phys_addr_t addr, u64 size) * - Not within any part of the kernel * - Not the BIOS reserved area (E820_TYPE_RESERVED, E820_TYPE_NVS, etc) */ -static bool can_free_region(u64 start, u64 size) +static __init bool can_free_region(u64 start, u64 size) { if (start + size > __pa_symbol(_text) && start <= __pa_symbol(_end)) return false; From patchwork Sat Feb 2 09:41:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 157331 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1509909jaa; Sat, 2 Feb 2019 01:41:41 -0800 (PST) X-Google-Smtp-Source: ALg8bN6BDr06C9iDmhGa+FlEqMBI3AdCzHvBN/l9/KAhCUai1ptuHW8/cuT10qfEc/dn7onlkFoS X-Received: by 2002:a62:2c81:: with SMTP id s123mr42587148pfs.174.1549100501930; Sat, 02 Feb 2019 01:41:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549100501; cv=none; d=google.com; s=arc-20160816; b=LPyhCmNIWjZ8S0g9dVwxvNxY0k34tbKktO/v4rFkxpxVtd1kecJlTzu2FGTQvpUI1V aLhhaCckgkPffSo2PJ4YBXlslpETF5CYTdHnhAomx3iL7dDMxxlo4nrMWhA5OttbrPU6 VFWkg0yN5dhFgHDdSKH+RT+OfKLD2FfsTE+6kvJd/AzscKcyHJauXmcgHr2tk2cjP2Ig ZRqSGExFs5u+4HYNtbvmQzZoX+uOGYBR3GpRMqYiMWS4ZB4iKNPUk3x7XQVfmjFYCFAC 1Rbgbq+mXlrm3sXITIS2oARAXdrF46/aFkEyLtMXJahjdlSiVgydbh9icHg5uRg2ckvz ndRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=AFbLoubj1VU+fWD4m3PgsQWK9N1pBi2vSKxBaCyXPeA=; b=g4zT9tf77cl0uz3ixsT26c8cOuH/yf8Z2GhkToD+JyG/vVcNDcuYh0SWlrjmyxbARn 6dDSRDwzw29YOC+ntaTYTaGqGLeBVhBVkpyDQLUBGwT+o1zmeCQuDfR00WYUYuKrUW+a Qy98b7FhcBwRmOG3SV6jgNkasjnBWtL8tPQRxyXhBp+tbnDjpcCpHA1gqJBkqMqsC9Ek SiQrOPkaSYeDapHgptNk/lyqlw8ld2BD+SVk1TfHWwPKcGGJIda3O04aod2wzHFU4aXD rGm7QgJrfDa7lL3+Ezziu7Cl+bmuEYtqQPFkFiGen71XK+6De65uSsvlYKzjw4FrAQ31 VuKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="XB+/rS6o"; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y10si8686394pgp.348.2019.02.02.01.41.41; Sat, 02 Feb 2019 01:41:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="XB+/rS6o"; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727316AbfBBJlk (ORCPT + 3 others); Sat, 2 Feb 2019 04:41:40 -0500 Received: from mail-ed1-f68.google.com ([209.85.208.68]:33705 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727594AbfBBJlk (ORCPT ); Sat, 2 Feb 2019 04:41:40 -0500 Received: by mail-ed1-f68.google.com with SMTP id p6so7526879eds.0 for ; Sat, 02 Feb 2019 01:41:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=AFbLoubj1VU+fWD4m3PgsQWK9N1pBi2vSKxBaCyXPeA=; b=XB+/rS6oAqX85C39Edcad9S6BneDPkg++b06fdp3bdu030e7HRvS3f/B73FY6YJ4hs moTmUusRGyxyQQYu/ivvT2Ex7ElQa8jTYQBMaz9ESXs+UUfT/a2fTM891qskr/SgBQ2h o1Hp4KKPvJSg6Mqr4AqI2RCXt54h2o2PYt/rY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=AFbLoubj1VU+fWD4m3PgsQWK9N1pBi2vSKxBaCyXPeA=; b=UN2ifQ59gNqfWUbStIYVLkTkMNybNayrh5DZ7RXsTLvP7s4IkCh6yooJB7ZqT6g1j/ mLAqWN3KvLRz3M3GR//A5CaZbWl8ku1wQokkH+pEZsklMFfXWgN/pAXVhhwXLRB19Uz3 ws3o1zftxyGTjV6aucWWEixByCfUK335tkRMAGSNVBg371D3bNYUljdF1guYXVkYvq49 njmASroubb6eE1PAYDOhRCzQkcRO16xoberDJ5zbtJ65Weq8AwBraUOqX8VyHn9YIas9 2ti4m0S2vOuYkgrUnVnia52GKaPGEpfijdrd+BkCyXSuP4yoDdTHFRR+Eed2ycP536iZ aZlg== X-Gm-Message-State: AJcUukfOF/TSQSdlwR0pnKyKNxQAY+Zxdnm/jtvx9QaFk8pf6npoVBq2 hF29TZmCf4z385VSl22U5uyB/dwHuSRkbA== X-Received: by 2002:a17:906:7711:: with SMTP id q17mr23302266ejm.118.1549100495968; Sat, 02 Feb 2019 01:41:35 -0800 (PST) Received: from mba13.c.hoisthospitality.com ([109.236.135.164]) by smtp.gmail.com with ESMTPSA id l41sm2608824eda.83.2019.02.02.01.41.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 02 Feb 2019 01:41:35 -0800 (PST) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner Cc: Ard Biesheuvel , linux-kernel@vger.kernel.org, AKASHI Takahiro , Alexander Graf , Bjorn Andersson , Borislav Petkov , Heinrich Schuchardt , Jeffrey Hugo , Lee Jones , Leif Lindholm , Linus Torvalds , Peter Jones , Peter Zijlstra , Sai Praneeth Prakhya Subject: [PATCH 06/10] efi: replace GPL license boilerplate with SPDX headers Date: Sat, 2 Feb 2019 10:41:15 +0100 Message-Id: <20190202094119.13230-7-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190202094119.13230-1-ard.biesheuvel@linaro.org> References: <20190202094119.13230-1-ard.biesheuvel@linaro.org> Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org Replace all GPL license blurbs with an equivalent SPDX header (most files are GPLv2, some are GPLv2+). While at it, drop some outdated header changelogs as well. Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/apple-properties.c | 13 +---- drivers/firmware/efi/arm-init.c | 6 +- drivers/firmware/efi/arm-runtime.c | 6 +- drivers/firmware/efi/capsule-loader.c | 4 +- drivers/firmware/efi/capsule.c | 4 +- drivers/firmware/efi/cper-arm.c | 14 +---- drivers/firmware/efi/cper.c | 14 +---- drivers/firmware/efi/dev-path-parser.c | 9 +-- drivers/firmware/efi/efi-bgrt.c | 5 +- drivers/firmware/efi/efi-pstore.c | 2 + drivers/firmware/efi/efibc.c | 10 +--- drivers/firmware/efi/efivars.c | 58 +------------------ drivers/firmware/efi/esrt.c | 1 + drivers/firmware/efi/fake_mem.c | 16 +---- drivers/firmware/efi/libstub/arm32-stub.c | 6 +- drivers/firmware/efi/libstub/arm64-stub.c | 6 +- .../firmware/efi/libstub/efi-stub-helper.c | 5 +- drivers/firmware/efi/libstub/fdt.c | 5 +- drivers/firmware/efi/libstub/gop.c | 4 +- drivers/firmware/efi/libstub/random.c | 6 +- drivers/firmware/efi/libstub/secureboot.c | 4 +- drivers/firmware/efi/libstub/tpm.c | 4 +- drivers/firmware/efi/memattr.c | 5 +- drivers/firmware/efi/runtime-map.c | 3 +- drivers/firmware/efi/test/efi_test.c | 1 + drivers/firmware/efi/test/efi_test.h | 2 +- drivers/firmware/efi/tpm.c | 5 +- drivers/firmware/efi/vars.c | 15 +---- 28 files changed, 29 insertions(+), 204 deletions(-) -- 2.17.1 diff --git a/drivers/firmware/efi/apple-properties.c b/drivers/firmware/efi/apple-properties.c index ac1654f74dc7..0e206c9e0d7a 100644 --- a/drivers/firmware/efi/apple-properties.c +++ b/drivers/firmware/efi/apple-properties.c @@ -1,19 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * apple-properties.c - EFI device properties on Macs * Copyright (C) 2016 Lukas Wunner * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License (version 2) as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - * * Note, all properties are considered as u8 arrays. * To get a value of any of them the caller must use device_property_read_u8_array(). */ diff --git a/drivers/firmware/efi/arm-init.c b/drivers/firmware/efi/arm-init.c index 1a6a77df8a5e..311cd349a862 100644 --- a/drivers/firmware/efi/arm-init.c +++ b/drivers/firmware/efi/arm-init.c @@ -1,14 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Extensible Firmware Interface * * Based on Extensible Firmware Interface Specification version 2.4 * * Copyright (C) 2013 - 2015 Linaro Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * */ #define pr_fmt(fmt) "efi: " fmt diff --git a/drivers/firmware/efi/arm-runtime.c b/drivers/firmware/efi/arm-runtime.c index 23ea1ed409d1..19ab3ad9cbba 100644 --- a/drivers/firmware/efi/arm-runtime.c +++ b/drivers/firmware/efi/arm-runtime.c @@ -1,14 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Extensible Firmware Interface * * Based on Extensible Firmware Interface Specification version 2.4 * * Copyright (C) 2013, 2014 Linaro Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * */ #include diff --git a/drivers/firmware/efi/capsule-loader.c b/drivers/firmware/efi/capsule-loader.c index 96688986da56..b1395133389e 100644 --- a/drivers/firmware/efi/capsule-loader.c +++ b/drivers/firmware/efi/capsule-loader.c @@ -1,10 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * EFI capsule loader driver. * * Copyright 2015 Intel Corporation - * - * This file is part of the Linux kernel, and is made available under - * the terms of the GNU General Public License version 2. */ #define pr_fmt(fmt) "efi: " fmt diff --git a/drivers/firmware/efi/capsule.c b/drivers/firmware/efi/capsule.c index 4938c29b7c5d..598b7800d14e 100644 --- a/drivers/firmware/efi/capsule.c +++ b/drivers/firmware/efi/capsule.c @@ -1,10 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * EFI capsule support. * * Copyright 2013 Intel Corporation; author Matt Fleming - * - * This file is part of the Linux kernel, and is made available under - * the terms of the GNU General Public License version 2. */ #define pr_fmt(fmt) "efi: " fmt diff --git a/drivers/firmware/efi/cper-arm.c b/drivers/firmware/efi/cper-arm.c index 502811344e81..36d3b8b9da47 100644 --- a/drivers/firmware/efi/cper-arm.c +++ b/drivers/firmware/efi/cper-arm.c @@ -1,20 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * UEFI Common Platform Error Record (CPER) support * * Copyright (C) 2017, The Linux Foundation. All rights reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include diff --git a/drivers/firmware/efi/cper.c b/drivers/firmware/efi/cper.c index a7902fccdcfa..6a966ecdd80a 100644 --- a/drivers/firmware/efi/cper.c +++ b/drivers/firmware/efi/cper.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * UEFI Common Platform Error Record (CPER) support * @@ -9,19 +10,6 @@ * * For more information about CPER, please refer to Appendix N of UEFI * Specification version 2.4. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include diff --git a/drivers/firmware/efi/dev-path-parser.c b/drivers/firmware/efi/dev-path-parser.c index 85d1834ee9b7..85ec99f97841 100644 --- a/drivers/firmware/efi/dev-path-parser.c +++ b/drivers/firmware/efi/dev-path-parser.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * dev-path-parser.c - EFI Device Path parser * Copyright (C) 2016 Lukas Wunner @@ -5,14 +6,6 @@ * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License (version 2) as * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . */ #include diff --git a/drivers/firmware/efi/efi-bgrt.c b/drivers/firmware/efi/efi-bgrt.c index b22ccfb0c991..a2384184a7de 100644 --- a/drivers/firmware/efi/efi-bgrt.c +++ b/drivers/firmware/efi/efi-bgrt.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright 2012 Intel Corporation * Author: Josh Triplett @@ -5,10 +6,6 @@ * Based on the bgrt driver: * Copyright 2012 Red Hat, Inc * Author: Matthew Garrett - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt diff --git a/drivers/firmware/efi/efi-pstore.c b/drivers/firmware/efi/efi-pstore.c index 0f7d97917197..9ea13e8d12ec 100644 --- a/drivers/firmware/efi/efi-pstore.c +++ b/drivers/firmware/efi/efi-pstore.c @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0+ + #include #include #include diff --git a/drivers/firmware/efi/efibc.c b/drivers/firmware/efi/efibc.c index 503bbe2a9d49..61e099826cbb 100644 --- a/drivers/firmware/efi/efibc.c +++ b/drivers/firmware/efi/efibc.c @@ -1,15 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0 /* * efibc: control EFI bootloaders which obey LoaderEntryOneShot var * Copyright (c) 2013-2016, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. */ #define pr_fmt(fmt) "efibc: " fmt diff --git a/drivers/firmware/efi/efivars.c b/drivers/firmware/efi/efivars.c index 8061667a6765..7576450c8254 100644 --- a/drivers/firmware/efi/efivars.c +++ b/drivers/firmware/efi/efivars.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Originally from efivars.c, * @@ -6,63 +7,6 @@ * * This code takes all variables accessible from EFI runtime and * exports them via sysfs - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Changelog: - * - * 17 May 2004 - Matt Domsch - * remove check for efi_enabled in exit - * add MODULE_VERSION - * - * 26 Apr 2004 - Matt Domsch - * minor bug fixes - * - * 21 Apr 2004 - Matt Tolentino - * fix locking per Peter Chubb's findings - * - * 25 Mar 2002 - Matt Domsch - * move uuid_unparse() to include/asm-ia64/efi.h:efi_guid_to_str() - * - * 12 Feb 2002 - Matt Domsch - * use list_for_each_safe when deleting vars. - * remove ifdef CONFIG_SMP around include - * v0.04 release to linux-ia64@linuxia64.org - * - * 20 April 2001 - Matt Domsch - * Moved vars from /proc/efi to /proc/efi/vars, and made - * efi.c own the /proc/efi directory. - * v0.03 release to linux-ia64@linuxia64.org - * - * 26 March 2001 - Matt Domsch - * At the request of Stephane, moved ownership of /proc/efi - * to efi.c, and now efivars lives under /proc/efi/vars. - * - * 12 March 2001 - Matt Domsch - * Feedback received from Stephane Eranian incorporated. - * efivar_write() checks copy_from_user() return value. - * efivar_read/write() returns proper errno. - * v0.02 release to linux-ia64@linuxia64.org - * - * 26 February 2001 - Matt Domsch - * v0.01 release to linux-ia64@linuxia64.org */ #include diff --git a/drivers/firmware/efi/esrt.c b/drivers/firmware/efi/esrt.c index 5d06bd247d07..d6dd5f503fa2 100644 --- a/drivers/firmware/efi/esrt.c +++ b/drivers/firmware/efi/esrt.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * esrt.c * diff --git a/drivers/firmware/efi/fake_mem.c b/drivers/firmware/efi/fake_mem.c index 6c7d60c239b5..9501edc0fcfb 100644 --- a/drivers/firmware/efi/fake_mem.c +++ b/drivers/firmware/efi/fake_mem.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * fake_mem.c * @@ -8,21 +9,6 @@ * By specifying this parameter, you can add arbitrary attribute to * specific memory range by updating original (firmware provided) EFI * memmap. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, see . - * - * The full GNU General Public License is included in this distribution in - * the file called "COPYING". */ #include diff --git a/drivers/firmware/efi/libstub/arm32-stub.c b/drivers/firmware/efi/libstub/arm32-stub.c index becbda445913..e8f7aefb6813 100644 --- a/drivers/firmware/efi/libstub/arm32-stub.c +++ b/drivers/firmware/efi/libstub/arm32-stub.c @@ -1,10 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2013 Linaro Ltd; - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * */ #include #include diff --git a/drivers/firmware/efi/libstub/arm64-stub.c b/drivers/firmware/efi/libstub/arm64-stub.c index 1b4d465cc5d9..1550d244e996 100644 --- a/drivers/firmware/efi/libstub/arm64-stub.c +++ b/drivers/firmware/efi/libstub/arm64-stub.c @@ -1,13 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2013, 2014 Linaro Ltd; * * This file implements the EFI boot stub for the arm64 kernel. * Adapted from ARM version by Mark Salter - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * */ /* diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c index e94975f4655b..8f2d000bec75 100644 --- a/drivers/firmware/efi/libstub/efi-stub-helper.c +++ b/drivers/firmware/efi/libstub/efi-stub-helper.c @@ -1,13 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Helper functions used by the EFI stub on multiple * architectures. This should be #included by the EFI stub * implementation files. * * Copyright 2011 Intel Corporation; author Matt Fleming - * - * This file is part of the Linux kernel, and is made available - * under the terms of the GNU General Public License version 2. - * */ #include diff --git a/drivers/firmware/efi/libstub/fdt.c b/drivers/firmware/efi/libstub/fdt.c index d474964b873b..7cfc51935c4b 100644 --- a/drivers/firmware/efi/libstub/fdt.c +++ b/drivers/firmware/efi/libstub/fdt.c @@ -1,13 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 /* * FDT related Helper functions used by the EFI stub on multiple * architectures. This should be #included by the EFI stub * implementation files. * * Copyright 2013 Linaro Limited; author Roy Franz - * - * This file is part of the Linux kernel, and is made available - * under the terms of the GNU General Public License version 2. - * */ #include diff --git a/drivers/firmware/efi/libstub/gop.c b/drivers/firmware/efi/libstub/gop.c index 24c461dea7af..0101ca4c13b1 100644 --- a/drivers/firmware/efi/libstub/gop.c +++ b/drivers/firmware/efi/libstub/gop.c @@ -1,10 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* ----------------------------------------------------------------------- * * Copyright 2011 Intel Corporation; author Matt Fleming * - * This file is part of the Linux kernel, and is made available under - * the terms of the GNU General Public License version 2. - * * ----------------------------------------------------------------------- */ #include diff --git a/drivers/firmware/efi/libstub/random.c b/drivers/firmware/efi/libstub/random.c index e0e603a89aa9..b4b1d1dcb5fd 100644 --- a/drivers/firmware/efi/libstub/random.c +++ b/drivers/firmware/efi/libstub/random.c @@ -1,10 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2016 Linaro Ltd; - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * */ #include diff --git a/drivers/firmware/efi/libstub/secureboot.c b/drivers/firmware/efi/libstub/secureboot.c index 72d9dfbebf08..edba5e7a3743 100644 --- a/drivers/firmware/efi/libstub/secureboot.c +++ b/drivers/firmware/efi/libstub/secureboot.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Secure boot handling. * @@ -5,9 +6,6 @@ * Roy Franz - * - * This file is part of the Linux kernel, and is made available under the - * terms of the GNU General Public License version 2. */ #include #include diff --git a/drivers/firmware/efi/libstub/tpm.c b/drivers/firmware/efi/libstub/tpm.c index a90b0b8fc69a..5bd04f75d8d6 100644 --- a/drivers/firmware/efi/libstub/tpm.c +++ b/drivers/firmware/efi/libstub/tpm.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * TPM handling. * @@ -5,9 +6,6 @@ * Copyright (C) 2017 Google, Inc. * Matthew Garrett * Thiebaud Weksteen - * - * This file is part of the Linux kernel, and is made available under the - * terms of the GNU General Public License version 2. */ #include #include diff --git a/drivers/firmware/efi/memattr.c b/drivers/firmware/efi/memattr.c index aac972b056d9..58452fde92cc 100644 --- a/drivers/firmware/efi/memattr.c +++ b/drivers/firmware/efi/memattr.c @@ -1,9 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2016 Linaro Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. */ #define pr_fmt(fmt) "efi: memattr: " fmt diff --git a/drivers/firmware/efi/runtime-map.c b/drivers/firmware/efi/runtime-map.c index 84a11d0a8023..ad9ddefc9dcb 100644 --- a/drivers/firmware/efi/runtime-map.c +++ b/drivers/firmware/efi/runtime-map.c @@ -1,8 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0 /* * linux/drivers/efi/runtime-map.c * Copyright (C) 2013 Red Hat, Inc., Dave Young - * - * This file is released under the GPLv2. */ #include diff --git a/drivers/firmware/efi/test/efi_test.c b/drivers/firmware/efi/test/efi_test.c index 51ecf7d6da48..877745c3aaf2 100644 --- a/drivers/firmware/efi/test/efi_test.c +++ b/drivers/firmware/efi/test/efi_test.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * EFI Test Driver for Runtime Services * diff --git a/drivers/firmware/efi/test/efi_test.h b/drivers/firmware/efi/test/efi_test.h index 5f4818bf112f..f2446aa1c2e3 100644 --- a/drivers/firmware/efi/test/efi_test.h +++ b/drivers/firmware/efi/test/efi_test.h @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * EFI Test driver Header * diff --git a/drivers/firmware/efi/tpm.c b/drivers/firmware/efi/tpm.c index 0cbeb3d46b18..3a689b40ccc0 100644 --- a/drivers/firmware/efi/tpm.c +++ b/drivers/firmware/efi/tpm.c @@ -1,10 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2017 Google, Inc. * Thiebaud Weksteen - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. */ #include diff --git a/drivers/firmware/efi/vars.c b/drivers/firmware/efi/vars.c index fceaafd67ec6..436d1776bc7b 100644 --- a/drivers/firmware/efi/vars.c +++ b/drivers/firmware/efi/vars.c @@ -1,22 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Originally from efivars.c * * Copyright (C) 2001,2003,2004 Dell * Copyright (C) 2004 Intel Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include From patchwork Sat Feb 2 09:41:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 157330 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1509914jaa; Sat, 2 Feb 2019 01:41:42 -0800 (PST) X-Google-Smtp-Source: ALg8bN7z+W10EtygAab1BrnK8KPxizRYKkCKXHBLm4jZLhrLUEDu/1VBFV/XlQl8BEy48fePbtEh X-Received: by 2002:a17:902:6b49:: with SMTP id g9mr42439057plt.98.1549100502221; Sat, 02 Feb 2019 01:41:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549100502; cv=none; d=google.com; s=arc-20160816; b=ijOFdKfB8tVrA8SB9o+Y2KbCcJJcLpnwvELlAvQ60G3ixWd2yIkouUNld7TozY21vf GSzrEgof+F3uQWJ1EHk6U87SeozrFdPU691d+W3/S8a7nqxHIf842sZ5lT0AW04yuVdj qZD/CHtPGT3hjHkPcy/rx+dEV35ROWbgGDQchCUPY0wXONBuY4riLRtugbdk9AzMSk7n zpngs5J9PGHd8316suYxHeUfUbrq7aWWH2lgrjABCS9OpsWFqoBKm6K6CwCQpJCCEiP5 3qQqTVFPjKfSwsB0VTblKCen+eZtNz9hCBMOrlbM0WR2RGCq2ScqIisHOl/ndu9UIQhg NEzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=tQBUl2UZJ0vfR/KYX3Z1OnD6qvSuR/J3cZ1KmLStMQw=; b=dLONtceJLBAn4vzdsaiAA+g3BwVtmdEg4/5Ksr4QaKl/Khj3PpURdYoogZS2NN72zr bQIpNU/d9HHuMCgRSi0sDi2vH9kvg4Bf6BMgrirqG9vIwDewvJ6S4+ITNxYI6w09rQrT 2JWPzuwxvbAEWdrRk1CGH23hvktkCssWLfPDc4mnE5bwlp0a4LXtWVTHuAYm1nuUonlL aFaKJSvfkD7naHWFv6h0nnUgZYZYrQjQ5AjxYLykcAE4QudGJ5psvpV5r2hgLzPsTvEc 1cGiia5UGI1xRutYpKQtMoNV3mh81pncwwwNCPSFmLaPyBuDKq6zRaq3Iu8DwysW3F/w PwZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="hBLc/6O/"; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y10si8686394pgp.348.2019.02.02.01.41.42; Sat, 02 Feb 2019 01:41:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="hBLc/6O/"; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727594AbfBBJlk (ORCPT + 3 others); Sat, 2 Feb 2019 04:41:40 -0500 Received: from mail-ed1-f68.google.com ([209.85.208.68]:44262 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727627AbfBBJlj (ORCPT ); Sat, 2 Feb 2019 04:41:39 -0500 Received: by mail-ed1-f68.google.com with SMTP id y56so7435168edd.11 for ; Sat, 02 Feb 2019 01:41:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tQBUl2UZJ0vfR/KYX3Z1OnD6qvSuR/J3cZ1KmLStMQw=; b=hBLc/6O/QY8ijpLk6qYy7tQmvlFjGW9YPnqwanYXgw1mgswBhE7ZzJjwAUG38zOxdS 5yAiGypuQ8Ks8fEg8zGfrguYNTBmpN5lwRbPbfRn9cMAzutBavYdzkrdlHgRVz86LIuA wwuGWvX0yxxs6x2Os2bCXL+F69LaZsymCxNxI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tQBUl2UZJ0vfR/KYX3Z1OnD6qvSuR/J3cZ1KmLStMQw=; b=EWtE/s4zCe46hxU+4lDzHp/COrUAV/fHR1GNTf5u0VhmijAX1oB5nLWJPGzq/Gp1zZ 4BQrLSu38L4020d5qS+Ok+MpSHNlx9Z8WnDFFKmST8axnD4zK+d4g9IcOsahy6fvoWIS YCMrs67P61IbtCRKAukWsQ3obQAptFMqaTUXmMggmcJdU5EakpPjVlLwMWXxYLBVvZK6 QycOakzIcLawtsEOdlWJKii9CQaupgBkiBqi0tOFzYogybC+GeiRBB6YloeX1Dsok0cp LujcnwOFwzQUFZEGuKC53brqztcB9C3ODVMGy1ZYGA5iLW70VsH0Wqfh0sxIOIKLh0zz KHRA== X-Gm-Message-State: AJcUukduuFA8l7+clqWunSubuXJnp3Zq+oBFtAN7k/h8oB3z8XNOVxY+ WarEvvBfhlovxlhgHqgX5KbF7zok8yWqrg== X-Received: by 2002:a50:a786:: with SMTP id i6mr42297103edc.37.1549100497431; Sat, 02 Feb 2019 01:41:37 -0800 (PST) Received: from mba13.c.hoisthospitality.com ([109.236.135.164]) by smtp.gmail.com with ESMTPSA id l41sm2608824eda.83.2019.02.02.01.41.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 02 Feb 2019 01:41:36 -0800 (PST) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner Cc: Ard Biesheuvel , linux-kernel@vger.kernel.org, AKASHI Takahiro , Alexander Graf , Bjorn Andersson , Borislav Petkov , Heinrich Schuchardt , Jeffrey Hugo , Lee Jones , Leif Lindholm , Linus Torvalds , Peter Jones , Peter Zijlstra , Sai Praneeth Prakhya Subject: [PATCH 07/10] efi: arm/arm64: allow SetVirtualAddressMap() to be omitted Date: Sat, 2 Feb 2019 10:41:16 +0100 Message-Id: <20190202094119.13230-8-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190202094119.13230-1-ard.biesheuvel@linaro.org> References: <20190202094119.13230-1-ard.biesheuvel@linaro.org> Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org The UEFI spec revision 2.7 errata A section 8.4 has the following to say about the virtual memory runtime services: "This section contains function definitions for the virtual memory support that may be optionally used by an operating system at runtime. If an operating system chooses to make EFI runtime service calls in a virtual addressing mode instead of the flat physical mode, then the operating system must use the services in this section to switch the EFI runtime services from flat physical addressing to virtual addressing." So it is pretty clear that calling SetVirtualAddressMap() is entirely optional, and so there is no point in doing so unless it achieves anything useful for us. This is not the case for 64-bit ARM. The identity mapping used by the firmware is arbitrarily converted into another permutation of userland addresses (i.e., bits [63:48] cleared), and the runtime code could easily deal with the original layout in exactly the same way as it deals with the converted layout. However, due to constraints related to page size differences if the OS is not running with 4k pages, and related to systems that may expose the individual sections of PE/COFF runtime modules as different memory regions, creating the virtual layout is a bit fiddly, and requires us to sort the memory map and reason about adjacent regions with identical memory types etc etc. So the obvious fix is to stop calling SetVirtualAddressMap() altogether on arm64 systems. However, to avoid surprises, which are notoriously hard to diagnose when it comes to OS<->firmware interactions, let's start by making it an opt-out feature, and implement support for the 'efi=novamap' kernel command line parameter on ARM and arm64 systems. (Note that 32-bit ARM generally does require SetVirtualAddressMap() to be used, given that the physical memory map and the kernel virtual address map are not guaranteed to be non-overlapping like on arm64. However, having support for efi=novamap,noruntime on 32-bit ARM, combined with the recently proposed support for earlycon=efifb, is likely to be useful to diagnose boot issues on such systems if they have no accessible serial port) Cc: Alexander Graf Cc: Heinrich Schuchardt Cc: AKASHI Takahiro Cc: Leif Lindholm Tested-by: Jeffrey Hugo Tested-by: Bjorn Andersson Tested-by: Lee Jones Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/libstub/arm-stub.c | 5 +++++ drivers/firmware/efi/libstub/efi-stub-helper.c | 10 ++++++++++ drivers/firmware/efi/libstub/efistub.h | 1 + drivers/firmware/efi/libstub/fdt.c | 3 +++ 4 files changed, 19 insertions(+) -- 2.17.1 diff --git a/drivers/firmware/efi/libstub/arm-stub.c b/drivers/firmware/efi/libstub/arm-stub.c index eee42d5e25ee..626ec4b4a664 100644 --- a/drivers/firmware/efi/libstub/arm-stub.c +++ b/drivers/firmware/efi/libstub/arm-stub.c @@ -370,6 +370,11 @@ void efi_get_virtmap(efi_memory_desc_t *memory_map, unsigned long map_size, paddr = in->phys_addr; size = in->num_pages * EFI_PAGE_SIZE; + if (novamap()) { + in->virt_addr = in->phys_addr; + continue; + } + /* * Make the mapping compatible with 64k pages: this allows * a 4k page size kernel to kexec a 64k page size kernel and diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c index 8f2d000bec75..e4610e72b78f 100644 --- a/drivers/firmware/efi/libstub/efi-stub-helper.c +++ b/drivers/firmware/efi/libstub/efi-stub-helper.c @@ -31,6 +31,7 @@ static unsigned long __chunk_size = EFI_READ_CHUNK_SIZE; static int __section(.data) __nokaslr; static int __section(.data) __quiet; +static int __section(.data) __novamap; int __pure nokaslr(void) { @@ -40,6 +41,10 @@ int __pure is_quiet(void) { return __quiet; } +int __pure novamap(void) +{ + return __novamap; +} #define EFI_MMAP_NR_SLACK_SLOTS 8 @@ -479,6 +484,11 @@ efi_status_t efi_parse_options(char const *cmdline) __chunk_size = -1UL; } + if (!strncmp(str, "novamap", 7)) { + str += strlen("novamap"); + __novamap = 1; + } + /* Group words together, delimited by "," */ while (*str && *str != ' ' && *str != ',') str++; diff --git a/drivers/firmware/efi/libstub/efistub.h b/drivers/firmware/efi/libstub/efistub.h index cefcf6ba3150..1b1dfcaa6fb9 100644 --- a/drivers/firmware/efi/libstub/efistub.h +++ b/drivers/firmware/efi/libstub/efistub.h @@ -27,6 +27,7 @@ extern int __pure nokaslr(void); extern int __pure is_quiet(void); +extern int __pure novamap(void); #define pr_efi(sys_table, msg) do { \ if (!is_quiet()) efi_printk(sys_table, "EFI stub: "msg); \ diff --git a/drivers/firmware/efi/libstub/fdt.c b/drivers/firmware/efi/libstub/fdt.c index 7cfc51935c4b..5440ba17a1c5 100644 --- a/drivers/firmware/efi/libstub/fdt.c +++ b/drivers/firmware/efi/libstub/fdt.c @@ -318,6 +318,9 @@ efi_status_t allocate_new_fdt_and_exit_boot(efi_system_table_t *sys_table, if (status == EFI_SUCCESS) { efi_set_virtual_address_map_t *svam; + if (novamap()) + return EFI_SUCCESS; + /* Install the new virtual address map */ svam = sys_table->runtime->set_virtual_address_map; status = svam(runtime_entry_count * desc_size, desc_size,