All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anup Patel <apatel@ventanamicro.com>
To: kvm-riscv@lists.infradead.org
Subject: [PATCH kvmtool 5/5] riscv: Fix serial0 alias path
Date: Mon, 15 Aug 2022 15:43:25 +0530	[thread overview]
Message-ID: <20220815101325.477694-6-apatel@ventanamicro.com> (raw)
In-Reply-To: <20220815101325.477694-1-apatel@ventanamicro.com>

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>
---
 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



WARNING: multiple messages have this Message-ID (diff)
From: Anup Patel <apatel@ventanamicro.com>
To: Will Deacon <will@kernel.org>,
	julien.thierry.kdev@gmail.com, maz@kernel.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Atish Patra <atishp@atishpatra.org>,
	Alistair Francis <Alistair.Francis@wdc.com>,
	Anup Patel <anup@brainfault.org>,
	kvm@vger.kernel.org, kvm-riscv@lists.infradead.org,
	Anup Patel <apatel@ventanamicro.com>
Subject: [PATCH kvmtool 5/5] riscv: Fix serial0 alias path
Date: Mon, 15 Aug 2022 15:43:25 +0530	[thread overview]
Message-ID: <20220815101325.477694-6-apatel@ventanamicro.com> (raw)
In-Reply-To: <20220815101325.477694-1-apatel@ventanamicro.com>

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>
---
 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


  parent reply	other threads:[~2022-08-15 10:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-15 10:13 [PATCH kvmtool 0/5] KVMTOOL RISC-V Svpbmt and Sstc Support Anup Patel
2022-08-15 10:13 ` Anup Patel
2022-08-15 10:13 ` [PATCH kvmtool 1/5] Update UAPI headers based on Linux-6.0-rc1 Anup Patel
2022-08-15 10:13   ` Anup Patel
2022-08-15 10:13 ` [PATCH kvmtool 2/5] riscv: Append ISA extensions to the device tree Anup Patel
2022-08-15 10:13   ` Anup Patel
2022-08-15 10:13 ` [PATCH kvmtool 3/5] riscv: Add Svpbmt extension support Anup Patel
2022-08-15 10:13   ` Anup Patel
2022-08-15 10:13 ` [PATCH kvmtool 4/5] riscv: Add Sstc " Anup Patel
2022-08-15 10:13   ` Anup Patel
2022-08-15 10:13 ` Anup Patel [this message]
2022-08-15 10:13   ` [PATCH kvmtool 5/5] riscv: Fix serial0 alias path Anup Patel
2022-08-31  9:59 ` [PATCH kvmtool 0/5] KVMTOOL RISC-V Svpbmt and Sstc Support Anup Patel
2022-08-31  9:59   ` Anup Patel
2022-09-22 12:45 ` Will Deacon
2022-09-22 12:45   ` Will Deacon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220815101325.477694-6-apatel@ventanamicro.com \
    --to=apatel@ventanamicro.com \
    --cc=kvm-riscv@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.