hv: Support HV console for multiple VMs - ACRN partition mode

ACRN in partition mode provides vUART for all VMs. This patch adds
support to add console redirection for multiple VMs.

Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com>
This commit is contained in:
Sainath Grandhi 2018-08-16 00:50:30 -07:00 committed by wenlingz
parent b8c1fd6104
commit b17de6a7e6
3 changed files with 24 additions and 1 deletions

View File

@ -723,6 +723,13 @@ static int shell_to_sos_console(__unused int argc, __unused char **argv)
struct vm *vm;
struct vuart *vuart;
#ifdef CONFIG_PARTITION_MODE
if (argc == 2U) {
guest_no = atoi(argv[1]);
}
vuart_vmid = guest_no;
#endif
/* Get the virtual device node */
vm = get_vm_from_vmid(guest_no);
if (vm == NULL) {

View File

@ -43,6 +43,10 @@
#define vm_vuart(vm) (vm->vuart)
#ifdef CONFIG_PARTITION_MODE
int8_t vuart_vmid = - 1;
#endif
static void fifo_reset(struct fifo *fifo)
{
fifo->rindex = 0U;
@ -349,7 +353,17 @@ void vuart_console_rx_chars(struct vuart *vu)
struct vuart *vuart_console_active(void)
{
#ifdef CONFIG_PARTITION_MODE
struct vm *vm;
if (vuart_vmid == -1) {
return NULL;
}
vm = get_vm_from_vmid(vuart_vmid);
#else
struct vm *vm = get_vm_from_vmid(0U);
#endif
if ((vm != NULL) && (vm->vuart != NULL)) {
struct vuart *vu = vm->vuart;

View File

@ -59,7 +59,9 @@ struct vuart {
struct vm *vm;
spinlock_t lock; /* protects all softc elements */
};
#ifdef CONFIG_PARTITION_MODE
extern int8_t vuart_vmid;
#endif
#ifdef HV_DEBUG
void *vuart_init(struct vm *vm);
struct vuart *vuart_console_active(void);