Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1072064imm; Mon, 9 Jul 2018 16:44:15 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc7VonDXA+tEBfM44qGtuRHbiWXO5oyKphU1Fzn0Ir3Fv4ztxCpql2Z0+rRlwpY3aEug/sz X-Received: by 2002:a17:902:740b:: with SMTP id g11-v6mr16697859pll.85.1531179855221; Mon, 09 Jul 2018 16:44:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531179855; cv=none; d=google.com; s=arc-20160816; b=MDXHAtKhUv/X1btr/lohUbpcz0OqIcOkaf6I7gpBnMiMxlvJgZaSWLSllIiv2DCpo5 cl3JMPECx51uwi/j26eYkkZaRxdTCCMxFtl4RxbYYXgPm+qf7I6wDfoY94lg/Z6/UC2J xVYDYnPo4NtQkCHr3mBi/SoYI0ob6hVLHRDd6HGDq+hqmAlGOvgnX2NEu1yBWJMYe1kn l9qCtuTB/y//CGBKB/NHbn8XviKGOBvPL9D842idy1ZIf0P6FGc5zliYYLr7bb+W2H3A mkY1RS2RLPNPlzznqBNEx9W9eA89ZuZQ/0Fo0SJqfj0enM9ehLG58zp7OqO0Ntyji8Qu W3Kw== 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=6svwEjRZKw/fRIHWE4svwtkCI66G0b2U5AUFtaL5oWI=; b=SofT5UIoDWqUDOntWjp84kKfFmJkLCaqV/A4W09jexqt2RsEWgawSICHcOQ2JaCEr7 4JSQKInHPlkNlHVsy077jFBG5K/E5jankkirRjvOnmwSzCx7SyAdCst8dnKEqXrmdPjn 3+b0Pwba99JX1Mgy/rh1oUy4L32P57zjBu7afz4/cxiBXgYCobr4G17BFI0sXT3oaqen wLT6Bm3Cm7rHn8a+llnW1MDPBMlDiyVZfJH/tmRUVUXTswVk5sRUhZPm9E6JdcFrYQCN fpNIoN7Ly/77yz7z1ubvlle6ifYqEjBPufkMPe1q01XOwq958uR5U3K8BibukX1JtIaf bfPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FeTciVgR; 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 z77-v6si16491847pff.100.2018.07.09.16.44.00; Mon, 09 Jul 2018 16:44:15 -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=FeTciVgR; 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 S933409AbeGIXmU (ORCPT + 99 others); Mon, 9 Jul 2018 19:42:20 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:38244 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933313AbeGIXmR (ORCPT ); Mon, 9 Jul 2018 19:42:17 -0400 Received: by mail-pf0-f193.google.com with SMTP id x13-v6so4806297pfh.5 for ; Mon, 09 Jul 2018 16:42:17 -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=6svwEjRZKw/fRIHWE4svwtkCI66G0b2U5AUFtaL5oWI=; b=FeTciVgRbk0YToviRxoz9bYqVWMSEQiEJeqNWbSeMvGwcrZJZo/UZyIrS27iadOssY JmTSWtU8+ugcFaFxk3q1QaRfTD+cKR/cEXRm8xLT0//nSgU91OvC496vj1eWzI429RGd aU37D3xacRIkpZEAoqbQ9u1z7MdC8h39cwdfU= 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=6svwEjRZKw/fRIHWE4svwtkCI66G0b2U5AUFtaL5oWI=; b=eDmjterxGIMaCoVI5crtZxDNbrC50y3vRCc7CU7eUSPFQBIkHMpOnpRSg/w3/iMSK+ iSJzD8cpVqdFVSUjbV5Pb85JsV/Pl9k/+vVwlnbunNbKFoY9WwZuN5I7a7XYcHoMRTIr SQyifI1YlVZrQ1Ifgwao+6pJXa6fZ+IA30H0+mvDT/HJZhDe+UOSmKhTht5g6Mhb8vSX bB20mAwyVDW15gOAheUH5c57eMXt+onL8YCfINR0Wnj7YkgCrovQgk4oYu5rXe9ouGlj yWF76FW9xjgnL9HPKcMGDDJNrG/4eHPOluQsIZn6TmaaIMJQCl5WpO4iPICluHoHw/54 YAtw== X-Gm-Message-State: APt69E3rnhy2fuobBg1yIWL++Tz4Wxl3tyM0lu6/Rme5uj5LGCKLGjSv /JWEyTkWkMz6tq4Z46W0IrvScw== X-Received: by 2002:a62:d34a:: with SMTP id q71-v6mr23092699pfg.17.1531179737032; Mon, 09 Jul 2018 16:42:17 -0700 (PDT) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id b62-v6sm71862898pfm.97.2018.07.09.16.42.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Jul 2018 16:42:16 -0700 (PDT) From: AKASHI Takahiro To: catalin.marinas@arm.com, will.deacon@arm.com, 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, AKASHI Takahiro Subject: [PATCH v3.1 3/4] efi/arm: map UEFI memory map even w/o runtime services enabled Date: Tue, 10 Jul 2018 08:42:28 +0900 Message-Id: <20180709234229.20181-4-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180709234229.20181-1-takahiro.akashi@linaro.org> References: <20180709234229.20181-1-takahiro.akashi@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Under the current implementation, UEFI memory map will be mapped and made available in virtual mappings only if runtime services are enabled. But in a later patch, we want to use UEFI memory map in acpi_os_ioremap() to create mappings of ACPI tables using memory attributes described in UEFI memory map. See the following commit: arm64: acpi: fix alignment fault in accessing ACPI tables So, as a first step, arm_enter_runtime_services() is modified, alongside Ard's patch[1], so that UEFI memory map will not be freed even if efi=noruntime. [1] https://marc.info/?l=linux-efi&m=152930773507524&w=2 Signed-off-by: AKASHI Takahiro Reviewed-by: Ard Biesheuvel --- drivers/firmware/efi/arm-runtime.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/firmware/efi/arm-runtime.c b/drivers/firmware/efi/arm-runtime.c index 59a8c0ec94d5..a00934d263c5 100644 --- a/drivers/firmware/efi/arm-runtime.c +++ b/drivers/firmware/efi/arm-runtime.c @@ -117,6 +117,13 @@ static int __init arm_enable_runtime_services(void) efi_memmap_unmap(); + mapsize = efi.memmap.desc_size * efi.memmap.nr_map; + + if (efi_memmap_init_late(efi.memmap.phys_map, mapsize)) { + pr_err("Failed to remap EFI memory map\n"); + return 0; + } + if (efi_runtime_disabled()) { pr_info("EFI runtime services will be disabled.\n"); return 0; @@ -129,13 +136,6 @@ static int __init arm_enable_runtime_services(void) pr_info("Remapping and enabling EFI services.\n"); - mapsize = efi.memmap.desc_size * efi.memmap.nr_map; - - if (efi_memmap_init_late(efi.memmap.phys_map, mapsize)) { - pr_err("Failed to remap EFI memory map\n"); - return -ENOMEM; - } - if (!efi_virtmap_init()) { pr_err("UEFI virtual mapping missing or invalid -- runtime services will not be available\n"); return -ENOMEM; -- 2.17.0