Thread (26 messages) 26 messages, 4 authors, 5d ago

Re: [PATCH v4 3/3] spi: pxa2xx: disable DMA for Apple MacBook8,1

From: sashiko-bot@kernel.org
Date: 2026-07-11 11:58:51

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The newly introduced `force_pio` module parameter is ignored on Merrifield (MRFLD) SPI controllers.
--
--- Patch [3]: [PATCH v4 3/3] spi: pxa2xx: disable DMA for Apple MacBook8,1 ---
commit 0c8e6fc35fa52622b2ece57fb64858693816478b
Author: Shih-Yuan Lee [off-list ref]

spi: pxa2xx: disable DMA for Apple MacBook8,1

On MacBook8,1 (early 2015 12" MacBook), the LPSS SPI controller's DMA
handshake and interrupt routing frequently fail or time out on boot,
causing the keyboard and trackpad to become unresponsive.

Avoid this architectural bug by disabling DMA and forcing the SPI
controller to use PIO mode. Move this platform/motherboard-level quirk
to the SPI host controller driver (spi-pxa2xx-pci.c) where LPSS setup
occurs, preventing layering violations, TOCTOU races, or execute-after-free
bugs in the client driver.

Additionally, introduce a force_pio module parameter in the PCI
host controller driver to allow other users to force PIO mode for
debugging.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=108331
quoted hunk ↗ jump to hunk
diff --git a/drivers/spi/spi-pxa2xx-pci.c b/drivers/spi/spi-pxa2xx-pci.c
index cae77ac185206..96bbc7a7c3817 100644
--- a/drivers/spi/spi-pxa2xx-pci.c
+++ b/drivers/spi/spi-pxa2xx-pci.c
[ ... ]
quoted hunk ↗ jump to hunk
@@ -166,7 +197,7 @@ static int lpss_spi_setup(struct pci_dev *dev, struct pxa2xx_spi_controller *c)
 
 	c->dma_filter = lpss_dma_filter;
 	c->dma_burst_size = 1;
-	c->enable_dma = 1;
+	c->enable_dma = pxa2xx_spi_pci_can_dma(dev);
 	return 0;
 }
 
[Severity: Medium]
What about mrfld_spi_setup()? It looks like the force_pio module parameter
introduced in this patch is only respected for LPSS devices.

If a user boots a Merrifield (MRFLD) system and passes
spi_pxa2xx_pci.force_pio=1, the parameter will be ignored since the driver
still hardcodes DMA enablement in mrfld_spi_setup():

drivers/spi/spi-pxa2xx-pci.c:mrfld_spi_setup() {
    ...
	c->dma_filter = lpss_dma_filter;
	c->dma_burst_size = 8;
	c->enable_dma = 1;
	return 0;
}

Could mrfld_spi_setup() also use pxa2xx_spi_pci_can_dma(dev) to ensure
the parameter works consistently across all devices supported by this driver?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260711114937.16670-1-fourdollars@debian.org?part=3
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help