All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Emfox Zhou" <emfox@debian.org>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH 3/5] HID: intel-thc-hid: intel-thc: stop all engines first
Date: Mon, 16 Nov 2026 13:39:02 +0000	[thread overview]
Message-ID: <sashiko-outbox-217096@kernel.org> (raw)
In-Reply-To: <20261116133132.1282020-4-emfox@debian.org>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Medium] HID: intel-thc-hid: intel-thc: missing PRD table reinit in
  thc_dma_configure() [1]
--

commit 68cc7b868e9e15fc7c7b6e500ccb219382a1991c
Author: Emfox Zhou <emfox@debian.org>

HID: intel-thc-hid: intel-thc: stop all engines first

This commit introduces a helper to clear the start bits of all four DMA
engines and uses it in thc_dma_unconfigure() before clearing the PRD base
address and control registers.

> diff --git a/drivers/hid/intel-thc-hid/intel-thc/intel-thc-dma.c b/drivers/hid/intel-thc-hid/intel-thc/intel-thc-dma.c
> index 704c02822e807..41efdfaf00bc2 100644
> --- a/drivers/hid/intel-thc-hid/intel-thc/intel-thc-dma.c
> +++ b/drivers/hid/intel-thc-hid/intel-thc/intel-thc-dma.c

[ ... ]

> @@ -518,16 +523,16 @@ void thc_dma_unconfigure(struct thc_device *dev)
>  {
>  	int chan;
>  
> +	/*
> +	 * Stop the engines first: one that is running keeps writing through
> +	 * a table whose base is already gone.
> +	 */
> +	thc_clear_start_bits(dev);
> +
>  	for (chan = 0; chan < MAX_THC_DMA_CHANNEL; chan++) {
>  		dma_set_prd_base_addr(dev, 0, &dev->dma_ctx->dma_config[chan]);
>  		dma_clear_prd_control(dev, &dev->dma_ctx->dma_config[chan]);
>  	}

[Severity: Medium]
This problem wasn't introduced by this patch, but does thc_dma_configure()
leave stale PRD table entries behind after an RxDMA reset [1]?

During RxDMA reception, hardware updates len, end_of_prd, and hw_status in
place inside config->prd_tbls, and thc_dma_read() normally restores each
consumed table via thc_copy_one_sgl_to_prd().  When RxDMA error recovery runs
try_recover() -> thc_rxdma_reset() -> thc_dma_configure(),
thc_reset_dma_settings() resets the hardware ring pointers without
reinitializing unread PRD tables, so subsequent transfers reuse the stale len
and end_of_prd values and can truncate frames or trigger repeated DMA errors.

[1] https://sashiko.dev/#/bug/linux-0a97c61f-7f80-4aab-98a8-b9354f3b828e

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261116133132.1282020-1-emfox@debian.org?part=3

  reply	other threads:[~2026-11-16 13:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 13:31 [PATCH 0/5] HID: intel-thc-hid: intel-thc: DMA lifetime fixes Emfox Zhou
2026-11-16 13:31 ` [PATCH 1/5] HID: intel-thc-hid: intel-thc: keep TxDMA write errors Emfox Zhou
2026-11-16 13:49   ` sashiko-bot
2026-11-16 13:31 ` [PATCH 2/5] HID: intel-thc-hid: intel-thc: free the failed channel Emfox Zhou
2026-11-16 13:31 ` [PATCH 3/5] HID: intel-thc-hid: intel-thc: stop all engines first Emfox Zhou
2026-11-16 13:39   ` sashiko-bot [this message]
2026-11-16 13:31 ` [PATCH 4/5] HID: intel-thc-hid: intel-thc: add the slow SPI gears Emfox Zhou
2026-11-16 13:31 ` [PATCH 5/5] HID: intel-thc-hid: intel-thc: budget the receive drain Emfox Zhou

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=sashiko-outbox-217096@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=emfox@debian.org \
    --cc=linux-input@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.