diff mbox

[1/2] tpm_tis: Return TPM_VERSION_UNSPEC in case of BE failure

Message ID 1510371554-29833-2-git-send-email-stefanb@linux.vnet.ibm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Stefan Berger Nov. 11, 2017, 3:39 a.m. UTC
In case the backend has a failure, such as the tpm_emulator's CMD_INIT
failing, the TIS goes into failure mode and does not respond to reads
or writes to MMIO registers. In this case we need to prevent the ACPI
table from being added and the straight-forward way is to indicate that
there's no known TPM version being used.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
---
 hw/tpm/tpm_tis.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Marc-André Lureau Dec. 13, 2017, 10:23 a.m. UTC | #1
On Sat, Nov 11, 2017 at 4:39 AM, Stefan Berger
<stefanb@linux.vnet.ibm.com> wrote:
> In case the backend has a failure, such as the tpm_emulator's CMD_INIT
> failing, the TIS goes into failure mode and does not respond to reads
> or writes to MMIO registers. In this case we need to prevent the ACPI
> table from being added and the straight-forward way is to indicate that
> there's no known TPM version being used.
>
> Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


> ---
>  hw/tpm/tpm_tis.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
> index c0a0204..eca3374 100644
> --- a/hw/tpm/tpm_tis.c
> +++ b/hw/tpm/tpm_tis.c
> @@ -970,6 +970,10 @@ static enum TPMVersion tpm_tis_get_tpm_version(TPMIf *ti)
>  {
>      TPMState *s = TPM(ti);
>
> +    if (tpm_backend_had_startup_error(s->be_driver)) {
> +        return TPM_VERSION_UNSPEC;
> +    }
> +
>      return tpm_backend_get_tpm_version(s->be_driver);
>  }
>
> --
> 2.5.5
>
>
Stefan Berger Dec. 13, 2017, 11:54 a.m. UTC | #2
On 12/13/2017 05:23 AM, Marc-André Lureau wrote:
> On Sat, Nov 11, 2017 at 4:39 AM, Stefan Berger
> <stefanb@linux.vnet.ibm.com> wrote:
>> In case the backend has a failure, such as the tpm_emulator's CMD_INIT
>> failing, the TIS goes into failure mode and does not respond to reads
>> or writes to MMIO registers. In this case we need to prevent the ACPI
>> table from being added and the straight-forward way is to indicate that
>> there's no known TPM version being used.
>>
>> Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

Resending an old response?

https://patchwork.kernel.org/patch/10058405/

>
>
>> ---
>>   hw/tpm/tpm_tis.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
>> index c0a0204..eca3374 100644
>> --- a/hw/tpm/tpm_tis.c
>> +++ b/hw/tpm/tpm_tis.c
>> @@ -970,6 +970,10 @@ static enum TPMVersion tpm_tis_get_tpm_version(TPMIf *ti)
>>   {
>>       TPMState *s = TPM(ti);
>>
>> +    if (tpm_backend_had_startup_error(s->be_driver)) {
>> +        return TPM_VERSION_UNSPEC;
>> +    }
>> +
>>       return tpm_backend_get_tpm_version(s->be_driver);
>>   }
>>
>> --
>> 2.5.5
>>
>>
>
>
diff mbox

Patch

diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
index c0a0204..eca3374 100644
--- a/hw/tpm/tpm_tis.c
+++ b/hw/tpm/tpm_tis.c
@@ -970,6 +970,10 @@  static enum TPMVersion tpm_tis_get_tpm_version(TPMIf *ti)
 {
     TPMState *s = TPM(ti);
 
+    if (tpm_backend_had_startup_error(s->be_driver)) {
+        return TPM_VERSION_UNSPEC;
+    }
+
     return tpm_backend_get_tpm_version(s->be_driver);
 }