From: Bhupinder Thakur <bhupinder.thakur@linaro.org>
To: xen-devel@lists.xenproject.org
Cc: Stefano Stabellini <sstabellini@kernel.org>,
Wei Liu <wei.liu2@citrix.com>,
George Dunlap <George.Dunlap@eu.citrix.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Ian Jackson <ian.jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
Julien Grall <julien.grall@arm.com>,
Jan Beulich <jbeulich@suse.com>,
Andre Przywara <andre.przywara@arm.com>
Subject: [PATCH 00/25 v7] SBSA UART emulation support in Xen
Date: Mon, 7 Aug 2017 14:22:52 +0530 [thread overview]
Message-ID: <1502095997-31219-1-git-send-email-bhupinder.thakur@linaro.org> (raw)
SBSA UART emulation for guests in Xen
======================================
Linaro has published VM System specification for ARM Processors, which
provides a set of guidelines for both guest OS and hypervisor implementations,
such that building OS images according to these guidelines guarantees
that those images can also run on hypervisors compliant with this specification.
One of the spec requirements is that the hypervisor must provide an
emulated SBSA UART as a serial console which meets the minimum requirements in
SBSA UART as defined in appendix B of the following
ARM Server Base Architecture Document:
https://static.docs.arm.com/den0029/a/Server_Base_System_Architecture_v3_1_ARM_DEN_0029A.pdf.
This feature allows the Xen guests to use SBSA compliant UART as
as a console.
Note that SBSA UART is a subset of full featured ARM pl011 UART and
supports only a subset of registers as mentioned below. It does not support
rx/tx DMA.
Currently, Xen supports paravirtualized (aka PV console) and an emulated serial
consoles. This feature will expose an emulated SBSA UART console to the
guest, which a user can access using xenconsole.
The device tree passed to the guest VM will contain the SBSA UART MMIO address
range and an irq for receiving rx/tx interrupts. The device tree format
is specified in Documentation/devicetree/bindings/serial/arm_sbsa_uart.txt.
The Xen hypervisor will expose two types of interfaces to the backend and domU.
The interface exposed to domU will be an emulated SBSA UART by emulating the
access to the following registers by the guest.
- Data register (DR) - RW
- Raw interrupt status register (RIS) - RO
- Masked interrupt status register (MIS)- RO
- Interrupt Mask (IMSC) - RW
- Interrupt Clear (ICR) - WO
It will also inject the interrupts to the guest in the following
conditions:
- incoming data in the rx buffer for the guest
- there is space in the tx buffer for the guest to write more data
The interface exposed to the backend will be the same PV console interface,
which minimizes the changes required in xenconsole to support a new SBSA UART
console.
This interface has rx and tx ring buffers and an event channel for
sending/receiving events from the backend.
So essentially Xen handles the data on behalf of domU and the backend. Any data
written by domU is captured by Xen and written to the TX (OUT) ring buffer
and an event is raised to the backend to read the TX ring buffer.
Similarly on reciving an event from xenconsole, Xen injects an interrupt to guest to
indicate there is data available in the RX (IN) ring buffer.
The SBSA UART state is completely captured in the set of registers
mentioned above and this state is updated everytime there is an event from
the backend or there is register read/write access from domU.
For example, if domU has masked the rx interrupt in the IMSC register, then Xen
will not inject an interrupt to guest and will just update the RIS register.
Once the interrupt is unmasked by guest, the interrupt will be delivered to the
guest.
Changes summary:
Xen Hypervisor
===============
1. Add emulation code to emulate read/write access to SBSA UART registers and
interrupts:
- It emulates DR read/write by reading and writing from/to the IN and
OUT ring buffers and raising an event to dom0 when there is data in
the OUT ring buffer and injecting an interrupt to the guest when there
is data in the IN ring buffer.
- Other registers are related to interrupt management and essentially
control when interrupts are delivered to the guest.
2. Add a new domctl API to initialize SBSA UART emulation in Xen.
3. Enable SBSA UART emulation for a domain based on a libxl option passed during
domain creation.
Toolstack
==========
1. Add a new option "vuart" in the domU configuration file to enable/disable vuart.
2. Create a SBSA UART DT node in the guest device tree. It uses a fixed
SPI IRQ number and MMIO address range for SBSA UART.
3. Call vuart init DOMCTL API to enable SBSA UART emulation.
5. Add a new vuart xenstore node, which contains:
- ring-ref
- event channel
- buffer limit
- type
Xenconsoled
============
1. Split the domain structure to support multiple consoles.
2. Modify different APIs such as buffer_append() etc. to operate on the
console structure.
3. Add support for handling multiple consoles.
4. Add support for vuart console:
The vpl011 changes available at the following repo:
url: https://git@git.linaro.org:/people/bhupinder.thakur/xen.git
branch: vpl011_v6
Kindly wait for one day to checkout the code from the above URL.
There are some TBD items which need to be looked at in the future:
1. Currently UEFI firmware logs the output to hvc console only. How can
UEFI firmware be made aware of pl011 console and how it can use it
as a console instead of hvc.
There was a discussion on this and it was decided that SBSA UART should
be used as a debug port by the UEFI firmware so that all debug output
is redirected to this port.
2. Linux seems to have hvc console as the default console i.e. if no
console is specified then it uses hvc as the console. How can an
option be provided in Linux to select either hvc or pl011 as the
default console.
It was suggeted to use the SPCR in ACPI and the stdout-path option in the
device tree to specify the default console. However, currently hvc console
is not describable in the ACPI/device tree. This support will have to be
added to allow the user to specify the default console.
3. ACPI support for pl011 device.
CC: Andrew Cooper <andrew.cooper3@citrix.com>
CC: George Dunlap <George.Dunlap@eu.citrix.com>
CC: Ian Jackson <ian.jackson@eu.citrix.com>
CC: Jan Beulich <jbeulich@suse.com>
CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Tim Deegan <tim@xen.org>
CC: Wei Liu <wei.liu2@citrix.com>
CC: Julien Grall <julien.grall@arm.com>
CC: Andre Przywara <andre.przywara@arm.com>
Bhupinder Thakur (25):
xen/arm: vpl011: Define common ring buffer helper functions in
console.h
xen/arm: vpl011: Add SBSA UART emulation in Xen
xen/arm: vpl011: Allocate a new GFN in the toolstack for vuart
xen/arm: vpl011: Add support for vuart in libxl
xen/arm: vpl011: Rearrange xen header includes in alphabetical order
in domctl.c
xen/arm: vpl011: Add a new domctl API to initialize vpl011
xen/arm: vpl011: Add a new vuart node in the xenstore
xen/arm: vpl011: Modify xenconsole to define and use a new console
structure
xen/arm: vpl011: Rename the console structure field conspath to xspath
xen/arm: vpl011: Modify xenconsole functions to take console structure
as input
xen/arm: vpl011: Add a new console_init function in xenconsole
xen/arm: vpl011: Add a new buffer_available function in xenconsole
xen/arm: vpl011: Add a new maybe_add_console_evtchn_fd function in
xenconsole
xen/arm: vpl011: Add a new maybe_add_console_tty_fd function in
xenconsole
xen/arm: vpl011: Add a new console_evtchn_unmask function in
xenconsole
xen/arm: vpl011: Add a new handle_console_ring function in xenconsole
xen/arm: vpl011: Add a new handle_console_tty function in xenconsole
xen/arm: vpl011: Add a new console_cleanup function in xenconsole
xen/arm: vpl011: Add a new console_open_log function in xenconsole
xen/arm: vpl011: Add a new console_close_evtchn function in xenconsole
xen/arm: vpl011: Add support for multiple consoles in xenconsole
xen/arm: vpl011: Add support for vuart console in xenconsole
xen/arm: vpl011: Add a new vuart console type to xenconsole client
xen/arm: vpl011: Add a pl011 uart DT node in the guest device tree
xen/arm: vpl011: Update documentation for vuart console support
config/arm32.mk | 1 +
config/arm64.mk | 1 +
docs/man/xl.cfg.pod.5.in | 12 +
docs/misc/console.txt | 44 ++-
tools/console/Makefile | 3 +-
tools/console/client/main.c | 13 +-
tools/console/daemon/io.c | 659 +++++++++++++++++++++++------------
tools/libxc/include/xc_dom.h | 2 +
tools/libxc/include/xenctrl.h | 20 ++
tools/libxc/xc_dom_arm.c | 5 +-
tools/libxc/xc_dom_boot.c | 2 +
tools/libxc/xc_domain.c | 25 ++
tools/libxl/libxl.h | 5 +
tools/libxl/libxl_arch.h | 7 +
tools/libxl/libxl_arm.c | 74 ++++
tools/libxl/libxl_console.c | 47 +++
tools/libxl/libxl_create.c | 9 +-
tools/libxl/libxl_device.c | 9 +-
tools/libxl/libxl_dom.c | 5 +
tools/libxl/libxl_internal.h | 6 +
tools/libxl/libxl_types.idl | 7 +
tools/libxl/libxl_types_internal.idl | 1 +
tools/libxl/libxl_x86.c | 8 +
tools/xl/xl_cmdtable.c | 2 +-
tools/xl/xl_console.c | 5 +-
tools/xl/xl_parse.c | 8 +
xen/arch/arm/Kconfig | 7 +
xen/arch/arm/Makefile | 1 +
xen/arch/arm/domain.c | 6 +
xen/arch/arm/domctl.c | 48 ++-
xen/arch/arm/vpl011.c | 454 ++++++++++++++++++++++++
xen/include/asm-arm/domain.h | 6 +
xen/include/asm-arm/pl011-uart.h | 2 +
xen/include/asm-arm/vpl011.h | 72 ++++
xen/include/public/arch-arm.h | 6 +
xen/include/public/domctl.h | 21 ++
xen/include/public/io/console.h | 4 +
37 files changed, 1366 insertions(+), 241 deletions(-)
create mode 100644 xen/arch/arm/vpl011.c
create mode 100644 xen/include/asm-arm/vpl011.h
--
2.7.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next reply other threads:[~2017-08-07 8:53 UTC|newest]
Thread overview: 67+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-07 8:52 Bhupinder Thakur [this message]
2017-08-07 8:52 ` [PATCH 01/25 v7] xen/arm: vpl011: Define common ring buffer helper functions in console.h Bhupinder Thakur
2017-08-07 8:52 ` [PATCH 02/25 v7] xen/arm: vpl011: Add SBSA UART emulation in Xen Bhupinder Thakur
2017-08-07 8:52 ` [PATCH 03/25 v7] xen/arm: vpl011: Allocate a new GFN in the toolstack for vuart Bhupinder Thakur
2017-08-07 8:52 ` [PATCH 04/25 v7] xen/arm: vpl011: Add support for vuart in libxl Bhupinder Thakur
2017-08-08 13:38 ` Julien Grall
2017-08-08 13:42 ` Julien Grall
2017-08-07 8:52 ` [PATCH 05/25 v7] xen/arm: vpl011: Rearrange xen header includes in alphabetical order in domctl.c Bhupinder Thakur
2017-08-07 8:52 ` [PATCH 06/25 v7] xen/arm: vpl011: Add a new domctl API to initialize vpl011 Bhupinder Thakur
2017-08-07 9:14 ` Jan Beulich
2017-08-21 10:28 ` Bhupinder Thakur
2017-08-21 11:56 ` Jan Beulich
2017-08-08 13:11 ` Wei Liu
2017-08-08 13:30 ` Wei Liu
2017-08-08 13:47 ` Julien Grall
2017-08-08 13:56 ` Julien Grall
2017-08-07 8:52 ` [PATCH 07/25 v7] xen/arm: vpl011: Add a new vuart node in the xenstore Bhupinder Thakur
2017-08-07 8:53 ` [PATCH 08/25 v7] xen/arm: vpl011: Modify xenconsole to define and use a new console structure Bhupinder Thakur
2017-08-07 8:53 ` [PATCH 09/25 v7] xen/arm: vpl011: Rename the console structure field conspath to xspath Bhupinder Thakur
2017-08-07 8:53 ` [PATCH 10/25 v7] xen/arm: vpl011: Modify xenconsole functions to take console structure as input Bhupinder Thakur
2017-08-07 8:53 ` [PATCH 11/25 v7] xen/arm: vpl011: Add a new console_init function in xenconsole Bhupinder Thakur
2017-08-08 13:11 ` Wei Liu
2017-08-07 8:53 ` [PATCH 12/25 v7] xen/arm: vpl011: Add a new buffer_available " Bhupinder Thakur
2017-08-07 8:53 ` [PATCH 13/25 v7] xen/arm: vpl011: Add a new maybe_add_console_evtchn_fd " Bhupinder Thakur
2017-08-08 13:12 ` Wei Liu
2017-08-07 8:53 ` [PATCH 14/25 v7] xen/arm: vpl011: Add a new maybe_add_console_tty_fd " Bhupinder Thakur
2017-08-08 13:12 ` Wei Liu
2017-08-07 8:53 ` [PATCH 15/25 v7] xen/arm: vpl011: Add a new console_evtchn_unmask " Bhupinder Thakur
2017-08-08 13:15 ` Wei Liu
2017-08-07 8:53 ` [PATCH 16/25 v7] xen/arm: vpl011: Add a new handle_console_ring " Bhupinder Thakur
2017-08-08 13:16 ` Wei Liu
2017-08-07 8:53 ` [PATCH 17/25 v7] xen/arm: vpl011: Add a new handle_console_tty " Bhupinder Thakur
2017-08-07 8:53 ` [PATCH 18/25 v7] xen/arm: vpl011: Add a new console_cleanup " Bhupinder Thakur
2017-08-08 13:29 ` Wei Liu
2017-08-07 8:53 ` [PATCH 19/25 v7] xen/arm: vpl011: Add a new console_open_log " Bhupinder Thakur
2017-08-08 13:31 ` Wei Liu
2017-08-07 8:53 ` [PATCH 20/25 v7] xen/arm: vpl011: Add a new console_close_evtchn " Bhupinder Thakur
2017-08-07 8:53 ` [PATCH 21/25 v7] xen/arm: vpl011: Add support for multiple consoles " Bhupinder Thakur
2017-08-08 13:48 ` Wei Liu
2017-08-07 8:53 ` [PATCH 22/25 v7] xen/arm: vpl011: Add support for vuart console " Bhupinder Thakur
2017-08-08 13:52 ` Wei Liu
2017-08-07 8:53 ` [PATCH 23/25 v7] xen/arm: vpl011: Add a new vuart console type to xenconsole client Bhupinder Thakur
2017-08-07 8:53 ` [PATCH 24/25 v7] xen/arm: vpl011: Add a pl011 uart DT node in the guest device tree Bhupinder Thakur
2017-08-08 14:12 ` Julien Grall
2017-08-08 14:53 ` Bhupinder Thakur
2017-08-07 8:53 ` [PATCH 25/25 v7] xen/arm: vpl011: Update documentation for vuart console support Bhupinder Thakur
2017-08-08 14:15 ` Julien Grall
2017-08-08 15:59 ` [PATCH 00/25 v7] SBSA UART emulation support in Xen Julien Grall
2017-08-09 10:58 ` Bhupinder Thakur
2017-08-09 11:03 ` Wei Liu
2017-08-10 7:59 ` Bhupinder Thakur
2017-08-10 11:40 ` Wei Liu
2017-08-10 12:40 ` Julien Grall
2017-08-10 13:01 ` Wei Liu
2017-08-10 14:31 ` Julien Grall
2017-08-10 15:36 ` Wei Liu
2017-08-10 14:26 ` Julien Grall
2017-08-10 16:00 ` Wei Liu
2017-08-10 16:11 ` Julien Grall
2017-08-10 16:38 ` Wei Liu
2017-08-10 17:51 ` Julien Grall
2017-08-15 9:49 ` Wei Liu
2017-08-18 13:30 ` Julien Grall
2017-08-18 13:48 ` Wei Liu
2017-08-14 7:52 ` Bhupinder Thakur
2017-08-14 13:54 ` Julien Grall
2017-08-22 14:35 ` Julien Grall
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1502095997-31219-1-git-send-email-bhupinder.thakur@linaro.org \
--to=bhupinder.thakur@linaro.org \
--cc=George.Dunlap@eu.citrix.com \
--cc=andre.przywara@arm.com \
--cc=andrew.cooper3@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=julien.grall@arm.com \
--cc=sstabellini@kernel.org \
--cc=tim@xen.org \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.