aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnup Patel <apatel@ventanamicro.com>2022-08-15 15:43:25 +0530
committerWill Deacon <will@kernel.org>2022-09-22 13:28:36 +0100
commited805be52f57934729379e0afd546b7433f7f987 (patch)
tree4f24eae12a29093fe4d7aceebef00ba067a96c75
parent3c07aeaf993a2ec607ff4e1f8b5b78d300c3c8f5 (diff)
downloadkvmtool-ed805be52f57934729379e0afd546b7433f7f987.tar.gz
riscv: Fix serial0 alias path
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@ventanamicro.com> Link: https://lore.kernel.org/r/20220815101325.477694-6-apatel@ventanamicro.com Signed-off-by: Will Deacon <will@kernel.org>
-rw-r--r--riscv/fdt.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/riscv/fdt.c b/riscv/fdt.c
index aeba0428..e3d77175 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. */