Commit 748b080f authored by Dikshita Agarwal's avatar Dikshita Agarwal Committed by Mauro Carvalho Chehab

media: venus: Add support for SSR trigger using fault injection

Here we introduce a new fault injection for SSR trigger.

To trigger the SSR:
 echo 100 >  /sys/kernel/debug/venus/fail_ssr/probability
 echo 1 >  /sys/kernel/debug/venus/fail_ssr/times
Co-developed-by: default avatarStanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: default avatarStanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: default avatarDikshita Agarwal <quic_dikshita@quicinc.com>
Reviewed-by: default avatarStephen Boyd <swboyd@chromium.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 81e00584
......@@ -265,6 +265,19 @@ static void venus_assign_register_offsets(struct venus_core *core)
}
}
static irqreturn_t venus_isr_thread(int irq, void *dev_id)
{
struct venus_core *core = dev_id;
irqreturn_t ret;
ret = hfi_isr_thread(irq, dev_id);
if (ret == IRQ_HANDLED && venus_fault_inject_ssr())
hfi_core_trigger_ssr(core, HFI_TEST_SSR_SW_ERR_FATAL);
return ret;
}
static int venus_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
......@@ -320,7 +333,7 @@ static int venus_probe(struct platform_device *pdev)
INIT_DELAYED_WORK(&core->work, venus_sys_error_handler);
init_waitqueue_head(&core->sys_err_done);
ret = devm_request_threaded_irq(dev, core->irq, hfi_isr, hfi_isr_thread,
ret = devm_request_threaded_irq(dev, core->irq, hfi_isr, venus_isr_thread,
IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
"venus", core);
if (ret)
......
......@@ -4,13 +4,22 @@
*/
#include <linux/debugfs.h>
#include <linux/fault-inject.h>
#include "core.h"
#ifdef CONFIG_FAULT_INJECTION
DECLARE_FAULT_ATTR(venus_ssr_attr);
#endif
void venus_dbgfs_init(struct venus_core *core)
{
core->root = debugfs_create_dir("venus", NULL);
debugfs_create_x32("fw_level", 0644, core->root, &venus_fw_debug);
#ifdef CONFIG_FAULT_INJECTION
fault_create_debugfs_attr("fail_ssr", core->root, &venus_ssr_attr);
#endif
}
void venus_dbgfs_deinit(struct venus_core *core)
......
......@@ -4,8 +4,21 @@
#ifndef __VENUS_DBGFS_H__
#define __VENUS_DBGFS_H__
#include <linux/fault-inject.h>
struct venus_core;
#ifdef CONFIG_FAULT_INJECTION
extern struct fault_attr venus_ssr_attr;
static inline bool venus_fault_inject_ssr(void)
{
return should_fail(&venus_ssr_attr, 1);
}
#else
static inline bool venus_fault_inject_ssr(void) { return false; }
#endif
void venus_dbgfs_init(struct venus_core *core);
void venus_dbgfs_deinit(struct venus_core *core);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment