[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] xen/riscv: add basic UART support



commit c428538c1a2ff6469ee6c1bf2da2a0a82d997629
Author:     Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
AuthorDate: Thu Jul 10 13:41:03 2025 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Jul 10 13:41:03 2025 +0200

    xen/riscv: add basic UART support
    
    Update Kconfig to select GENERIC_UART_INIT for basic UART init ( find a dt 
node
    and call device specific device_init() ).
    
    Drop `default n if RISCV` statement for config HAS_NS16550 as now ns16550 is
    ready to be compiled and used by RISC-V. Also, make the config user 
selectable
    for everyone except X86.
    
    Initialize a minimal amount of stuff to have UART and Xen console:
     - Initialize uart by calling uart_init().
     - Initialize Xen console by calling console_init_{pre,post}irq().
     - Initialize timer and its internal lists which are used by
       init_timer() which is called by ns16550_init_postirq(); otherwise
       "Unhandled exception: Store/AMO Page Fault" occurs.
     - Enable local interrupt to recieve an input from UART
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
    Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/arch/riscv/Kconfig   |  1 +
 xen/arch/riscv/setup.c   | 12 ++++++++++++
 xen/drivers/char/Kconfig |  3 +--
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/xen/arch/riscv/Kconfig b/xen/arch/riscv/Kconfig
index 62c5b7ba34..96bef90751 100644
--- a/xen/arch/riscv/Kconfig
+++ b/xen/arch/riscv/Kconfig
@@ -2,6 +2,7 @@ config RISCV
        def_bool y
        select FUNCTION_ALIGNMENT_16B
        select GENERIC_BUG_FRAME
+       select GENERIC_UART_INIT
        select HAS_DEVICE_TREE
        select HAS_PMAP
        select HAS_UBSAN
diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index 0e7398159c..a17096bf02 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -4,12 +4,15 @@
 #include <xen/bug.h>
 #include <xen/bootfdt.h>
 #include <xen/compile.h>
+#include <xen/console.h>
 #include <xen/device_tree.h>
 #include <xen/init.h>
 #include <xen/irq.h>
 #include <xen/mm.h>
+#include <xen/serial.h>
 #include <xen/shutdown.h>
 #include <xen/smp.h>
+#include <xen/timer.h>
 #include <xen/vmap.h>
 #include <xen/xvmalloc.h>
 
@@ -134,8 +137,17 @@ void __init noreturn start_xen(unsigned long bootcpu_id,
 
     intc_preinit();
 
+    uart_init();
+    console_init_preirq();
+
     intc_init();
 
+    timer_init();
+
+    local_irq_enable();
+
+    console_init_postirq();
+
     printk("All set up\n");
 
     machine_halt();
diff --git a/xen/drivers/char/Kconfig b/xen/drivers/char/Kconfig
index e6e12bb413..8e49a52c73 100644
--- a/xen/drivers/char/Kconfig
+++ b/xen/drivers/char/Kconfig
@@ -2,8 +2,7 @@ config GENERIC_UART_INIT
        bool
 
 config HAS_NS16550
-       bool "NS16550 UART driver" if ARM
-       default n if RISCV
+       bool "NS16550 UART driver" if !X86
        default y
        help
          This selects the 16550-series UART support. For most systems, say Y.
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.