From patchwork Thu Nov 8 18:45:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 150589 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1189422ljp; Thu, 8 Nov 2018 10:46:07 -0800 (PST) X-Google-Smtp-Source: AJdET5fpisifeeclN959V4et5rx2dkHtoTMzYjf2UIhJtJDBxILkJQzAPPLU/Jq9Ov1Zsu1U8pY7 X-Received: by 2002:a62:6981:: with SMTP id e123-v6mr5667456pfc.104.1541702767555; Thu, 08 Nov 2018 10:46:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541702767; cv=none; d=google.com; s=arc-20160816; b=uSOwhJSw+PeUOA1QAzD0/2HyEtQAbI/SSGq0AbImTNRdjF3StHI05j71DAWTM2Tu1U KxVZDaOGiVX77iYy2YWNHyR9b9Wjk46TCm1HrgU65ba0DpZMeiHQ/mz7xbeZ81AWrWuC 2kNZ7HLZSWyqDfLKzMzfuICwARPQOqXbKJHSQWIDRdScZjk3lAdNNExxo3LjqHiPUnO/ vnHbxYhos2fNax0OPxQBhUNMm5r+Zgt396EPT8ABJZcl0lIt7RUsXlCGDMVcHurqumXD uiVO8nfUscL9YqspoJqUL6Q62Pbk+iFNEcL6/PkXr6I/aStc82gROY50tHZ22LgIHeov AuYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zdGv+oVf/CZZxAJf0IhvH0KDdYwNbAZEs9agoXrU6qY=; b=vDZJCfTH+OEb1AaAUEsUXSlm888eA/TBgRXLDlDShdS3FA18bwZkcO3/ykCkZrcOi3 2oTFZ+2S98eWfGb3oekVC0/5w/aZBy8iT4QFwZgkgaoIi6vLsL0NV7UQ8ruadvWgnrA7 TLTHmQp+4WWfwODFb5UhL0i73/ZBdMflWyPdbLilECV6a0/5CpB1m8+As8eoK5nbmV8j 6PQZVYS0CZ/IRh1WScolyHNFgMhntKDXvTrtbesiwsA/g+KrIfXHM8VVenoqmPcaWNgZ r98cF6NZq+cn6w8meTnPoVgWikyVt652Zql3yKHGEjZbdGkX8bHWNgmw09+eNspFUKE7 xdag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TB5WEYDR; 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 i25-v6si4199518pgi.426.2018.11.08.10.46.07; Thu, 08 Nov 2018 10:46:07 -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=TB5WEYDR; 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 S1727426AbeKIEWx (ORCPT + 3 others); Thu, 8 Nov 2018 23:22:53 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:43833 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726751AbeKIEWw (ORCPT ); Thu, 8 Nov 2018 23:22:52 -0500 Received: by mail-wr1-f65.google.com with SMTP id y3-v6so22064786wrh.10 for ; Thu, 08 Nov 2018 10:46:04 -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 :mime-version:content-transfer-encoding; bh=zdGv+oVf/CZZxAJf0IhvH0KDdYwNbAZEs9agoXrU6qY=; b=TB5WEYDRB/3KjDRkWLPxp0BvWbP//zTZ1PJJs2w1o0mJj9LFYDVH+T1jVyYlNnCDm/ 8oYfd5PR2Xzb8jP8lVb1KAND3s4+VgiBPFvdXkKPydvMxv5laV+rGa0YrON2glhMT8r5 NNawbkuc5ZKn2/h0AGi7eQJsUGm1CDo1ZXwCw= 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:mime-version:content-transfer-encoding; bh=zdGv+oVf/CZZxAJf0IhvH0KDdYwNbAZEs9agoXrU6qY=; b=Lz3JAyfSNkyeeVDOnts35AujNGjbvG7KgmYeNwi0W7O8I4A9PWTAVpDsHYqgkMhDf7 i/BUozoRzL/03zSEahRe2jhOTqdbrBusqJsoLGLWYstYcat2DVRHh9dkrEvt/qW+BfWt e2+F3q09fV0JcoTYaclsPugM7i9VQ69Hi8r9SGD0HM1yflGwFV4XPzcGV7wgQQ9W/pLc sygg6mg0Hoir9o2Cw0tJ04nnEkg2KblZrT+MsQdiXuDJFGKg9dIXeWVbpaIUwUVSfQXH QpHYBawJnslC3BpDbUiSYiuIPnNWXp3DfVmOEBsMBKXVbE2esWbGR8i6Zz0TCBHeiQYZ xu3Q== X-Gm-Message-State: AGRZ1gLgMaY0aJpsvReMgDvqfIYXRadOXb/Z2DMzRIpnKrs2iH3A3lDV w+F9k/PH1ctSrjce0EAQAxafum1hbGE= X-Received: by 2002:a5d:650c:: with SMTP id x12-v6mr5391053wru.150.1541702763326; Thu, 08 Nov 2018 10:46:03 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:744a:cf78:9aaa:a66d]) by smtp.gmail.com with ESMTPSA id r2-v6sm2821050wrq.1.2018.11.08.10.46.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Nov 2018 10:46:02 -0800 (PST) From: Ard Biesheuvel To: linux-efi@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, will.deacon@arm.com, marc.zyngier@arm.com, mark.rutland@arm.com, leif.lindholm@linaro.org, Ard Biesheuvel Subject: [PATCH 1/2] efi: arm: revert deferred unmap of early memmap mapping Date: Thu, 8 Nov 2018 19:45:51 +0100 Message-Id: <20181108184552.14366-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181108184552.14366-1-ard.biesheuvel@linaro.org> References: <20181108184552.14366-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org Commit 3ea86495aef2 ("efi/arm: preserve early mapping of UEFI memory map longer for BGRT") deferred the unmap of the early mapping of the UEFI to accommodate the ACPI BGRT code, which looks up the memory type that backs the BGRT table to validate it against the requirements of the UEFI spec. Unfortunately, this causes problems on ARM, which does not permit early mappings to persist after paging_init() is called, resulting in a WARN() splat. Since we don't support the BGRT table on ARM anway, let's revert ARM to the old behaviour, which is to take down the early mapping at the end of efi_init(). Fixes: 3ea86495aef2 ("efi/arm: preserve early mapping of UEFI memory ...") Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/arm-init.c | 4 ++++ drivers/firmware/efi/arm-runtime.c | 2 +- drivers/firmware/efi/memmap.c | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) -- 2.19.1 diff --git a/drivers/firmware/efi/arm-init.c b/drivers/firmware/efi/arm-init.c index 388a929baf95..1a6a77df8a5e 100644 --- a/drivers/firmware/efi/arm-init.c +++ b/drivers/firmware/efi/arm-init.c @@ -265,6 +265,10 @@ void __init efi_init(void) (params.mmap & ~PAGE_MASK))); init_screen_info(); + + /* ARM does not permit early mappings to persist across paging_init() */ + if (IS_ENABLED(CONFIG_ARM)) + efi_memmap_unmap(); } static int __init register_gop_device(void) diff --git a/drivers/firmware/efi/arm-runtime.c b/drivers/firmware/efi/arm-runtime.c index 922cfb813109..a00934d263c5 100644 --- a/drivers/firmware/efi/arm-runtime.c +++ b/drivers/firmware/efi/arm-runtime.c @@ -110,7 +110,7 @@ static int __init arm_enable_runtime_services(void) { u64 mapsize; - if (!efi_enabled(EFI_BOOT) || !efi_enabled(EFI_MEMMAP)) { + if (!efi_enabled(EFI_BOOT)) { pr_info("EFI services will not be available.\n"); return 0; } diff --git a/drivers/firmware/efi/memmap.c b/drivers/firmware/efi/memmap.c index fa2904fb841f..38b686c67b17 100644 --- a/drivers/firmware/efi/memmap.c +++ b/drivers/firmware/efi/memmap.c @@ -118,6 +118,9 @@ int __init efi_memmap_init_early(struct efi_memory_map_data *data) void __init efi_memmap_unmap(void) { + if (!efi_enabled(EFI_MEMMAP)) + return; + if (!efi.memmap.late) { unsigned long size;