From patchwork Tue Jun 19 06:44:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 10473353 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 C0EF860230 for ; Tue, 19 Jun 2018 06:45:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B5C952882F for ; Tue, 19 Jun 2018 06:45:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA20828930; Tue, 19 Jun 2018 06:45: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 1A8A82882F for ; Tue, 19 Jun 2018 06:45:53 +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=mfi+cqYF48NxKgpkiWaUo93lJ+8q4kK1ZX4eNbWYuRc=; b=MD+muETrsLgAn6SRGclV+cd1Jx RHlo8A9r9PbSXd0yJdDT4h+getkKmfQKIl+zmK8+gKfVe2bmyhamjTlx0KUqWcarypubWhAKPJ04b XlJketonoxIgoUVpvuADPwrZHlkdWhaYKMcA1pxofB6rUxFtqvRunrEeqr/TDQztR+A8Kblb8qfnZ C5T4Lb6deY2JloKsSSi/0/bI75LknWg3fFoyVz70JDr0L6VwQZzRkVhH0WLya+/fpYXmXPPKK4Fbl 4PYjet1XnVQX2SUZoXxqyJIMLgAQjEA0rYkHSVjRFUwIe49s3DZUhidU9JbTHxupoUefw4d4z5gmf 5HqfaMJQ==; 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 1fVAOc-0006Gx-H5; Tue, 19 Jun 2018 06:45:42 +0000 Received: from mail-pl0-x244.google.com ([2607:f8b0:400e:c01::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fVANK-0004E3-Ij for linux-arm-kernel@lists.infradead.org; Tue, 19 Jun 2018 06:44:38 +0000 Received: by mail-pl0-x244.google.com with SMTP id c41-v6so10395933plj.10 for ; Mon, 18 Jun 2018 23:44:12 -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=oQBxjbhd3sorzsMaJwszGFfBNGkMSm+1QnH1URdsLGE=; b=bsGImkMY0YQk+qC/DMf4ZWW82ZNqGj0m/RmAzznQP/SqxLo85JmXW+bGukd2Py81mJ NJq3/y/OrRE5BiufK0c/G2RWf8xbPV9V6YA0PhvhThoHNkqfu8T/kcMV7haRHqLOpUqT Myn7Mo6OWE/tHptsgB9uMtXPrFh6U2gPNvu2o= 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=oQBxjbhd3sorzsMaJwszGFfBNGkMSm+1QnH1URdsLGE=; b=JHu4RH0NNpHZL2QQWqu8QAP2R+QJkQ/tWizy/aOhIo8E/kFDtASDSiJWGvnAQznQ71 /TmCu+daOvYEPSvOYOlrLMOVQHZnAxRGvE8jYG4nXMPbA8+saHCaEhMiUgUjDbQ3amqP GKNytcTLRM35M3F7gD5mG02FxjUpHi0ylv1rk0Fx4krCJ2hks5/EYpR3L+RBE2xDE3jP /bIrZeuyYLpu/SZhgPgnjcGFUJLofjAFVbGwV+9sb2nGl/rR4nngbgVMXLKSpY9/ytKS EaJi9HDVcSph/sPfBFsH2XXprVTvGbdEVsWTK7Ywenvu41Ob7a0UPEobInb+N8tfjAl/ HmDg== X-Gm-Message-State: APt69E3wDJJjqLti9S8iNXvSsTZiKp0aKuXkQKsM1XOWyS/yOEIznfko mHSvCgNkkRs1PM04PzKwgjSZCA== X-Google-Smtp-Source: ADUXVKLynddqdeTat6wj960ZnMvhIjLrGp4GTefuqwtw2o86/2WlLDJGYHNca/7+mjGwrfTZC8+PKQ== X-Received: by 2002:a17:902:1e4:: with SMTP id b91-v6mr17386973plb.155.1529390651996; Mon, 18 Jun 2018 23:44:11 -0700 (PDT) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id e68-v6sm32031601pfl.65.2018.06.18.23.44.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Jun 2018 23:44:11 -0700 (PDT) From: AKASHI Takahiro To: catalin.marinas@arm.com, will.deacon@arm.com, akpm@linux-foundation.org, ard.biesheuvel@linaro.org Subject: [PATCH v2 2/4] efi/arm: map UEFI memory map even w/o runtime services enabled Date: Tue, 19 Jun 2018 15:44:22 +0900 Message-Id: <20180619064424.6642-3-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180619064424.6642-1-takahiro.akashi@linaro.org> References: <20180619064424.6642-1-takahiro.akashi@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180618_234422_651583_99F53ED3 X-CRM114-Status: GOOD ( 14.73 ) 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. So, as a first step, arm_enter_runtime_services() will be modified so that UEFI memory map will be always accessible. See a relevant commit: arm64: acpi: fix alignment fault in accessing ACPI tables Signed-off-by: AKASHI Takahiro Cc: Ard Biesheuvel Acked-by: James Morse 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 5889cbea60b8..30ac5c82051e 100644 --- a/drivers/firmware/efi/arm-runtime.c +++ b/drivers/firmware/efi/arm-runtime.c @@ -115,6 +115,13 @@ static int __init arm_enable_runtime_services(void) return 0; } + 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; @@ -127,13 +134,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;