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 [off-list ref]
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.
quoted hunk ↗ jump to hunk
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
[ ... ]
quoted hunk ↗ jump to hunk
@@ -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