Received: by 2002:a05:7412:f584:b0:e2:908c:2ebd with SMTP id eh4csp2188782rdb; Tue, 5 Sep 2023 18:13:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEBCIMSEdc6JB2P/1Jy++i5bD08ZX21gKNSRcFhhkXQfn2cWJfuBfJnbrpn+eWF7+Al4WMx X-Received: by 2002:aa7:c442:0:b0:525:8124:20fe with SMTP id n2-20020aa7c442000000b00525812420femr1506745edr.18.1693962807058; Tue, 05 Sep 2023 18:13:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693962807; cv=none; d=google.com; s=arc-20160816; b=zBDJEIM0GUZaSIHyu0DB+QgkK4zaRLaj5zv81aHxMlAmy9nll2M73hARACBpOL+Eu9 ktBaQBzLm/UP5AzvQx+wKIFj5jbG4UHRlUdacoyZHjvMJcZcIvTudfpw49Mm1vcoGOXy 3XdiEF/O/FORm5nvjD7C7S2cMfHSti7c11bKDbkSXN0BByJO/n9ylQh3qYKBhqIwGJ6F 0kqyuuURvi/jdR2nd6b9QN/uOBewpUnrkWhBDKFJFEIV1VSKcm0PX7en5f4MiiiNQX9G p2h6SeU+90ihettSdjVl7B9BjwwHJiLiMZtMvaFwpb+5fNVPXzR6TZe0YhJ4rWX2+UvT qXxA== 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=HhiZN0af0GKQzmbElaLnPYoSBX8RdpFFj/orVmk2/oA=; fh=6ZrZ4ZyLUpRzqVqJQRMgR3F5M7sEpPu6mbU3Otqv0DQ=; b=yskmvBXq2cr4gUPriygaoKNfGe3vXJuS1gisjzis+jzpt9/FMxS6fWdMFQJno84aN4 HQFOgDa6b/xzN/vZu7Mprzq3KELhRT8jr1savuJsYyu45wspjsF36uAWlWB7U7QheUfO Tb4aAE9qax+irMnfuJEhVUcjnJvjePEbHE/cc8XColEPcE1mEPC/eFz68N74WI+3T1zt BLc2oBn4uP1KDDHt0p5maHOzarLcpwWiPgCj9ub/Ytuvpc82b7CV3h+JXfgJmycPaDQv t31RRdwCGa7uQvqT+Xq5ca3omKo4QdwYVnP6aw/0WtHNajVvnVDhSNYCANltkiKqyNvD DQFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jGHavaqS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cw10-20020a056402228a00b0052c7734a9e9si5782137edb.603.2023.09.05.18.13.00; Tue, 05 Sep 2023 18:13:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jGHavaqS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S239349AbjIEWW2 (ORCPT + 99 others); Tue, 5 Sep 2023 18:22:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229848AbjIEWW2 (ORCPT ); Tue, 5 Sep 2023 18:22:28 -0400 X-Greylist: delayed 1200 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 05 Sep 2023 15:22:24 PDT Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94A02185; Tue, 5 Sep 2023 15:22:24 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD1B5C433CD; Tue, 5 Sep 2023 21:44:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1693950292; bh=vcOAE7cgvg+KKXXIGsF2W5d9uDa6HKdsbuwQ5Vq67Hs=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=jGHavaqS13fmdKZew+/6eohIqfMfSIDMNF8ecF6e6Tftr+0gFeMN24/qbQrr9qzoN sxjSzQY+X2BeJ5p8QM09VzaiUGZPDxYMzFc2tFm0xQl3j44NeH4FDD88TVn7fURIJH rraFiv3Y6vlqQRofV/15pdh7bdx0+7MMtDnydwsxGQ/Cm+NRs5AYqa/G1BK/ZGF2K5 m/lkJeefKDtFY/iSGIYyBJnMUO4RUH7KPkJkljUW8bWfhBGcVYEj/rHXMoL9y7xJCz wi6KzwC8QsrTsL18NFWJoQYOQbWKTge8YX+GDvs++0ZnufZNguFeiBI05DYbkUwK+M wGePCE13CxnJQ== Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-500c6ff99acso354590e87.1; Tue, 05 Sep 2023 14:44:52 -0700 (PDT) X-Gm-Message-State: AOJu0YztkWauCmyPHnu3U1KIH5nP80myWgODXWj9asxEXQgr+SeHbzrU 1sspBihABAfOq+jnwhHwhuqxzlki7ncChtITF4E= X-Received: by 2002:a05:6512:2256:b0:4fe:13c9:2071 with SMTP id i22-20020a056512225600b004fe13c92071mr356383lfu.2.1693950290708; Tue, 05 Sep 2023 14:44:50 -0700 (PDT) MIME-Version: 1.0 References: <20230830231758.2561402-1-sjg@chromium.org> <20230830231758.2561402-3-sjg@chromium.org> In-Reply-To: <20230830231758.2561402-3-sjg@chromium.org> From: Ard Biesheuvel Date: Tue, 5 Sep 2023 23:44:39 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v5 3/4] schemas: Add some common reserved-memory usages To: Simon Glass Cc: devicetree@vger.kernel.org, Maximilian Brune , ron minnich , Tom Rini , Dhaval Sharma , U-Boot Mailing List , Mark Rutland , Yunhui Cui , linux-acpi@vger.kernel.org, Gua Guo , Lean Sheng Tan , Guo Dong , lkml , Rob Herring , Chiu Chasel Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 31 Aug 2023 at 01:18, Simon Glass wrote: > > The Devicetree specification skips over handling of a logical view of > the memory map, pointing users to the UEFI specification. > > It is common to split firmware into 'Platform Init', which does the > initial hardware setup and a "Payload" which selects the OS to be booted. > Thus an handover interface is required between these two pieces. > > Where UEFI boot-time services are not available, but UEFI firmware is > present on either side of this interface, information about memory usage > and attributes must be presented to the "Payload" in some form. > I don't think the UEFI references are needed or helpful here. > This aims to provide an small schema addition for this mapping. > > For now, no attempt is made to create an exhaustive binding, so there are > some example types listed. More can be added later. > > The compatible string is not included, since the node name is enough to > indicate the purpose of a node, as per the existing reserved-memory > schema. > > This binding does not include a binding for the memory 'attribute' > property, defined by EFI_BOOT_SERVICES.GetMemoryMap(). It may be useful > to have that as well, but perhaps not as a bit mask. > > Signed-off-by: Simon Glass > --- > > Changes in v5: > - Drop the memory-map node (should have done that in v4) > - Tidy up schema a bit > > Changes in v4: > - Make use of the reserved-memory node instead of creating a new one > > Changes in v3: > - Reword commit message again > - cc a lot more people, from the FFI patch > - Split out the attributes into the /memory nodes > > Changes in v2: > - Reword commit message > > .../reserved-memory/common-reserved.yaml | 53 +++++++++++++++++++ > 1 file changed, 53 insertions(+) > create mode 100644 dtschema/schemas/reserved-memory/common-reserved.yaml > > diff --git a/dtschema/schemas/reserved-memory/common-reserved.yaml b/dtschema/schemas/reserved-memory/common-reserved.yaml > new file mode 100644 > index 0000000..d1b466b > --- /dev/null > +++ b/dtschema/schemas/reserved-memory/common-reserved.yaml > @@ -0,0 +1,53 @@ > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/reserved-memory/common-reserved.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Common memory reservations > + > +description: | > + Specifies that the reserved memory region can be used for the purpose > + indicated by its node name. > + > + Clients may reuse this reserved memory if they understand what it is for. > + > +maintainers: > + - Simon Glass > + > +allOf: > + - $ref: reserved-memory.yaml > + > +properties: > + $nodename: > + enum: > + - acpi-reclaim > + - acpi-nvs > + - boot-code > + - boot-data > + - runtime-code > + - runtime-data > + These types are used by firmware to describe the nature of certain memory regions to the OS. Boot code and data can be discarded, as well as ACPI reclaim after its contents have been consumed. Runtime code and data need to be mapped for runtime features to work. When one firmware phase communicates the purpose of a certain memory reservation to another, it is typically not limited to whether its needs to be preserved and when it needs to be mapped (and with which attributes). I'd expect a memory reservation appearing under this node to have a clearly defined purpose, and the subsequent phases need to be able to discover this information. For example, a communication buffer for secure<->non-secure communication or a page with spin tables used by PSCI. None of the proposed labels are appropriate for this, and I'd much rather have a compatible string or some other property that clarifies the nature in a more suitable way. Note that 'no-map' already exists to indicate that the CPU should not map this memory unless it does so for the specific purpose that the reservation was made for. > + reg: > + description: region of memory that is reserved for the purpose indicated > + by the node name. > + > +required: > + - reg > + > +unevaluatedProperties: false > + > +examples: > + - | > + reserved-memory { > + #address-cells = <1>; > + #size-cells = <1>; > + > + boot-code@12340000 { > + reg = <0x12340000 0x00800000>; > + }; > + > + boot-data@43210000 { > + reg = <0x43210000 0x00800000>; > + }; > + }; > -- > 2.42.0.rc2.253.gd59a3bf2b4-goog >