8250 driver
diff --git a/arch/arm64/kvm/Kconfig b/arch/arm64/kvm/Kconfig
index 425cff3..a90c54e 100644
--- a/arch/arm64/kvm/Kconfig
+++ b/arch/arm64/kvm/Kconfig
@@ -68,6 +68,9 @@
config KVM_ARM_HYP_DEBUG_UART_DRIVER_PL011
bool "pl011"
+config KVM_ARM_HYP_DEBUG_UART_DRIVER_8250
+ bool "8250"
+
endchoice
config KVM_ARM_HYP_DEBUG_UART_ADDR
diff --git a/arch/arm64/kvm/hyp/debug-pl011.h b/arch/arm64/kvm/hyp/debug-pl011.h
index 320490c..5989940 100644
--- a/arch/arm64/kvm/hyp/debug-pl011.h
+++ b/arch/arm64/kvm/hyp/debug-pl011.h
@@ -68,6 +68,37 @@ static inline void __hyp_uart_wait_tx_flush(void *base)
#endif /* __ASSEMBLY__ */
+#elif defined(CONFIG_KVM_ARM_HYP_DEBUG_UART_DRIVER_8250)
+
+#define HYP_8250_UART_LSR (5 << 2)
+#define HYP_8250_UART_LSR_TEMT 6
+
+#ifdef __ASSEMBLY__
+
+.macro hyp_uart_wait_tx_ready, tmpnr
+9992: hyp_uart_base x\tmpnr
+ ldr w\tmpnr, [x\tmpnr, HYP_8250_UART_LSR]
+ tbz w\tmpnr, HYP_8250_UART_LSR_TEMT, 9992b
+.endm
+
+.macro hyp_uart_wait_tx_flush, tmpnr
+.endm
+
+#else /* __ASSEMBLY__ */
+
+static inline void __hyp_uart_wait_tx_ready(void *base)
+{
+ unsigned int val;
+
+ do {
+ val = __hyp_readw(base + HYP_8250_UART_LSR);
+ } while (!(val & (1u << HYP_8250_UART_LSR_TEMT)));
+}
+
+static inline void __hyp_uart_wait_tx_flush(void *base) {}
+
+#endif /* __ASSEMBLY__ */
+
#endif /* CONFIG_KVM_ARM_HYP_DEBUG_UART_DRIVER_* */
#ifdef __ASSEMBLY__