kmd: trigger RCE snapshot on timeout

Jira CAMERASW-32243

Change-Id: I529a0d39990f6a20ff9780089383deebe22e2741
Signed-off-by: Mark Krueger <mkrueger@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3355776
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Ying Zhou <yizhou@nvidia.com>
Reviewed-by: Shiva Dubey <sdubey@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Mohit Ingale <mohiti@nvidia.com>
This commit is contained in:
Mark Stephen Krueger
2025-05-05 16:13:12 -04:00
committed by Jon Hunter
parent e6a11f7e4c
commit 872a72234a
3 changed files with 21 additions and 0 deletions

View File

@@ -50,6 +50,7 @@
#include <media/fusa-capture/capture-common.h>
#include <media/fusa-capture/capture-isp.h>
#include <linux/arm64-barrier.h>
#include <linux/tegra-rtcpu-trace.h>
/**
* @brief Invalid ISP channel ID; the channel is not initialized.
@@ -1322,6 +1323,8 @@ static void isp_capture_ivc_status_callback(
* - Sends the control message by calling @ref tegra_capture_ivc_control_submit().
* - Waits for the capture response with a timeout by calling
* @ref wait_for_completion_timeout().
* - If the response is not received within the timeout,
* log the RCE snapshot by calling @ref rtcpu_trace_panic_callback().
* - Compares the response header with the expected header using @ref memcmp().
* - Releases the control message lock using @ref mutex_unlock().
* - Logs a debug message indicating the received response using @ref dev_dbg().
@@ -1376,6 +1379,7 @@ static int isp_capture_ivc_send_control(struct tegra_isp_channel *chan,
if (timeout <= 0) {
dev_err(chan->isp_dev,
"isp capture control message timed out\n");
rtcpu_trace_panic_callback(capture->rtcpu_dev);
err = -ETIMEDOUT;
goto fail;
}
@@ -2883,6 +2887,8 @@ fail:
* - If given timeout is negative, waits for capture response completion
* using @ref wait_for_completion_killable().
* - Otherwise, waits using @ref wait_for_completion_killable_timeout().
* - If the response is not received within the timeout,
* log the RCE snapshot by calling @ref rtcpu_trace_panic_callback().
* - Acquires the capture channel reset lock using @ref mutex_lock().
* - Checks if a reset capture flag is set.
* - Releases the capture channel reset lock using @ref mutex_unlock().
@@ -2945,6 +2951,7 @@ int isp_capture_status(
if (err == 0) {
dev_dbg(chan->isp_dev,
"isp capture status timed out\n");
rtcpu_trace_panic_callback(capture->rtcpu_dev);
return -ETIMEDOUT;
}
}

View File

@@ -37,6 +37,7 @@
#include <linux/of.h>
#include <linux/tegra-capture-ivc.h>
#include <linux/tegra-camera-rtcpu.h>
#include <linux/tegra-rtcpu-trace.h>
#include <asm/arch_timer.h>
#include <uapi/linux/nvhost_events.h>
@@ -448,6 +449,8 @@ static void vi_capture_ivc_status_callback(
* - Locks the control message mutex using @ref mutex_lock().
* - Submits the capture control message using @ref tegra_capture_ivc_control_submit().
* - Waits for the response with timeout using @ref wait_for_completion_timeout().
* - If the response is not received within the timeout,
* log the RCE snapshot by calling @ref rtcpu_trace_panic_callback().
* - Validates the response header matches the request using @ref memcmp().
* - Unlocks the control message mutex using @ref mutex_unlock().
*
@@ -492,6 +495,7 @@ static int vi_capture_ivc_send_control(
if (timeout <= 0) {
dev_err(chan->dev,
"capture control message timed out\n");
rtcpu_trace_panic_callback(capture->rtcpu_dev);
err = -ETIMEDOUT;
goto fail;
}
@@ -2004,6 +2008,8 @@ EXPORT_SYMBOL_GPL(vi_capture_request);
* - Waits for capture completion with specified timeout using
* @ref wait_for_completion_interruptible() if selected timtout is negative,
* or @ref wait_for_completion_timeout() otherwise.
* - If the response is not received within the timeout,
* log the RCE snapshot by calling @ref rtcpu_trace_panic_callback().
* - Convert timeout value to jiffies using @ref msecs_to_jiffies().
*
* @param[in] chan VI channel context.
@@ -2050,6 +2056,7 @@ int vi_capture_status(
if (ret == -ERESTARTSYS) {
dev_dbg(chan->dev,
"capture status interrupted\n");
rtcpu_trace_panic_callback(capture->rtcpu_dev);
return -ETIMEDOUT;
}
} else {
@@ -2059,6 +2066,7 @@ int vi_capture_status(
if (ret == 0) {
dev_dbg(chan->dev,
"capture status timed out\n");
rtcpu_trace_panic_callback(capture->rtcpu_dev);
return -ETIMEDOUT;
}
}

View File

@@ -28,6 +28,7 @@
#include <linux/tegra-ivc-bus.h>
#include <linux/platform/tegra/common.h>
#include <soc/tegra/fuse.h>
#include <linux/tegra-rtcpu-trace.h>
#define CAMRTC_TEST_CAM_DEVICES 5
@@ -338,8 +339,11 @@ DEFINE_SEQ_FOPS(camrtc_dbgfs_fops_forced_reset_restore,
* - Verifies IVC channel is online with @ref tegra_ivc_channel_online_check()
* - Flushes any stray responses by calling @ref tegra_ivc_read_advance()
* - Waits for write availability using @ref wait_event_interruptible_timeout()
* - If the wait times out log the RCE snapshot by calling @ref rtcpu_trace_panic_callback().
* - Writes request using @ref tegra_ivc_write()
* - Waits for and reads response using @ref tegra_ivc_read_peek()
* - If the response is not received within the timeout,
* log the RCE snapshot by calling @ref rtcpu_trace_panic_callback().
* - Verifies response matches request type
* - Releases resources and lock using @ref tegra_ivc_channel_runtime_put() and @ref mutex_unlock()
*
@@ -404,6 +408,7 @@ static int camrtc_ivc_dbg_full_frame_xact(
tegra_ivc_channel_has_been_reset(ch) ||
tegra_ivc_can_write(&ch->ivc), timeout);
if (timeout <= 0) {
rtcpu_trace_panic_callback(camrtc_get_device(ch));
ret = timeout ?: -ETIMEDOUT;
goto out;
}
@@ -424,6 +429,7 @@ static int camrtc_ivc_dbg_full_frame_xact(
tegra_ivc_can_read(&ch->ivc),
timeout);
if (timeout <= 0) {
rtcpu_trace_panic_callback(camrtc_get_device(ch));
ret = timeout ?: -ETIMEDOUT;
break;
}