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: 142529 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp5522764ljj; Sun, 22 Jul 2018 18:59:48 -0700 (PDT) X-Google-Smtp-Source: AAOMgpekZ8+2Ud9ojQNpCHei+go+6cUWrz3weELGWK/fj44lv2Xj7Ia1qfPoo33lsvM354Pjqd7e X-Received: by 2002:a65:5245:: with SMTP id q5-v6mr10239506pgp.67.1532311188558; Sun, 22 Jul 2018 18:59:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532311188; cv=none; d=google.com; s=arc-20160816; b=CaoXdslfZLqZYm0MlXe5od193u1uDl3WHdBvDSrNHNX+7ZakLM3Qu74IbEzgdcGMnN Zuy+QCczDTSHa9iNbeGsULtJ2iMokvcWGdWTWROCPj762/9/GagXg4L0t5f8hdr+7RpJ bepAb/bcE15ITGE/qxGqMURWM7FgoYNRVBCWWeRT+oAQN8eDUr/9Ae0m+4aVW9EIciZl 62bl2SzaAsnkOVA/YuXIZJLO73O8W602LwThiTjJWXbtUN78glpNuE5oGm5ThTOTUAPf DsJmS+deSHobstKXY0wWEWbLGJR0eGoVkP2DgKcBieXpnCvUNhUnlGbSbmFgtZhV60Il tD0A== 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=GtIoJieKMHTN394dMOednMEC4qx4H0+B96ztFdyM5HA=; b=Hu2llyg/9iINZI+rmKhxFzs7i2AdBrHUl5bE571GOkwe80+rcW/qQm49KTrv70Oy8v qVqU6yC3Olg854RAMX8DS6TBWanV8ropBpaIELxQ/tjLE8Z5cpn+BEDET7H8a1j3U3tC U4jcYLyl2bUigL0G7QBfDm+UUqfqVVc3QOTSoupiYlwaBeBn81QFn7JEhinMLf71uRot CBDz1i9ThHcUgrvI4w/KvXYQpGL1p33xSDhlFATDt259n5d3zGYrOwTjaXeuMWOVZ5QQ HueDsgGGw9OehAWeCSsMffwAnGK2cxEOYfv5oaaIM+2WfpWPMIXQhAnCCAQgQTVewTrY UHpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AoWFjrqT; 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 f34-v6si7389466plf.495.2018.07.22.18.59.48; Sun, 22 Jul 2018 18:59:48 -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=AoWFjrqT; 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 S2387775AbeGWC6c (ORCPT + 31 others); Sun, 22 Jul 2018 22:58:32 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:33462 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387727AbeGWC6c (ORCPT ); Sun, 22 Jul 2018 22:58:32 -0400 Received: by mail-pg1-f196.google.com with SMTP id r5-v6so11060990pgv.0 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=eGpXIxNW+oVYhhnTY6QgGgLXcXfvp+3qplrmdRWyZEy6dq7cTpzozLa08TO3P5Ylvg EXCpd73aYWwpTo8WDMN2o5BXw2JxmD0ANP+Znqg+HgOYwrT2pAMjdnS8jHz+ruO+jDjd 3Xacp/R9VB3ElU6SA4eJU1zhiqnJCLwrA8W43+S87T0qzyQQvttxG9qkSNHp7f3hhdsy 3YO9TTv6RHdQSP3h1nt1x4zjH4nmr/4vZc4o6qqS4FkPkD0+nT617jk5mNMls+ZX+prY qSWSJzO0dscZhqAAjYOuZ6wZPmlf3yecSoNbEyIVnKBHfIIWJ2G9fTslRiQlD4bjmeDR ErZQ== X-Gm-Message-State: AOUpUlEGbRjmnb3PHkipL26RlOKJ1Jy2WXs33/StUg+KYuwchKtww7gn ebdsO233XBbZKBtg9sQqu0i0JA== 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 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 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> 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(-) -- 2.18.0 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;