[PATCH v2 0/4] Fixes for TPM interrupt handling
From: Lino Sanfilippo
Date: Sun Apr 25 2021 - 19:49:14 EST
This series enables interrupts for TPM. For this some obstacles had to be
removed first, like the interrupt handler running in interrupt context and
thus not allowing to access registers over SPI. Also the locality handling
has been simplified to make a complicated synchronization between threads
and irq handler unnecessary. As a side effect of this simplification a bug
is fixed in which a TMP command is issued without a claimed locality in
case of TPM 2.
Another fix concerns the interrupt test which currently is broken.
Finally the results of the capability query at startup is used to only set
the interrupts which are actually supported by the hardware.
These patches are based on Linux mainline V5.12 and tested on a SLB 9670
which uses TPM 2 via SPI.
Of course any further testing is highly appreciated.
PATCH 1: The SPI implementation of the functions to read/write to/from
registers uses mutexes and thus require a sleepable context. For this
reason request a threaded interrupt handler.
PATCH 2: Simplify locality handling by taking the driver locality (0) at
driver startup and releasing it at driver shutdown. This also fixes a bug
in case of TMP 2.
PATCH 3: Fix and simplify the test for interrupts.
PATCH 4: Only set the interrupts which are reported as being available.
Changes in v2:
- rebase against 5.12
- free irq on error path
Lino Sanfilippo (4):
tpm: Use a threaded interrupt handler
tpm: Simplify locality handling
tpm: Fix test for interrupts
tpm: Only enable supported irqs
drivers/char/tpm/tpm-chip.c | 40 ----------
drivers/char/tpm/tpm_tis_core.c | 170 +++++++++++++++++-----------------------
drivers/char/tpm/tpm_tis_core.h | 2 +-
include/linux/tpm.h | 5 +-
4 files changed, 72 insertions(+), 145 deletions(-)
--
2.7.4