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: 719543 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 0FFE9C83F14 for ; Wed, 30 Aug 2023 23:18:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239343AbjH3XSO (ORCPT ); Wed, 30 Aug 2023 19:18:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235578AbjH3XSO (ORCPT ); Wed, 30 Aug 2023 19:18:14 -0400 Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33A10A3 for ; Wed, 30 Aug 2023 16:18:10 -0700 (PDT) Received: by mail-io1-xd34.google.com with SMTP id ca18e2360f4ac-7927952ca67so11401239f.2 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=Dgk7Wz6maq4Tos5BoV/UVLbBVpVCQhEBEpX9y5JBJlCs1IL+831zvrafawWh4f+JxX eFCwZ0CkHKHe8pXiOGPzSGLvzwxKK+zRCpNaM8P3eAGnMoVSVWAiziEZLUEOtBzWT4T5 TjVa/Xn1tkjmpNojwmSsRGz3zi2uhqk7K37xkJ8rV4K1rAsdu0Ku09+0CoVzMmKd6mOf a+gXsNdfzFIz8wUEi2KI1Bndo9ppypkoSFXHQY1XSxl1veL5fBEg2+BOByrdGOVRbcwP NWaZAOgAG1gnHyAvrZH1RBcqIn7q5PhcAJbf3QKX6Diqn6lQ2CLwd0JsgHw8R5S76iXM xg2w== X-Gm-Message-State: AOJu0Yw486KuJvJ2hhsodpn7AOoVBwkyKc3J4/a17yLyJ7/6LsifYeuR JKJIn9Pj14IppWXbCPcbQ2ZKqg== 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: linux-acpi@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: 719542 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 59173C83F15 for ; Wed, 30 Aug 2023 23:18:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230122AbjH3XSW (ORCPT ); Wed, 30 Aug 2023 19:18:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344403AbjH3XSV (ORCPT ); Wed, 30 Aug 2023 19:18:21 -0400 Received: from mail-io1-xd30.google.com (mail-io1-xd30.google.com [IPv6:2607:f8b0:4864:20::d30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A48D6CF for ; Wed, 30 Aug 2023 16:18:15 -0700 (PDT) Received: by mail-io1-xd30.google.com with SMTP id ca18e2360f4ac-7924a3eb5afso12311739f.0 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=dbe2snh4QDCmyNaYDPH5cwieFxurGU5t33EqdVafnEM0kzdk/ZQ1TiqxOsEymV/geW Qal22X1Kco34va615JbW0dOwgYfT3rPb5ITHFrvkuqXGusT1u35fr3Rh7F2ZBZW8PvWR bCtd7Y6QCDm/nmB1bMnNxVQRgDVy9V/xEAsbn66WzW450YALB5xnud2jmCyL7RZhCesS kJMjWHBBoE2uz1Po+YBRbk5S0elHUIkSiNo5KkJHu2U54DNeBW7otza7lRuYZwpoxwSB CaxG50qfGDSbt5xx5BTVAcR2UBODwViexn/IEmLwweJ/mOEteo6ix+sdnSoLuGFoZQAX wQjQ== X-Gm-Message-State: AOJu0Yzz56ZbHu/XNwa/0EaW3cA4GtTcz5w+I50TbbpkwcadsqB3ttRY kkYBbSaM2F5FLT0jo76hWLQMMg== 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: linux-acpi@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: 718639 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 70260C83F1A for ; Wed, 30 Aug 2023 23:18:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344408AbjH3XSX (ORCPT ); Wed, 30 Aug 2023 19:18:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344420AbjH3XSV (ORCPT ); Wed, 30 Aug 2023 19:18:21 -0400 Received: from mail-io1-xd2f.google.com (mail-io1-xd2f.google.com [IPv6:2607:f8b0:4864:20::d2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F7CA1A2 for ; Wed, 30 Aug 2023 16:18:16 -0700 (PDT) Received: by mail-io1-xd2f.google.com with SMTP id ca18e2360f4ac-7927f24140eso11987139f.2 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=k88xMtJIRvMPckE06n5es/LvKfugIbYC2lrjW+1wyhrt/NIJsFdpmpcNF4fsO6Fcs2 nxGcubghopuhtmIqDXnFPV7UZuyGbFwnoIv8Sp33imAsaAXjv4TGUuFcdpJZ+7VxzXne ngkj0PMKerWGbzliqe+eMsG3k0Dgk/Q/H9ftGLqSgQVTr6GzFPBMYMFQCV1VNzF34yME S9SmUaFdzZ8HSI5BFsFiVNTmBQJ4kkRkM/poaLlTzvmGhghPFvAxY8Qmty71+0eC0Oto KTzYv5cKavQot2+rFA3P1dsHlM5s+1VKwSECQyA9xWQ0kstE92FaTgkqMF4OMHkEm3dL I2vQ== X-Gm-Message-State: AOJu0YzsooJYiCfwseO3VtVwDM7Tzz6VGVH7xzbdJOZTN0VvJSXOwOxC g+/5m64clDpVFr6akZLcpw50Jw== 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: 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 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: 718638 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 4F32EC6FA8F for ; Wed, 30 Aug 2023 23:18:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240908AbjH3XSg (ORCPT ); Wed, 30 Aug 2023 19:18:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344424AbjH3XSY (ORCPT ); Wed, 30 Aug 2023 19:18:24 -0400 Received: from mail-io1-xd2f.google.com (mail-io1-xd2f.google.com [IPv6:2607:f8b0:4864:20::d2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 571C2E40 for ; Wed, 30 Aug 2023 16:18:17 -0700 (PDT) Received: by mail-io1-xd2f.google.com with SMTP id ca18e2360f4ac-792975085b2so11827239f.1 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=cuNMHLILDby0YSZLglYnBhHPiAikrudU4+JTuFjVVxqCRDVNmvt2lHjcDCD992Hebb H0qRUAzbPe0zXUcTHGbR4HkuwiI40i5Bs8eCULlK6eGM/1+UdErY58N6aJ2JAsCxIqJL xotdOuhA7+uuM6OejH/oD47xxwXtUx+QdPRWuX4AOOukT0IQOsZ9rGhyOB32Sj4DeAS0 3gkxYMl/f6Fqgqa6UdOuMXew6SPvpxT2IcqNxa1KTLPuqx9QYiS9CrAj54H5ljkHwSSS Owsu4qmdOq4Dof/9rrR6DTbj8SSlJl0+6N4mvstBW81Bmw10qcvtQnnNhGWoIlk7TcpQ udCw== X-Gm-Message-State: AOJu0YykSQje0SlycizkSG3Qut+NoOHwca5O+bOiRv6+kcEtQ3zxkM8v /ft3k64uBC9PFYfXRd2Dm6CLtQ== 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: linux-acpi@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