mbox series

[0/2] intel-spi: Split hardware and software sequencing

Message ID 20221020164508.29182-1-mauro.lima@eclypsium.com
Headers show
Series intel-spi: Split hardware and software sequencing | expand

Message

Mauro Lima Oct. 20, 2022, 4:45 p.m. UTC
Right now the only driver for Intel's spi has a DANGEROUS tag for
a bug in the past on certain Lenovo platforms. It was cleared out
that the bug was caused for the spi software sequencing mechanism
and if we only use the driver with the hardware sequencing
capabilities will be much safer[1].

This changes will remove all the software sequencing bits from
the driver and left only the hardware sequencing functionality.
If the software sequencing capabilities are needed, the old driver
can be build using the DANGEROUS option from the menu.

[1] https://lkml.org/lkml/2021/11/11/468

Mauro Lima (2):
  spi: intel-spi: Move software sequencing logic outside the core
  spi: intel-spi: build the driver with hardware sequencing by default

 drivers/spi/Kconfig            |  15 +-
 drivers/spi/Makefile           |   2 +-
 drivers/spi/spi-intel-common.h | 171 +++++++++++++++++
 drivers/spi/spi-intel-swseq.c  | 231 +++++++++++++++++++++++
 drivers/spi/spi-intel-swseq.h  |  23 +++
 drivers/spi/spi-intel.c        | 326 +++------------------------------
 6 files changed, 464 insertions(+), 304 deletions(-)
 create mode 100644 drivers/spi/spi-intel-common.h
 create mode 100644 drivers/spi/spi-intel-swseq.c
 create mode 100644 drivers/spi/spi-intel-swseq.h

Comments

Mika Westerberg Oct. 25, 2022, 6:09 a.m. UTC | #1
Hi,

On Thu, Oct 20, 2022 at 01:45:06PM -0300, Mauro Lima wrote:
> Right now the only driver for Intel's spi has a DANGEROUS tag for
> a bug in the past on certain Lenovo platforms. It was cleared out
> that the bug was caused for the spi software sequencing mechanism
> and if we only use the driver with the hardware sequencing
> capabilities will be much safer[1].
> 
> This changes will remove all the software sequencing bits from
> the driver and left only the hardware sequencing functionality.
> If the software sequencing capabilities are needed, the old driver
> can be build using the DANGEROUS option from the menu.
> 
> [1] https://lkml.org/lkml/2021/11/11/468
> 
> Mauro Lima (2):
>   spi: intel-spi: Move software sequencing logic outside the core
>   spi: intel-spi: build the driver with hardware sequencing by default

I'be been thinking about this and I believe we can do something simpler
instead.

All the modern "Core" CPUs expose this as PCI device and that only
supports hardware sequencer which should be safe so I think we can do
something like this:

1. Make spi-intel-pci.c to set the type to INTEL_SPI_CNL for all the
   controllers it supports (and double check that this is the case for
   all these controllers).

As a side effect the ispi->sregs will be set to NULL so the core driver
does not even try to use the software seguencer.

2. Update Kconfig of SPI_INTEL_PCI to remove "DANGEROUS" and mention in
   the help text that this only supports the hardware sequencer and only
   the modern core hardware.

3. Update Kconfig of SPI_INTEL_PLATFORM help text to mention that most
   of these are using software sequencer, leave "DANGEROUS" there.

Does this make sense? Let me know what you think. I can do this myself
as well (might take some while though since busy with other things
usual).