diff options
| author | Roman Bogorodskiy <novel@FreeBSD.org> | 2026-01-04 13:59:34 +0000 |
|---|---|---|
| committer | Roman Bogorodskiy <novel@FreeBSD.org> | 2026-01-07 18:06:45 +0100 |
| commit | 9fc7fe6427579f1c82a371588df6fd6af3b83dfd (patch) | |
| tree | 47b7c517ce5d726b1e92a3ca1ff78b887e494f8d /usr.sbin | |
| parent | 3b6615ec0332f901fcc9e9307f78717424f09c1e (diff) | |
bhyve: improve console error reporting on arm64
Currently, on arm64, if bhyve fails to initialize the console,
it falls into assert(), which does not look particularly pretty
for users.
Replace the assert with proper error handling so bhyve prints
a meaningful error message and exits with status code 4 (error).
That matches the behavior on amd64.
Approved by: markj
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D54504
Diffstat (limited to 'usr.sbin')
| -rw-r--r-- | usr.sbin/bhyve/aarch64/bhyverun_machdep.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/usr.sbin/bhyve/aarch64/bhyverun_machdep.c b/usr.sbin/bhyve/aarch64/bhyverun_machdep.c index e099df0559a1..10018d082f7e 100644 --- a/usr.sbin/bhyve/aarch64/bhyverun_machdep.c +++ b/usr.sbin/bhyve/aarch64/bhyverun_machdep.c @@ -270,7 +270,7 @@ mmio_uart_mem_handler(struct vcpu *vcpu __unused, int dir, return (0); } -static bool +static int init_mmio_uart(struct vmctx *ctx) { struct uart_pl011_softc *sc; @@ -280,14 +280,14 @@ init_mmio_uart(struct vmctx *ctx) path = get_config_value("console"); if (path == NULL) - return (false); + return (1); sc = uart_pl011_init(mmio_uart_intr_assert, mmio_uart_intr_deassert, ctx); if (uart_pl011_tty_open(sc, path) != 0) { EPRINTLN("Unable to initialize backend '%s' for mmio uart", path); - assert(0); + return (-1); } bzero(&mr, sizeof(struct mem_range)); @@ -301,7 +301,7 @@ init_mmio_uart(struct vmctx *ctx) error = register_mem(&mr); assert(error == 0); - return (true); + return (0); } static void @@ -414,8 +414,11 @@ bhyve_init_platform(struct vmctx *ctx, struct vcpu *bsp) return (error); } - if (init_mmio_uart(ctx)) + error = init_mmio_uart(ctx); + if (error == 0) fdt_add_uart(UART_MMIO_BASE, UART_MMIO_SIZE, UART_INTR); + else if (error < 0) + return (error); init_mmio_rtc(ctx); fdt_add_rtc(RTC_MMIO_BASE, RTC_MMIO_SIZE, RTC_INTR); fdt_add_timer(); |
