mbox series

[v1,0/8] xen/console: cleanup console input switch logic

Message ID 20250318233617.849903-1-dmukhin@ford.com (mailing list archive)
Headers show
Series xen/console: cleanup console input switch logic | expand

Message

Denis Mukhin March 18, 2025, 11:36 p.m. UTC
Currently, on x86, console input can be rotated in round-robin manner
only between dom0, PV shim, and Xen itself. On Arm the input rotation
can include domUs with vpl011.
  
The patch series introduces the concept of "console focus", which is
defined as the ID of the domain that currently owns the physical console
input.
  
The patch series originates from the NS16550 UART emulator series [1]
for x86, which requires ability to switch physical console input to a
PVH/HVM domain with an emulated UART.
 
The main idea is introducing a per-domain permission flag that is set
during domain initialization and used by the console driver to switch
the input across permitted domains.
 
Patch 0 removes all the trailing white spaces in the console driver code.
 
Patch 1 introduces a new domain permission flag to mark ownership of the
console input for the console driver.   
 
Patches 2-4 prepare console driver to allow console input rotation
across multiple domains based on the new permission flag.
 
Patches 5-6 perform mechanical renames to fit the usage in the code.
 
Patch 7 cleans up the console input switch logic.
 
Patch 8 simplifies the existing vUART code by using newly introduced APIs.

CI: https://gitlab.com/xen-project/people/dmukhin/xen/-/pipelines/1723361248

[1]: https://lore.kernel.org/xen-devel/20250103-vuart-ns8250-v3-v1-0-c5d36b31d66c@ford.com/

Denis Mukhin (8):
  xen/console: fix trailing whitespaces
  xen/console: introduce console input permission
  xen/domain: introduce domid_top
  xen/domain: introduce domid_alloc()
  xen/console: rename switch_serial_input() to console_switch_focus()
  xen/console: rename console_rx to console_focus
  xen/console: introduce console_set_focus()
  xen/console: introduce console_get_focus()

 xen/arch/arm/dom0less-build.c      |  15 ++-
 xen/arch/arm/domain_build.c        |  19 +++-
 xen/arch/arm/include/asm/setup.h   |   2 -
 xen/arch/arm/setup.c               |   2 -
 xen/arch/arm/vpl011.c              |   7 +-
 xen/arch/ppc/include/asm/setup.h   |   2 -
 xen/arch/riscv/include/asm/setup.h |   2 -
 xen/arch/x86/include/asm/setup.h   |   2 -
 xen/arch/x86/pv/shim.c             |   2 +
 xen/common/domain.c                |   5 +
 xen/common/domctl.c                |  71 +++++++++------
 xen/common/kernel.c                |   8 ++
 xen/drivers/char/console.c         | 142 +++++++++++++++++------------
 xen/include/xen/console.h          |   3 +-
 xen/include/xen/domain.h           |   5 +
 xen/include/xen/sched.h            |   8 +-
 16 files changed, 180 insertions(+), 115 deletions(-)

Comments

Denis Mukhin March 19, 2025, 7:52 p.m. UTC | #1
On Tuesday, March 18th, 2025 at 4:36 PM, dmkhn@proton.me <dmkhn@proton.me> wrote:

> 
> 
> Currently, on x86, console input can be rotated in round-robin manner
> only between dom0, PV shim, and Xen itself. On Arm the input rotation
> can include domUs with vpl011.
> 
> The patch series introduces the concept of "console focus", which is
> defined as the ID of the domain that currently owns the physical console
> input.
> 
> The patch series originates from the NS16550 UART emulator series [1]
> for x86, which requires ability to switch physical console input to a
> PVH/HVM domain with an emulated UART.
> 
> The main idea is introducing a per-domain permission flag that is set
> during domain initialization and used by the console driver to switch
> the input across permitted domains.
> 
> Patch 0 removes all the trailing white spaces in the console driver code.
> 
> Patch 1 introduces a new domain permission flag to mark ownership of the
> console input for the console driver.
> 
> Patches 2-4 prepare console driver to allow console input rotation
> across multiple domains based on the new permission flag.
> 
> Patches 5-6 perform mechanical renames to fit the usage in the code.
> 
> Patch 7 cleans up the console input switch logic.
> 
> Patch 8 simplifies the existing vUART code by using newly introduced APIs.

Corrected series explanation:

Patch 1 removes all the trailing white spaces in the console driver code.

Patch 2 introduces a new domain permission flag to mark ownership of the
console input for the console driver.
 
Patches 3, 4 prepare console driver to allow console input rotation
across multiple domains based on the new permission flag.

Patches 5, 6 perform mechanical renames to fit the usage in the code.
 
Patch 7 cleans up the console input switch logic.

Patch 8 simplifies the existing vUART code by using newly introduced APIs.


> 
> CI: https://gitlab.com/xen-project/people/dmukhin/xen/-/pipelines/1723361248
> 
> [1]: https://lore.kernel.org/xen-devel/20250103-vuart-ns8250-v3-v1-0-c5d36b31d66c@ford.com/
> 
> Denis Mukhin (8):
> xen/console: fix trailing whitespaces
> xen/console: introduce console input permission
> xen/domain: introduce domid_top
> xen/domain: introduce domid_alloc()
> xen/console: rename switch_serial_input() to console_switch_focus()
> xen/console: rename console_rx to console_focus
> xen/console: introduce console_set_focus()
> xen/console: introduce console_get_focus()
> 
> xen/arch/arm/dom0less-build.c | 15 ++-
> xen/arch/arm/domain_build.c | 19 +++-
> xen/arch/arm/include/asm/setup.h | 2 -
> xen/arch/arm/setup.c | 2 -
> xen/arch/arm/vpl011.c | 7 +-
> xen/arch/ppc/include/asm/setup.h | 2 -
> xen/arch/riscv/include/asm/setup.h | 2 -
> xen/arch/x86/include/asm/setup.h | 2 -
> xen/arch/x86/pv/shim.c | 2 +
> xen/common/domain.c | 5 +
> xen/common/domctl.c | 71 +++++++++------
> xen/common/kernel.c | 8 ++
> xen/drivers/char/console.c | 142 +++++++++++++++++------------
> xen/include/xen/console.h | 3 +-
> xen/include/xen/domain.h | 5 +
> xen/include/xen/sched.h | 8 +-
> 16 files changed, 180 insertions(+), 115 deletions(-)
> 
> --
> 2.34.1