Skip to content

Commit b17de6a

Browse files
Sainath Grandhiwenlingz
authored andcommitted
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>
1 parent b8c1fd6 commit b17de6a

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

hypervisor/debug/shell.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,13 @@ static int shell_to_sos_console(__unused int argc, __unused char **argv)
723723
struct vm *vm;
724724
struct vuart *vuart;
725725

726+
#ifdef CONFIG_PARTITION_MODE
727+
if (argc == 2U) {
728+
guest_no = atoi(argv[1]);
729+
}
730+
731+
vuart_vmid = guest_no;
732+
#endif
726733
/* Get the virtual device node */
727734
vm = get_vm_from_vmid(guest_no);
728735
if (vm == NULL) {

hypervisor/debug/vuart.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@
4343

4444
#define vm_vuart(vm) (vm->vuart)
4545

46+
#ifdef CONFIG_PARTITION_MODE
47+
int8_t vuart_vmid = - 1;
48+
#endif
49+
4650
static void fifo_reset(struct fifo *fifo)
4751
{
4852
fifo->rindex = 0U;
@@ -349,7 +353,17 @@ void vuart_console_rx_chars(struct vuart *vu)
349353

350354
struct vuart *vuart_console_active(void)
351355
{
356+
#ifdef CONFIG_PARTITION_MODE
357+
struct vm *vm;
358+
359+
if (vuart_vmid == -1) {
360+
return NULL;
361+
}
362+
363+
vm = get_vm_from_vmid(vuart_vmid);
364+
#else
352365
struct vm *vm = get_vm_from_vmid(0U);
366+
#endif
353367

354368
if ((vm != NULL) && (vm->vuart != NULL)) {
355369
struct vuart *vu = vm->vuart;

hypervisor/include/debug/vuart.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ struct vuart {
5959
struct vm *vm;
6060
spinlock_t lock; /* protects all softc elements */
6161
};
62-
62+
#ifdef CONFIG_PARTITION_MODE
63+
extern int8_t vuart_vmid;
64+
#endif
6365
#ifdef HV_DEBUG
6466
void *vuart_init(struct vm *vm);
6567
struct vuart *vuart_console_active(void);

0 commit comments

Comments
 (0)