[tpmdd-devel,1/3] ACPICA: Update TPM2 ACPI table

Submitted by Jiandi An on March 10, 2017, 9:58 a.m.

Details

Message ID 1489139889-14376-2-git-send-email-anjiandi@codeaurora.org
State New
Headers show

Commit Message

Jiandi An March 10, 2017, 9:58 a.m.
TCG ACPI Specification Family "1.2" and "2.0" Version 1.2
Revision 8 introduces new start method for ARM SMC.

- Add new start method (type 11) for ARM SMC
- Add start method specific parameters for ARM SMC start method

Signed-off-by: Jiandi An <anjiandi@codeaurora.org>
---
 drivers/char/tpm/tpm_crb.c |  6 +++++-
 drivers/char/tpm/tpm_tis.c |  6 +++++-
 include/acpi/actbl2.h      | 12 ++++++++++++
 3 files changed, 22 insertions(+), 2 deletions(-)

Comments

Moore, Robert March 10, 2017, 3:35 p.m.
This appears to be the latest version on the TCG website:

*TCG ACPI Specification for Family 1.2 and 2.0, Level 00, Revision 00.37
December 19, 2014

Which is what ACPICA is using.

Please send me a link to a newer version if you have it.
Thanks,
Bob

> -----Original Message-----
> From: Jiandi An [mailto:anjiandi@codeaurora.org]
> Sent: Friday, March 10, 2017 1:58 AM
> To: tpmdd-devel@lists.sourceforge.net
> Cc: peterhuewe@gmx.de; tpmdd@selhorst.net;
> jarkko.sakkinen@linux.intel.com; jgunthorpe@obsidianresearch.com; Moore,
> Robert <robert.moore@intel.com>; Zheng, Lv <lv.zheng@intel.com>;
> Wysocki, Rafael J <rafael.j.wysocki@intel.com>; lenb@kernel.org; Jiandi
> An <anjiandi@codeaurora.org>
> Subject: [PATCH 1/3] ACPICA: Update TPM2 ACPI table
> 
> TCG ACPI Specification Family "1.2" and "2.0" Version 1.2 Revision 8
> introduces new start method for ARM SMC.
> 
> - Add new start method (type 11) for ARM SMC
> - Add start method specific parameters for ARM SMC start method
> 
> Signed-off-by: Jiandi An <anjiandi@codeaurora.org>
> ---
>  drivers/char/tpm/tpm_crb.c |  6 +++++-
>  drivers/char/tpm/tpm_tis.c |  6 +++++-
>  include/acpi/actbl2.h      | 12 ++++++++++++
>  3 files changed, 22 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c
> index cb6fb13..089fcf8 100644
> --- a/drivers/char/tpm/tpm_crb.c
> +++ b/drivers/char/tpm/tpm_crb.c
> @@ -410,12 +410,16 @@ static int crb_acpi_add(struct acpi_device
> *device)
>  	struct tpm_chip *chip;
>  	struct device *dev = &device->dev;
>  	acpi_status status;
> +	u32 default_len;
>  	u32 sm;
>  	int rc;
> 
> +	default_len = sizeof(struct acpi_table_tpm2) -
> +		      sizeof(union platform_params);
> +
>  	status = acpi_get_table(ACPI_SIG_TPM2, 1,
>  				(struct acpi_table_header **) &buf);
> -	if (ACPI_FAILURE(status) || buf->header.length < sizeof(*buf)) {
> +	if (ACPI_FAILURE(status) || buf->header.length < default_len) {
>  		dev_err(dev, FW_BUG "failed to get TPM2 ACPI table\n");
>  		return -EINVAL;
>  	}
> diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
> index c7e1384..0e2e5f6 100644
> --- a/drivers/char/tpm/tpm_tis.c
> +++ b/drivers/char/tpm/tpm_tis.c
> @@ -253,11 +253,15 @@ static int tpm_tis_acpi_init(struct acpi_device
> *acpi_dev)
>  	acpi_status st;
>  	struct list_head resources;
>  	struct tpm_info tpm_info = {};
> +	u32 default_len;
>  	int ret;
> 
> +	default_len = sizeof(struct acpi_table_tpm2) -
> +		      sizeof(union platform_params);
> +
>  	st = acpi_get_table(ACPI_SIG_TPM2, 1,
>  			    (struct acpi_table_header **) &tbl);
> -	if (ACPI_FAILURE(st) || tbl->header.length < sizeof(*tbl)) {
> +	if (ACPI_FAILURE(st) || tbl->header.length < default_len) {
>  		dev_err(&acpi_dev->dev,
>  			FW_BUG "failed to get TPM2 ACPI table\n");
>  		return -EINVAL;
> diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h index
> 7aee9fb..9612049 100644
> --- a/include/acpi/actbl2.h
> +++ b/include/acpi/actbl2.h
> @@ -1277,6 +1277,14 @@ struct acpi_table_tcpa_server {
>   *
> 
> ************************************************************************
> ******/
> 
> +struct tpm2_crb_smc {
> +	u32 interrupt;
> +	u8 interrupt_flags;
> +	u8 op_flags;
> +	u16 reserved2;
> +	u32 smc_func_id;
> +};
> +
>  struct acpi_table_tpm2 {
>  	struct acpi_table_header header;	/* Common ACPI table header
> */
>  	u16 platform_class;
> @@ -1285,6 +1293,9 @@ struct acpi_table_tpm2 {
>  	u32 start_method;
> 
>  	/* Platform-specific data follows */
> +	union platform_params {
> +		struct tpm2_crb_smc smc_params;
> +	} platform_data;
>  };
> 
>  /* Values for start_method above */
> @@ -1294,6 +1305,7 @@ struct acpi_table_tpm2 {
>  #define ACPI_TPM2_MEMORY_MAPPED                     6
>  #define ACPI_TPM2_COMMAND_BUFFER                    7
>  #define ACPI_TPM2_COMMAND_BUFFER_WITH_START_METHOD  8
> +#define ACPI_TPM2_COMMAND_BUFFER_WITH_SMC          11
> 
> 
> /***********************************************************************
> ********
>   *
> --
> Jiandi An
> Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
> Technologies, Inc.
> Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a
> Linux Foundation Collaborative Project.


------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
Jiandi An March 10, 2017, 6:10 p.m.
On 03/10/17 09:35, Moore, Robert wrote:
> This appears to be the latest version on the TCG website:
>
> *TCG ACPI Specification for Family 1.2 and 2.0, Level 00, Revision 00.37
> December 19, 2014
>
> Which is what ACPICA is using.
>
> Please send me a link to a newer version if you have it.

Hi Bob,
Here is the link to "TCG ACPI Specification Family "1.2" and "2.0" 
Version 1.2 Revision 8".  Thanks.

https://trustedcomputinggroup.org/wp-content/uploads/TCG_ACPIGeneralSpecification-Family-1.2-and-2.0-Ver1.2-Rev8_public-revie....pdf

https://trustedcomputinggroup.org/specifications-public-review/

> Thanks,
> Bob
>
>> -----Original Message-----
>> From: Jiandi An [mailto:anjiandi@codeaurora.org]
>> Sent: Friday, March 10, 2017 1:58 AM
>> To: tpmdd-devel@lists.sourceforge.net
>> Cc: peterhuewe@gmx.de; tpmdd@selhorst.net;
>> jarkko.sakkinen@linux.intel.com; jgunthorpe@obsidianresearch.com; Moore,
>> Robert <robert.moore@intel.com>; Zheng, Lv <lv.zheng@intel.com>;
>> Wysocki, Rafael J <rafael.j.wysocki@intel.com>; lenb@kernel.org; Jiandi
>> An <anjiandi@codeaurora.org>
>> Subject: [PATCH 1/3] ACPICA: Update TPM2 ACPI table
>>
>> TCG ACPI Specification Family "1.2" and "2.0" Version 1.2 Revision 8
>> introduces new start method for ARM SMC.
>>
>> - Add new start method (type 11) for ARM SMC
>> - Add start method specific parameters for ARM SMC start method
>>
>> Signed-off-by: Jiandi An <anjiandi@codeaurora.org>
>> ---
>>   drivers/char/tpm/tpm_crb.c |  6 +++++-
>>   drivers/char/tpm/tpm_tis.c |  6 +++++-
>>   include/acpi/actbl2.h      | 12 ++++++++++++
>>   3 files changed, 22 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c
>> index cb6fb13..089fcf8 100644
>> --- a/drivers/char/tpm/tpm_crb.c
>> +++ b/drivers/char/tpm/tpm_crb.c
>> @@ -410,12 +410,16 @@ static int crb_acpi_add(struct acpi_device
>> *device)
>>   	struct tpm_chip *chip;
>>   	struct device *dev = &device->dev;
>>   	acpi_status status;
>> +	u32 default_len;
>>   	u32 sm;
>>   	int rc;
>>
>> +	default_len = sizeof(struct acpi_table_tpm2) -
>> +		      sizeof(union platform_params);
>> +
>>   	status = acpi_get_table(ACPI_SIG_TPM2, 1,
>>   				(struct acpi_table_header **) &buf);
>> -	if (ACPI_FAILURE(status) || buf->header.length < sizeof(*buf)) {
>> +	if (ACPI_FAILURE(status) || buf->header.length < default_len) {
>>   		dev_err(dev, FW_BUG "failed to get TPM2 ACPI table\n");
>>   		return -EINVAL;
>>   	}
>> diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
>> index c7e1384..0e2e5f6 100644
>> --- a/drivers/char/tpm/tpm_tis.c
>> +++ b/drivers/char/tpm/tpm_tis.c
>> @@ -253,11 +253,15 @@ static int tpm_tis_acpi_init(struct acpi_device
>> *acpi_dev)
>>   	acpi_status st;
>>   	struct list_head resources;
>>   	struct tpm_info tpm_info = {};
>> +	u32 default_len;
>>   	int ret;
>>
>> +	default_len = sizeof(struct acpi_table_tpm2) -
>> +		      sizeof(union platform_params);
>> +
>>   	st = acpi_get_table(ACPI_SIG_TPM2, 1,
>>   			    (struct acpi_table_header **) &tbl);
>> -	if (ACPI_FAILURE(st) || tbl->header.length < sizeof(*tbl)) {
>> +	if (ACPI_FAILURE(st) || tbl->header.length < default_len) {
>>   		dev_err(&acpi_dev->dev,
>>   			FW_BUG "failed to get TPM2 ACPI table\n");
>>   		return -EINVAL;
>> diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h index
>> 7aee9fb..9612049 100644
>> --- a/include/acpi/actbl2.h
>> +++ b/include/acpi/actbl2.h
>> @@ -1277,6 +1277,14 @@ struct acpi_table_tcpa_server {
>>    *
>>
>> ************************************************************************
>> ******/
>>
>> +struct tpm2_crb_smc {
>> +	u32 interrupt;
>> +	u8 interrupt_flags;
>> +	u8 op_flags;
>> +	u16 reserved2;
>> +	u32 smc_func_id;
>> +};
>> +
>>   struct acpi_table_tpm2 {
>>   	struct acpi_table_header header;	/* Common ACPI table header
>> */
>>   	u16 platform_class;
>> @@ -1285,6 +1293,9 @@ struct acpi_table_tpm2 {
>>   	u32 start_method;
>>
>>   	/* Platform-specific data follows */
>> +	union platform_params {
>> +		struct tpm2_crb_smc smc_params;
>> +	} platform_data;
>>   };
>>
>>   /* Values for start_method above */
>> @@ -1294,6 +1305,7 @@ struct acpi_table_tpm2 {
>>   #define ACPI_TPM2_MEMORY_MAPPED                     6
>>   #define ACPI_TPM2_COMMAND_BUFFER                    7
>>   #define ACPI_TPM2_COMMAND_BUFFER_WITH_START_METHOD  8
>> +#define ACPI_TPM2_COMMAND_BUFFER_WITH_SMC          11
>>
>>
>> /***********************************************************************
>> ********
>>    *
>> --
>> Jiandi An
>> Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
>> Technologies, Inc.
>> Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a
>> Linux Foundation Collaborative Project.
>
Jarkko Sakkinen March 11, 2017, 8:19 a.m.
On Fri, Mar 10, 2017 at 03:58:07AM -0600, Jiandi An wrote:
> TCG ACPI Specification Family "1.2" and "2.0" Version 1.2
> Revision 8 introduces new start method for ARM SMC.
> 
> - Add new start method (type 11) for ARM SMC
> - Add start method specific parameters for ARM SMC start method
> 
> Signed-off-by: Jiandi An <anjiandi@codeaurora.org>

Could you briefly describe what SMC is? I don't know

1. What the abbrevation stands for.
2. What it is.

/Jarkko

> ---
>  drivers/char/tpm/tpm_crb.c |  6 +++++-
>  drivers/char/tpm/tpm_tis.c |  6 +++++-
>  include/acpi/actbl2.h      | 12 ++++++++++++
>  3 files changed, 22 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c
> index cb6fb13..089fcf8 100644
> --- a/drivers/char/tpm/tpm_crb.c
> +++ b/drivers/char/tpm/tpm_crb.c
> @@ -410,12 +410,16 @@ static int crb_acpi_add(struct acpi_device *device)
>  	struct tpm_chip *chip;
>  	struct device *dev = &device->dev;
>  	acpi_status status;
> +	u32 default_len;
>  	u32 sm;
>  	int rc;
>  
> +	default_len = sizeof(struct acpi_table_tpm2) -
> +		      sizeof(union platform_params);
> +
>  	status = acpi_get_table(ACPI_SIG_TPM2, 1,
>  				(struct acpi_table_header **) &buf);
> -	if (ACPI_FAILURE(status) || buf->header.length < sizeof(*buf)) {
> +	if (ACPI_FAILURE(status) || buf->header.length < default_len) {
>  		dev_err(dev, FW_BUG "failed to get TPM2 ACPI table\n");
>  		return -EINVAL;
>  	}
> diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
> index c7e1384..0e2e5f6 100644
> --- a/drivers/char/tpm/tpm_tis.c
> +++ b/drivers/char/tpm/tpm_tis.c
> @@ -253,11 +253,15 @@ static int tpm_tis_acpi_init(struct acpi_device *acpi_dev)
>  	acpi_status st;
>  	struct list_head resources;
>  	struct tpm_info tpm_info = {};
> +	u32 default_len;
>  	int ret;
>  
> +	default_len = sizeof(struct acpi_table_tpm2) -
> +		      sizeof(union platform_params);
> +
>  	st = acpi_get_table(ACPI_SIG_TPM2, 1,
>  			    (struct acpi_table_header **) &tbl);
> -	if (ACPI_FAILURE(st) || tbl->header.length < sizeof(*tbl)) {
> +	if (ACPI_FAILURE(st) || tbl->header.length < default_len) {
>  		dev_err(&acpi_dev->dev,
>  			FW_BUG "failed to get TPM2 ACPI table\n");
>  		return -EINVAL;
> diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
> index 7aee9fb..9612049 100644
> --- a/include/acpi/actbl2.h
> +++ b/include/acpi/actbl2.h
> @@ -1277,6 +1277,14 @@ struct acpi_table_tcpa_server {
>   *
>   ******************************************************************************/
>  
> +struct tpm2_crb_smc {
> +	u32 interrupt;
> +	u8 interrupt_flags;
> +	u8 op_flags;
> +	u16 reserved2;
> +	u32 smc_func_id;
> +};
> +
>  struct acpi_table_tpm2 {
>  	struct acpi_table_header header;	/* Common ACPI table header */
>  	u16 platform_class;
> @@ -1285,6 +1293,9 @@ struct acpi_table_tpm2 {
>  	u32 start_method;
>  
>  	/* Platform-specific data follows */
> +	union platform_params {
> +		struct tpm2_crb_smc smc_params;
> +	} platform_data;
>  };
>  
>  /* Values for start_method above */
> @@ -1294,6 +1305,7 @@ struct acpi_table_tpm2 {
>  #define ACPI_TPM2_MEMORY_MAPPED                     6
>  #define ACPI_TPM2_COMMAND_BUFFER                    7
>  #define ACPI_TPM2_COMMAND_BUFFER_WITH_START_METHOD  8
> +#define ACPI_TPM2_COMMAND_BUFFER_WITH_SMC          11
>  
>  /*******************************************************************************
>   *
> -- 
> Jiandi An
> Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
> Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
> 

------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
Jiandi An March 11, 2017, 9:18 p.m.
On 03/11/17 02:19, Jarkko Sakkinen wrote:
> On Fri, Mar 10, 2017 at 03:58:07AM -0600, Jiandi An wrote:
>> TCG ACPI Specification Family "1.2" and "2.0" Version 1.2
>> Revision 8 introduces new start method for ARM SMC.
>>
>> - Add new start method (type 11) for ARM SMC
>> - Add start method specific parameters for ARM SMC start method
>>
>> Signed-off-by: Jiandi An <anjiandi@codeaurora.org>
>
> Could you briefly describe what SMC is? I don't know
>
> 1. What the abbrevation stands for.
SMC stands for Secure Monitor Call.

> 2. What it is.
In ARM, TrustZone security extensions ennable a Secure software
environment with Secure Monitor mode.  A Secure Monitor Call (SMC) is
used to enter the Secure Monitor mode and perform a Secure Monitor
service call.  Software executing in the non-secure state and in the
secure state at exception levels lower than EL3 in ARM will request
runtime services using the Secure Monitor Call (SMC) instruction to
enter EL3 secure mode.

I'll include a brief description in commit message of patch as well
in next version of the patch.

Thanks.
- Jiandi

>
> /Jarkko
>
>> ---
>>   drivers/char/tpm/tpm_crb.c |  6 +++++-
>>   drivers/char/tpm/tpm_tis.c |  6 +++++-
>>   include/acpi/actbl2.h      | 12 ++++++++++++
>>   3 files changed, 22 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c
>> index cb6fb13..089fcf8 100644
>> --- a/drivers/char/tpm/tpm_crb.c
>> +++ b/drivers/char/tpm/tpm_crb.c
>> @@ -410,12 +410,16 @@ static int crb_acpi_add(struct acpi_device *device)
>>   	struct tpm_chip *chip;
>>   	struct device *dev = &device->dev;
>>   	acpi_status status;
>> +	u32 default_len;
>>   	u32 sm;
>>   	int rc;
>>
>> +	default_len = sizeof(struct acpi_table_tpm2) -
>> +		      sizeof(union platform_params);
>> +
>>   	status = acpi_get_table(ACPI_SIG_TPM2, 1,
>>   				(struct acpi_table_header **) &buf);
>> -	if (ACPI_FAILURE(status) || buf->header.length < sizeof(*buf)) {
>> +	if (ACPI_FAILURE(status) || buf->header.length < default_len) {
>>   		dev_err(dev, FW_BUG "failed to get TPM2 ACPI table\n");
>>   		return -EINVAL;
>>   	}
>> diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
>> index c7e1384..0e2e5f6 100644
>> --- a/drivers/char/tpm/tpm_tis.c
>> +++ b/drivers/char/tpm/tpm_tis.c
>> @@ -253,11 +253,15 @@ static int tpm_tis_acpi_init(struct acpi_device *acpi_dev)
>>   	acpi_status st;
>>   	struct list_head resources;
>>   	struct tpm_info tpm_info = {};
>> +	u32 default_len;
>>   	int ret;
>>
>> +	default_len = sizeof(struct acpi_table_tpm2) -
>> +		      sizeof(union platform_params);
>> +
>>   	st = acpi_get_table(ACPI_SIG_TPM2, 1,
>>   			    (struct acpi_table_header **) &tbl);
>> -	if (ACPI_FAILURE(st) || tbl->header.length < sizeof(*tbl)) {
>> +	if (ACPI_FAILURE(st) || tbl->header.length < default_len) {
>>   		dev_err(&acpi_dev->dev,
>>   			FW_BUG "failed to get TPM2 ACPI table\n");
>>   		return -EINVAL;
>> diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
>> index 7aee9fb..9612049 100644
>> --- a/include/acpi/actbl2.h
>> +++ b/include/acpi/actbl2.h
>> @@ -1277,6 +1277,14 @@ struct acpi_table_tcpa_server {
>>    *
>>    ******************************************************************************/
>>
>> +struct tpm2_crb_smc {
>> +	u32 interrupt;
>> +	u8 interrupt_flags;
>> +	u8 op_flags;
>> +	u16 reserved2;
>> +	u32 smc_func_id;
>> +};
>> +
>>   struct acpi_table_tpm2 {
>>   	struct acpi_table_header header;	/* Common ACPI table header */
>>   	u16 platform_class;
>> @@ -1285,6 +1293,9 @@ struct acpi_table_tpm2 {
>>   	u32 start_method;
>>
>>   	/* Platform-specific data follows */
>> +	union platform_params {
>> +		struct tpm2_crb_smc smc_params;
>> +	} platform_data;
>>   };
>>
>>   /* Values for start_method above */
>> @@ -1294,6 +1305,7 @@ struct acpi_table_tpm2 {
>>   #define ACPI_TPM2_MEMORY_MAPPED                     6
>>   #define ACPI_TPM2_COMMAND_BUFFER                    7
>>   #define ACPI_TPM2_COMMAND_BUFFER_WITH_START_METHOD  8
>> +#define ACPI_TPM2_COMMAND_BUFFER_WITH_SMC          11
>>
>>   /*******************************************************************************
>>    *
>> --
>> Jiandi An
>> Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
>> Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
>>
Jarkko Sakkinen March 13, 2017, 11:43 a.m.
On Sat, Mar 11, 2017 at 03:18:03PM -0600, Jiandi An wrote:
> On 03/11/17 02:19, Jarkko Sakkinen wrote:
> > On Fri, Mar 10, 2017 at 03:58:07AM -0600, Jiandi An wrote:
> > > TCG ACPI Specification Family "1.2" and "2.0" Version 1.2
> > > Revision 8 introduces new start method for ARM SMC.
> > > 
> > > - Add new start method (type 11) for ARM SMC
> > > - Add start method specific parameters for ARM SMC start method
> > > 
> > > Signed-off-by: Jiandi An <anjiandi@codeaurora.org>
> > 
> > Could you briefly describe what SMC is? I don't know
> > 
> > 1. What the abbrevation stands for.
> SMC stands for Secure Monitor Call.
> 
> > 2. What it is.
> In ARM, TrustZone security extensions ennable a Secure software
> environment with Secure Monitor mode.  A Secure Monitor Call (SMC) is
> used to enter the Secure Monitor mode and perform a Secure Monitor
> service call.  Software executing in the non-secure state and in the
> secure state at exception levels lower than EL3 in ARM will request
> runtime services using the Secure Monitor Call (SMC) instruction to
> enter EL3 secure mode.
> 
> I'll include a brief description in commit message of patch as well
> in next version of the patch.
> 
> Thanks.
> - Jiandi

Thank you. I got the idea but it still would be also good idea to
have this documented in the commit message so it's available in the
commit log if we need to backtrack something.

/Jarkko

------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford

Patch hide | download patch | download mbox

diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c
index cb6fb13..089fcf8 100644
--- a/drivers/char/tpm/tpm_crb.c
+++ b/drivers/char/tpm/tpm_crb.c
@@ -410,12 +410,16 @@  static int crb_acpi_add(struct acpi_device *device)
 	struct tpm_chip *chip;
 	struct device *dev = &device->dev;
 	acpi_status status;
+	u32 default_len;
 	u32 sm;
 	int rc;
 
+	default_len = sizeof(struct acpi_table_tpm2) -
+		      sizeof(union platform_params);
+
 	status = acpi_get_table(ACPI_SIG_TPM2, 1,
 				(struct acpi_table_header **) &buf);
-	if (ACPI_FAILURE(status) || buf->header.length < sizeof(*buf)) {
+	if (ACPI_FAILURE(status) || buf->header.length < default_len) {
 		dev_err(dev, FW_BUG "failed to get TPM2 ACPI table\n");
 		return -EINVAL;
 	}
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index c7e1384..0e2e5f6 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -253,11 +253,15 @@  static int tpm_tis_acpi_init(struct acpi_device *acpi_dev)
 	acpi_status st;
 	struct list_head resources;
 	struct tpm_info tpm_info = {};
+	u32 default_len;
 	int ret;
 
+	default_len = sizeof(struct acpi_table_tpm2) -
+		      sizeof(union platform_params);
+
 	st = acpi_get_table(ACPI_SIG_TPM2, 1,
 			    (struct acpi_table_header **) &tbl);
-	if (ACPI_FAILURE(st) || tbl->header.length < sizeof(*tbl)) {
+	if (ACPI_FAILURE(st) || tbl->header.length < default_len) {
 		dev_err(&acpi_dev->dev,
 			FW_BUG "failed to get TPM2 ACPI table\n");
 		return -EINVAL;
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index 7aee9fb..9612049 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -1277,6 +1277,14 @@  struct acpi_table_tcpa_server {
  *
  ******************************************************************************/
 
+struct tpm2_crb_smc {
+	u32 interrupt;
+	u8 interrupt_flags;
+	u8 op_flags;
+	u16 reserved2;
+	u32 smc_func_id;
+};
+
 struct acpi_table_tpm2 {
 	struct acpi_table_header header;	/* Common ACPI table header */
 	u16 platform_class;
@@ -1285,6 +1293,9 @@  struct acpi_table_tpm2 {
 	u32 start_method;
 
 	/* Platform-specific data follows */
+	union platform_params {
+		struct tpm2_crb_smc smc_params;
+	} platform_data;
 };
 
 /* Values for start_method above */
@@ -1294,6 +1305,7 @@  struct acpi_table_tpm2 {
 #define ACPI_TPM2_MEMORY_MAPPED                     6
 #define ACPI_TPM2_COMMAND_BUFFER                    7
 #define ACPI_TPM2_COMMAND_BUFFER_WITH_START_METHOD  8
+#define ACPI_TPM2_COMMAND_BUFFER_WITH_SMC          11
 
 /*******************************************************************************
  *