[PATCH] pstore: Use root address-cells/size-cells as defaults for reserved-memory

Andrey Skvortsov andrej.skvortzov at gmail.com
Sat Aug 26 22:06:17 CEST 2023


Hi Heinrich,

On 23-08-26 15:10, Heinrich Schuchardt wrote:
> On 8/26/23 14:16, Andrey Skvortsov wrote:
> > u-boot adds reserve-memory node, if it's missing, with following
> > properties:
> > 
> > ```
> >      reserved-memory {
> >           #address-cells = <2>;
> >           #size-cells = <2>;
> 
> This defines the size of cells for the children of reserved-memory and
> and for the ranges property. If you set the cell sizes to 1 you can no
> longer encode 64 bit addresses.

This will be limited to 32 bit only for platforms, that don't support
64 bit. These platforms explicitly defines #address-cells = 1 and #size-cells = 1 in
root node.


> >           ranges;
> >      }
> > ```
> > 
> > But with these default address-cells and size-cells values, pstore
> > isn't working on A64. Root node for A64 defines 'address-cells' and
> > 'size-cells' as 1.
> > 
> > dtc complains if reserved-memory has different address-cells and
> > size-cells.
> > 
> > ```
> >       Warning (ranges_format): /reserved-memory:ranges: empty "ranges"
> >       property but its #address-cells (2) differs from / (1)
> 
> I cannot find any such requirement in the Devicetree Specification 1.4.
> Is this a dtc bug?

This is current behavior of Linux kernel. When root #address-cells and
reserved-memory #address-cells don't match, then reserved-memory
region is ignored. See [1].

dmesg output:
```
 OF: fdt: Reserved memory: unsupported node format, ignoring
```

> > This patch takes into account address-cells and size-cells of the root
> > node and uses them as values for new reserved-memory node.
> 
> Reservations may be above 4 GiB. How does your patch consider this?

It's entirely possible to do on platforms, that support that. Default
fallback value is still 2 for #address-cells and #size-cells.


1. https://elixir.bootlin.com/linux/latest/source/drivers/of/fdt.c#L548

-- 
Best regards,
Andrey Skvortsov


More information about the U-Boot mailing list