[PATCH kvmtool 5/5] riscv: Fix serial0 alias path
Anup Patel
apatel at ventanamicro.com
Mon Aug 15 03:13:25 PDT 2022
We have all MMIO devices under "/smb" DT node so the serial0 alias
path should have "/smb" prefix.
Fixes: 7c9aac003925 ("riscv: Generate FDT at runtime for Guest/VM")
Signed-off-by: Anup Patel <apatel at ventanamicro.com>
---
riscv/fdt.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/riscv/fdt.c b/riscv/fdt.c
index aeba042..e3d7717 100644
--- a/riscv/fdt.c
+++ b/riscv/fdt.c
@@ -122,6 +122,7 @@ static int setup_fdt(struct kvm *kvm)
cpu_to_fdt64(kvm->arch.memory_guest_start),
cpu_to_fdt64(kvm->ram_size),
};
+ char *str;
void *fdt = staging_fdt;
void *fdt_dest = guest_flat_to_host(kvm,
kvm->arch.dtb_guest_start);
@@ -205,12 +206,15 @@ static int setup_fdt(struct kvm *kvm)
_FDT(fdt_end_node(fdt));
if (fdt_stdout_path) {
- _FDT(fdt_begin_node(fdt, "aliases"));
- _FDT(fdt_property_string(fdt, "serial0", fdt_stdout_path));
- _FDT(fdt_end_node(fdt));
-
+ str = malloc(strlen(fdt_stdout_path) + strlen("/smb") + 1);
+ sprintf(str, "/smb%s", fdt_stdout_path);
free(fdt_stdout_path);
fdt_stdout_path = NULL;
+
+ _FDT(fdt_begin_node(fdt, "aliases"));
+ _FDT(fdt_property_string(fdt, "serial0", str));
+ _FDT(fdt_end_node(fdt));
+ free(str);
}
/* Finalise. */
--
2.34.1
More information about the kvm-riscv
mailing list