[PATCH] hw/loongarch/virt: Fix FDT memory node address width

Jiaxun Yang posted 1 patch 6 months, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20240520-loongarch-fdt-memnode-v1-1-5ea9be93911e@flygoat.com
Maintainers: Song Gao <gaosong@loongson.cn>
hw/loongarch/virt.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH] hw/loongarch/virt: Fix FDT memory node address width
Posted by Jiaxun Yang 6 months, 1 week ago
Higher bits for memory nodes were omitted at qemu_fdt_setprop_cells.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
This should be stable backported, otherwise DT boot is totally broken.
---
 hw/loongarch/virt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c
index f0640d2d8035..f97626bacf65 100644
--- a/hw/loongarch/virt.c
+++ b/hw/loongarch/virt.c
@@ -463,7 +463,8 @@ static void fdt_add_memory_node(MachineState *ms,
     char *nodename = g_strdup_printf("/memory@%" PRIx64, base);
 
     qemu_fdt_add_subnode(ms->fdt, nodename);
-    qemu_fdt_setprop_cells(ms->fdt, nodename, "reg", 0, base, 0, size);
+    qemu_fdt_setprop_cells(ms->fdt, nodename, "reg", base >> 32, base,
+                           size >> 32, size);
     qemu_fdt_setprop_string(ms->fdt, nodename, "device_type", "memory");
 
     if (ms->numa_state && ms->numa_state->num_nodes) {

---
base-commit: 85ef20f1673feaa083f4acab8cf054df77b0dbed
change-id: 20240520-loongarch-fdt-memnode-e36c01ae9b6e

Best regards,
-- 
Jiaxun Yang <jiaxun.yang@flygoat.com>
Re: [PATCH] hw/loongarch/virt: Fix FDT memory node address width
Posted by Michael Tokarev 6 months, 1 week ago
21.05.2024 00:06, Jiaxun Yang wrpte:
> Higher bits for memory nodes were omitted at qemu_fdt_setprop_cells.
> 
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
> This should be stable backported, otherwise DT boot is totally broken.

Please add Cc: qemu-stable@ for changes which needs to be back-ported.
I don't read *every* patch on qemu@ list, it just so happened I noticed
this one.

Thanks,

/mjt
-- 
GPG Key transition (from rsa2048 to rsa4096) since 2024-04-24.
New key: rsa4096/61AD3D98ECDF2C8E  9D8B E14E 3F2A 9DD7 9199  28F1 61AD 3D98 ECDF 2C8E
Old key: rsa2048/457CE0A0804465C5  6EE1 95D1 886E 8FFB 810D  4324 457C E0A0 8044 65C5
Transition statement: http://www.corpit.ru/mjt/gpg-transition-2024.txt
Re: [PATCH] hw/loongarch/virt: Fix FDT memory node address width
Posted by gaosong 6 months, 1 week ago
在 2024/5/21 上午5:06, Jiaxun Yang 写道:
> Higher bits for memory nodes were omitted at qemu_fdt_setprop_cells.
>
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
> This should be stable backported, otherwise DT boot is totally broken.
> ---
>   hw/loongarch/virt.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
Thank you.

Reviewed-by: Song Gao <gaosong@loongson.cn>

Thanks.
Song Gao
> diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c
> index f0640d2d8035..f97626bacf65 100644
> --- a/hw/loongarch/virt.c
> +++ b/hw/loongarch/virt.c
> @@ -463,7 +463,8 @@ static void fdt_add_memory_node(MachineState *ms,
>       char *nodename = g_strdup_printf("/memory@%" PRIx64, base);
>   
>       qemu_fdt_add_subnode(ms->fdt, nodename);
> -    qemu_fdt_setprop_cells(ms->fdt, nodename, "reg", 0, base, 0, size);
> +    qemu_fdt_setprop_cells(ms->fdt, nodename, "reg", base >> 32, base,
> +                           size >> 32, size);
>       qemu_fdt_setprop_string(ms->fdt, nodename, "device_type", "memory");
>   
>       if (ms->numa_state && ms->numa_state->num_nodes) {
>
> ---
> base-commit: 85ef20f1673feaa083f4acab8cf054df77b0dbed
> change-id: 20240520-loongarch-fdt-memnode-e36c01ae9b6e
>
> Best regards,