[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 00/36] Introduce NS8250 UART emulator
The patch series introduces initial in-hypervisor emulator for NS8250/NS16x50-compatible UARTs under CONFIG_HAS_VUART_NS8250. In parallel domain creation scenario (hyperlaunch), NS8520 emulator helps early guest OS bringup debugging, because it eliminates dependency on the external emulator being operational by the time domains are created. Also, there's no early console facility similar to vpl011 to support x86 guest OS bring up. The NS8250 emulator is disabled by default. Series ====== - patches 1-2: some miscellaneous random fixes, added into the series because I stepped into those while debugging NS8250 emulator. - patches 3-14: preparation fixes for xen console and NS8250 emulator. - patches 15-29: xen console driver cleanup and preparation for enabling physical serial console focus assignment to the guest VM w/ virtual NS8250. - patches 30-36: initial NS8250 emulator. That adds the I/O port emulator for legacy PC COM UARTs, Kconfig option, enabling emulator and libxl plumbing. Limitations =========== - Only x86; - Only Linux guest tested so far; - Only legacy COM{1,2,3,4} resources, no customization; - Only Xen console as a backend, no inter-domain communication (similar to vpl011 on Arm); - Only 8-bit characters; - Baud rate is not emulated; - FIFO-less mode is not emulated properly; - RX FIFO interrupt moderation (FCR) is not emulated properly, TL16C750 has special FCR handling; - No integration w/ VM snapshotting (HVM_REGISTER_SAVE_RESTORE() and friends); - Assumes no ISA-device IRQ sharing; - MMIO-based UART is not supported. Testing ======= I tested boot of HVM linux guest w/ OVMF as the virtual firmware. The emulator, if enabled via CONFIG_HAS_VUART_NS8250=y, will use COM1 (0x3f8) resources by default. To test w/ virtual COM1, the guest kernel parameters should contain earlycon=uart,io,0x3f8,115200n8 console=uart,io,0x3f8,115200n8 Xen is able to forward physical console input to the domain w/ virtual NS8250. To switch the console focus press Ctrl+aaa. If console= is given to the HVM kernel, then the user shall be able to see the login prompt on xen console once console focus is switched to the HVM guest. Signed-off-by: Denis Mukhin <dmukhin@xxxxxxxx> --- Denis Mukhin (36): x86/setup: fix typo in acpi=off description xsm/flask: missing breaks, MISRA rule 16.4 xen: introduce resource.h xen/irq: introduce NO_IRQ xen/xmalloc: add kmalloc() and kfree() aliases xen/ctype: introduce isconsole() arm/vuart: use guest_printk() arm/vuart: make domain_has_vuart() public riscv/domain: introduce domain_has_vuart() ppc/domain: introduce domain_has_vuart() x86/domain: introduce domain_has_vuart() x86/domain: print emulation_flags xen/domain: add get_initial_domain_id() xen/domain: enable max_init_domid for all architectures xen/console: move vpl011-related code to vpl011 emulator xen/console: rename console_input_domain xen/console: rename switch_serial_input() to console_find_owner() xen/console: rename console_rx to console_owner xen/console: introduce printk_common() xen/console: introduce consoled_is_enabled() xen/console: introduce use of 'is_console' flag xen/console: introduce console_set_owner() xen/console: introduce console_owner_domid() xen/console: introduce console_init_owner() xen/console: introduce handle_keypress_in_domain() xen/console: introduce console_write() xen/console: introduce hwdom_crashconsole= xen/console: simplify console owner switch hint xen/console: make console buffer size configurable xen/8250-uart: add missing definitions x86/hvm: add HVM-specific Kconfig x86/hvm: add helpers for raising guest IRQs x86/hvm: introduce NS8250 UART emulator x86/domain: implement domain_has_vuart() xen/console: enable console owners w/ emulated NS8250 docs/misc: update console documentation docs/misc/console.txt | 48 +- docs/misc/xen-command-line.pandoc | 5 + tools/libs/light/libxl_x86.c | 6 +- tools/ocaml/libs/xc/xenctrl.ml | 1 + tools/ocaml/libs/xc/xenctrl.mli | 1 + tools/python/xen/lowlevel/xc/xc.c | 4 +- xen/arch/arm/include/asm/domain.h | 9 + xen/arch/arm/include/asm/setup.h | 2 - xen/arch/arm/include/asm/vpl011.h | 2 +- xen/arch/arm/setup.c | 2 - xen/arch/arm/vpl011.c | 21 +- xen/arch/arm/vuart.c | 9 +- xen/arch/ppc/include/asm/domain.h | 2 + xen/arch/ppc/include/asm/setup.h | 2 - xen/arch/riscv/include/asm/domain.h | 2 + xen/arch/riscv/include/asm/setup.h | 2 - xen/arch/x86/Kconfig | 66 +- xen/arch/x86/dom0_build.c | 2 + xen/arch/x86/domain.c | 16 +- xen/arch/x86/hvm/Kconfig | 77 ++ xen/arch/x86/hvm/Makefile | 1 + xen/arch/x86/hvm/hvm.c | 10 +- xen/arch/x86/hvm/irq.c | 24 + xen/arch/x86/hvm/vuart_ns8250.c | 1012 +++++++++++++++++++++++++++ xen/arch/x86/include/asm/domain.h | 8 +- xen/arch/x86/include/asm/hvm/domain.h | 5 + xen/arch/x86/include/asm/hvm/irq.h | 3 + xen/arch/x86/include/asm/hvm/vuart_ns8250.h | 75 ++ xen/arch/x86/include/asm/pv/shim.h | 4 +- xen/arch/x86/include/asm/setup.h | 3 +- xen/arch/x86/pv/shim.c | 6 +- xen/arch/x86/setup.c | 2 +- xen/common/device-tree/device-tree.c | 21 +- xen/common/domain.c | 41 +- xen/drivers/char/Kconfig | 23 + xen/drivers/char/console.c | 379 +++++----- xen/drivers/char/consoled.c | 18 +- xen/drivers/passthrough/arm/smmu.c | 19 +- xen/include/public/arch-x86/xen.h | 14 +- xen/include/xen/8250-uart.h | 82 ++- xen/include/xen/console.h | 4 +- xen/include/xen/consoled.h | 35 +- xen/include/xen/ctype.h | 3 + xen/include/xen/domain.h | 4 + xen/include/xen/irq.h | 1 + xen/include/xen/lib.h | 3 + xen/include/xen/resource.h | 40 ++ xen/include/xen/xmalloc.h | 5 + xen/xsm/flask/hooks.c | 4 + 49 files changed, 1778 insertions(+), 350 deletions(-) --- base-commit: c8e3e39085bf97d1afb775d54884d239387e32cd change-id: 20241125-vuart-ns8250-v1-5a4b57ca529e Best regards, -- Denis Mukhin <dmukhin@xxxxxxxx>
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |