diff mbox series

[v12,17/19] tpm, sysfs: Show locality used by kernel

Message ID 20241219194216.152839-18-ross.philipson@oracle.com
State New
Headers show
Series x86: Trenchboot secure dynamic launch Linux kernel support | expand

Commit Message

Ross Philipson Dec. 19, 2024, 7:42 p.m. UTC
Expose the locality used by the kernel to sysfs.

Signed-off-by: Ross Philipson <ross.philipson@oracle.com>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
---
 drivers/char/tpm/tpm-sysfs.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Jarkko Sakkinen March 7, 2025, 7:09 a.m. UTC | #1
On Thu, Dec 19, 2024 at 11:42:14AM -0800, Ross Philipson wrote:
> Expose the locality used by the kernel to sysfs.
> 
> Signed-off-by: Ross Philipson <ross.philipson@oracle.com>
> Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
> ---
>  drivers/char/tpm/tpm-sysfs.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/char/tpm/tpm-sysfs.c b/drivers/char/tpm/tpm-sysfs.c
> index 94231f052ea7..2da5857e223b 100644
> --- a/drivers/char/tpm/tpm-sysfs.c
> +++ b/drivers/char/tpm/tpm-sysfs.c
> @@ -309,6 +309,14 @@ static ssize_t tpm_version_major_show(struct device *dev,
>  }
>  static DEVICE_ATTR_RO(tpm_version_major);
>  
> +static ssize_t locality_show(struct device *dev, struct device_attribute *attr, char *buf)
> +{
> +	struct tpm_chip *chip = to_tpm_chip(dev);
> +
> +	return sprintf(buf, "%u\n", chip->kernel_locality);
> +}
> +static DEVICE_ATTR_RO(locality);
> +
>  #ifdef CONFIG_TCG_TPM2_HMAC
>  static ssize_t null_name_show(struct device *dev, struct device_attribute *attr,
>  			      char *buf)
> @@ -336,6 +344,7 @@ static struct attribute *tpm1_dev_attrs[] = {
>  	&dev_attr_durations.attr,
>  	&dev_attr_timeouts.attr,
>  	&dev_attr_tpm_version_major.attr,
> +	&dev_attr_locality.attr,
>  	NULL,
>  };
>  
> @@ -344,6 +353,7 @@ static struct attribute *tpm2_dev_attrs[] = {
>  #ifdef CONFIG_TCG_TPM2_HMAC
>  	&dev_attr_null_name.attr,
>  #endif
> +	&dev_attr_locality.attr,
>  	NULL
>  };
>  
> -- 
> 2.39.3
> 

I think we are now in good standing point with TPM changes.

I'd really put focus now on unimportant seeming but actually important
documentation full refinement. It has all the infos but it is torture
to read still :-) I did put detail how I would like it to be edited
(personally, perhaps others could comment that part too). If it was
a bit more punctual it would be easier to follow rest of the patch
set.

BR, Jarkko
Ross Philipson March 7, 2025, 7:39 p.m. UTC | #2
On 3/6/25 11:09 PM, Jarkko Sakkinen wrote:
> On Thu, Dec 19, 2024 at 11:42:14AM -0800, Ross Philipson wrote:
>> Expose the locality used by the kernel to sysfs.
>>
>> Signed-off-by: Ross Philipson <ross.philipson@oracle.com>
>> Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
>> ---
>>   drivers/char/tpm/tpm-sysfs.c | 10 ++++++++++
>>   1 file changed, 10 insertions(+)
>>
>> diff --git a/drivers/char/tpm/tpm-sysfs.c b/drivers/char/tpm/tpm-sysfs.c
>> index 94231f052ea7..2da5857e223b 100644
>> --- a/drivers/char/tpm/tpm-sysfs.c
>> +++ b/drivers/char/tpm/tpm-sysfs.c
>> @@ -309,6 +309,14 @@ static ssize_t tpm_version_major_show(struct device *dev,
>>   }
>>   static DEVICE_ATTR_RO(tpm_version_major);
>>   
>> +static ssize_t locality_show(struct device *dev, struct device_attribute *attr, char *buf)
>> +{
>> +	struct tpm_chip *chip = to_tpm_chip(dev);
>> +
>> +	return sprintf(buf, "%u\n", chip->kernel_locality);
>> +}
>> +static DEVICE_ATTR_RO(locality);
>> +
>>   #ifdef CONFIG_TCG_TPM2_HMAC
>>   static ssize_t null_name_show(struct device *dev, struct device_attribute *attr,
>>   			      char *buf)
>> @@ -336,6 +344,7 @@ static struct attribute *tpm1_dev_attrs[] = {
>>   	&dev_attr_durations.attr,
>>   	&dev_attr_timeouts.attr,
>>   	&dev_attr_tpm_version_major.attr,
>> +	&dev_attr_locality.attr,
>>   	NULL,
>>   };
>>   
>> @@ -344,6 +353,7 @@ static struct attribute *tpm2_dev_attrs[] = {
>>   #ifdef CONFIG_TCG_TPM2_HMAC
>>   	&dev_attr_null_name.attr,
>>   #endif
>> +	&dev_attr_locality.attr,
>>   	NULL
>>   };
>>   
>> -- 
>> 2.39.3
>>
> 
> I think we are now in good standing point with TPM changes.
> 
> I'd really put focus now on unimportant seeming but actually important
> documentation full refinement. It has all the infos but it is torture
> to read still :-) I did put detail how I would like it to be edited
> (personally, perhaps others could comment that part too). If it was
> a bit more punctual it would be easier to follow rest of the patch
> set.

Yes this is very fair. We can do a scrub of all documentation including 
commit messages and comments. We will incorporate your and other folk's 
input in the process.

Thank you for taking the time to look through these patches. I know 
people are busy, we really appreciate it.

Ross

> 
> BR, Jarkko
diff mbox series

Patch

diff --git a/drivers/char/tpm/tpm-sysfs.c b/drivers/char/tpm/tpm-sysfs.c
index 94231f052ea7..2da5857e223b 100644
--- a/drivers/char/tpm/tpm-sysfs.c
+++ b/drivers/char/tpm/tpm-sysfs.c
@@ -309,6 +309,14 @@  static ssize_t tpm_version_major_show(struct device *dev,
 }
 static DEVICE_ATTR_RO(tpm_version_major);
 
+static ssize_t locality_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	struct tpm_chip *chip = to_tpm_chip(dev);
+
+	return sprintf(buf, "%u\n", chip->kernel_locality);
+}
+static DEVICE_ATTR_RO(locality);
+
 #ifdef CONFIG_TCG_TPM2_HMAC
 static ssize_t null_name_show(struct device *dev, struct device_attribute *attr,
 			      char *buf)
@@ -336,6 +344,7 @@  static struct attribute *tpm1_dev_attrs[] = {
 	&dev_attr_durations.attr,
 	&dev_attr_timeouts.attr,
 	&dev_attr_tpm_version_major.attr,
+	&dev_attr_locality.attr,
 	NULL,
 };
 
@@ -344,6 +353,7 @@  static struct attribute *tpm2_dev_attrs[] = {
 #ifdef CONFIG_TCG_TPM2_HMAC
 	&dev_attr_null_name.attr,
 #endif
+	&dev_attr_locality.attr,
 	NULL
 };