From patchwork Mon Jul 23 01:57:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 10539511 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A083990E3 for ; Mon, 23 Jul 2018 02:00:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A922284B9 for ; Mon, 23 Jul 2018 02:00:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8852B284EE; Mon, 23 Jul 2018 02:00:41 +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 2E19F28500 for ; Mon, 23 Jul 2018 02:00:40 +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=E+mwGhmQrss0QWNl7fNLUEwVd+32wWIEGmagoExG3/A=; b=IH4BDQb0UN1MoLJvgqUtn9py8o aacKZI4zU8n0wlymAC6ooYatP8rTXyGz/impbZbHhOacZD4T5Ije0FbYCqZ6v4k9cUh0LThSTElO1 SRCQijYQt8+jHdXlLYxKBi2QbOzei/p8FF2o4sm12D4/Uj+UISNoiQoJsU55u0owIlMAUkD43L4CI LcKkBUHEkm0KmBbwGWroulVqF+4jHd71t2nepUkCA3WGPOdy2xnOyG/1ZBIzQhJQSC4qlW8dzlN7z b9VZQQm+vDVUeE5oEO3jylZ4YuoghmTDoHrjWbbr4BByE3d7kf5Kl0+doQCqCqstKiMAbp8GGUrlk xtmVe7Sw==; 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 1fhQ9I-0002x3-Dq; Mon, 23 Jul 2018 02:00:32 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fhQ8h-0001sT-IG for linux-arm-kernel@lists.infradead.org; Mon, 23 Jul 2018 02:00:09 +0000 Received: by mail-pg1-x542.google.com with SMTP id f1-v6so11050058pgq.12 for ; Sun, 22 Jul 2018 18:59:45 -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=GtIoJieKMHTN394dMOednMEC4qx4H0+B96ztFdyM5HA=; b=AoWFjrqTENdZ9sLR9tvk1DXtMK9FYxuVEAVx/sMtK6DtxQQP0xrnHfemjwcM4cMMNk GCBLIkc+Vmd6T8VbZxCOrxbZpA3z0bYgz+SzuGUilDfWEtTsBCyvrj1zo1j4cBD/2JtH XwlZXgHsekdRhkURfYmzIZ3JQpB832BHynTqw= 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=GtIoJieKMHTN394dMOednMEC4qx4H0+B96ztFdyM5HA=; b=DtHg70Hb5Toc9Ftlg8aMqKrLsnGmJs9OjwyLMzp5lJi37MKd8nERsxpga4SVfvT6gV ZbSjP1w8EE9/J+U0qK+3CcIc6UjeepPBUgxo642LOviH/f10Y+nBkR2PF9Q1JuRN5g4s XHx9uZnFU2rMezZNHHy397nz2RMnGCqJMyL2/c470KPO6ojAvAbnB4daTEGnJZB4uiKK fmCjMBPV06QoZjnqDgbPVVJwv9ZO1Phc3B04DhSRu5xCv0+iYC4D/0cZLa8jch2ZeRCZ uaxkJmBWz2WxW7/lIKA/k+8/LNtzDPT8H1uD1/49NnGKS9mgvkgDvl25t4ZJeTb/VF/M 0i0g== X-Gm-Message-State: AOUpUlG1OWsPoG5VtLXxQgTNFwAmQYaN5RnxwZ8ajLlGhItE53KOHVvC Lbchau12BWfudpGDXuW6ml/azw== X-Google-Smtp-Source: AAOMgpfn7SiEA5UlKYRa4N3WBHYhBXi7Jeb1Cz5AYzBjJQraGUylWAveqkruQzCpcyPtp3v0wHEeng== X-Received: by 2002:a62:b40c:: with SMTP id h12-v6mr11414833pfn.18.1532311185039; Sun, 22 Jul 2018 18:59:45 -0700 (PDT) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id a134-v6sm8384082pfa.158.2018.07.22.18.59.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 22 Jul 2018 18:59:44 -0700 (PDT) From: AKASHI Takahiro To: catalin.marinas@arm.com, will.deacon@arm.com, rjw@rjwysocki.net, lenb@kernel.org, ard.biesheuvel@linaro.org Subject: [PATCH v4 4/5] efi/arm: map UEFI memory map even w/o runtime services enabled Date: Mon, 23 Jul 2018 10:57:31 +0900 Message-Id: <20180723015732.24252-5-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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180722_185955_900242_038E9205 X-CRM114-Status: GOOD ( 13.92 ) 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;