tpm: Fix initialization of a few flags of CRB interface
v2 cover tpm: Fix initialization of a few flags of CRB interface
Fix the initialization of a few flags of the CRB interface. I tested the changes with UEFI and it works fine. SeaBIOS needs to have the latest patches applied.
Stefan
Stefan Berger (4):
tpm: CRB: Set tpmRegValidSts flag to '1' in device reset
tpm: CRB: set registers to 0 by default
tpm: CRB: reset locAssigned upon relinquishing locality
tpm: CRB: query backend for TPM established flag
hw/tpm/tpm_crb.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
Signature · 1 line
2.5.5
PATCH v2 1/4 tpm: CRB: Set tpmRegValidSts flag to '1' in device reset
Fix the initialization of the tpmRegValidSts flag and set it to '1' during device reset without expecting a write to another register. This seems to also be the default behavior of real hardware.
--- hw/tpm/tpm_crb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/tpm/tpm_crb.c +2 -2
@@ -145,8 +145,6 @@ static void tpm_crb_mmio_write(void *opaque, hwaddr addr, beenSeized, 0);ARRAY_FIELD_DP32 (s->regs,CRB_LOC_STATE , locAssigned,1 ); -ARRAY_FIELD_DP32 (s->regs,CRB_LOC_STATE , - tpmRegValidSts,1 );break ; }break ;
@@ -210,6 +208,8 @@ static void tpm_crb_reset(void *dev)tpm_backend_reset (s->tpmbe); +ARRAY_FIELD_DP32 (s->regs,CRB_LOC_STATE , + tpmRegValidSts,1 );ARRAY_FIELD_DP32 (s->regs,CRB_INTF_ID , InterfaceType,CRB_INTF_TYPE_CRB_ACTIVE ); ARRAY_FIELD_DP32(s->regs, CRB_INTF_ID,
Signature · 1 line
2.5.5
PATCH v2 2/4 tpm: CRB: set registers to 0 by default
In reply to Stefan BergerInitialize all registers of the CRB device to 0. This clears a few flags upon a reset.
--- hw/tpm/tpm_crb.c | 2 ++ 1 file changed, 2 insertions(+)
hw/tpm/tpm_crb.c +2 -0
@@ -208,6 +208,8 @@ static void tpm_crb_reset(void *dev)tpm_backend_reset (s->tpmbe); +memset (s->regs,0 ,sizeof (s->regs)); +ARRAY_FIELD_DP32 (s->regs,CRB_LOC_STATE , tpmRegValidSts,1 ); ARRAY_FIELD_DP32(s->regs, CRB_INTF_ID,
Signature · 1 line
2.5.5
PATCH v2 3/4 tpm: CRB: reset locAssigned upon relinquishing locality
In reply to Stefan Berger--- hw/tpm/tpm_crb.c | 2 ++ 1 file changed, 2 insertions(+)
hw/tpm/tpm_crb.c +2 -0
@@ -137,6 +137,8 @@ static void tpm_crb_mmio_write(void *opaque, hwaddr addr,/* not loc 3 or 4 */ break ;case CRB_LOC_CTRL_RELINQUISH : +ARRAY_FIELD_DP32 (s->regs,CRB_LOC_STATE , + locAssigned,0 );break ;case CRB_LOC_CTRL_REQUEST_ACCESS : ARRAY_FIELD_DP32(s->regs, CRB_LOC_STS,
Signature · 1 line
2.5.5
PATCH v2 4/4 tpm: CRB: query backend for TPM established flag
In reply to Stefan Berger--- hw/tpm/tpm_crb.c | 6 ++++++ 1 file changed, 6 insertions(+)
hw/tpm/tpm_crb.c +6 -0
@@ -84,6 +84,12 @@ static uint64_t tpm_crb_mmio_read(void *opaque, hwaddr addr,unsigned offset = addr &3 ;uint32_t val = *(uint32_t *)regs >> (8 * offset); +switch (addr) { +case A_CRB_LOC_STATE : + val |= !tpm_backend_get_tpm_established_flag (s->tpmbe); +break ; + } +trace_tpm_crb_mmio_read (addr, size, val);return val;
Signature · 1 line
2.5.5
Hi
Quoted 5 lines · Stefan Berger
Fix the initialization of a few flags of the CRB interface. I tested the changes with UEFI and it works fine. SeaBIOS needs to have the latest patches applied.
Stefan
Quoted 8 lines
Stefan Berger (4):
tpm: CRB: Set tpmRegValidSts flag to '1' in device reset
tpm: CRB: set registers to 0 by default
tpm: CRB: reset locAssigned upon relinquishing locality
tpm: CRB: query backend for TPM established flaghw/tpm/tpm_crb.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
Series:
For 2.12?
thanks
Signature · 1 line
Marc-André Lureau
Quoted 15 lines · Marc-André Lureau
Hi
Quoted 11 lines · Stefan Berger
Fix the initialization of a few flags of the CRB interface. I tested the changes with UEFI and it works fine. SeaBIOS needs to have the latest patches applied.
Stefan
Stefan Berger (4):
tpm: CRB: Set tpmRegValidSts flag to '1' in device reset
tpm: CRB: set registers to 0 by default
tpm: CRB: reset locAssigned upon relinquishing locality
tpm: CRB: query backend for TPM established flag
Quoted 6 lines
Quoted 2 lines
hw/tpm/tpm_crb.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)Series:
Reviewed-by Marc-André Lureau <[email protected]>For 2.12?
Ideally, yes.
Quoted 3 lines
thanks