Skip to contentSkip to conversation

hw/rx: rx-gdbsim DTB load address aligned of 16byte.

PATCH Superseded Yoshinori Sato 2 participants 3 messages Feb 2, 2022 – Feb 3, 2022

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 hw/rx: rx-gdbsim DTB load address aligned of 16byte.

Linux kernel required alined address of DTB.
But missing align in dtb load function.
Fixed to load to the correct address.

v2 changes.
Use ROUND_DOWN macro.

---
 hw/rx/rx-gdbsim.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/rx/rx-gdbsim.c +1 -1
index 75d1fec6ca..2356af83a0 100644
@@ -142,7 +142,7 @@ static void rx_gdbsim_init(MachineState *machine)
                 exit(1);
             }
             /* DTB is located at the end of SDRAM space. */
-            dtb_offset = machine->ram_size - dtb_size;
+            dtb_offset = ROUND_DOWN(machine->ram_size - dtb_size, 16 - 1);
             rom_add_blob_fixed("dtb", dtb, dtb_size,
                                SDRAM_BASE + dtb_offset);
             /* Set dtb address to R1 */
Signature · 1 line
2.30.2
#1 lore raw
Quoted 18 lines · Yoshinori Sato

Linux kernel required alined address of DTB.
But missing align in dtb load function.
Fixed to load to the correct address.

v2 changes.
Use ROUND_DOWN macro.

---
  hw/rx/rx-gdbsim.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/rx/rx-gdbsim.c +0 -0
index 75d1fec6ca..2356af83a0 100644

hw/rx/rx-gdbsim.c static void rx_gdbsim_init(MachineState *machine) · line 145

Quoted 5 lines
hw/rx/rx-gdbsim.c +1 -1
@@ -142,7 +142,7 @@ static void rx_gdbsim_init(MachineState *machine)
                  exit(1);
              }
              /* DTB is located at the end of SDRAM space. */
-            dtb_offset = machine->ram_size - dtb_size;
+            dtb_offset = ROUND_DOWN(machine->ram_size - dtb_size, 16 - 1);

Why did you add '-1'?

#2 lore raw
Quoted 15 lines · Philippe Mathieu-Daudé via
Quoted 13 lines · Yoshinori Sato

Linux kernel required alined address of DTB.
But missing align in dtb load function.
Fixed to load to the correct address.

v2 changes.
Use ROUND_DOWN macro.

---
  hw/rx/rx-gdbsim.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines

hw/rx/rx-gdbsim.c static void rx_gdbsim_init(MachineState *machine) · line 145

Quoted 10 lines
hw/rx/rx-gdbsim.c +1 -1
index 75d1fec6ca..2356af83a0 100644
@@ -142,7 +142,7 @@ static void rx_gdbsim_init(MachineState *machine)
                  exit(1);
              }
              /* DTB is located at the end of SDRAM space. */
-            dtb_offset = machine->ram_size - dtb_size;
+            dtb_offset = ROUND_DOWN(machine->ram_size - dtb_size, 16 - 1);

Why did you add '-1'?

Oh. I misunderstood.
I'll sent v3.
Thanks.

Signature · 1 line
Yosinori Sato