Skip to content

Commit

Permalink
core: Add hypercall to write to debug console
Browse files Browse the repository at this point in the history
In order to debug non-root cell boot-strap procedures, it can be helpful
to have a simple and reliable channel for printing messages, and that
independently of passing physical UARTs through or establishing virtual
networks. Such a channel can easily provided via a hypervisor that
writes to the hypervisor's debug console.

However, only invocations from cells which have the explicit permission
via the configuration flag JAILHOUSE_CELL_DEBUG_CONSOLE are executed.
The default remains off, and the administrator is expected to grant this
permission only temporarily while debugging a specific cell.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
  • Loading branch information
jan-kiszka committed Sep 26, 2016
1 parent eadf9fe commit a7aedbd
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Documentation/hypervisor-interfaces.txt
Expand Up @@ -255,6 +255,20 @@ Return code: Requested value (>=0) or negative error code
-EINVAL (-22) - invalid CPU ID


Hypercall "Debug Console putc" (code 8)
- - - - - - - - - - - - - - - - - - - -

Write a single character to the hypervisor's debug console.

Arguments: 1. character to write

Return code: 0 on success, negative error code otherwise

Possible errors are:
-EPERM (-1) - cell lacks JAILHOUSE_CELL_DEBUG_CONSOLE flag in its
configuration


Communication Region
--------------------

Expand Down
6 changes: 6 additions & 0 deletions hypervisor/control.c
Expand Up @@ -791,6 +791,12 @@ long hypercall(unsigned long code, unsigned long arg1, unsigned long arg2)
return cell_get_state(cpu_data, arg1);
case JAILHOUSE_HC_CPU_GET_INFO:
return cpu_get_info(cpu_data, arg1, arg2);
case JAILHOUSE_HC_DEBUG_CONSOLE_PUTC:
if (!(cpu_data->cell->config->flags &
JAILHOUSE_CELL_DEBUG_CONSOLE))
return -EPERM;
printk("%c", (char)arg1);
return 0;
default:
return -ENOSYS;
}
Expand Down
1 change: 1 addition & 0 deletions hypervisor/include/jailhouse/cell-config.h
Expand Up @@ -42,6 +42,7 @@
#define JAILHOUSE_CELL_NAME_MAXLEN 31

#define JAILHOUSE_CELL_PASSIVE_COMMREG 0x00000001
#define JAILHOUSE_CELL_DEBUG_CONSOLE 0x00000002

#define JAILHOUSE_CELL_DESC_SIGNATURE "JAILCELL"

Expand Down
1 change: 1 addition & 0 deletions hypervisor/include/jailhouse/hypercall.h
Expand Up @@ -47,6 +47,7 @@
#define JAILHOUSE_HC_HYPERVISOR_GET_INFO 5
#define JAILHOUSE_HC_CELL_GET_STATE 6
#define JAILHOUSE_HC_CPU_GET_INFO 7
#define JAILHOUSE_HC_DEBUG_CONSOLE_PUTC 8

/* Hypervisor information type */
#define JAILHOUSE_INFO_MEM_POOL_SIZE 0
Expand Down

0 comments on commit a7aedbd

Please sign in to comment.