Re: [PATCH v16 5/7] spi: pxa2xx: disable DMA for Apple MacBook8,1
"Shih-Yuan Lee (FourDollars)" <[email protected]> Tue, 21 Jul 2026 22:49:17 +0800
| Newsgroups | org.kernel.vger.linux-spi,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <CAAT15mOxrJxb+jRf1P=yu=vXgDj9kRhrdSLkB8v4tEbhHOZ+Pw@mail.gmail.com> |
On Tue, Jul 21, 2026 at 3:27 AM Andy Shevchenko <[email protected]> wrote: > > On Tue, Jul 21, 2026 at 12:21:14AM +0800, Shih-Yuan Lee wrote: > > On MacBook8,1 (early 2015 12" MacBook), the LPSS SPI controller at > > 00:15.4 suffers from hardware DMA handshake failures and interrupt > > routing bugs, causing keyboard/touchpad transactions to fail when > > DMA is enabled. > > Why? The thing like this I noticed on some other HW which required different > DMA settings. Have you tried to investigate the issue more? > > > Move the forced PIO mode DMI quirk to spi-pxa2xx-pci.c (the LPSS host > > controller PCI glue driver) to avoid layering violations in client > > drivers (such as applespi). > > > > Add an explicit DMI match table for MacBook8,1 and a module parameter > > spi_pxa2xx_force_pio to allow forcing PIO mode on demand. > > This looks like a hack. Please, if you have a hardware, try to dump the errors, > collect the data corruption or timeouts and provide more information. DMA for > SPI on LPSS hardware never was a problem (unlike UART in some cases). I'm almost > 100% sure the problem is in DMA configuration / setting bits. > > ... > > > #include <linux/dmaengine.h> > > #include <linux/platform_data/dma-dw.h> > > +#include <linux/dmi.h> > > Keep list ordered. > > > #include "spi-pxa2xx.h" > > ... > > > +static bool spi_pxa2xx_force_pio; > > +module_param_named(force_pio, spi_pxa2xx_force_pio, bool, 0444); > > +MODULE_PARM_DESC(force_pio, "Force PIO mode (disables DMA) for SPI transfers. ([0] = disabled, 1 = enabled)"); > > No. There is no room for module parameters like this. Hi Andy, Thank you for the review and feedback. Regarding your question about why DMA fails on this hardware, I have just sent a detailed reply to Lukas in this thread outlining our physical verification findings. In short, I confirmed that the DMA controller's physical interrupt line is not functioning on this motherboard, and macOS and Windows 10 also completely bypass the DMA controller. Please refer to that email for the DMAR/IOMMU and cross-OS analysis details. Regarding your other comments: 1. Header Sorting: I will fix the alphabetical ordering of the include headers in the next revision. 2. The force_pio Module Parameter: The original spi-pxa2xx driver is designed to hardcode DMA usage if DMA channels are available. I introduced the force_pio module parameter for two reasons: • It serves as a diagnostic tool for users on similar hardware to easily test and verify if their issues are related to DMA. • It allows developers to easily test and debug the PIO code path on DMA-capable LPSS hardware to prevent regressions. That being said, if module parameters of this type are strictly not preferred, I am completely fine with removing force_pio and keeping only the DMI-based quirk for the MacBook8,1. Please let me know your preference. Thanks, Shih-Yuan