Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1029750imm; Wed, 4 Jul 2018 10:07:59 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeZY6ryT0VZB+AETg5dCsyXAcSYI8R9jmZHPgnm7SJV+jww5c1/trFGpBGKTkyntG+/FZvc X-Received: by 2002:a17:902:1566:: with SMTP id b35-v6mr2909734plh.107.1530724079602; Wed, 04 Jul 2018 10:07:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530724079; cv=none; d=google.com; s=arc-20160816; b=d3pehJl3LLl1sMugNPlrJjRJobxtg/JjfxrqOn33RAM3UMtnMhwohChIA1LwayxCk4 apKkmKxfxL0RZ+TSDFzskG9o52iwceG6yaOwIW9RvoF5OJNjL8qukhS843sz9qTqGwpW lkL6xdlgUutySh6uiF7J5CjG+U/+g3Hs6/6+kbh4ahETh611UEVeJNY1I33SzuzDB1Zl no8XP580rUFnEaDnHkgPcP1N2uvfslTfg4LsF2gO5sXYq/akBSwpDMA3o/KfjdR7PfI2 OodVHMzzKbkwQAYOKA8sg3+Mj2PpBT9GympAGlCIOeFRZ+WDUT9r6r5s+kizxVbjv9uc ujuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=RpC+kW8gQ3thT4M2oDdIVl9NZ33PDC3/SwudCxjM8yE=; b=ihv2emDm/wJZAoAy3akwBY4EO6cJ5HAHXYxGvvJ7gascgdD4gil66LMBCqxDah8dcG hNtmiPbTeXbUH0Z6o1ZPkGXBJZpWkTScceVhYSsh8kdjJvAeMi9M7gMzElD9RDcVr8B1 FNraYxehrDUiQrdXrLRroOF0X+nIhY6qGCRSYFyLEMfxLmlE/uT+/+TAXmyPdSwN2t5h 4vsY29c0sNIOXI50swSd7h3c0yjzKzp1hEBCbDUp7FJWQNTzVLOoGDfDcV/LBFa67DeY 9es7jRhMcqwaOQt36bu+bag9joA+VrdVPqbtAr9nycEflGp28jt5T8mWjfB9A0tCedDx j/NQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 139-v6si3785734pgg.408.2018.07.04.10.07.44; Wed, 04 Jul 2018 10:07:59 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752846AbeGDRGR (ORCPT + 99 others); Wed, 4 Jul 2018 13:06:17 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:40894 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752165AbeGDRGQ (ORCPT ); Wed, 4 Jul 2018 13:06:16 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E29167A9; Wed, 4 Jul 2018 10:06:15 -0700 (PDT) Received: from edgewater-inn.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B29B63F5AD; Wed, 4 Jul 2018 10:06:15 -0700 (PDT) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id AF7341AE180C; Wed, 4 Jul 2018 18:06:55 +0100 (BST) Date: Wed, 4 Jul 2018 18:06:55 +0100 From: Will Deacon To: AKASHI Takahiro Cc: catalin.marinas@arm.com, akpm@linux-foundation.org, ard.biesheuvel@linaro.org, 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 Subject: Re: [PATCH v2 3/4] efi/arm: map UEFI memory map earlier on boot Message-ID: <20180704170655.GD8370@arm.com> References: <20180619064424.6642-1-takahiro.akashi@linaro.org> <20180619064424.6642-4-takahiro.akashi@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180619064424.6642-4-takahiro.akashi@linaro.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi all, [Ard -- please can you look at the EFI parts of this patch] On Tue, Jun 19, 2018 at 03:44:23PM +0900, AKASHI Takahiro wrote: > Since arm_enter_runtime_services() was modified to always create a virtual > mapping of UEFI memory map in the previous patch, it is now renamed to > efi_enter_virtual_mode() and called earlier before acpi_load_tables() > in acpi_early_init(). > > This will allow us to use UEFI memory map in acpi_os_ioremap() to create > mappings of ACPI tables using memory attributes described in UEFI memory > map. > > See a relevant commit: > arm64: acpi: fix alignment fault in accessing ACPI tables > > Signed-off-by: AKASHI Takahiro > Cc: Ard Biesheuvel > Cc: Andrew Morton > --- > drivers/firmware/efi/arm-runtime.c | 15 ++++++--------- > init/main.c | 3 +++ > 2 files changed, 9 insertions(+), 9 deletions(-) > > diff --git a/drivers/firmware/efi/arm-runtime.c b/drivers/firmware/efi/arm-runtime.c > index 30ac5c82051e..566ef0a9edb5 100644 > --- a/drivers/firmware/efi/arm-runtime.c > +++ b/drivers/firmware/efi/arm-runtime.c > @@ -106,46 +106,43 @@ static bool __init efi_virtmap_init(void) > * non-early mapping of the UEFI system table and virtual mappings for all > * EFI_MEMORY_RUNTIME regions. > */ > -static int __init arm_enable_runtime_services(void) > +void __init efi_enter_virtual_mode(void) > { > u64 mapsize; > > if (!efi_enabled(EFI_BOOT)) { > pr_info("EFI services will not be available.\n"); > - return 0; > + return; > } > > 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; > + return; > } > > if (efi_runtime_disabled()) { > pr_info("EFI runtime services will be disabled.\n"); > - return 0; > + return; > } > > if (efi_enabled(EFI_RUNTIME_SERVICES)) { > pr_info("EFI runtime services access via paravirt.\n"); > - return 0; > + return; > } > > pr_info("Remapping and enabling EFI services.\n"); > > if (!efi_virtmap_init()) { > pr_err("UEFI virtual mapping missing or invalid -- runtime services will not be available\n"); > - return -ENOMEM; > + return; > } > > /* Set up runtime services function pointers */ > efi_native_runtime_setup(); > set_bit(EFI_RUNTIME_SERVICES, &efi.flags); > - > - return 0; > } > -early_initcall(arm_enable_runtime_services); > > void efi_virtmap_load(void) > { > diff --git a/init/main.c b/init/main.c > index 3b4ada11ed52..532fc0d02353 100644 > --- a/init/main.c > +++ b/init/main.c > @@ -694,6 +694,9 @@ asmlinkage __visible void __init start_kernel(void) > debug_objects_mem_init(); > setup_per_cpu_pageset(); > numa_policy_init(); > + if (IS_ENABLED(CONFIG_EFI) && > + (IS_ENABLED(CONFIG_ARM64) || IS_ENABLED(CONFIG_ARM))) > + efi_enter_virtual_mode(); Hmm, this is ugly as hell. Is there nothing else we can piggy-back off? It's also fairly jarring that, on x86, efi_enter_virtual_mode() is called a few lines later, *after* acpi_early_init() has been called. The rest of the series looks fine to me, but I'm not comfortable taking changes like this via the arm64 tree. Will