[PATCH] hw/rx: rx-gdbsim: DTB load address fix.

Yoshinori Sato posted 1 patch 4 years ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20220131094203.772226-1-ysato@users.sourceforge.jp
Maintainers: Yoshinori Sato <ysato@users.sourceforge.jp>
hw/rx/rx-gdbsim.c | 1 +
1 file changed, 1 insertion(+)
[PATCH] hw/rx: rx-gdbsim: DTB load address fix.
Posted by Yoshinori Sato 4 years ago
Linux kernel required alined address of DTB.
But missing align in dtb load function.
Fixed to load to the correct address.

Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
---
 hw/rx/rx-gdbsim.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/rx/rx-gdbsim.c b/hw/rx/rx-gdbsim.c
index 75d1fec6ca..f70472aeaf 100644
--- a/hw/rx/rx-gdbsim.c
+++ b/hw/rx/rx-gdbsim.c
@@ -143,6 +143,7 @@ static void rx_gdbsim_init(MachineState *machine)
             }
             /* DTB is located at the end of SDRAM space. */
             dtb_offset = machine->ram_size - dtb_size;
+            dtb_offset &= ~0x0f;
             rom_add_blob_fixed("dtb", dtb, dtb_size,
                                SDRAM_BASE + dtb_offset);
             /* Set dtb address to R1 */
-- 
2.30.2


Re: [PATCH] hw/rx: rx-gdbsim: DTB load address fix.
Posted by Philippe Mathieu-Daudé via 4 years ago
Cc'ing qemu-trivial@

On 31/1/22 10:42, Yoshinori Sato wrote:
> Linux kernel required alined address of DTB.
> But missing align in dtb load function.
> Fixed to load to the correct address.
> 
> Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
> ---
>   hw/rx/rx-gdbsim.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/hw/rx/rx-gdbsim.c b/hw/rx/rx-gdbsim.c
> index 75d1fec6ca..f70472aeaf 100644
> --- a/hw/rx/rx-gdbsim.c
> +++ b/hw/rx/rx-gdbsim.c
> @@ -143,6 +143,7 @@ static void rx_gdbsim_init(MachineState *machine)
>               }
>               /* DTB is located at the end of SDRAM space. */
>               dtb_offset = machine->ram_size - dtb_size;
> +            dtb_offset &= ~0x0f;


Alternatively (more explicit):

           dtb_offset = ROUND_DOWN(machine->ram_size - dtb_size, 16);

For any option:
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>