Merge tpm 2018/03/21 v1

-----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJaskm+AAoJEHWtZYAqC0IRrq0H/1K0DXpPlHPmQoSIgj1geQlr
 uoOjXaLAYNwEul9l94GsRdZXQfKMjcawZKyv2zAMpuhuAYcCab3NZ0S89m5POZnp
 fKzn8umAClaZyKP1ClmgpEkdH7x/8GFj2p7bcdPrL2PoTrY68pUAyacKGUf5O0AH
 Hc1ZTj1K5904c6tXHuxUMSWKH5N1LLqq6cXVYltDQsCMG7uPOpzrtYHQ2SUR6HzZ
 PpkBCUxZfiR0htXzuAc45rDiNIZerJ7wj6vGDB16dOfHrje9G4EqrzlA/p62S7LN
 nDiF3BtHg+C3IKIaJ9ya1EB60bY3c8nmUkNuJLGq6b9k7OTQFIGe+fcgQIFm550=
 =bAha
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/stefanberger/tags/pull-tpm-2018-03-21-1' into staging

Merge tpm 2018/03/21 v1

# gpg: Signature made Wed 21 Mar 2018 12:02:06 GMT
# gpg:                using RSA key 75AD65802A0B4211
# gpg: Good signature from "Stefan Berger <stefanb@linux.vnet.ibm.com>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: B818 B9CA DF90 89C2 D5CE  C66B 75AD 6580 2A0B 4211

* remotes/stefanberger/tags/pull-tpm-2018-03-21-1:
  tpm: CRB: query backend for TPM established flag
  tpm: CRB: reset locAssigned upon relinquishing locality
  tpm: CRB: set registers to 0 by default
  tpm: CRB: Set tpmRegValidSts flag to '1' in device reset

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2018-03-22 12:13:43 +00:00
commit b2ce07de4e

View File

@ -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;
@ -137,6 +143,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,
@ -145,8 +153,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 +216,10 @@ 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,
InterfaceType, CRB_INTF_TYPE_CRB_ACTIVE);
ARRAY_FIELD_DP32(s->regs, CRB_INTF_ID,