acrn-hypervisor/hypervisor/include/debug/npk_log.h
Zhi Jin 6367650a70 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>
2018-08-23 11:09:25 +08:00

57 lines
1.1 KiB
C

/*
* Copyright (C) 2018 Intel Corporation.
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef NPK_LOG_H
#define NPK_LOG_H
#define HV_NPK_LOG_REF_SHIFT 2U
#define HV_NPK_LOG_REF_MASK ((1U << HV_NPK_LOG_REF_SHIFT) - 1U)
#define HV_NPK_LOG_MAX 1024U
#define HV_NPK_LOG_HDR 0x01000242U
enum {
HV_NPK_LOG_CMD_INVALID,
HV_NPK_LOG_CMD_CONF,
HV_NPK_LOG_CMD_ENABLE,
HV_NPK_LOG_CMD_DISABLE,
HV_NPK_LOG_CMD_QUERY,
};
enum {
HV_NPK_LOG_RES_INVALID,
HV_NPK_LOG_RES_OK,
HV_NPK_LOG_RES_KO,
HV_NPK_LOG_RES_ENABLED,
HV_NPK_LOG_RES_DISABLED,
};
struct hv_npk_log_param;
struct npk_chan {
uint64_t Dn;
uint64_t DnM;
uint64_t DnTS;
uint64_t DnMTS;
uint64_t USER;
uint64_t USER_TS;
uint32_t FLAG;
uint32_t FLAG_TS;
uint32_t MERR;
uint32_t unused;
} __packed;
#ifdef HV_DEBUG
void npk_log_setup(struct hv_npk_log_param *param);
void npk_log_write(const char *buf, size_t len);
#else
static inline void npk_log_setup(__unused struct hv_npk_log_param *param)
{}
static inline void npk_log_write(__unused const char *buf, __unused size_t len)
{}
#endif /* HV_DEBUG */
#endif /* NPK_LOG_H */