Re: [RFC PATCH v2 1/2] tpm, tpm_tis: Introduce TPM_IOC_SET_LOCALITY

From: Jarkko Sakkinen
Date: Sat Nov 02 2024 - 10:07:19 EST


On Sat Nov 2, 2024 at 3:39 PM EET, Jarkko Sakkinen wrote:
> int tpm_chip_set_locality(struct tpm_chip *chip, u8 locality)
> {
> int ret;
>
> if (locality >= TPM_MAX_LOCALITY)
> return false;
>
> ret = tpm_try_get_ops(chip);
> if (ret)
> return ret;
>
> chip->default_locality = locality;
>
> tpm_put_ops(chip);
> return 0;
> }
> EXPORT_SYMBOL_GPL(tpm_chip_set_locality);

Other things to take from 1/2 of my RFC to this:

1. Must be one-shot.
2. Must be only for tpm_tis as this is made to work only with that
driver. E.g. 15/20 is only for tpm_tis. I guess that is the
main target anyway here. Future patch sets can extend this to
other drivers.

TPM_CHIP_FLAG_SET_LOCALITY_ENABLED use in 1/2 can be referenced
for a solution.

Kernel command-line parameter: I agree not having it if no need
for ioctl, so that is addressed too.

BR, Jarkko