From patchwork Mon Jul 9 23:42:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 10515949 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 308BB60318 for ; Mon, 9 Jul 2018 23:55:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D6632582C for ; Mon, 9 Jul 2018 23:55:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 106C628BBF; Mon, 9 Jul 2018 23:55:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id ADE7F2582C for ; Mon, 9 Jul 2018 23:55:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=qD2g7bfO/Bpwx+8ypowumt97DkE1gG5LI+RvRIUfMPs=; b=GAAmORhu+Lb/v0wviSQPWuI3PC 2aUUGYB1T8Nj2Kh2fcFl+5tsT28Ak/HtAFXQkv4t7nZR8HYGRNahs8O68ElUNzOW32q9yv98QURmE L94xw+MoNp5kQlkqVswESLKPtQ9McyJ9Q5WC0TNgfpP5tIHjMAlibOp11wPTYsMIFUTXLwZJaDzmp c895AqK51uCBwmCmTCgJ5mtAmh3ZoXlqS3RNuy1kDrfH76lr2WmdcdYmyWwbCEGaO/f6PvMAo0exS 94Mv68m/ujpLKsoocN3ixxW7miw60+qBvrjeuhAYvUAZEbopFFamWRszfTtVAORo+VAPzSrroiEW2 sE/sOXsQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fcg0V-0004FX-Ml; Mon, 09 Jul 2018 23:55:51 +0000 Received: from mail-pf0-x241.google.com ([2607:f8b0:400e:c00::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fcfnX-0006LF-Jm for linux-arm-kernel@lists.infradead.org; Mon, 09 Jul 2018 23:42:36 +0000 Received: by mail-pf0-x241.google.com with SMTP id e13-v6so1368415pff.7 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=ubZOuLlwVp9dwjb1k8LsKDbv4mZNPgDQd85MfTxq2b/WPTaovHuYLLTWN7FkNqiSry Uu9ss0J758qJNl3bK2LU1akg6/qtLrxoqOYk4V7a+ae+2osB3pfiMV1fsPgz5gRDv/r+ ftTM7mXEL3VbWUCeTTupdR4RSnewvnzCeBK2oQI+5QrRb3f+3P48sLV25IUT5WxNf3Ct b051cpXDHdqPX8D36fD7uO5Wlk5KH/9m+0DZ7g/0B8HDDPONOkwLNifewEEDWqsFHHqq MXDtKRymlWjkHSFOwdMyWi2Tc0GHBlHZ1ltLy502PyrqhwhOh/cXguhVqwC3YdU+DX0T GBtQ== X-Gm-Message-State: APt69E3CaxLrmAOf2QntfcP98oroBlF2Y0Yrjz0oraR0DL0RRk6fiPfY ODI0Y3yHh8FGRqFrFhvNmk3EaA== X-Google-Smtp-Source: AAOMgpczgUeSnu5TlYsHMBObQ11TnIv5AyBgBx71eoDGls/uL90/hIQwdIfkx+rzF084axxrlH1t/w== 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180709_164227_802413_6FEB0BAC X-CRM114-Status: GOOD ( 14.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, lorenzo.pieralisi@arm.com, graeme.gregory@linaro.org, al.stone@linaro.org, bhsharma@redhat.com, tbaicar@codeaurora.org, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, AKASHI Takahiro , james.morse@arm.com, hanjun.guo@linaro.org, sudeep.holla@arm.com, dyoung@redhat.com, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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;