From: Simon Glass <sjg@chromium.org>
To: devicetree@vger.kernel.org
Cc: Maximilian Brune <maximilian.brune@9elements.com>,
ron minnich <rminnich@gmail.com>, Tom Rini <trini@konsulko.com>,
Dhaval Sharma <dhaval@rivosinc.com>,
U-Boot Mailing List <u-boot@lists.denx.de>,
Mark Rutland <mark.rutland@arm.com>,
Yunhui Cui <cuiyunhui@bytedance.com>,
linux-acpi@vger.kernel.org, Ard Biesheuvel <ardb@kernel.org>,
Gua Guo <gua.guo@intel.com>,
Lean Sheng Tan <sheng.tan@9elements.com>,
Guo Dong <guo.dong@intel.com>,
lkml <linux-kernel@vger.kernel.org>,
Rob Herring <robh@kernel.org>,
Chiu Chasel <chasel.chiu@intel.com>,
Simon Glass <sjg@chromium.org>
Subject: [PATCH v5 2/4] Bring in some other reserved-memory files
Date: Wed, 30 Aug 2023 17:17:50 -0600 [thread overview]
Message-ID: <20230830231758.2561402-2-sjg@chromium.org> (raw)
In-Reply-To: <20230830231758.2561402-1-sjg@chromium.org>
Add schema yaml files from v6.5 which are not vendor-specific, nor
Linux-specific.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
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>;
+ };
+ };
+
+...
--
2.42.0.rc2.253.gd59a3bf2b4-goog
next prev parent reply other threads:[~2023-08-30 23:18 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-30 23:17 [PATCH v5 1/4] Add reserved-memory Simon Glass
2023-08-30 23:17 ` Simon Glass [this message]
2023-08-30 23:17 ` [PATCH v5 3/4] schemas: Add some common reserved-memory usages Simon Glass
2023-09-05 21:44 ` Ard Biesheuvel
2023-09-06 14:34 ` Rob Herring
2023-09-06 14:53 ` Simon Glass
2023-09-06 16:08 ` Ard Biesheuvel
[not found] ` <CAPnjgZ1oGF0Ni3RhK4fv6mJk40YjqyFVJxt6FfS9AW2rkcs9iA@mail.gmail.com>
2023-09-07 13:31 ` Ard Biesheuvel
2023-09-07 13:56 ` Simon Glass
2023-09-07 14:12 ` Ard Biesheuvel
2023-09-07 14:50 ` Simon Glass
2023-09-07 15:07 ` Ard Biesheuvel
2023-09-07 15:56 ` Simon Glass
2023-09-07 16:19 ` Ard Biesheuvel
2023-09-07 21:39 ` Simon Glass
2023-09-07 15:43 ` Rob Herring
2023-08-30 23:17 ` [PATCH v5 4/4] memory: Add ECC properties Simon Glass
2023-09-07 16:58 ` Rob Herring
2023-09-07 16:41 ` [PATCH v5 1/4] Add reserved-memory Rob Herring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230830231758.2561402-2-sjg@chromium.org \
--to=sjg@chromium.org \
--cc=ardb@kernel.org \
--cc=chasel.chiu@intel.com \
--cc=cuiyunhui@bytedance.com \
--cc=devicetree@vger.kernel.org \
--cc=dhaval@rivosinc.com \
--cc=gua.guo@intel.com \
--cc=guo.dong@intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=maximilian.brune@9elements.com \
--cc=rminnich@gmail.com \
--cc=robh@kernel.org \
--cc=sheng.tan@9elements.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).