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

@@ -89,14 +89,17 @@ void do_logmsg(uint32_t severity, const char *fmt, ...)
uint16_t pcpu_id;
bool do_console_log;
bool do_mem_log;
bool do_npk_log;
char *buffer;
do_console_log = (((logmsg.flags & LOG_FLAG_STDOUT) != 0U) &&
(severity <= console_loglevel));
do_mem_log = (((logmsg.flags & LOG_FLAG_MEMORY) != 0U) &&
(severity <= mem_loglevel));
do_npk_log = ((logmsg.flags & LOG_FLAG_NPK) != 0U &&
(severity <= npk_loglevel));
if (!do_console_log && !do_mem_log) {
if (!do_console_log && !do_mem_log && !do_npk_log) {
return;
}
@@ -124,6 +127,10 @@ void do_logmsg(uint32_t severity, const char *fmt, ...)
- strnlen_s(buffer, LOG_MESSAGE_MAX_SIZE), fmt, args);
va_end(args);
/* Check if flags specify to output to NPK */
if (do_npk_log)
npk_log_write(buffer, strnlen_s(buffer, LOG_MESSAGE_MAX_SIZE));
/* Check if flags specify to output to stdout */
if (do_console_log) {
spinlock_irqsave_obtain(&(logmsg.lock), &rflags);