For the moment, only support the fast&easy output path that is always
available: SBI. No UARTs needed for the hypervisor, SBI suffices atm.

Signed-off-by: Ralf Ramsauer <[email protected]>
---
 hypervisor/arch/riscv/dbg-write.c | 18 +++++++++++++++++-
 include/jailhouse/console.h       |  1 +
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/hypervisor/arch/riscv/dbg-write.c 
b/hypervisor/arch/riscv/dbg-write.c
index 6bd75887..8f85b321 100644
--- a/hypervisor/arch/riscv/dbg-write.c
+++ b/hypervisor/arch/riscv/dbg-write.c
@@ -4,14 +4,30 @@
  * Copyright (c) Siemens AG, 2020
  *
  * Authors:
- *  Jan Kiszka <[email protected]>
+ *  Konrad Schwarz <[email protected]>
  *
  * This work is licensed under the terms of the GNU GPL, version 2.  See
  * the COPYING file in the top-level directory.
  */
 
+#include <jailhouse/types.h>
+#include <jailhouse/console.h>
+#include <jailhouse/control.h>
 #include <jailhouse/printk.h>
+#include <asm/sbi.h>
+
+static void riscv_dbg_write_sbi(const char *msg)
+{
+       char ch;
+
+       while ((ch = *msg++))
+               sbi_console_putchar_legacy0_1(ch);
+}
 
 void arch_dbg_write_init(void)
 {
+       u32 dbg_type = system_config->debug_console.type;
+
+       if (dbg_type == JAILHOUSE_CON_TYPE_RISCV_SBI)
+               arch_dbg_write = riscv_dbg_write_sbi;
 }
diff --git a/include/jailhouse/console.h b/include/jailhouse/console.h
index e7c934a5..e53df8ff 100644
--- a/include/jailhouse/console.h
+++ b/include/jailhouse/console.h
@@ -51,6 +51,7 @@
 #define JAILHOUSE_CON_TYPE_IMX         0x0008
 #define JAILHOUSE_CON_TYPE_IMX_LPUART  0x0009
 #define JAILHOUSE_CON_TYPE_SCIF                0x000a
+#define JAILHOUSE_CON_TYPE_RISCV_SBI   0x000b
 
 /* Flags: bit 0 is used to select PIO (cleared) or MMIO (set) access */
 #define JAILHOUSE_CON_ACCESS_PIO       0x0000
-- 
2.40.1

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/20230519204033.643200-35-ralf.ramsauer%40oth-regensburg.de.

Reply via email to