From 3209f157adb0fb387c5f2129b5c96249ae5a38f7 Mon Sep 17 00:00:00 2001 From: Daniel Rossier Date: Sat, 14 Nov 2026 10:50:53 +0100 Subject: [PATCH] avz: leave the i.MX UART's interrupt to the guest Under AVZ the UART's interrupt belongs to the agency, whose console driver attaches its own handler. AVZ bound imx_uart_int to it as well: gic_handle then ran that handler and EOIed the interrupt before it reached the guest, and the handler's read of URXD took the byte. On Verdin the agency console received nothing. pl011.c already skips the binding under CONFIG_AVZ; do the same here. edgem1 carried this as an AVZ patch; it can drop it. --- CHANGELOG | 7 ++++--- so3/so3/devices/serial/imx_uart.c | 10 ++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 035892328d..c28be831f2 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -21,9 +21,10 @@ POSIX networking calls, and the build system aligned on Infrabase. a paused one stays off the scheduler when an event arrives; a scheduler's lock has one holder which the other CPUs wait for, taken and released with its holder mark under masked interrupts (an interrupt in between - froze the CPU at boot, about one boot in 4200). A Raspberry - Pi 5 (BCM2712) platform skeleton is added; it builds but has not been - validated on a board yet. + froze the CPU at boot, about one boot in 4200); the i.MX UART's + interrupt is left to the agency, whose console lost its input on Verdin + when AVZ took it. A Raspberry Pi 5 (BCM2712) platform skeleton is + added; it builds but has not been validated on a board yet. • Kernel: the ARM timer reload is computed from the counter frequency (the Raspberry Pi 4 tick was 2.9 % too long); a futex is freed by its waker, diff --git a/so3/so3/devices/serial/imx_uart.c b/so3/so3/devices/serial/imx_uart.c index 22b022c512..5a93e276c4 100644 --- a/so3/so3/devices/serial/imx_uart.c +++ b/so3/so3/devices/serial/imx_uart.c @@ -97,6 +97,7 @@ static char imx_uart_get_byte(bool polling) return 0; } +#ifndef CONFIG_AVZ static irq_return_t imx_uart_int(int irq, void *dummy) { u32 val; @@ -123,6 +124,7 @@ static irq_return_t imx_uart_int(int irq, void *dummy) return IRQ_COMPLETED; } +#endif /* !CONFIG_AVZ */ static void imx_uart_enable_irq(void) { @@ -158,7 +160,15 @@ static int imx_uart_init(dev_t *dev, int fdt_offset) fdt_interrupt_node(fdt_offset, &imx_uart.irq_def); +#ifndef CONFIG_AVZ + /* As in pl011.c: when AVZ runs as hypervisor, the UART's interrupt + * belongs to the agency guest, its console driver attaches its own + * handler. Bound here, gic_handle's irq_desc->action != NULL branch + * would run imx_uart_int and EOI the interrupt before it ever reaches + * the guest, and imx_uart_int's read of URXD would take the byte from + * it as well. AVZ prints on the UART and reads nothing from it. */ irq_bind(imx_uart.irq_def.irqnr, imx_uart_int, NULL, NULL); +#endif serial_ops.enable_irq();