From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77894C83F16 for ; Tue, 29 Aug 2023 19:19:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236285AbjH2TSr (ORCPT ); Tue, 29 Aug 2023 15:18:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239121AbjH2TSX (ORCPT ); Tue, 29 Aug 2023 15:18:23 -0400 Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABCEBFD for ; Tue, 29 Aug 2023 12:18:19 -0700 (PDT) Received: by mail-io1-xd2c.google.com with SMTP id ca18e2360f4ac-792965813e7so112741739f.2 for ; Tue, 29 Aug 2023 12:18:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1693336699; x=1693941499; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=asdwWrQgSDUsQBbMFgdwSUCGxAMIv135nq9+k2HMaa0=; b=RDPVP53Na4RjKIWVH4dYAGzx+P4LsBWFkOALAa+gmqqY5yCjmdWpCUpTFmxELphu2N u4XclXHLKT62uF4s7WWpt2ZIHom/6aI9lesxGW2jk1l7yERIEsKbHwUglbAhdF7oCBzl F6/WkjbcJ2idMkWbb3YsaIKzXq8ompF2DDfgA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693336699; x=1693941499; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=asdwWrQgSDUsQBbMFgdwSUCGxAMIv135nq9+k2HMaa0=; b=EL63zEfsJzZWow3Lq33pMt04Q86SCRhAP+j1XtKF/V9yYrAAFqf9u58yh9ZqiISQ0x 2Dc2xHVNe03MpUMjxSfNVN3MAz7aI0zkzk8n7/KF8xrltR/qX/3TK/AFpPCdTekoqGtE FUlSJ9af4QZmyEDpgMAlBAx4Gj6w7jLaYCujBA5prr1uIZ/uuoWS3PZkjMTcC4gvbevq u4JmoDlFCpw1URdj06poln6gY3RaOEE3lpWXJ4sNB2oqDxsbi93byP9VG6baT/V7pSRU WBlBZzZtYF2ceOQinKaal10CD0+AsWKKr7HMyU3ptI2knpVlZEqHKL7bLEUWZT01+E6o sgig== X-Gm-Message-State: AOJu0YyZL1qweAAl6dYpRDhaWTYvoIccNLjCOhKCAUabuSrnNrIb/5X5 u0Hylm3glvoGtDzLdlo08KicvQ== X-Google-Smtp-Source: AGHT+IGAS+bTigCPmRP0jxu5uZgQG+yMGKUfr6n4pFO5Py5STv9I4dkw/kX8J7iBq5DSVfvEGDSG5w== X-Received: by 2002:a5d:990f:0:b0:790:fc73:6e3c with SMTP id x15-20020a5d990f000000b00790fc736e3cmr332445iol.8.1693336699097; Tue, 29 Aug 2023 12:18:19 -0700 (PDT) Received: from kea.bld.corp.google.com ([2620:15c:183:200:16d9:c947:1a18:4c10]) by smtp.gmail.com with ESMTPSA id fq8-20020a056638650800b004332f6537e2sm3359798jab.83.2023.08.29.12.18.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Aug 2023 12:18:18 -0700 (PDT) From: Simon Glass To: devicetree@vger.kernel.org Cc: Dhaval Sharma , Mark Rutland , Gua Guo , Tom Rini , Rob Herring , U-Boot Mailing List , ron minnich , Ard Biesheuvel , Lean Sheng Tan , Maximilian Brune , Chiu Chasel , lkml , Yunhui Cui , linux-acpi@vger.kernel.org, Guo Dong , Simon Glass Subject: [PATCH v4 3/4] schemas: Add a schema for memory map Date: Tue, 29 Aug 2023 13:18:08 -0600 Message-ID: <20230829191812.135759-3-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.rc2.253.gd59a3bf2b4-goog In-Reply-To: <20230829191812.135759-1-sjg@chromium.org> References: <20230829191812.135759-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org 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. This aims to provide an initial schema for this mapping. Note that this is separate from the existing /memory and /reserved-memory nodes, since it is mostly concerned with what the memory is used for. It may cover only a small fraction of available memory. For now, no attempt is made to create an exhaustive binding, so there are some example types listed. This can be completed once this has passed initial review. 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 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 dtschema/schemas/memory-map.yaml | 61 +++++++++++++++++++ .../reserved-memory/common-reserved.yaml | 53 ++++++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 dtschema/schemas/memory-map.yaml create mode 100644 dtschema/schemas/reserved-memory/common-reserved.yaml diff --git a/dtschema/schemas/memory-map.yaml b/dtschema/schemas/memory-map.yaml new file mode 100644 index 0000000..4b06583 --- /dev/null +++ b/dtschema/schemas/memory-map.yaml @@ -0,0 +1,61 @@ +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2023 Google LLC +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/memory-map.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: /memory-map nodes +description: | + Common properties always required in /memory-map nodes. These nodes are + intended to resolve the nonchalant clause 3.4.1 ("/memory node and UEFI") + in the Devicetree Specification. + +maintainers: + - Simon Glass + +properties: + $nodename: + const: 'memory-map' + +patternProperties: + "^([a-z][a-z0-9\\-]+@[0-9a-f]+)?$": + type: object + additionalProperties: false + + properties: + reg: + minItems: 1 + maxItems: 1024 + + usage: + $ref: /schemas/types.yaml#/definitions/string + description: | + Describes the usage of the memory region, e.g.: + + "acpi-reclaim", "acpi-nvs", "bootcode", "bootdata", "bootdata", + "runtime-code", "runtime-data". + + See enum EFI_MEMORY_TYPE in "Unified Extensible Firmware Interface + (UEFI) Specification" for all the types. For now there are not + listed here. + + required: + - reg + +additionalProperties: false + +examples: + - | + memory-map { + acpi@f0000 { + reg = <0xf0000 0x4000>; + usage = "acpi-reclaim"; + }; + + runtime@12300000 { + reg = <0x12300000 0x28000>; + usage = "runtime-code"; + }; + }; +... diff --git a/dtschema/schemas/reserved-memory/common-reserved.yaml b/dtschema/schemas/reserved-memory/common-reserved.yaml new file mode 100644 index 0000000..70cdead --- /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/base.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 + +# always select the core schema +select: true + +properties: + $nodename: + oneOf: + - acpi-reclaim + - acpi-nvs + - boot-code + - boot-data + - runtime-code + - runtime-data + + 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