Skip to content

Surface Pro 10: stylus triggers "read DMA buffer failed" in intel-thc-dma.c #2261

Description

@ffaon

Surface Pro 10, Ubuntu 26.04, kernel 6.19.8-surface-3.

hi, i think i found why the stylus doesn't work.

using the stylus gives:

[  266.566485] intel_quickspi 0000:00:10.0: Copied 4096 bytes instead of requested 7492
[  266.566502] intel_quickspi 0000:00:10.0: read DMA buffer failed -5
[  266.566546] ACPI: \_SB.PC00.THC0._RST: Excess arguments...
[  266.569732] intel_quickspi 0000:00:10.0: THC interrupt already unquiesce
[  271.857939] intel_quickspi 0000:00:10.0: Wait RESET_RESPONSE timeout, ret:0
[  271.857956] intel_quickspi 0000:00:10.0: Reset touch device failed, ret = -110

after that the controller is stuck until the module is reloaded.

in read_dma_buffer() (line 593), sg_copy_to_buffer() gets nent from walking the PRD table, so it's a segment count after dma_map_sg(). but it walks config->sgls[], the unmapped cpu scatterlist. my iommu is on (iommu: Default domain type: Translated), so segments get merged and the two counts don't match.

the HID descriptor has a Pen collection with tip pressure and X/Y tilt, plus a vendor page 0xFF0B with reports up to 7487 bytes.

changing it to sgls_nent_pages (already stored by the driver, already used in dma_unmap_sg()) fixes it here:

 	sg = read_config->sgls[prd_table_index];
-	ret = sg_copy_to_buffer(sg, nent, read_buff, mes_len);
+	ret = sg_copy_to_buffer(sg, read_config->sgls_nent_pages[prd_table_index],
+				read_buff, mes_len);

with this + iptsd running, the stylus works with pressure. no more DMA errors, survives reboot via dkms.

i don't know if this is the right fix or if it's the same issue others are seeing, someone who knows this driver will judge better.

i used claude opus 5 to help analyse the code and write this. tested on my own hardware.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions