[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2b9e9b38-5ed7-aff1-9ead-534e9d857eda@gmx.de>
Date: Thu, 16 Jun 2022 00:22:12 +0200
From: Lino Sanfilippo <LinoSanfilippo@....de>
To: Jarkko Sakkinen <jarkko@...nel.org>
Cc: peterhuewe@....de, jgg@...pe.ca, stefanb@...ux.vnet.ibm.com,
linux@...ewoehner.de, linux-integrity@...r.kernel.org,
linux-kernel@...r.kernel.org, l.sanfilippo@...bus.com,
lukas@...ner.de, p.rosenberger@...bus.com
Subject: Re: [PATCH v5 07/10] tmp, tmp_tis: Implement usage counter for
locality
On 15.06.22 at 20:23, Jarkko Sakkinen wrote:
> On Fri, Jun 10, 2022 at 01:08:43PM +0200, LinoSanfilippo@....de wrote:
>> From: Lino Sanfilippo <l.sanfilippo@...bus.com>
>>
>> Implement a usage counter for the (default) locality used by the TPM TIS
>> driver:
>> Request the locality from the TPM if it has not been claimed yet, otherwise
>> only increment the counter. Also release the locality if the counter is 0
>> otherwise only decrement the counter. Ensure thread-safety by protecting
>> the counter with a mutex.
>>
>> This allows to request and release the locality from a thread and the
>> interrupt handler at the same time without the danger to interfere with
>> each other.
>>
>> Signed-off-by: Lino Sanfilippo <l.sanfilippo@...bus.com>
>> ---
>> drivers/char/tpm/tpm_tis_core.c | 30 ++++++++++++++++++++++++++++--
>> drivers/char/tpm/tpm_tis_core.h | 2 ++
>> 2 files changed, 30 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
>> index 028bec44362d..0ef74979bc2c 100644
>> --- a/drivers/char/tpm/tpm_tis_core.c
>> +++ b/drivers/char/tpm/tpm_tis_core.c
>> @@ -158,16 +158,26 @@ static bool check_locality(struct tpm_chip *chip, int l)
>> return false;
>> }
>>
>> +static int release_locality_locked(struct tpm_tis_data *priv, int l)
>> +{
>> + tpm_tis_write8(priv, TPM_ACCESS(l), TPM_ACCESS_ACTIVE_LOCALITY);
>
> nit: empty line here
>
> Also it would not hurt to prefix it with tpm_tis.
>
> This is for simple and practical reasons, like grepping. I don't
> mind if you do that also for other functions (if you want to).
>
Ok, will do so.
Regards,
Lino
Powered by blists - more mailing lists