All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 00/10] TPM IRQ fixes
@ 2022-06-10 11:08 LinoSanfilippo
  2022-06-10 11:08 ` [PATCH v5 01/10] tpm, tpm_tis: Avoid cache incoherency in test for interrupts LinoSanfilippo
                   ` (9 more replies)
  0 siblings, 10 replies; 31+ messages in thread
From: LinoSanfilippo @ 2022-06-10 11:08 UTC (permalink / raw)
  To: peterhuewe, jarkko, jgg
  Cc: stefanb, linux, linux-integrity, linux-kernel, l.sanfilippo,
	LinoSanfilippo, lukas, p.rosenberger

From: Lino Sanfilippo <l.sanfilippo@kunbus.com>

This series enables IRQ support for the TPM TIS core. For this reason a
number of bugfixes around the interrupt handling are required (patches 1 to
4).

Patches 5 and 6 take into account that according to the TPM Interface
Specification stsValid and commandRead interrupts might not be supported
by the hardware. For this reason the supported interrupts are first queried
and stored (patch 5). Then wait_for_tpm_stat() is adjusted to not wait for
status changes that are not reported by interrupts (patch 6).


Patch 7 addresses the issue with concurrent locality handling:

Since the interrupt handler writes the interrupt status registers it needs
to hold the locality. However it runs concurrently to the thread which
triggered the interrupt (e.g. by reading or writing data to the TPM). So
it must take care when claiming and releasing the locality itself,
because it may race with the concurrent running thread which also claims
and releases the locality.
To avoid that both interrupt and concurrent running thread interfere with
each other a locality counter is used which guarantees that at any time
the locality is held as long as it is required by one of both execution
paths.

Patch 8 implements the request of a threaded interrupt handler. This is
needed since SPI uses a mutex for data transmission and since we access the
interrupt status register via SPI in the irq handler we need a sleepable
context.
In the last version of this series this was only done for SPI. But since
with patch 9 grabbing and releasing the locality includes using a mutex
which protects a locality counter the threaded interrupt is always
needed.



Changes in v5:
- improve commit message of patch 1 as requested by Jarko
- drop patch that makes locality handling simpler by only claiming it at
  driver startup and releasing it at driver shutdown (requested by Jarko)
- drop patch that moves the interrupt test from tpm_tis_send()
  to tmp_tis_probe_irq_single() as requested by Jarko
- add patch to make locality handling threadsafe so that it can also be
  done by the irq handler
- separate logical changes into own patches
- always request threaded interrupt handler

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 (10):
  tpm, tpm_tis: Avoid cache incoherency in test for interrupts
  tpm, tpm_tis: Claim locality before writing TPM_INT_ENABLE register
  tpm, tpm_tis: Disable interrupts if tpm_tis_probe_irq() failed
  tpm, tmp_tis: Claim locality before writing interrupt registers
  tpm, tpm_tis: Store result of interrupt capability query
  tpm, tpm_tis: Only handle supported interrupts in wait_for_tpm_stat()
  tmp, tmp_tis: Implement usage counter for locality
  tpm, tpm_tis: Request threaded interrupt handler
  tpm, tpm_tis: Claim locality in interrupt handler
  tpm, tpm_tis: Enable interrupt test

 drivers/char/tpm/tpm_tis_core.c | 217 ++++++++++++++++++++++----------
 drivers/char/tpm/tpm_tis_core.h |   9 +-
 2 files changed, 156 insertions(+), 70 deletions(-)


base-commit: 4b0986a3613c92f4ec1bdc7f60ec66fea135991f
-- 
2.36.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2022-06-26  5:19 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-10 11:08 [PATCH v5 00/10] TPM IRQ fixes LinoSanfilippo
2022-06-10 11:08 ` [PATCH v5 01/10] tpm, tpm_tis: Avoid cache incoherency in test for interrupts LinoSanfilippo
2022-06-15 14:32   ` Jarkko Sakkinen
2022-06-15 22:06     ` Lino Sanfilippo
2022-06-10 11:08 ` [PATCH v5 02/10] tpm, tpm_tis: Claim locality before writing TPM_INT_ENABLE register LinoSanfilippo
2022-06-15 14:33   ` Jarkko Sakkinen
2022-06-10 11:08 ` [PATCH v5 03/10] tpm, tpm_tis: Disable interrupts if tpm_tis_probe_irq() failed LinoSanfilippo
2022-06-15 18:11   ` Jarkko Sakkinen
2022-06-10 11:08 ` [PATCH v5 04/10] tpm, tmp_tis: Claim locality before writing interrupt registers LinoSanfilippo
2022-06-15 18:13   ` Jarkko Sakkinen
2022-06-10 11:08 ` [PATCH v5 05/10] tpm, tpm_tis: Store result of interrupt capability query LinoSanfilippo
2022-06-15 18:18   ` Jarkko Sakkinen
2022-06-15 22:07     ` Lino Sanfilippo
2022-06-10 11:08 ` [PATCH v5 06/10] tpm, tpm_tis: Only handle supported interrupts in wait_for_tpm_stat() LinoSanfilippo
2022-06-15 18:21   ` Jarkko Sakkinen
2022-06-15 22:08     ` Lino Sanfilippo
2022-06-10 11:08 ` [PATCH v5 07/10] tmp, tmp_tis: Implement usage counter for locality LinoSanfilippo
2022-06-15 18:23   ` Jarkko Sakkinen
2022-06-15 22:22     ` Lino Sanfilippo
2022-06-10 11:08 ` [PATCH v5 08/10] tpm, tpm_tis: Request threaded interrupt handler LinoSanfilippo
2022-06-15 18:24   ` Jarkko Sakkinen
2022-06-10 11:08 ` [PATCH v5 09/10] tpm, tpm_tis: Claim locality in " LinoSanfilippo
2022-06-15 18:25   ` Jarkko Sakkinen
2022-06-10 11:08 ` [PATCH v5 10/10] tpm, tpm_tis: Enable interrupt test LinoSanfilippo
2022-06-15 18:26   ` Jarkko Sakkinen
2022-06-15 21:54     ` Michael Niewöhner
2022-06-15 23:30       ` Lino Sanfilippo
2022-06-16 13:03         ` Michael Niewöhner
2022-06-16 13:13           ` Lino Sanfilippo
2022-06-16 13:04     ` Michael Niewöhner
2022-06-26  5:19       ` Jarkko Sakkinen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.