From: Praveen Talari <praveen.talari@oss.qualcomm.com>
To: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>,
Mark Brown <broonie@kernel.org>,
linux-arm-msm@vger.kernel.org, linux-spi@vger.kernel.org,
linux-kernel@vger.kernel.org, bjorn.andersson@oss.qualcomm.com,
dmitry.baryshkov@oss.qualcomm.com
Cc: prasad.sodagudi@oss.qualcomm.com,
mukesh.savaliya@oss.qualcomm.com, quic_vtanuku@quicinc.com,
aniket.randive@oss.qualcomm.com,
chandana.chiluveru@oss.qualcomm.com,
jyothi.seerapu@oss.qualcomm.com
Subject: Re: [PATCH v1 2/3] spi: geni-qcom: Fix abort sequence execution for serial engine errors
Date: Thu, 29 Jan 2026 21:19:03 +0530 [thread overview]
Message-ID: <565a54cb-32cf-41d8-87fb-d60be63cca95@oss.qualcomm.com> (raw)
In-Reply-To: <0fddd038-185a-4cc0-b080-d12ba973cce3@oss.qualcomm.com>
Hi Konrad,
On 1/29/2026 5:18 PM, Konrad Dybcio wrote:
> On 1/28/26 5:22 PM, Praveen Talari wrote:
>> HI Konrad,
>>
>> Thank you for review.
>>
>> On 1/27/2026 6:47 PM, Konrad Dybcio wrote:
>>> On 1/22/26 4:10 PM, Praveen Talari wrote:
>>>> The driver currently skips the abort sequence for target mode when serial
>>>> engine errors occur. This leads to improper error recovery as the serial
>>>> engine may remain in an undefined state without proper cleanup, potentially
>>>> causing subsequent operations to fail or behave unpredictably.
>>>>
>>>> Fix this by ensuring the abort sequence and DMA reset always execute during
>>>> error recovery, as both are required for proper serial engine error
>>>> handling.
>>>>
>>>> Signed-off-by: Praveen Talari <praveen.talari@oss.qualcomm.com>
>>>> ---
>>>> drivers/spi/spi-geni-qcom.c | 3 ++-
>>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/spi/spi-geni-qcom.c b/drivers/spi/spi-geni-qcom.c
>>>> index f5d05025b196..e5320e2fb834 100644
>>>> --- a/drivers/spi/spi-geni-qcom.c
>>>> +++ b/drivers/spi/spi-geni-qcom.c
>>>> @@ -167,7 +167,7 @@ static void handle_se_timeout(struct spi_controller *spi,
>>>> * doesn`t support CMD Cancel sequnece
>>>> */
>>>> spin_unlock_irq(&mas->lock);
>>>> - goto reset_if_dma;
>>>> + goto abort;
>>>> }
>>>> reinit_completion(&mas->cancel_done);
>>>> @@ -178,6 +178,7 @@ static void handle_se_timeout(struct spi_controller *spi,
>>>> if (time_left)
>>>> goto reset_if_dma;
>>>> +abort:
>>>> spin_lock_irq(&mas->lock);
>>>
>>> Now that the jump is just 5 LoC, you can dispose of the goto and change it
>>> to an if-statement
>>
>> Is the modification below good?
>>
>> diff --git a/drivers/spi/spi-geni-qcom.c b/drivers/spi/spi-geni-qcom.c
>> index f5d05025b196..4feaf24d47ea 100644
>> --- a/drivers/spi/spi-geni-qcom.c
>> +++ b/drivers/spi/spi-geni-qcom.c
>> @@ -167,16 +167,15 @@ static void handle_se_timeout(struct spi_controller *spi,
>> * doesn`t support CMD Cancel sequnece
>> */
>> spin_unlock_irq(&mas->lock);
>> - goto reset_if_dma;
>> - }
>> -
>> - reinit_completion(&mas->cancel_done);
>> - geni_se_cancel_m_cmd(se);
>> - spin_unlock_irq(&mas->lock);
>> + } else {
>> + reinit_completion(&mas->cancel_done);
>> + geni_se_cancel_m_cmd(se);
>> + spin_unlock_irq(&mas->lock);
>>
>> - time_left = wait_for_completion_timeout(&mas->cancel_done, HZ);
>> - if (time_left)
>> - goto reset_if_dma;
>> + time_left = wait_for_completion_timeout(&mas->cancel_done, HZ);
>> + if (time_left)
>> + goto reset_if_dma;
>> + }
>>
>> spin_lock_irq(&mas->lock);
>> reinit_completion(&mas->abort_done);
>
> I think we can make it even shorter:
>
> diff --git a/drivers/spi/spi-geni-qcom.c b/drivers/spi/spi-geni-qcom.c
> index 231fd31de048..59567ef6759e 100644
> --- a/drivers/spi/spi-geni-qcom.c
> +++ b/drivers/spi/spi-geni-qcom.c
> @@ -161,25 +161,20 @@ static void handle_se_timeout(struct spi_controller *spi,
> xfer = mas->cur_xfer;
> mas->cur_xfer = NULL;
>
> - if (spi->target) {
> - /*
> - * skip CMD Cancel sequnece since spi target
> - * doesn`t support CMD Cancel sequnece
> - */
> + /* The controller doesn't support the Cancel commnand in target mode */
> + if (!spi->target) {
> + reinit_completion(&mas->cancel_done);
> + geni_se_cancel_m_cmd(se);
> +
> spin_unlock_irq(&mas->lock);
> - goto abort;
> +
> + time_left = wait_for_completion_timeout(&mas->cancel_done, HZ);
> + if (time_left)
> + goto reset_if_dma;
> +
> + spin_lock_irq(&mas->lock);
> }
>
> - reinit_completion(&mas->cancel_done);
> - geni_se_cancel_m_cmd(se);
> - spin_unlock_irq(&mas->lock);
> -
> - time_left = wait_for_completion_timeout(&mas->cancel_done, HZ);
> - if (time_left)
> - goto reset_if_dma;
> -
> -abort:
> - spin_lock_irq(&mas->lock);
> reinit_completion(&mas->abort_done);
> geni_se_abort_m_cmd(se);
> spin_unlock_irq(&mas->lock);
Thank you for help. will review and update in next patch.
Thanks,
Praveen
>
>
> Konrad
next prev parent reply other threads:[~2026-01-29 15:49 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-22 15:10 [PATCH v1 0/3] Improve SPI target mode support and error handling Praveen Talari
2026-01-22 15:10 ` [PATCH v1 1/3] spi: geni-qcom: Improve target mode allocation by using proper allocation functions Praveen Talari
2026-01-27 13:15 ` Konrad Dybcio
2026-01-28 16:32 ` Praveen Talari
2026-01-29 11:42 ` Konrad Dybcio
2026-01-29 15:45 ` Praveen Talari
2026-01-30 11:22 ` Konrad Dybcio
2026-01-22 15:10 ` [PATCH v1 2/3] spi: geni-qcom: Fix abort sequence execution for serial engine errors Praveen Talari
2026-01-27 13:17 ` Konrad Dybcio
2026-01-28 16:22 ` Praveen Talari
2026-01-29 11:48 ` Konrad Dybcio
2026-01-29 15:49 ` Praveen Talari [this message]
2026-01-29 15:10 ` [PATCH " Markus Elfring
2026-01-22 15:10 ` [PATCH v1 3/3] spi: geni-qcom: Add target abort support Praveen Talari
2026-01-27 13:21 ` Konrad Dybcio
2026-01-28 16:28 ` Praveen Talari
2026-01-29 11:42 ` Konrad Dybcio
2026-01-29 15:50 ` Praveen Talari
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=565a54cb-32cf-41d8-87fb-d60be63cca95@oss.qualcomm.com \
--to=praveen.talari@oss.qualcomm.com \
--cc=aniket.randive@oss.qualcomm.com \
--cc=bjorn.andersson@oss.qualcomm.com \
--cc=broonie@kernel.org \
--cc=chandana.chiluveru@oss.qualcomm.com \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=jyothi.seerapu@oss.qualcomm.com \
--cc=konrad.dybcio@oss.qualcomm.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=mukesh.savaliya@oss.qualcomm.com \
--cc=prasad.sodagudi@oss.qualcomm.com \
--cc=quic_vtanuku@quicinc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox