From patchwork Mon Jul 23 01:57:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 142528 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp5522670ljj; Sun, 22 Jul 2018 18:59:40 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfl3TF7JSL7XrEV9ojIykEGAcKMkZaNyWN4CWMt8KVf+DtxAXPaCS5iYM4BA99xojJY146F X-Received: by 2002:a63:161a:: with SMTP id w26-v6mr10602391pgl.257.1532311180157; Sun, 22 Jul 2018 18:59:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532311180; cv=none; d=google.com; s=arc-20160816; b=ZJQ51TBDIprxt36iYvOzhyefUWp5w2FXd5+apdHPprThL038WmxDh1ltKIMb5aJaST r+82ux3Gz7ZxMEw7XzwHI4eOf24bDl+KgUyQQUl4YL4uFYeTw/j7ywc2szO2X9G8L5gn vvBVQAyJ4k6dL3SdX+joTlLgo2AIfAYZwdBf7OdvugiZiXD81vUoEUPbxbJZJoKfY5A9 xO4ZT3uX0qrHfasUd0e37bA6r++BnHa+n2LTQzMfg3BQtARTPesEebVQfkToW3wDxQxV xIeT1zzVS1/B1yQ1+jcB/tSjkc9zNFjRRGk9y4pqkFQkrfifxwJsccdxOzj7dTPfE8IY HzGw== 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:arc-authentication-results; bh=erM0Z9H4UEy3rQv1/bN5wC7X6sLU17kati65NrFno1I=; b=kJ+lX5pqYFxxh9mA5kgeoOukqVFA8Ms2Me2rwR3+M3AiJIHuNO2XL3sjY894dnwo9S 4wJge2yCA+S1JR2NZtHU7FoZ0oD6369n5+7hAifqu0xYtJI2KYayQhO0TRhjaRbqz2so NJPPi4z4zvC9+uZocMItQJ7FMkNd9n0Z27CosSDHsyNIeT4iQXU/AR14LbWroxPteUhs vfFpP+V7g1zKd4n7QNhSC/2LU4WnTo0JDei6sMaOZx9ER+jhuuZhjdGo84UYgP9ZL9xp DNFdTqI4GmLrRCHyctDH1zd3mRocoWvOU+bR+i2dNawsxAUjx0+njU+/rThplab3etUJ MYCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TBTOJQLk; 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; 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 f4-v6si7099710plo.226.2018.07.22.18.59.39; Sun, 22 Jul 2018 18:59:40 -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; dkim=pass header.i=@linaro.org header.s=google header.b=TBTOJQLk; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387722AbeGWC6Y (ORCPT + 31 others); Sun, 22 Jul 2018 22:58:24 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:46609 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731059AbeGWC6Y (ORCPT ); Sun, 22 Jul 2018 22:58:24 -0400 Received: by mail-pl0-f67.google.com with SMTP id t17-v6so4986923ply.13 for ; Sun, 22 Jul 2018 18:59:37 -0700 (PDT) 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=erM0Z9H4UEy3rQv1/bN5wC7X6sLU17kati65NrFno1I=; b=TBTOJQLkajO3HY6BXZarrvI5rygueAf02u7zvXLiL8oTEfyaCJiEWTAKkFQD5siKva mwaNxKr1ko7O/hpoL0Yf46+dJ/Gmq4FUsvC+B1nuuSBCRmjKi15MRKmf61rtoDX8JMnh nAAee1TLGfgJeNxcajORbEOx9nj83BlAi5ICU= 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=erM0Z9H4UEy3rQv1/bN5wC7X6sLU17kati65NrFno1I=; b=uGU//AUicRI//PR+UpxHnK+g9mXaOQAQjNqOAGxjZ7Dq+O95FBZrvwTv5LGmTkeAzd DYeU6RelqMHh/HoSPWUy5sr1tWepi+ZrNfx3ZBWOzNacC0tjhGKmGZEAB7p0bkgTOAB9 P0z3xHvqnxyClPog6WiFgAJEL8z9RXN3d5pZyKECBsGuSDpEhomwZn7K/8aYGewz1LWJ QD6jdMGUbCZCdRi7igPQluHMopQNGlI/nbDzpRiIinJe+OHsDpgOfqIIFxd42PJjnz+r csUEe2je3oC+jAd0P+QHWAXnJfqjWBZ2S/P6/1SXkena+42Wyi0fez2D+q5tmzFrTz40 1a4g== X-Gm-Message-State: AOUpUlHv+h2IixoNMw+XYUpW306kzl6eNAtu0+pLxT7uloFHWxuu6TqL a7WTynPj0Lt+ABXOEFcIN+6Jsg== X-Received: by 2002:a17:902:583:: with SMTP id f3-v6mr11083324plf.115.1532311176843; Sun, 22 Jul 2018 18:59:36 -0700 (PDT) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id h190-v6sm15115682pge.85.2018.07.22.18.59.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 22 Jul 2018 18:59:36 -0700 (PDT) From: AKASHI Takahiro To: catalin.marinas@arm.com, will.deacon@arm.com, rjw@rjwysocki.net, lenb@kernel.org, ard.biesheuvel@linaro.org Cc: tbaicar@codeaurora.org, bhsharma@redhat.com, dyoung@redhat.com, james.morse@arm.com, mark.rutland@arm.com, al.stone@linaro.org, graeme.gregory@linaro.org, hanjun.guo@linaro.org, lorenzo.pieralisi@arm.com, sudeep.holla@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kexec@lists.infradead.org Subject: [PATCH v4 3/5] efi/arm: preserve early mapping of UEFI memory map longer for BGRT Date: Mon, 23 Jul 2018 10:57:30 +0900 Message-Id: <20180723015732.24252-4-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180723015732.24252-1-takahiro.akashi@linaro.org> References: <20180723015732.24252-1-takahiro.akashi@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ard Biesheuvel The BGRT code validates the contents of the table against the UEFI memory map, and so it expects it to be mapped when the code runs. On ARM, this is currently not the case, since we tear down the early mapping after efi_init() completes, and only create the permanent mapping in arm_enable_runtime_services(), which executes as an early initcall, but still leaves a window where the UEFI memory map is not mapped. So move the call to efi_memmap_unmap() from efi_init() to arm_enable_runtime_services(). Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/arm-init.c | 1 - drivers/firmware/efi/arm-runtime.c | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) -- 2.18.0 diff --git a/drivers/firmware/efi/arm-init.c b/drivers/firmware/efi/arm-init.c index b5214c143fee..388a929baf95 100644 --- a/drivers/firmware/efi/arm-init.c +++ b/drivers/firmware/efi/arm-init.c @@ -259,7 +259,6 @@ void __init efi_init(void) reserve_regions(); efi_esrt_init(); - efi_memmap_unmap(); memblock_reserve(params.mmap & PAGE_MASK, PAGE_ALIGN(params.mmap_size + diff --git a/drivers/firmware/efi/arm-runtime.c b/drivers/firmware/efi/arm-runtime.c index 5889cbea60b8..59a8c0ec94d5 100644 --- a/drivers/firmware/efi/arm-runtime.c +++ b/drivers/firmware/efi/arm-runtime.c @@ -115,6 +115,8 @@ static int __init arm_enable_runtime_services(void) return 0; } + efi_memmap_unmap(); + if (efi_runtime_disabled()) { pr_info("EFI runtime services will be disabled.\n"); return 0;