From 872a72234aa57ef99720bd8d2c0fa665666dc52d Mon Sep 17 00:00:00 2001 From: Mark Stephen Krueger Date: Mon, 5 May 2025 16:13:12 -0400 Subject: [PATCH] kmd: trigger RCE snapshot on timeout Jira CAMERASW-32243 Change-Id: I529a0d39990f6a20ff9780089383deebe22e2741 Signed-off-by: Mark Krueger Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3355776 GVS: buildbot_gerritrpt Reviewed-by: mobile promotions Reviewed-by: Ying Zhou Reviewed-by: Shiva Dubey Reviewed-by: svcacv Tested-by: mobile promotions Reviewed-by: Mohit Ingale --- .../platform/tegra/camera/fusa-capture/capture-isp.c | 7 +++++++ .../media/platform/tegra/camera/fusa-capture/capture-vi.c | 8 ++++++++ drivers/platform/tegra/rtcpu/rtcpu-debug.c | 6 ++++++ 3 files changed, 21 insertions(+) diff --git a/drivers/media/platform/tegra/camera/fusa-capture/capture-isp.c b/drivers/media/platform/tegra/camera/fusa-capture/capture-isp.c index 27264b9f..3eba0556 100644 --- a/drivers/media/platform/tegra/camera/fusa-capture/capture-isp.c +++ b/drivers/media/platform/tegra/camera/fusa-capture/capture-isp.c @@ -50,6 +50,7 @@ #include #include #include +#include /** * @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; } } diff --git a/drivers/media/platform/tegra/camera/fusa-capture/capture-vi.c b/drivers/media/platform/tegra/camera/fusa-capture/capture-vi.c index e410bc4c..9df15aae 100644 --- a/drivers/media/platform/tegra/camera/fusa-capture/capture-vi.c +++ b/drivers/media/platform/tegra/camera/fusa-capture/capture-vi.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -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; } } diff --git a/drivers/platform/tegra/rtcpu/rtcpu-debug.c b/drivers/platform/tegra/rtcpu/rtcpu-debug.c index de5e0976..4b61707d 100644 --- a/drivers/platform/tegra/rtcpu/rtcpu-debug.c +++ b/drivers/platform/tegra/rtcpu/rtcpu-debug.c @@ -28,6 +28,7 @@ #include #include #include +#include #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; }