diff mbox series

[v4,1/5] tpm: add a "ppi" boolean property

Message ID 20180621115530.11069-2-marcandre.lureau@redhat.com
State New
Headers show
Series Add support for TPM Physical Presence interface | expand

Commit Message

Marc-André Lureau June 21, 2018, 11:55 a.m. UTC
The following patches implement the TPM Physical Presence Interface,
and makes use of new memory region and fw_cfg entries. Enable it by
default on >2.12 machine type.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 include/hw/compat.h | 10 ++++++++++
 hw/tpm/tpm_crb.c    |  3 +++
 hw/tpm/tpm_tis.c    |  3 +++
 3 files changed, 16 insertions(+)

Comments

Stefan Berger June 21, 2018, 12:11 p.m. UTC | #1
On 06/21/2018 07:55 AM, Marc-André Lureau wrote:
> The following patches implement the TPM Physical Presence Interface,
> and makes use of new memory region and fw_cfg entries. Enable it by
> default on >2.12 machine type.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>   include/hw/compat.h | 10 ++++++++++
>   hw/tpm/tpm_crb.c    |  3 +++
>   hw/tpm/tpm_tis.c    |  3 +++
>   3 files changed, 16 insertions(+)
>
> diff --git a/include/hw/compat.h b/include/hw/compat.h
> index 563908b874..dac847548b 100644
> --- a/include/hw/compat.h
> +++ b/include/hw/compat.h
> @@ -2,6 +2,16 @@
>   #define HW_COMPAT_H
>   
>   #define HW_COMPAT_2_12 \
> +    {\
> +        .driver   = "tpm-crb",\
> +        .property = "ppi",\
> +        .value    = "false",\
> +    },\
> +    {\
> +        .driver   = "tpm-tis",\
> +        .property = "ppi",\
> +        .value    = "false",\
> +    },\
>       {\
>           .driver   = "migration",\
>           .property = "decompress-error-check",\
> diff --git a/hw/tpm/tpm_crb.c b/hw/tpm/tpm_crb.c
> index a92dd50437..d5b0ac5920 100644
> --- a/hw/tpm/tpm_crb.c
> +++ b/hw/tpm/tpm_crb.c
> @@ -41,6 +41,8 @@ typedef struct CRBState {
>       MemoryRegion cmdmem;
>   
>       size_t be_buffer_size;
> +
> +    bool ppi_enabled;
>   } CRBState;
>   
>   #define CRB(obj) OBJECT_CHECK(CRBState, (obj), TYPE_TPM_CRB)
> @@ -221,6 +223,7 @@ static const VMStateDescription vmstate_tpm_crb = {
>   
>   static Property tpm_crb_properties[] = {
>       DEFINE_PROP_TPMBE("tpmdev", CRBState, tpmbe),
> +    DEFINE_PROP_BOOL("ppi", CRBState, ppi_enabled, true),
>       DEFINE_PROP_END_OF_LIST(),
>   };

Wouldn't we have to bump up the version of teh VMStateDescription?

    Stefan
>   
> diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
> index 12f5c9a759..d9ddf9b723 100644
> --- a/hw/tpm/tpm_tis.c
> +++ b/hw/tpm/tpm_tis.c
> @@ -81,6 +81,8 @@ typedef struct TPMState {
>       TPMVersion be_tpm_version;
>   
>       size_t be_buffer_size;
> +
> +    bool ppi_enabled;
>   } TPMState;
>   
>   #define TPM(obj) OBJECT_CHECK(TPMState, (obj), TYPE_TPM_TIS)
> @@ -950,6 +952,7 @@ static const VMStateDescription vmstate_tpm_tis = {
>   static Property tpm_tis_properties[] = {
>       DEFINE_PROP_UINT32("irq", TPMState, irq_num, TPM_TIS_IRQ),
>       DEFINE_PROP_TPMBE("tpmdev", TPMState, be_driver),
> +    DEFINE_PROP_BOOL("ppi", TPMState, ppi_enabled, true),
>       DEFINE_PROP_END_OF_LIST(),
>   };
>
Stefan Berger June 21, 2018, 12:19 p.m. UTC | #2
On 06/21/2018 08:11 AM, Stefan Berger wrote:
> On 06/21/2018 07:55 AM, Marc-André Lureau wrote:
>> The following patches implement the TPM Physical Presence Interface,
>> and makes use of new memory region and fw_cfg entries. Enable it by
>> default on >2.12 machine type.
>>
>> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>> ---
>>   include/hw/compat.h | 10 ++++++++++
>>   hw/tpm/tpm_crb.c    |  3 +++
>>   hw/tpm/tpm_tis.c    |  3 +++
>>   3 files changed, 16 insertions(+)
>>
>> diff --git a/include/hw/compat.h b/include/hw/compat.h
>> index 563908b874..dac847548b 100644
>> --- a/include/hw/compat.h
>> +++ b/include/hw/compat.h
>> @@ -2,6 +2,16 @@
>>   #define HW_COMPAT_H
>>     #define HW_COMPAT_2_12 \
>> +    {\
>> +        .driver   = "tpm-crb",\
>> +        .property = "ppi",\
>> +        .value    = "false",\
>> +    },\
>> +    {\
>> +        .driver   = "tpm-tis",\
>> +        .property = "ppi",\
>> +        .value    = "false",\
>> +    },\
>>       {\
>>           .driver   = "migration",\
>>           .property = "decompress-error-check",\
>> diff --git a/hw/tpm/tpm_crb.c b/hw/tpm/tpm_crb.c
>> index a92dd50437..d5b0ac5920 100644
>> --- a/hw/tpm/tpm_crb.c
>> +++ b/hw/tpm/tpm_crb.c
>> @@ -41,6 +41,8 @@ typedef struct CRBState {
>>       MemoryRegion cmdmem;
>>         size_t be_buffer_size;
>> +
>> +    bool ppi_enabled;
>>   } CRBState;
>>     #define CRB(obj) OBJECT_CHECK(CRBState, (obj), TYPE_TPM_CRB)
>> @@ -221,6 +223,7 @@ static const VMStateDescription vmstate_tpm_crb = {
>>     static Property tpm_crb_properties[] = {
>>       DEFINE_PROP_TPMBE("tpmdev", CRBState, tpmbe),
>> +    DEFINE_PROP_BOOL("ppi", CRBState, ppi_enabled, true),
>>       DEFINE_PROP_END_OF_LIST(),
>>   };
>
> Wouldn't we have to bump up the version of teh VMStateDescription?

Ah, command line option...

    Stefan
Marc-André Lureau June 28, 2018, 11:21 a.m. UTC | #3
Hi

On Thu, Jun 21, 2018 at 2:11 PM, Stefan Berger
<stefanb@linux.vnet.ibm.com> wrote:
> On 06/21/2018 07:55 AM, Marc-André Lureau wrote:
>>
>> The following patches implement the TPM Physical Presence Interface,
>> and makes use of new memory region and fw_cfg entries. Enable it by
>> default on >2.12 machine type.
>>
>> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>> ---
>>   include/hw/compat.h | 10 ++++++++++
>>   hw/tpm/tpm_crb.c    |  3 +++
>>   hw/tpm/tpm_tis.c    |  3 +++
>>   3 files changed, 16 insertions(+)
>>
>> diff --git a/include/hw/compat.h b/include/hw/compat.h
>> index 563908b874..dac847548b 100644
>> --- a/include/hw/compat.h
>> +++ b/include/hw/compat.h
>> @@ -2,6 +2,16 @@
>>   #define HW_COMPAT_H
>>     #define HW_COMPAT_2_12 \
>> +    {\
>> +        .driver   = "tpm-crb",\
>> +        .property = "ppi",\
>> +        .value    = "false",\
>> +    },\
>> +    {\
>> +        .driver   = "tpm-tis",\
>> +        .property = "ppi",\
>> +        .value    = "false",\
>> +    },\
>>       {\
>>           .driver   = "migration",\
>>           .property = "decompress-error-check",\
>> diff --git a/hw/tpm/tpm_crb.c b/hw/tpm/tpm_crb.c
>> index a92dd50437..d5b0ac5920 100644
>> --- a/hw/tpm/tpm_crb.c
>> +++ b/hw/tpm/tpm_crb.c
>> @@ -41,6 +41,8 @@ typedef struct CRBState {
>>       MemoryRegion cmdmem;
>>         size_t be_buffer_size;
>> +
>> +    bool ppi_enabled;
>>   } CRBState;
>>     #define CRB(obj) OBJECT_CHECK(CRBState, (obj), TYPE_TPM_CRB)
>> @@ -221,6 +223,7 @@ static const VMStateDescription vmstate_tpm_crb = {
>>     static Property tpm_crb_properties[] = {
>>       DEFINE_PROP_TPMBE("tpmdev", CRBState, tpmbe),
>> +    DEFINE_PROP_BOOL("ppi", CRBState, ppi_enabled, true),
>>       DEFINE_PROP_END_OF_LIST(),
>>   };
>
>
> Wouldn't we have to bump up the version of teh VMStateDescription?

A device property is not saved with vmstate afaik.

>
>    Stefan
>
>>   diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
>> index 12f5c9a759..d9ddf9b723 100644
>> --- a/hw/tpm/tpm_tis.c
>> +++ b/hw/tpm/tpm_tis.c
>> @@ -81,6 +81,8 @@ typedef struct TPMState {
>>       TPMVersion be_tpm_version;
>>         size_t be_buffer_size;
>> +
>> +    bool ppi_enabled;
>>   } TPMState;
>>     #define TPM(obj) OBJECT_CHECK(TPMState, (obj), TYPE_TPM_TIS)
>> @@ -950,6 +952,7 @@ static const VMStateDescription vmstate_tpm_tis = {
>>   static Property tpm_tis_properties[] = {
>>       DEFINE_PROP_UINT32("irq", TPMState, irq_num, TPM_TIS_IRQ),
>>       DEFINE_PROP_TPMBE("tpmdev", TPMState, be_driver),
>> +    DEFINE_PROP_BOOL("ppi", TPMState, ppi_enabled, true),
>>       DEFINE_PROP_END_OF_LIST(),
>>   };
>>
>
>
>
>
diff mbox series

Patch

diff --git a/include/hw/compat.h b/include/hw/compat.h
index 563908b874..dac847548b 100644
--- a/include/hw/compat.h
+++ b/include/hw/compat.h
@@ -2,6 +2,16 @@ 
 #define HW_COMPAT_H
 
 #define HW_COMPAT_2_12 \
+    {\
+        .driver   = "tpm-crb",\
+        .property = "ppi",\
+        .value    = "false",\
+    },\
+    {\
+        .driver   = "tpm-tis",\
+        .property = "ppi",\
+        .value    = "false",\
+    },\
     {\
         .driver   = "migration",\
         .property = "decompress-error-check",\
diff --git a/hw/tpm/tpm_crb.c b/hw/tpm/tpm_crb.c
index a92dd50437..d5b0ac5920 100644
--- a/hw/tpm/tpm_crb.c
+++ b/hw/tpm/tpm_crb.c
@@ -41,6 +41,8 @@  typedef struct CRBState {
     MemoryRegion cmdmem;
 
     size_t be_buffer_size;
+
+    bool ppi_enabled;
 } CRBState;
 
 #define CRB(obj) OBJECT_CHECK(CRBState, (obj), TYPE_TPM_CRB)
@@ -221,6 +223,7 @@  static const VMStateDescription vmstate_tpm_crb = {
 
 static Property tpm_crb_properties[] = {
     DEFINE_PROP_TPMBE("tpmdev", CRBState, tpmbe),
+    DEFINE_PROP_BOOL("ppi", CRBState, ppi_enabled, true),
     DEFINE_PROP_END_OF_LIST(),
 };
 
diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
index 12f5c9a759..d9ddf9b723 100644
--- a/hw/tpm/tpm_tis.c
+++ b/hw/tpm/tpm_tis.c
@@ -81,6 +81,8 @@  typedef struct TPMState {
     TPMVersion be_tpm_version;
 
     size_t be_buffer_size;
+
+    bool ppi_enabled;
 } TPMState;
 
 #define TPM(obj) OBJECT_CHECK(TPMState, (obj), TYPE_TPM_TIS)
@@ -950,6 +952,7 @@  static const VMStateDescription vmstate_tpm_tis = {
 static Property tpm_tis_properties[] = {
     DEFINE_PROP_UINT32("irq", TPMState, irq_num, TPM_TIS_IRQ),
     DEFINE_PROP_TPMBE("tpmdev", TPMState, be_driver),
+    DEFINE_PROP_BOOL("ppi", TPMState, ppi_enabled, true),
     DEFINE_PROP_END_OF_LIST(),
 };