hv: debug: add the hypervisor NPK log

The npk_log is a log destination for the hypervisor, similar to the
console_log and the mem_log. It can be enabled/disabled/configured
by the SOS kernel via the hypercall HC_SETUP_HV_NPK_LOG.
The configuration includes:
1. Set the MMIO base address of the reserved NPK master.
2. Set the log level of the hypervisor NPK log.
After that, the npk_log can be enabled to write the hypervisor logs to
the MMIO address of the reserved NPK master with a simple header.

Signed-off-by: Zhi Jin <zhi.jin@intel.com>
Signed-off-by: Liu, Xiaojing <xiaojing.liu@intel.com>
Reviewed-by: CHEN Gang <gang.c.chen@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
Zhi Jin
2018-08-01 13:23:35 +08:00
committed by wenlingz
parent 3c6df9b70c
commit 6367650a70
8 changed files with 183 additions and 13 deletions

View File

@@ -128,6 +128,7 @@ static struct shell_cmd shell_cmds[] = {
/* The initial log level*/
uint32_t console_loglevel = CONFIG_CONSOLE_LOGLEVEL_DEFAULT;
uint32_t mem_loglevel = CONFIG_MEM_LOGLEVEL_DEFAULT;
uint32_t npk_loglevel = CONFIG_NPK_LOGLEVEL_DEFAULT;
static struct shell hv_shell;
static struct shell *p_shell = &hv_shell;
@@ -872,17 +873,21 @@ static int shell_loglevel(int argc, char **argv)
{
char str[MAX_STR_SIZE] = {0};
if (argc == 1) {
snprintf(str, MAX_STR_SIZE,
"console_loglevel: %u, mem_loglevel: %u\r\n",
console_loglevel, mem_loglevel);
shell_puts(str);
} else if (argc == 2) {
console_loglevel = atoi(argv[1]);
} else if (argc == 3) {
console_loglevel = atoi(argv[1]);
switch (argc) {
case 4:
npk_loglevel = atoi(argv[3]);
case 3:
mem_loglevel = atoi(argv[2]);
} else {
case 2:
console_loglevel = atoi(argv[1]);
break;
case 1:
snprintf(str, MAX_STR_SIZE, "console_loglevel: %u, "
"mem_loglevel: %u, npk_loglevel: %u\r\n",
console_loglevel, mem_loglevel, npk_loglevel);
shell_puts(str);
break;
default:
return -EINVAL;
}