[PATCH v4 0/6] TPM irq fixes

From: Lino Sanfilippo
Date: Mon May 09 2022 - 04:26:46 EST


This series fixes issues around the interrupt handling in the TPM TIS core.

Patch 1:
Request threaded interrupt handler for SPI. This is needed since SPI uses a
mutex for data transmission and since we exchange data via SPI int the irq
handler we need a sleepable context.

Patch 2:
Make locality handling simpler by only claiming it at driver startup and
releasing it at driver shutdown.

Patch 3:
Enable the irq test which is always skipped in the current code.

Patch 4:
Fix the irq test by ensuring CPU cache coherency when setting the irq test
condition on one and checking it on another CPU.

Patch 5:
Move the irq test and the check for irq test from tpm_tis_send() to
tpm_tis_probe_irq_single() so the check has not to be done for each data
transmission.

Patch 6:
Instead of blindly trying to enable all possible interrupts, use the result
from the capability query and request only the interrupts that are actually
supported.


Changes in v4:
- only request threaded irq in case of SPI as requested by Jarko.
- reimplement patch 2 to limit locality handling changes to the TIS core.
- separate fixes from cleanups as requested by Jarko.
- rephrase commit messages

Changes in v3:
- fixed compiler error reported by kernel test robot
- rephrased commit message as suggested by Jarko Sakkinen
- added Reviewed-by tag

Changes in v2:
- rebase against 5.12
- free irq on error path


Lino Sanfilippo (6):
tpm, tpm_tis_spi: Request threaded irq
tpm, tpm_tis: Claim and release locality only once
tpm, tpm_tis: enable irq test
tpm, tpm_tis: avoid CPU cache incoherency in irq test
tpm, tpm_tis: Move irq test from tpm_tis_send() to
tpm_tis_probe_irq_single()
tpm, tpm_tis: Only enable supported IRQs

drivers/char/tpm/tpm_tis_core.c | 202 ++++++++++++----------------
drivers/char/tpm/tpm_tis_core.h | 8 +-
drivers/char/tpm/tpm_tis_spi_main.c | 5 +-
3 files changed, 96 insertions(+), 119 deletions(-)


base-commit: fe27d189e3f42e31d3c8223d5daed7285e334c5e
--
2.36.0