dts - linux,usable-memory
Laurentiu-Cristian Duca
laurentiu.duca at gmail.com
Thu Aug 3 00:50:57 PDT 2023
On 8/2/23, Samuel Holland <samuel.holland at sifive.com> wrote:
> 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>;
>
I tried this also without success. The same error.
here is my devicetree.dts:
/dts-v1/;
/ {
#address-cells = <0x2>;
#size-cells = <0x2>;
model = "kise-lab,simrv";
compatible = "kise_lab,simrv";
cpus {
#address-cells = <0x1>;
#size-cells = <0x0>;
// 104 * 10^6 = 0x632ea00
timebase-frequency = <0x632ea00>;
cpu at 0 {
device_type = "cpu";
reg = <0x0>;
status = "okay";
compatible = "riscv";
riscv,isa = "rv32acim";
mmu-type = "riscv,sv32";
// 104 * 10^6 = 0x632ea00
clock-frequency = <0x632ea00>;
interrupt-controller {
#interrupt-cells = <0x1>;
interrupt-controller;
compatible = "riscv,cpu-intc";
phandle = <0x1>;
linux,phandle = <0x01>;
};
};
cpu at 1 {
device_type = "cpu";
reg = <0x1>;
status = "okay";
compatible = "riscv";
riscv,isa = "rv32acim";
mmu-type = "riscv,sv32";
clock-frequency = <0x632ea00>;
interrupt-controller {
#interrupt-cells = <0x01>;
interrupt-controller;
compatible = "riscv,cpu-intc";
phandle = <0x02>;
linux,phandle = <0x02>;
};
};
};
memory at 80000000 {
device_type = "memory";
//reg = <0x0 0x80000000 0x0 0x4000000>;
// tangnano
reg = <0x0 0x80000000 0x0 0x700000>;
linux,usable-memory = <0x0 0x80000000 0x0 0x700000>;
};
soc {
#address-cells = <0x2>;
#size-cells = <0x2>;
compatible = "simple-bus";
ranges;
clint at 60000000 {
compatible = "riscv,clint0";
reg = <0x0 0x60000000 0x0 0x8000000>;
//interrupts-extended = <0x01 0x03 0x01 0x07
0x02 0x03 0x02 0x07>; // m priv level
interrupts-extended = <0x01 0x01 0x01 0x05
0x02 0x01 0x02 0x05>; // s priv level
};
plic at 50000000 {
#interrupt-cells = <0x1>;
interrupt-controller;
compatible = "riscv,plic0";
riscv,ndev = <0x1f>;
reg = <0x0 0x50000000 0x0 0x8000000>;
interrupts-extended = <0x01 0x09 0x01 0x0b
0x02 0x09 0x02 0x0b>;
phandle = <0x3>;
};
};
chosen {
//bootargs = "console=hvc0 earlycon=sbi root=/dev/vda
rw initcall_debug=1 ignore_loglevel=1";
bootargs = "console=hvc0 earlycon=sbi root=/dev/vda rw
ignore_loglevel=1";
//bootargs = "console=hvc0 earlycon=sbi root=/dev/vda
rw ignore_loglevel=1 memmap=3800K at 80002000,4000K at 80400000";
//bootargs = "console=hvc0 earlycon=sbi root=/dev/vda rw";
};
};
thank you,
laurentiu
> Regards,
> Samuel
>
>
More information about the linux-riscv
mailing list