Skip to content

schemas: reserved-memory: clarify reg supports a single entry only#197

Merged
robherring merged 1 commit into
devicetree-org:mainfrom
one-theone:main
Jun 12, 2026
Merged

schemas: reserved-memory: clarify reg supports a single entry only#197
robherring merged 1 commit into
devicetree-org:mainfrom
one-theone:main

Conversation

@one-theone

@one-theone one-theone commented May 19, 2026

Copy link
Copy Markdown

The existing description is internally inconsistent. The opening sentence says "Each child of the reserved-memory node specifies one or more regions of reserved memory", but the next sentence narrows this to a singular form: "Each child node may either use a 'reg' property to specify a specific range of reserved memory, or a 'size' property ... to request a dynamically allocated block of memory"

Multiple entries in 'reg' have never been fully functional in the Linux kernel, so drop the "one or more" wording and add 'maxItems: 1' to the reg property.

Suggested-by: Rob Herring robh@kernel.org
Link: https://lore.kernel.org/all/20260506014752.GA280279-robh@kernel.org/

The corresponding Linux kernel support is under review on LKML
( https://lore.kernel.org/lkml/20260525121700.2706141-1-chenwandun1@gmail.com/)

The existing description is internally inconsistent. The opening
sentence says "Each child of the reserved-memory node specifies one
or more regions of reserved memory", but the next sentence narrows
this to a singular form: "Each child node may either use a 'reg'
property to specify a specific range of reserved memory, or a 'size'
property ... to request a dynamically allocated block of memory"

Multiple entries in 'reg' have never been fully functional in the
Linux kernel, so drop the "one or more" wording and add 'maxItems: 1'
to the reg property.

Suggested-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/all/20260506014752.GA280279-robh@kernel.org/
Signed-off-by: Wandun Chen <chenwandun@lixiang.com>
mj22226 pushed a commit to mj22226/linux that referenced this pull request Jun 3, 2026
A /reserved-memory child node may have multiple <base size> tuples in
'reg' property, but multiple entries in 'reg' have never been fully
functional:
 - fdt_scan_reserved_mem() in the early pass loops over every
   tuple and reserves them all.

 - fdt_scan_reserved_mem_late() reads 'reg' by
   of_flat_dt_get_addr_size(), which returns false if entries != 1.
   So 'reg' property with multiple <base size> entries will be
   skipped, no reserved_mem entry is created in reserved_mem[].

Supporting multiple <base size> tuples is not a good idea:
  - It requires reserved_mem_ops->node_init support. Currently,
    CMA(rmem_cma_setup) and DMA(rmem_dma_setup) are not supported.

  - of_reserved_mem_lookup() is name-based, only the first entry in
    multiple <base size> tuples will be found.

So change to support one <base size> entry in 'reg' property.

Also update dt binding:
  devicetree-org/dt-schema#197

Suggested-by: Rob Herring <robh@kernel.org>
Signed-off-by: Wandun Chen <chenwandun@lixiang.com>
Tested-by: Meijing Zhao <zhaomeijing@lixiang.com>
Link: https://lore.kernel.org/all/20260506014752.GA280279-robh@kernel.org/
Link: https://patch.msgid.link/20260525121700.2706141-1-chenwandun1@gmail.com
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
@robherring robherring merged commit 2203c17 into devicetree-org:main Jun 12, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants