[PATCH v13 16/19] tpm, tpm_tis: Allow locality to be set to a different value
ross.philipson at oracle.com
ross.philipson at oracle.com
Tue Apr 15 14:04:36 PDT 2025
On 4/12/25 12:15 PM, ALOK TIWARI wrote:
>
>
> On 11-04-2025 02:11, Ross Philipson wrote:
>> DRTM needs to be able to set the locality used by kernel. Provide
>> a one-shot function tpm_chip_set_locality() for the purpose.
>>
>> Signed-off-by: Ross Philipson <ross.philipson at oracle.com>
>> Signed-off-by: Jarkko Sakkinen <jarkko at kernel.org>
>> ---
>> drivers/char/tpm/tpm-chip.c | 33 ++++++++++++++++++++++++++++++++-
>> drivers/char/tpm/tpm_tis_core.c | 2 ++
>> include/linux/tpm.h | 4 ++++
>> 3 files changed, 38 insertions(+), 1 deletion(-)
>>
>> +/**
>> + * tpm_chip_set_locality() - Set the TPM locality kernel uses
>> + * @chip: &tpm_chip instance
>> + * @locality: new locality
>> + *
>> + * This a one-shot function. Returns zero or POSIX error on failure.
>> + */
>> +int tpm_chip_set_locality(struct tpm_chip *chip, u8 locality)
>> +{
>> + int ret;
>> +
>> + if (locality < 0 || locality >= TPM_MAX_LOCALITY)
>> + return -EINVAL;
>> +
>> + ret = tpm_try_get_ops(chip);
>> + if (ret)
>> + return ret;
>> +
>> + if (!(chip->flags & TPM_CHIP_FLAG_SET_LOCALITY_ENABLED)) {
>> + tpm_put_ops(chip);
>> + return -EINVAL;
>> + }
>> +
>> + chip->kernel_locality = locality;
>> + chip->flags &= ~TPM_CHIP_FLAG_SET_LOCALITY_ENABLED;
>> + tpm_put_ops(chip);
>> + return 0;
>
> a '\n' before return is customary
Can do, thanks
>
>> +}
>> +EXPORT_SYMBOL_GPL(tpm_chip_set_locality);
>> diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/
>> tpm_tis_core.c
>
>
> Thanks,
> Alok
More information about the kexec
mailing list