FAILED: patch "[PATCH] media: qcom: camss: vfe: Fix VFE reset while another line is streaming" failed to apply to 6.1-stable tree
Subsystems (5)
Sasha Levin
maintainerThe patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x e5d4b0e69a4017fd39354499c9d7583f625f0524
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 6.1.y' 'HEAD^..'
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From e5d4b0e69a4017fd39354499c9d7583f625f0524 Mon Sep 17 00:00:00 2001
From: Hitesh Patel <[email protected]>
Date: Mon, 28 Sep 2026 17:45:05 +0530
Subject: [PATCH] media: qcom: camss: vfe: Fix VFE reset while another line is
streaming
vfe_disable_output() stops the write masters of the line being disabled and then resets the whole VFE. The reset is not limited to that line.
When two lines of one VFE stream at the same time, which is the case whenever a CSID demultiplexes several virtual channels to different RDIs, stopping the first line resets the VFE underneath the second line. The second line's write master configuration is wiped, the buffers it had in flight are never completed, and the VFE is left in a state in which the next global reset is not acknowledged. Stopping or restarting the second line then fails with:
VFE reset timeout
Move the reset to vfe_disable() and do it under stream_lock, as part of the decrement that makes the count reach zero, so that exactly one caller resets and no line can be enabled while the reset runs. Stopping the line's write masters is enough to quiesce that line on its own. With a single line streaming, the reset happens exactly as before.
--- drivers/media/platform/qcom/camss/camss-vfe.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/media/platform/qcom/camss/camss-vfe.c +5 -9
@@ -808,7 +808,7 @@ int vfe_put_output(struct vfe_line *line)return 0 ; } -static int vfe_disable_output (struct vfe_line *line) +static void vfe_disable_output (struct vfe_line *line) {struct vfe_device *vfe =to_vfe (line);struct vfe_output *output = &line->output;
@@ -820,8 +820,6 @@ static int vfe_disable_output(struct vfe_line *line) vfe->res->hw_ops->vfe_wm_stop (vfe, output->wm_idx[i]); output->gen2.active_num =0 ;spin_unlock_irqrestore (&vfe->output_lock, flags); - -return vfe_reset (vfe); }/*
@@ -833,21 +831,19 @@ static int vfe_disable_output(struct vfe_line *line)int vfe_disable (struct vfe_line *line) {struct vfe_device *vfe =to_vfe (line); -int ret; +int ret =0 ; - ret =vfe_disable_output (line); -if (ret) - goto error; +vfe_disable_output (line);vfe_put_output (line);mutex_lock (&vfe->stream_lock); - vfe->stream_count--; +if (--vfe->stream_count ==0 ) + ret =vfe_reset (vfe);mutex_unlock (&vfe->stream_lock); -error:return ret; }
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/3 media: qcom: camss: Move vfe_disable into a common routine where applicable
From: Bryan O'Donoghue <[email protected]>
[ Upstream commit 90cc4555730bfd0fc6af5c8a5a81d80bfce4cff7 ]
We can move vfe_disable() into a common routine in the core VFE file provided we make wm_stop() a VFE specific callback.
The callback is required to capture the case where VFE 17x currently isn't VC enabled where as VFE 480 is.
Stable-dep-of: e5d4b0e69a40 ("media: qcom: camss: vfe: Fix VFE reset while another line is streaming")
--- .../media/platform/qcom/camss/camss-vfe-170.c | 40 +------------------ .../media/platform/qcom/camss/camss-vfe-480.c | 40 +------------------ drivers/media/platform/qcom/camss/camss-vfe.c | 39 ++++++++++++++++++ drivers/media/platform/qcom/camss/camss-vfe.h | 9 +++++ 4 files changed, 50 insertions(+), 78 deletions(-)
drivers/media/platform/qcom/camss/camss-vfe-170.c +1 -39
@@ -492,22 +492,6 @@ static int vfe_enable_output(struct vfe_line *line)return 0 ; } -static void vfe_disable_output (struct vfe_line *line) -{ -struct vfe_device *vfe =to_vfe (line); -struct vfe_output *output = &line->output; -unsigned long flags; -unsigned int i; - -spin_lock_irqsave (&vfe->output_lock, flags); -for (i =0 ; i < output->wm_num; i++) -vfe_wm_stop (vfe, output->wm_idx[i]); - output->gen2.active_num =0 ; -spin_unlock_irqrestore (&vfe->output_lock, flags); - -vfe_reset (vfe); -} -/* * vfe_enable - Enable streaming on VFE line * @line: VFE line
@@ -553,29 +537,6 @@ static int vfe_enable(struct vfe_line *line)return ret; } -/* -* vfe_disable - Disable streaming on VFE line -* @line: VFE line -* -* Return 0 on success or a negative error code otherwise -*/ -static int vfe_disable (struct vfe_line *line) -{ -struct vfe_device *vfe =to_vfe (line); - -vfe_disable_output (line); - -vfe_put_output (line); - -mutex_lock (&vfe->stream_lock); - - vfe->stream_count--; - -mutex_unlock (&vfe->stream_lock); - -return 0 ; -} -/* * vfe_isr_sof - Process start of frame interrupt * @vfe: VFE Device
@@ -770,4 +731,5 @@ const struct vfe_hw_ops vfe_ops_170 = { .vfe_enable = vfe_enable, .vfe_halt = vfe_halt, .violation_read = vfe_violation_read, + .vfe_wm_stop = vfe_wm_stop, };
drivers/media/platform/qcom/camss/camss-vfe-480.c +1 -39
@@ -329,22 +329,6 @@ static int vfe_enable_output(struct vfe_line *line)return 0 ; } -static void vfe_disable_output (struct vfe_line *line) -{ -struct vfe_device *vfe =to_vfe (line); -struct vfe_output *output = &line->output; -unsigned long flags; -unsigned int i; - -spin_lock_irqsave (&vfe->output_lock, flags); -for (i =0 ; i < output->wm_num; i++) -vfe_wm_stop (vfe, output->wm_idx[i]); - output->gen2.active_num =0 ; -spin_unlock_irqrestore (&vfe->output_lock, flags); - -vfe_reset (vfe); -} -/* * vfe_enable - Enable streaming on VFE line * @line: VFE line
@@ -392,29 +376,6 @@ static int vfe_enable(struct vfe_line *line)return ret; } -/* -* vfe_disable - Disable streaming on VFE line -* @line: VFE line -* -* Return 0 on success or a negative error code otherwise -*/ -static int vfe_disable (struct vfe_line *line) -{ -struct vfe_device *vfe =to_vfe (line); - -vfe_disable_output (line); - -vfe_put_output (line); - -mutex_lock (&vfe->stream_lock); - - vfe->stream_count--; - -mutex_unlock (&vfe->stream_lock); - -return 0 ; -} -/* * vfe_isr_reg_update - Process reg update interrupt * @vfe: VFE Device
@@ -584,4 +545,5 @@ const struct vfe_hw_ops vfe_ops_480 = { .vfe_disable = vfe_disable, .vfe_enable = vfe_enable, .vfe_halt = vfe_halt, + .vfe_wm_stop = vfe_wm_stop, };
drivers/media/platform/qcom/camss/camss-vfe.c +39 -0
@@ -407,6 +407,45 @@ int vfe_put_output(struct vfe_line *line)return 0 ; } +static int vfe_disable_output (struct vfe_line *line) +{ +struct vfe_device *vfe =to_vfe (line); +struct vfe_output *output = &line->output; +unsigned long flags; +unsigned int i; + +spin_lock_irqsave (&vfe->output_lock, flags); +for (i =0 ; i < output->wm_num; i++) + vfe->ops->vfe_wm_stop (vfe, output->wm_idx[i]); + output->gen2.active_num =0 ; +spin_unlock_irqrestore (&vfe->output_lock, flags); + +return vfe_reset (vfe); +} + +/* +* vfe_disable - Disable streaming on VFE line +* @line: VFE line +* +* Return 0 on success or a negative error code otherwise +*/ +int vfe_disable (struct vfe_line *line) +{ +struct vfe_device *vfe =to_vfe (line); + +vfe_disable_output (line); + +vfe_put_output (line); + +mutex_lock (&vfe->stream_lock); + + vfe->stream_count--; + +mutex_unlock (&vfe->stream_lock); + +return 0 ; +} +/** * vfe_isr_comp_done() - Process composite image done interrupt * @vfe: VFE Device
drivers/media/platform/qcom/camss/camss-vfe.h +9 -0
@@ -116,6 +116,7 @@ struct vfe_hw_ops {int (*vfe_enable)(struct vfe_line *line);int (*vfe_halt)(struct vfe_device *vfe);void (*violation_read)(struct vfe_device *vfe); +void (*vfe_wm_stop)(struct vfe_device *vfe,u8 wm); };struct vfe_isr_ops {
@@ -194,6 +195,14 @@ int vfe_reserve_wm(struct vfe_device *vfe, enum vfe_line_id line_id);*/ int vfe_reset (struct vfe_device *vfe); +/* +* vfe_disable - Disable streaming on VFE line +* @line: VFE line +* +* Return 0 on success or a negative error code otherwise +*/ +int vfe_disable (struct vfe_line *line); +extern const struct vfe_hw_ops vfe_ops_4_1;extern const struct vfe_hw_ops vfe_ops_4_7;extern const struct vfe_hw_ops vfe_ops_4_8;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/3 media: qcom: camss: Propagate vfe_reset error up the callstack
From: Bryan O'Donoghue <[email protected]>
[ Upstream commit 5c07f30bed52ed85673b634f77467e404645785d ]
A previous patch I had removed the returns from vfe_disable() since we didn't trap any meaningful errors. Konrad pointed out vfe_reset() could return an error, which is true.
Trap the vfe_reset() error code and throw it up the callstack.
Stable-dep-of: e5d4b0e69a40 ("media: qcom: camss: vfe: Fix VFE reset while another line is streaming")
--- drivers/media/platform/qcom/camss/camss-vfe.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/media/platform/qcom/camss/camss-vfe.c +6 -2
@@ -432,8 +432,11 @@ static int vfe_disable_output(struct vfe_line *line)int vfe_disable (struct vfe_line *line) {struct vfe_device *vfe =to_vfe (line); +int ret; -vfe_disable_output (line); + ret =vfe_disable_output (line); +if (ret) + goto error;vfe_put_output (line);
@@ -443,7 +446,8 @@ int vfe_disable(struct vfe_line *line)mutex_unlock (&vfe->stream_lock); -return 0 ; +error: +return ret; }/**
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 3/3 media: qcom: camss: vfe: Fix VFE reset while another line is streaming
In reply to Sasha LevinFrom: Hitesh Patel <[email protected]>
[ Upstream commit e5d4b0e69a4017fd39354499c9d7583f625f0524 ]
vfe_disable_output() stops the write masters of the line being disabled and then resets the whole VFE. The reset is not limited to that line.
When two lines of one VFE stream at the same time, which is the case whenever a CSID demultiplexes several virtual channels to different RDIs, stopping the first line resets the VFE underneath the second line. The second line's write master configuration is wiped, the buffers it had in flight are never completed, and the VFE is left in a state in which the next global reset is not acknowledged. Stopping or restarting the second line then fails with:
VFE reset timeout
Move the reset to vfe_disable() and do it under stream_lock, as part of the decrement that makes the count reach zero, so that exactly one caller resets and no line can be enabled while the reset runs. Stopping the line's write masters is enough to quiesce that line on its own. With a single line streaming, the reset happens exactly as before.
--- drivers/media/platform/qcom/camss/camss-vfe.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/media/platform/qcom/camss/camss-vfe.c +5 -9
@@ -407,7 +407,7 @@ int vfe_put_output(struct vfe_line *line)return 0 ; } -static int vfe_disable_output (struct vfe_line *line) +static void vfe_disable_output (struct vfe_line *line) {struct vfe_device *vfe =to_vfe (line);struct vfe_output *output = &line->output;
@@ -419,8 +419,6 @@ static int vfe_disable_output(struct vfe_line *line) vfe->ops->vfe_wm_stop (vfe, output->wm_idx[i]); output->gen2.active_num =0 ;spin_unlock_irqrestore (&vfe->output_lock, flags); - -return vfe_reset (vfe); }/*
@@ -432,21 +430,19 @@ static int vfe_disable_output(struct vfe_line *line)int vfe_disable (struct vfe_line *line) {struct vfe_device *vfe =to_vfe (line); -int ret; +int ret =0 ; - ret =vfe_disable_output (line); -if (ret) - goto error; +vfe_disable_output (line);vfe_put_output (line);mutex_lock (&vfe->stream_lock); - vfe->stream_count--; +if (--vfe->stream_count ==0 ) + ret =vfe_reset (vfe);mutex_unlock (&vfe->stream_lock); -error:return ret; }
Signature · 1 line
2.53.0