From patchwork Wed Aug 30 23:17:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 718691 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 2A926C6FA8F for ; Wed, 30 Aug 2023 23:18:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239739AbjH3XSO (ORCPT ); Wed, 30 Aug 2023 19:18:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233311AbjH3XSO (ORCPT ); Wed, 30 Aug 2023 19:18:14 -0400 Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5835DA8 for ; Wed, 30 Aug 2023 16:18:10 -0700 (PDT) Received: by mail-io1-xd2e.google.com with SMTP id ca18e2360f4ac-7928ba24936so11977539f.0 for ; Wed, 30 Aug 2023 16:18:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1693437489; x=1694042289; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=IomW+Mec9sthmR9cu2/c2HOTyUZrOLUcRUv85KAO91E=; b=HeGKYJiVQcey1hhJvHAPgIWumyvkUl7DzP3F21rzsplSxBigebVkhwe08kAbeBQRxf BtpZx0wKFbXDts9uRh953LzYYHha8EQaQPq1uaeLh7EfncrEBlGlnVmyHCSh9pPpnKX8 rSNjJGqoSWi+r6YgytUKv8fYf8tVQe2mg+ytQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693437489; x=1694042289; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=IomW+Mec9sthmR9cu2/c2HOTyUZrOLUcRUv85KAO91E=; b=Ags5k1GJEKMwblMoA5evBSAga0ZEA51K0ydgFxBtJk1nLGLk5wNmUDP7zTqZsZfHxr CGK3NnZnNn8mMbJC7xyAegkT55q8FyJERZn2lRIeQuOKLG7q5u61M5zvER2LLw2Ejr3R mbncS0N95U5wVZFll15YAyc50BzwpYc53GaQwNdP0lecb7tv8kKfbg5DY93F5qHCGNIE dc+S3gJmiRJf4NLyYVCnsyTuKc8CzL30tki94Rhu+QgJn555C8fmG7fjfFNp1798stTW OjOcWq7aonWZ1azaS5mydc9XbHzG6XbMfahGrRePPUIDRe4OlK0ro8sxVn69uZqbpuJ8 s4Ag== X-Gm-Message-State: AOJu0YxaGkb5jjNqzdI7lmG3ys2WpHhxIQEyy2cg8eXaqYbKxaR23qam SYM5yyh5wReD/dwjvo5huYLvS+zOVKPs02qQ8uQ= X-Google-Smtp-Source: AGHT+IEYGJNH1CGCeQsbWkow001Dg/4CtvKV/pF2SGqYbrCiviXf5gzS1igFQo1OGrX4mpY8x0Tnlg== X-Received: by 2002:a5e:a706:0:b0:78b:d0a9:34fb with SMTP id b6-20020a5ea706000000b0078bd0a934fbmr3795029iod.20.1693437489546; Wed, 30 Aug 2023 16:18:09 -0700 (PDT) Received: from kea.bld.corp.google.com ([2620:15c:183:200:b147:266a:7359:2232]) by smtp.gmail.com with ESMTPSA id z25-20020a5ec919000000b007951e14b951sm73360iol.25.2023.08.30.16.18.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Aug 2023 16:18:09 -0700 (PDT) From: Simon Glass To: devicetree@vger.kernel.org Cc: Maximilian Brune , ron minnich , Tom Rini , Dhaval Sharma , U-Boot Mailing List , Mark Rutland , Yunhui Cui , linux-acpi@vger.kernel.org, Ard Biesheuvel , Gua Guo , Lean Sheng Tan , Guo Dong , lkml , Rob Herring , Chiu Chasel , Simon Glass Subject: [PATCH v5 1/4] Add reserved-memory Date: Wed, 30 Aug 2023 17:17:49 -0600 Message-ID: <20230830231758.2561402-1-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.rc2.253.gd59a3bf2b4-goog MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Bring in this file from Linux v6.5 Signed-off-by: Simon Glass --- (no changes since v4) Changes in v4: - New patch .../reserved-memory/reserved-memory.yaml | 181 ++++++++++++++++++ 1 file changed, 181 insertions(+) create mode 100644 dtschema/schemas/reserved-memory/reserved-memory.yaml diff --git a/dtschema/schemas/reserved-memory/reserved-memory.yaml b/dtschema/schemas/reserved-memory/reserved-memory.yaml new file mode 100644 index 0000000..c680e39 --- /dev/null +++ b/dtschema/schemas/reserved-memory/reserved-memory.yaml @@ -0,0 +1,181 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/reserved-memory/reserved-memory.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: /reserved-memory Child Node Common + +maintainers: + - devicetree-spec@vger.kernel.org + +description: > + Reserved memory is specified as a node under the /reserved-memory node. The + operating system shall exclude reserved memory from normal usage one can + create child nodes describing particular reserved (excluded from normal use) + memory regions. Such memory regions are usually designed for the special + usage by various device drivers. + + Each child of the reserved-memory node specifies one or more regions + of reserved memory. Each child node may either use a 'reg' property to + specify a specific range of reserved memory, or a 'size' property with + optional constraints to request a dynamically allocated block of + memory. + + Following the generic-names recommended practice, node names should + reflect the purpose of the node (ie. "framebuffer" or "dma-pool"). + Unit address (@
) should be appended to the name if the node + is a static allocation. + +properties: + reg: true + + size: + oneOf: + - $ref: /schemas/types.yaml#/definitions/uint32 + - $ref: /schemas/types.yaml#/definitions/uint64 + description: > + Length based on parent's \#size-cells. Size in bytes of memory to + reserve. + + alignment: + oneOf: + - $ref: /schemas/types.yaml#/definitions/uint32 + - $ref: /schemas/types.yaml#/definitions/uint64 + description: > + Length based on parent's \#size-cells. Address boundary for + alignment of allocation. + + alloc-ranges: + $ref: /schemas/types.yaml#/definitions/uint32-array + description: > + Address and Length pairs. Specifies regions of memory that are + acceptable to allocate from. + + iommu-addresses: + $ref: /schemas/types.yaml#/definitions/phandle-array + description: > + A list of phandle and specifier pairs that describe static IO virtual + address space mappings and carveouts associated with a given reserved + memory region. The phandle in the first cell refers to the device for + which the mapping or carveout is to be created. + + The specifier consists of an address/size pair and denotes the IO + virtual address range of the region for the given device. The exact + format depends on the values of the "#address-cells" and "#size-cells" + properties of the device referenced via the phandle. + + When used in combination with a "reg" property, an IOVA mapping is to + be established for this memory region. One example where this can be + useful is to create an identity mapping for physical memory that the + firmware has configured some hardware to access (such as a bootsplash + framebuffer). + + If no "reg" property is specified, the "iommu-addresses" property + defines carveout regions in the IOVA space for the given device. This + can be useful if a certain memory region should not be mapped through + the IOMMU. + + no-map: + type: boolean + description: > + Indicates the operating system must not create a virtual mapping + of the region as part of its standard mapping of system memory, + nor permit speculative access to it under any circumstances other + than under the control of the device driver using the region. + + reusable: + type: boolean + description: > + The operating system can use the memory in this region with the + limitation that the device driver(s) owning the region need to be + able to reclaim it back. Typically that means that the operating + system can use that region to store volatile or cached data that + can be otherwise regenerated or migrated elsewhere. + +allOf: + - if: + required: + - no-map + + then: + not: + required: + - reusable + + - if: + required: + - reusable + + then: + not: + required: + - no-map + +oneOf: + - oneOf: + - required: + - reg + + - required: + - size + + - oneOf: + # IOMMU reservations + - required: + - iommu-addresses + + # IOMMU mappings + - required: + - reg + - iommu-addresses + +additionalProperties: true + +examples: + - | + / { + compatible = "foo"; + model = "foo"; + + #address-cells = <2>; + #size-cells = <2>; + + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + + adsp_resv: reservation-adsp { + /* + * Restrict IOVA mappings for ADSP buffers to the 512 MiB region + * from 0x40000000 - 0x5fffffff. Anything outside is reserved by + * the ADSP for I/O memory and private memory allocations. + */ + iommu-addresses = <&adsp 0x0 0x00000000 0x00 0x40000000>, + <&adsp 0x0 0x60000000 0xff 0xa0000000>; + }; + + fb: framebuffer@90000000 { + reg = <0x0 0x90000000 0x0 0x00800000>; + iommu-addresses = <&dc0 0x0 0x90000000 0x0 0x00800000>; + }; + }; + + bus@0 { + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x0 0x0 0x40000000>; + + adsp: adsp@2990000 { + reg = <0x2990000 0x2000>; + memory-region = <&adsp_resv>; + }; + + dc0: display@15200000 { + reg = <0x15200000 0x10000>; + memory-region = <&fb>; + }; + }; + }; +... From patchwork Wed Aug 30 23:17:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 718690 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 47188C83F16 for ; Wed, 30 Aug 2023 23:18:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245732AbjH3XSW (ORCPT ); Wed, 30 Aug 2023 19:18:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230122AbjH3XSV (ORCPT ); Wed, 30 Aug 2023 19:18:21 -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 A417DC5 for ; Wed, 30 Aug 2023 16:18:15 -0700 (PDT) Received: by mail-io1-xd2c.google.com with SMTP id ca18e2360f4ac-79536bc669dso11622939f.3 for ; Wed, 30 Aug 2023 16:18:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1693437495; x=1694042295; 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=eHtRVfZdazalwXF7/K/X+IK1quBJnoh9ttNrkKe1UhE=; b=MyqsxcjLJHpDx+Zuo9Crtc2OR4po45WncypPEfOpEPkTUhzHbjl7K0V5dcg2fiEn23 TqFBlVSVrj5/ClksIcvWTJIdRDCAdSkJehN2yIpkLZ/myDaJTD7eKP/NKl2hVZn91FMB 9c2GjWRAMTmPvkd0/NMUhF3kwdEmY3TJiqtJ8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693437495; x=1694042295; 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=eHtRVfZdazalwXF7/K/X+IK1quBJnoh9ttNrkKe1UhE=; b=U9Pfn+UANjh/ohKKHmaQJUU3eO9wFuin71VrkPq643+Tk0ywj1i5WpNOx8nHEGFMjX PVC8v4tDIuLr3j29P97dsOj4Fe4YQqLM6Amh8iW7wy+Q1spvX/19by5Nl79TiJvcapvK /iMfRB+zvL9ws5MmK4Hka+xRGVjLNhHdSWJ4SB46xCu3P6kzea9sEyGdE+biHiTwF+tu Zaj++JBx9rLbG/QQNjUgtL2W4JqtUhyUl70cQGLMr3KDHQT/BWbsYUfXww8ac7yTA3eg qoZpxU59DgBr4jsbqXKiskQrqb53nUy7M7E/jIKgem/MWLfHi1YHwFTnkC2N6qP5o4S7 z78w== X-Gm-Message-State: AOJu0YzuQEmsXgrnZeUX/ajUy0KXmzK4+skPbZY/4p/kjgS5DHMq7m7C IQWmx6AHUHG7wowAJdsCHcTc5vUMAcw74thwXIw= X-Google-Smtp-Source: AGHT+IEakavImaUnpU6sdboDG8r+uspqLawPT8R+8zuQfCmFsnJ9iwEhtG5lpm0/Jpn3CMcMbrd35w== X-Received: by 2002:a5e:d510:0:b0:783:6eef:1496 with SMTP id e16-20020a5ed510000000b007836eef1496mr3804390iom.19.1693437494858; Wed, 30 Aug 2023 16:18:14 -0700 (PDT) Received: from kea.bld.corp.google.com ([2620:15c:183:200:b147:266a:7359:2232]) by smtp.gmail.com with ESMTPSA id z25-20020a5ec919000000b007951e14b951sm73360iol.25.2023.08.30.16.18.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Aug 2023 16:18:14 -0700 (PDT) From: Simon Glass To: devicetree@vger.kernel.org Cc: Maximilian Brune , ron minnich , Tom Rini , Dhaval Sharma , U-Boot Mailing List , Mark Rutland , Yunhui Cui , linux-acpi@vger.kernel.org, Ard Biesheuvel , Gua Guo , Lean Sheng Tan , Guo Dong , lkml , Rob Herring , Chiu Chasel , Simon Glass Subject: [PATCH v5 2/4] Bring in some other reserved-memory files Date: Wed, 30 Aug 2023 17:17:50 -0600 Message-ID: <20230830231758.2561402-2-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.rc2.253.gd59a3bf2b4-goog In-Reply-To: <20230830231758.2561402-1-sjg@chromium.org> References: <20230830231758.2561402-1-sjg@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add schema yaml files from v6.5 which are not vendor-specific, nor Linux-specific. Signed-off-by: Simon Glass --- Changes in v5: - Trim back to just a subset of mostly generic schemas Changes in v4: - New patch .../schemas/reserved-memory/framebuffer.yaml | 52 ++++++++++ .../reserved-memory/memory-region.yaml | 40 ++++++++ .../reserved-memory/shared-dma-pool.yaml | 97 +++++++++++++++++++ 3 files changed, 189 insertions(+) create mode 100644 dtschema/schemas/reserved-memory/framebuffer.yaml create mode 100644 dtschema/schemas/reserved-memory/memory-region.yaml create mode 100644 dtschema/schemas/reserved-memory/shared-dma-pool.yaml diff --git a/dtschema/schemas/reserved-memory/framebuffer.yaml b/dtschema/schemas/reserved-memory/framebuffer.yaml new file mode 100644 index 0000000..851ec24 --- /dev/null +++ b/dtschema/schemas/reserved-memory/framebuffer.yaml @@ -0,0 +1,52 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/reserved-memory/framebuffer.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: /reserved-memory framebuffer node + +maintainers: + - devicetree-spec@vger.kernel.org + +allOf: + - $ref: reserved-memory.yaml + +properties: + compatible: + const: framebuffer + description: > + This indicates a region of memory meant to be used as a framebuffer for + a set of display devices. It can be used by an operating system to keep + the framebuffer from being overwritten and use it as the backing memory + for a display device (such as simple-framebuffer). + +unevaluatedProperties: false + +examples: + - | + / { + compatible = "foo"; + model = "foo"; + #address-cells = <1>; + #size-cells = <1>; + + chosen { + framebuffer { + compatible = "simple-framebuffer"; + memory-region = <&fb>; + }; + }; + + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + fb: framebuffer@80000000 { + compatible = "framebuffer"; + reg = <0x80000000 0x007e9000>; + }; + }; + }; +... diff --git a/dtschema/schemas/reserved-memory/memory-region.yaml b/dtschema/schemas/reserved-memory/memory-region.yaml new file mode 100644 index 0000000..592f180 --- /dev/null +++ b/dtschema/schemas/reserved-memory/memory-region.yaml @@ -0,0 +1,40 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/reserved-memory/memory-region.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Reserved Memory Region + +maintainers: + - devicetree-spec@vger.kernel.org + +description: | + Regions in the /reserved-memory node may be referenced by other device + nodes by adding a memory-region property to the device node. + +select: true + +properties: + memory-region: + $ref: /schemas/types.yaml#/definitions/phandle-array + description: > + Phandle to a /reserved-memory child node assigned to the device. + + memory-region-names: + $ref: /schemas/types.yaml#/definitions/string-array + description: > + A list of names, one for each corresponding entry in the + memory-region property + +additionalProperties: true + +examples: + - | + fb0: video@12300000 { + /* ... */ + reg = <0x12300000 0x1000>; + memory-region = <&display_reserved>; + }; + +... diff --git a/dtschema/schemas/reserved-memory/shared-dma-pool.yaml b/dtschema/schemas/reserved-memory/shared-dma-pool.yaml new file mode 100644 index 0000000..457de09 --- /dev/null +++ b/dtschema/schemas/reserved-memory/shared-dma-pool.yaml @@ -0,0 +1,97 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/reserved-memory/shared-dma-pool.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: /reserved-memory DMA pool + +maintainers: + - devicetree-spec@vger.kernel.org + +allOf: + - $ref: reserved-memory.yaml + +properties: + compatible: + oneOf: + - const: shared-dma-pool + description: > + This indicates a region of memory meant to be used as a shared + pool of DMA buffers for a set of devices. It can be used by an + operating system to instantiate the necessary pool management + subsystem if necessary. + + - const: restricted-dma-pool + description: > + This indicates a region of memory meant to be used as a pool + of restricted DMA buffers for a set of devices. The memory + region would be the only region accessible to those devices. + When using this, the no-map and reusable properties must not + be set, so the operating system can create a virtual mapping + that will be used for synchronization. The main purpose for + restricted DMA is to mitigate the lack of DMA access control + on systems without an IOMMU, which could result in the DMA + accessing the system memory at unexpected times and/or + unexpected addresses, possibly leading to data leakage or + corruption. The feature on its own provides a basic level of + protection against the DMA overwriting buffer contents at + unexpected times. However, to protect against general data + leakage and system memory corruption, the system needs to + provide way to lock down the memory access, e.g., MPU. Note + that since coherent allocation needs remapping, one must set + up another device coherent pool by shared-dma-pool and use + dma_alloc_from_dev_coherent instead for atomic coherent + allocation. + + linux,cma-default: + type: boolean + description: > + If this property is present, then Linux will use the region for + the default pool of the contiguous memory allocator. + + linux,dma-default: + type: boolean + description: > + If this property is present, then Linux will use the region for + the default pool of the consistent DMA allocator. + +if: + properties: + compatible: + contains: + const: restricted-dma-pool +then: + properties: + no-map: false + reusable: false + +unevaluatedProperties: false + +examples: + - | + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + /* global autoconfigured region for contiguous allocations */ + linux,cma { + compatible = "shared-dma-pool"; + reusable; + size = <0x4000000>; + alignment = <0x2000>; + linux,cma-default; + }; + + display_reserved: framebuffer@78000000 { + reg = <0x78000000 0x800000>; + }; + + restricted_dma_reserved: restricted-dma-pool@50000000 { + compatible = "restricted-dma-pool"; + reg = <0x50000000 0x4000000>; + }; + }; + +... From patchwork Wed Aug 30 23:17:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 719231 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 36B64C6FA8F for ; Wed, 30 Aug 2023 23:18:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244566AbjH3XSX (ORCPT ); Wed, 30 Aug 2023 19:18:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344432AbjH3XSV (ORCPT ); Wed, 30 Aug 2023 19:18:21 -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 5EC671A3 for ; Wed, 30 Aug 2023 16:18:16 -0700 (PDT) Received: by mail-io1-xd2c.google.com with SMTP id ca18e2360f4ac-792707f78b5so12002939f.1 for ; Wed, 30 Aug 2023 16:18:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1693437495; x=1694042295; 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=c5dYm0P+tYaP9ugFonlv+1+ajXE4Bun3MDvz1H4U99Y=; b=P3WE23B6141JCcjBvCXKkZ7FZ1BuR5KSG/cfbHG5l/0nMg13lRkfd4lzJoJboyZMXM LOLioz0G6BJuozaNPPem3a8juIZ3aE+OxFRYiP0uZf94/xApZ3fs2ziLqBDeBcPaW+zv bJ48Nf5TpnApbfzow1xSiyJNpZyBFsnWag/bM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693437495; x=1694042295; 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=c5dYm0P+tYaP9ugFonlv+1+ajXE4Bun3MDvz1H4U99Y=; b=FqBl8wyCOwOSwdCqxz0hYnWVUgO6IVWGE1M8mvfCp3kPrCZm8kkA6p/vQ0jX2U6FbC BITvgkGR28nJU85rRTmJwnkwYQTSpi9ZI0VbUJHru9FAlQpRG5YzlRKfd5ISUz6kDR9t 1LVxNhId+TJ3a+2cQpV385VFGTcIehXn9nPQ3UzSQFvs6DjjvFkdMPT91tbk8QE3UvEz l+pCpMpHdr/iNftS9FE3xFsngROHChi60vNufYOqv4seAF0Wdv64tl2ATS7FG+jjDrcv pRZGDqYt2GHJaNvQXPiOjTUJxhKD63WMsGNA1tfJsnAWQUdJnBtdgJ8QtRb9/ZfRXwR0 kNcg== X-Gm-Message-State: AOJu0YwBhAQYJZa9S/oqNQNVr/+N0c/nspxNHUtNsWZllt4xDxcwQFxn U8Siy3KKJ4NMGWfl0xkT8GBDtmI+hclbBHofOC4= X-Google-Smtp-Source: AGHT+IHbhEkN2e11zGzdoaKLoCaWImVUNVgxzxMc+LsGq9Hv9e+k6T9lyQM2LaTI4FZURLKgKoaYeg== X-Received: by 2002:a5e:8a48:0:b0:790:c259:4ee5 with SMTP id o8-20020a5e8a48000000b00790c2594ee5mr4273635iom.8.1693437495666; Wed, 30 Aug 2023 16:18:15 -0700 (PDT) Received: from kea.bld.corp.google.com ([2620:15c:183:200:b147:266a:7359:2232]) by smtp.gmail.com with ESMTPSA id z25-20020a5ec919000000b007951e14b951sm73360iol.25.2023.08.30.16.18.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Aug 2023 16:18:15 -0700 (PDT) From: Simon Glass To: devicetree@vger.kernel.org Cc: Maximilian Brune , ron minnich , Tom Rini , Dhaval Sharma , U-Boot Mailing List , Mark Rutland , Yunhui Cui , linux-acpi@vger.kernel.org, Ard Biesheuvel , Gua Guo , Lean Sheng Tan , Guo Dong , lkml , Rob Herring , Chiu Chasel , Simon Glass Subject: [PATCH v5 3/4] schemas: Add some common reserved-memory usages Date: Wed, 30 Aug 2023 17:17:51 -0600 Message-ID: <20230830231758.2561402-3-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.rc2.253.gd59a3bf2b4-goog In-Reply-To: <20230830231758.2561402-1-sjg@chromium.org> References: <20230830231758.2561402-1-sjg@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@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 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 + + 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>; + }; + }; From patchwork Wed Aug 30 23:17:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 719230 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 98884C83F15 for ; Wed, 30 Aug 2023 23:18:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344452AbjH3XSg (ORCPT ); Wed, 30 Aug 2023 19:18:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236060AbjH3XSf (ORCPT ); Wed, 30 Aug 2023 19:18:35 -0400 Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61068E42 for ; Wed, 30 Aug 2023 16:18:17 -0700 (PDT) Received: by mail-io1-xd2d.google.com with SMTP id ca18e2360f4ac-77ac14ff51bso11461039f.3 for ; Wed, 30 Aug 2023 16:18:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1693437496; x=1694042296; 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=HY2cU6JGuZrguIyfLb09NlceqC/Y62AT/KhqZYbIbwU=; b=M942CseN4xXa7ivkN3BQ9ivaUDeaX11zck40TQgJZ7eE9yfunHmrPWwL7oyxKDAHF7 0zvPrCY65S9NnUXzqwpP8gTCEo4NfmUuA6CkeJOSEttfV5HAiQlD4cW/tMxVKR5vWtaf u8QANLGfifUWO9TKEFik3R95p/ZOjrZqmdL+k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693437496; x=1694042296; 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=HY2cU6JGuZrguIyfLb09NlceqC/Y62AT/KhqZYbIbwU=; b=gFQV7n1DOBvFSE2u+VF6PXpzbI0hNsIsO6dU4l7t3iznQ+TfHyi8ezcEJYWgsVMvut SOq/HA9ZnC2jakDWcmqUJ2RkLuwVkgJ8kx99WUq7INU46IK6qiGbmFYIPEbA1lnpjotZ gfddrgaH2pKem8a6OabDv/QIAxzamLF0aG/ERiu3uE680azosW8XDIqtyd6Kqhq5BAs+ 9DzaeuWXqLFCXgnydsU18qm7UmrjMHAB7XqcvaHGotSjrk/1HfZdnokc/CA9Nvpw5035 EKvzN8SMB5YLfv91vCYc1RCwkbMAy2n0QiNfwtMuARqlS4lFxO5sZTvMFRpEjGfJm5M3 kFrg== X-Gm-Message-State: AOJu0YxHVKaBqAf4BV5eOJ9pZR+U8qkYLB3PAUoebvwE/Oj/bU54nfsv 3FtMPc9kkQ3Pou17kW7jXpSt74eOsCDoapKMUZk= X-Google-Smtp-Source: AGHT+IEDA6Kz+88UsYqnGtgINRuvJ4OfWV7BCV1mSX3IDTB900P56/Cp3vrRoaq3PqkXR21lxfX66Q== X-Received: by 2002:a6b:6112:0:b0:790:f733:2f9e with SMTP id v18-20020a6b6112000000b00790f7332f9emr3861880iob.13.1693437496510; Wed, 30 Aug 2023 16:18:16 -0700 (PDT) Received: from kea.bld.corp.google.com ([2620:15c:183:200:b147:266a:7359:2232]) by smtp.gmail.com with ESMTPSA id z25-20020a5ec919000000b007951e14b951sm73360iol.25.2023.08.30.16.18.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Aug 2023 16:18:16 -0700 (PDT) From: Simon Glass To: devicetree@vger.kernel.org Cc: Maximilian Brune , ron minnich , Tom Rini , Dhaval Sharma , U-Boot Mailing List , Mark Rutland , Yunhui Cui , linux-acpi@vger.kernel.org, Ard Biesheuvel , Gua Guo , Lean Sheng Tan , Guo Dong , lkml , Rob Herring , Chiu Chasel , Simon Glass Subject: [PATCH v5 4/4] memory: Add ECC properties Date: Wed, 30 Aug 2023 17:17:52 -0600 Message-ID: <20230830231758.2561402-4-sjg@chromium.org> X-Mailer: git-send-email 2.42.0.rc2.253.gd59a3bf2b4-goog In-Reply-To: <20230830231758.2561402-1-sjg@chromium.org> References: <20230830231758.2561402-1-sjg@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Some memories provide ECC detection and/or correction. For software which wants to check memory, it is helpful to see which regions provide this feature. Add this as a property of the /memory nodes, since it presumably follows the hardware-level memory system. Signed-off-by: Simon Glass --- Changes in v5: - Redo to make this property specific to ECC - Provide properties both for detection and correction Changes in v3: - Add new patch to update the /memory nodes dtschema/schemas/memory.yaml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/dtschema/schemas/memory.yaml b/dtschema/schemas/memory.yaml index 1d74410..944aa9f 100644 --- a/dtschema/schemas/memory.yaml +++ b/dtschema/schemas/memory.yaml @@ -34,7 +34,37 @@ patternProperties: description: For the purpose of identification, each NUMA node is associated with a unique token known as a node id. + ecc-detection: + $ref: /schemas/types.yaml#/definitions/string + enum: + - none + - single-bit + - multi-bit + description: | + If present, this inidcates the type of memory errors which can be + detected and reported by the Error-Correction Code (ECC) memory + subsystem: + none - No error detection is possible + single-bit - Detects and reports single-bit ECC errors + multi-bit - Detects and reports multiple-bit ECC errors + + If not present, this is equivalent to 'none'. + ecc-correction: + $ref: /schemas/types.yaml#/definitions/string + enum: + - none + - single-bit + - multi-bit + description: | + If present, this inidcates the type of memory errors which can be + corrected by the Error-Correction Code (ECC) memory subsystem: + + none - No error correction is possible + single-bit - Corrects single-bit ECC errors + multi-bit - Corrects multiple-bit ECC errors + + If not present, this is equivalent to 'none'. required: - device_type