RE: [PATCH v2 2/4] tpm: Simplify locality handling

From: Peter.Huewe
Date: Wed Apr 28 2021 - 03:14:48 EST


On Mon, Apr 26, 2021 at 01:47:18AM +0200, Lino Sanfilippo wrote:
> Currently the TPM (default) locality is claimed and released for each
> access to the TPM registers which require a claimed locality. This
> results in locality claim/release combos at various code places. For
> interrupt handling we also need such a combo in the interrupt handler
> (for clearing the interrupts) which makes the locality handling even
> more complicated since now we also have to synchronize concurrent
> accesses in process and in interrupt context.
>
> Since currently the driver uses only one locality anyway, avoid the
> increasing complexity by claiming it once at driver startup and only
> releasing it at driver shutdown.
>
> Due to the simplifications the functions tpm_request_locality() and
> tpm_relinquish_locality() are not needed any more an can be removed.
>

+1
I like the idea, as it also improves performance a bit.
Peter