dts - linux,usable-memory

Samuel Holland samuel.holland at sifive.com
Wed Aug 2 08:13:12 PDT 2023


Hi Laurentiu,

On 2023-08-02 9:37 AM, Laurentiu-Cristian Duca wrote:
> On 8/2/23, Laurentiu-Cristian Duca <laurentiu.duca at gmail.com> wrote:
>> On 8/2/23, Conor Dooley <conor at kernel.org> wrote:
>>> Hey,
>>>
>>> On Wed, Aug 02, 2023 at 04:51:47PM +0300, Laurentiu-Cristian Duca wrote:
>>>>   my name is laurentiu-cristian duca and i am an open-source enthusiast.
>>>> lately i have tried to use the linux,usable-memory in the dts memory
>>>> node
>>>> and linux freezes.
>>>>   if i use only reg, linux boots fine.
>>>>   does anybody used linux,usable-memory and can you show a working
>>>> example.
>>>>
>>>>   here is what i tried
>>>>         memory at 80000000 {
>>>>                 device_type = "memory";
>>>>                 reg = <0x0 0x80000000 0x0 0x700000>;
>>>>                 //linux,usable-memory = <0x80000000 0x700000>;
>>>>         };
>>>
>>> What are you actually doing when you freeze? A normal boot? Kexec?
>>> What hardware is this?
>>> Are you using OpenSBI, and if so what version?
>>> What version of the kernel is this?
>>
>>   linux5.13.19 with busybox minimal rootfs, bbl (berkeley boot loader),
>> hardware fpga board with only uart and memory 8MB
>> i simulate in verilator the verilog sources and i have success if the
>> dts has reg.
>>  when it freezes, i can not see any message in simulation
> [    0.000000] Linux version 5.13.19 (laur at laurPC-100)
> (riscv32-linux-gcc.br_real (Buildroot 2021.08) 11.1.0, GNU ld (GNU
> Binutils) 2.37) #402 SMP Wed Aug 2 15:27:14 EEST 2023
> [    0.000000] OF: fdt: memory scan node memory at 80000000, reg size 8,
> [    0.000000] Machine model: kise-lab,simrv
> [    0.000000] earlycon: sbi0 at I/O port 0x0 (options '')
> [    0.000000] printk: bootconsole [sbi0] enabled
> [    0.000000] printk: debug: ignoring loglevel setting.
> from here i can not see anything
> 
> 
>> if you want to, i can send you the sources
>>
>>   please tell me if the dts memory property is written correctly for
>> linux,usable-memory

It is not. The number of cells you need is given by the #address-cells and
#size-cells properties of the root node (see early_init_dt_scan_memory()). You
didn't include that part of the DTS in your example, but I am guessing the "reg"
property is correct, and it has two cells each. linux,usable-memory should look
the same. So the correct format would be:

        linux,usable-memory = <0x0 0x80000000 0x0 0x700000>;

Regards,
Samuel




More information about the linux-riscv mailing list