Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp4120563pxb; Tue, 17 Nov 2020 11:48:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJwcdjZtNDTnDeeXsZOTGO/I1tvoSPSQzJfoL8UAAIP9tlbw1HesjDCp6pqbx+Dm4uXyT7vg X-Received: by 2002:a17:907:d1e:: with SMTP id gn30mr21599252ejc.148.1605642535805; Tue, 17 Nov 2020 11:48:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605642535; cv=none; d=google.com; s=arc-20160816; b=bCTSIQpWcbk4jYymnxFIE4c7Lv5Nv0+FmeXhbpzkySSHV2aLob7WvPmckEZtLPfpxQ SaRPnzNDirs4KhtJrnaDBjm6PwKpht89G43o0ospK1o/YAIaAHvnUusyw34UxVZ0AjTA hsAH7qS0q2putfIDRF3clMcEpoa1WEeRopcGucuWJ3menvNKcDl9jYicgDlQLTmmaOlD kTigfOCv2JUDHkcp7bElLlCOhJof+tvk1kFj1Oblr4D/zEA14j52qmBQ3/5nBF30V0+p 2mNGmTmgF2Sh8tJ0b83Dz0gUiLc2MZx251DdJymE07m+CCXoBv1iYcA+UENNuPL5OQAQ /IWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=zwzquOtJHjlj4g1WdzUdpwgBbECfw5A7/tMKKYnJz7M=; b=c2sBgXIuObUZ2b18msqJCOsr74FHQG9jzH2Bq/UGFF9K/y+j+Jdgu54GsPIAGBodyT atis6ZWMkzxtVWWuaEGSiSv1qZsvSoqaUF7Lu89eH4VRySGd/fGolbzPOhIw82MDTLDA x9ZOqnPLTZ8FVwf6WfPxHdilgUSVGePtizgE2ocoRuL8GWC/x/Uz11DigPTARGWXK+NA IvUSxN5BbBB/2jeQZtqozgHfjpG1NpyXI6DEQPzJ6O1kUIu0lQAndNTngHeffeSlLdNl a/5G1XBmV6sb2WwaRHmCQPJarnrZfOb9qcNF9omli9RndxS0V4CaAQ3VnMY8U2kvZTNJ 897Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uzOYWmAF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z5si15460989edl.605.2020.11.17.11.48.31; Tue, 17 Nov 2020 11:48:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uzOYWmAF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730068AbgKQTpG (ORCPT + 99 others); Tue, 17 Nov 2020 14:45:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:55836 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727955AbgKQTpG (ORCPT ); Tue, 17 Nov 2020 14:45:06 -0500 Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D93CA24654; Tue, 17 Nov 2020 19:45:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605642306; bh=qNozKMsilVGHcKuDFqYgNc1oR4jJ69WTtekuHemKsA4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=uzOYWmAFsp5u8A1goye7laB+uln8gqXV99XauIwSEYwYTGXnrkndJ1sdA0QPbsHW/ uXFPVcvnzkLe+GYCOMvNnDStRP9jwZYNOFkt+AwKP1ltA3sG4bxugT2gpWZQD9Krqq 7zwau8mE4xSeZENQKfIlP12S23rRKNZejLI/7ECQ= Received: by mail-ot1-f52.google.com with SMTP id a15so20644085otf.5; Tue, 17 Nov 2020 11:45:05 -0800 (PST) X-Gm-Message-State: AOAM5326K/lD+bUu0rZXSicp8roCoOvGJGIWq/L/L6aMsWuVHJNWs9DA UVPV6DhTCQZhkIOKRcpSoDzegIK1SfXcWlGQBQ== X-Received: by 2002:a05:6830:2259:: with SMTP id t25mr4284277otd.192.1605642305060; Tue, 17 Nov 2020 11:45:05 -0800 (PST) MIME-Version: 1.0 References: <20201117181607.1761516-1-qperret@google.com> <20201117181607.1761516-16-qperret@google.com> In-Reply-To: <20201117181607.1761516-16-qperret@google.com> From: Rob Herring Date: Tue, 17 Nov 2020 13:44:53 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH 15/27] of/fdt: Introduce early_init_dt_add_memory_hyp() To: Quentin Perret Cc: Catalin Marinas , Will Deacon , Marc Zyngier , James Morse , Julien Thierry , Suzuki K Poulose , Frank Rowand , "moderated list:ARM64 PORT (AARCH64 ARCHITECTURE)" , open list , "open list:KERNEL VIRTUAL MACHINE FOR ARM64 (KVM/arm64)" , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE" , Android Kernel Team , android-kvm@google.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 17, 2020 at 12:16 PM Quentin Perret wrote: > > Introduce early_init_dt_add_memory_hyp() to allow KVM to conserve a copy > of the memory regions parsed from DT. This will be needed in the context > of the protected nVHE feature of KVM/arm64 where the code running at EL2 > will be cleanly separated from the host kernel during boot, and will > need its own representation of memory. > > Signed-off-by: Quentin Perret > --- > drivers/of/fdt.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c > index 4602e467ca8b..af2b5a09c5b4 100644 > --- a/drivers/of/fdt.c > +++ b/drivers/of/fdt.c > @@ -1099,6 +1099,10 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, > #define MAX_MEMBLOCK_ADDR ((phys_addr_t)~0) > #endif > > +void __init __weak early_init_dt_add_memory_hyp(u64 base, u64 size) > +{ > +} > + > void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size) > { > const u64 phys_offset = MIN_MEMBLOCK_ADDR; > @@ -1139,6 +1143,7 @@ void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size) > base = phys_offset; > } > memblock_add(base, size); > + early_init_dt_add_memory_hyp(base, size); Can this be done right after we add all the memblocks using the memblock API? I thought EFI would also need to be handled, but looks like it just calls early_init_dt_add_memory_arch(). That's odd especially for ACPI systems... I don't really like putting what looks like an arm64 only hook here, but then I don't want an arm64 version of early_init_dt_add_memory_arch() either. We're almost to the point of getting rid of the arch specific ones. But I don't have a better suggestion currently. Rob