video: driver: add new command to update firmware logs
- use msm_vidc_debug for driver logs only - added support for msm_fw_debug, new command to update video fw log levels Change-Id: I4e1c50861ab056312c2df49673d419515d049f21 Signed-off-by: Deepa Guthyappa Madivalara <quic_dmadival@quicinc.com>
このコミットが含まれているのは:
@@ -35,6 +35,7 @@ struct msm_vidc_inst;
|
||||
#endif
|
||||
|
||||
extern unsigned int msm_vidc_debug;
|
||||
extern unsigned int msm_fw_debug;
|
||||
extern bool msm_vidc_lossless_encode;
|
||||
extern bool msm_vidc_syscache_disable;
|
||||
extern int msm_vidc_clock_voting;
|
||||
@@ -62,7 +63,7 @@ extern bool msm_vidc_synx_fence_enable;
|
||||
* To enable all messages set msm_vidc_debug = 0x101F
|
||||
*/
|
||||
|
||||
enum vidc_msg_prio {
|
||||
enum vidc_msg_prio_drv {
|
||||
VIDC_ERR = 0x00000001,
|
||||
VIDC_HIGH = 0x00000002,
|
||||
VIDC_LOW = 0x00000004,
|
||||
@@ -72,25 +73,27 @@ enum vidc_msg_prio {
|
||||
VIDC_STAT = 0x00000040,
|
||||
VIDC_ENCODER = 0x00000100,
|
||||
VIDC_DECODER = 0x00000200,
|
||||
VIDC_PRINTK = 0x00001000,
|
||||
VIDC_FTRACE = 0x00002000,
|
||||
FW_LOW = 0x00010000,
|
||||
FW_MED = 0x00020000,
|
||||
FW_HIGH = 0x00040000,
|
||||
FW_ERROR = 0x00080000,
|
||||
FW_FATAL = 0x00100000,
|
||||
FW_PERF = 0x00200000,
|
||||
VIDC_PRINTK = 0x10000000,
|
||||
VIDC_FTRACE = 0x20000000,
|
||||
};
|
||||
enum vidc_msg_prio_fw {
|
||||
FW_LOW = 0x00000001,
|
||||
FW_MED = 0x00000002,
|
||||
FW_HIGH = 0x00000004,
|
||||
FW_ERROR = 0x00000008,
|
||||
FW_FATAL = 0x00000010,
|
||||
FW_PERF = 0x00000020,
|
||||
FW_PRINTK = 0x10000000,
|
||||
FW_FTRACE = 0x20000000,
|
||||
};
|
||||
|
||||
#define DRV_LOG (VIDC_ERR | VIDC_PRINTK)
|
||||
#define DRV_LOGSHIFT (0)
|
||||
#define DRV_LOGMASK (0x0FFF)
|
||||
#define DRV_LOGMASK (0x0FFFFFFF)
|
||||
|
||||
#define FW_LOG (FW_ERROR | FW_FATAL | FW_PRINTK)
|
||||
#define FW_LOGSHIFT (16)
|
||||
#define FW_LOGMASK (0x0FFF0000)
|
||||
#define FW_LOGSHIFT (0)
|
||||
#define FW_LOGMASK (0x0FFFFFFF)
|
||||
|
||||
#define dprintk_inst(__level, __level_str, inst, __fmt, ...) \
|
||||
do { \
|
||||
@@ -146,7 +149,7 @@ enum vidc_msg_prio {
|
||||
|
||||
#define dprintk_firmware(__level, __fmt, ...) \
|
||||
do { \
|
||||
if (__level & FW_PRINTK) { \
|
||||
if ((msm_fw_debug & (__level)) & FW_PRINTK) { \
|
||||
pr_info(FW_DBG_TAG __fmt, \
|
||||
"fw", \
|
||||
##__VA_ARGS__); \
|
||||
|
@@ -21,11 +21,13 @@ extern struct msm_vidc_core *g_core;
|
||||
#define MSM_VIDC_MIN_STATS_DELAY_MS 200
|
||||
#define MSM_VIDC_MAX_STATS_DELAY_MS 10000
|
||||
|
||||
unsigned int msm_vidc_debug = (DRV_LOG | FW_LOG);
|
||||
unsigned int msm_vidc_debug = DRV_LOG;
|
||||
unsigned int msm_fw_debug = FW_LOG;
|
||||
|
||||
/* disabled synx fence by default temporarily */
|
||||
bool msm_vidc_synx_fence_enable = false;
|
||||
|
||||
static int debug_level_set(const char *val,
|
||||
static int debug_level_set_drv(const char *val,
|
||||
const struct kernel_param *kp)
|
||||
{
|
||||
struct msm_vidc_core *core = NULL;
|
||||
@@ -50,9 +52,8 @@ static int debug_level_set(const char *val,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* check if driver or FW logmask is more than default level */
|
||||
if (((dvalue & DRV_LOGMASK) & ~(DRV_LOG)) ||
|
||||
((dvalue & FW_LOGMASK) & ~(FW_LOG))) {
|
||||
/* check if driver is more than default level */
|
||||
if ((dvalue & DRV_LOGMASK) & ~(DRV_LOG)) {
|
||||
core->capabilities[HW_RESPONSE_TIMEOUT].value = 4 * HW_RESPONSE_TIMEOUT_VALUE;
|
||||
core->capabilities[SW_PC_DELAY].value = 4 * SW_PC_DELAY_VALUE;
|
||||
core->capabilities[FW_UNLOAD_DELAY].value = 4 * FW_UNLOAD_DELAY_VALUE;
|
||||
@@ -63,7 +64,8 @@ static int debug_level_set(const char *val,
|
||||
core->capabilities[FW_UNLOAD_DELAY].value = FW_UNLOAD_DELAY_VALUE;
|
||||
}
|
||||
|
||||
d_vpr_h("timeout updated: hw_response %u, sw_pc %u, fw_unload %u, debug_level %#x\n",
|
||||
d_vpr_h(
|
||||
"timeout updated for driver: hw_response %u, sw_pc %u, fw_unload %u, debug_level %#x\n",
|
||||
core->capabilities[HW_RESPONSE_TIMEOUT].value,
|
||||
core->capabilities[SW_PC_DELAY].value,
|
||||
core->capabilities[FW_UNLOAD_DELAY].value,
|
||||
@@ -72,14 +74,71 @@ static int debug_level_set(const char *val,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int debug_level_get(char *buffer, const struct kernel_param *kp)
|
||||
static int debug_level_set_fw(const char *val,
|
||||
const struct kernel_param *kp)
|
||||
{
|
||||
struct msm_vidc_core *core = NULL;
|
||||
unsigned int dvalue;
|
||||
int ret;
|
||||
|
||||
if (!kp || !kp->arg || !val) {
|
||||
d_vpr_e("%s: Invalid params\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ret = kstrtouint(val, 0, &dvalue);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
msm_fw_debug = dvalue;
|
||||
|
||||
core = *(struct msm_vidc_core **)kp->arg;
|
||||
|
||||
if (!core) {
|
||||
d_vpr_e("%s: Invalid core/capabilities\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* check if firmware is more than default level */
|
||||
if ((dvalue & FW_LOGMASK) & ~(FW_LOG)) {
|
||||
core->capabilities[HW_RESPONSE_TIMEOUT].value = 4 * HW_RESPONSE_TIMEOUT_VALUE;
|
||||
core->capabilities[SW_PC_DELAY].value = 4 * SW_PC_DELAY_VALUE;
|
||||
core->capabilities[FW_UNLOAD_DELAY].value = 4 * FW_UNLOAD_DELAY_VALUE;
|
||||
} else {
|
||||
/* reset timeout values, if user reduces the logging */
|
||||
core->capabilities[HW_RESPONSE_TIMEOUT].value = HW_RESPONSE_TIMEOUT_VALUE;
|
||||
core->capabilities[SW_PC_DELAY].value = SW_PC_DELAY_VALUE;
|
||||
core->capabilities[FW_UNLOAD_DELAY].value = FW_UNLOAD_DELAY_VALUE;
|
||||
}
|
||||
|
||||
d_vpr_h(
|
||||
"timeout updated for firmware: hw_response %u, sw_pc %u, fw_unload %u, debug_level %#x\n",
|
||||
core->capabilities[HW_RESPONSE_TIMEOUT].value,
|
||||
core->capabilities[SW_PC_DELAY].value,
|
||||
core->capabilities[FW_UNLOAD_DELAY].value,
|
||||
msm_fw_debug);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int debug_level_get_drv(char *buffer, const struct kernel_param *kp)
|
||||
{
|
||||
return scnprintf(buffer, PAGE_SIZE, "%#x", msm_vidc_debug);
|
||||
}
|
||||
|
||||
static int debug_level_get_fw(char *buffer, const struct kernel_param *kp)
|
||||
{
|
||||
return scnprintf(buffer, PAGE_SIZE, "%#x", msm_fw_debug);
|
||||
}
|
||||
|
||||
static const struct kernel_param_ops msm_vidc_debug_fops = {
|
||||
.set = debug_level_set,
|
||||
.get = debug_level_get,
|
||||
.set = debug_level_set_drv,
|
||||
.get = debug_level_get_drv,
|
||||
};
|
||||
|
||||
static const struct kernel_param_ops msm_fw_debug_fops = {
|
||||
.set = debug_level_set_fw,
|
||||
.get = debug_level_get_fw,
|
||||
};
|
||||
|
||||
static int fw_dump_set(const char *val,
|
||||
@@ -145,6 +204,7 @@ static const struct kernel_param_ops msm_vidc_synx_fence_debug_fops = {
|
||||
};
|
||||
|
||||
module_param_cb(msm_vidc_debug, &msm_vidc_debug_fops, &g_core, 0644);
|
||||
module_param_cb(msm_fw_debug, &msm_fw_debug_fops, &g_core, 0644);
|
||||
module_param_cb(msm_vidc_fw_dump, &msm_vidc_fw_dump_fops, &g_core, 0644);
|
||||
module_param_cb(msm_vidc_synx_fence_enable,
|
||||
&msm_vidc_synx_fence_debug_fops, &g_core, 0644);
|
||||
|
@@ -124,7 +124,7 @@ static void __flush_debug_queue(struct msm_vidc_core *core,
|
||||
u8 *log;
|
||||
struct hfi_debug_header *pkt;
|
||||
bool local_packet = false;
|
||||
enum vidc_msg_prio log_level = msm_vidc_debug;
|
||||
enum vidc_msg_prio_fw log_level_fw = msm_fw_debug;
|
||||
|
||||
if (!core) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
@@ -143,7 +143,7 @@ static void __flush_debug_queue(struct msm_vidc_core *core,
|
||||
* Local packet is used when error occurred.
|
||||
* It is good to print these logs to printk as well.
|
||||
*/
|
||||
log_level |= FW_PRINTK;
|
||||
log_level_fw |= FW_PRINTK;
|
||||
}
|
||||
|
||||
while (!venus_hfi_queue_dbg_read(core, packet)) {
|
||||
@@ -169,7 +169,7 @@ static void __flush_debug_queue(struct msm_vidc_core *core,
|
||||
* line.
|
||||
*/
|
||||
log = (u8 *)packet + sizeof(struct hfi_debug_header) + 1;
|
||||
dprintk_firmware(log_level, "%s", log);
|
||||
dprintk_firmware(log_level_fw, "%s", log);
|
||||
}
|
||||
|
||||
if (local_packet)
|
||||
@@ -565,7 +565,7 @@ static int __resume(struct msm_vidc_core *core)
|
||||
goto err_reset_core;
|
||||
}
|
||||
|
||||
__sys_set_debug(core, (msm_vidc_debug & FW_LOGMASK) >> FW_LOGSHIFT);
|
||||
__sys_set_debug(core, (msm_fw_debug & FW_LOGMASK) >> FW_LOGSHIFT);
|
||||
|
||||
rc = call_res_op(core, llcc, core, true);
|
||||
if (rc) {
|
||||
@@ -853,7 +853,7 @@ int venus_hfi_core_init(struct msm_vidc_core *core)
|
||||
if (rc)
|
||||
goto error;
|
||||
|
||||
rc = __sys_set_debug(core, (msm_vidc_debug & FW_LOGMASK) >> FW_LOGSHIFT);
|
||||
rc = __sys_set_debug(core, (msm_fw_debug & FW_LOGMASK) >> FW_LOGSHIFT);
|
||||
if (rc)
|
||||
goto error;
|
||||
|
||||
@@ -1133,8 +1133,7 @@ int venus_hfi_session_open(struct msm_vidc_inst *inst)
|
||||
goto unlock;
|
||||
}
|
||||
|
||||
__sys_set_debug(core,
|
||||
(msm_vidc_debug & FW_LOGMASK) >> FW_LOGSHIFT);
|
||||
__sys_set_debug(core, (msm_fw_debug & FW_LOGMASK) >> FW_LOGSHIFT);
|
||||
|
||||
rc = hfi_packet_session_command(inst,
|
||||
HFI_CMD_OPEN,
|
||||
|
新しいイシューから参照
ユーザーをブロックする