xenvm: drivers: serial: Implement serial interface to Xen PV console
This commit adds minimal support of Xen hypervisor console via UART-like driver. Implementation allows to use poll_in/poll_out char interface for uart_console.c driver directly to HV console instead of using Xen virtual PL011 UART. Future implementation will support interrupt driven interface on Xen event channels, currently it is under development. Also this commit introduces early console_io Xen interface, which allows to receive printk/stdout messages quickly after start, but requires Xen, built with CONFIG_DEBUG option. Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
This commit is contained in:
parent
c4ab278688
commit
d9a3efb834
13 changed files with 348 additions and 2 deletions
23
include/xen/console.h
Normal file
23
include/xen/console.h
Normal file
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright (c) 2021 EPAM Systems
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#ifndef __XEN_CONSOLE_H__
|
||||
#define __XEN_CONSOLE_H__
|
||||
|
||||
#include <init.h>
|
||||
#include <device.h>
|
||||
#include <drivers/uart.h>
|
||||
#include <sys/device_mmio.h>
|
||||
|
||||
struct hvc_xen_data {
|
||||
DEVICE_MMIO_RAM; /* should be first */
|
||||
const struct device *dev;
|
||||
struct xencons_interface *intf;
|
||||
uint64_t evtchn;
|
||||
};
|
||||
|
||||
int xen_console_init(const struct device *dev);
|
||||
|
||||
#endif /* __XEN_CONSOLE_H__ */
|
13
include/xen/events.h
Normal file
13
include/xen/events.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* Copyright (c) 2021 EPAM Systems
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#ifndef __XEN_EVENTS_H__
|
||||
#define __XEN_EVENTS_H__
|
||||
|
||||
#include <xen/public/event_channel.h>
|
||||
|
||||
void notify_evtchn(evtchn_port_t port);
|
||||
|
||||
#endif /* __XEN_EVENTS_H__ */
|
14
include/xen/generic.h
Normal file
14
include/xen/generic.h
Normal file
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* Copyright (c) 2021 EPAM Systems
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#ifndef __XEN_GENERIC_H__
|
||||
#define __XEN_GENERIC_H__
|
||||
|
||||
#include <xen/public/xen.h>
|
||||
|
||||
#define XEN_PAGE_SIZE 4096
|
||||
#define XEN_PAGE_SHIFT 12
|
||||
|
||||
#endif /* __XEN_GENERIC_H__ */
|
17
include/xen/hvm.h
Normal file
17
include/xen/hvm.h
Normal file
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* Copyright (c) 2021 EPAM Systems
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#ifndef __XEN_HVM_H__
|
||||
#define __XEN_HVM_H__
|
||||
|
||||
#include <xen/public/hvm/hvm_op.h>
|
||||
#include <xen/public/hvm/params.h>
|
||||
|
||||
#include <kernel.h>
|
||||
|
||||
int hvm_set_parameter(int idx, uint64_t value);
|
||||
int hvm_get_parameter(int idx, uint64_t *value);
|
||||
|
||||
#endif /* __XEN_HVM_H__ */
|
Loading…
Add table
Add a link
Reference in a new issue