diff mbox

[2/4] tpm: CRB: Reset Granted flag when relinquishing locality

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

Commit Message

Stefan Berger March 28, 2018, 8:59 p.m. UTC
Reset the Granted flag when relinquishing a locality.

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

Comments

Marc-André Lureau March 29, 2018, 10:43 a.m. UTC | #1
On Wed, Mar 28, 2018 at 10:59 PM, Stefan Berger
<stefanb@linux.vnet.ibm.com> wrote:
> Reset the Granted flag when relinquishing a locality.
>
> Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>

Makes sense. I tried to avoid looking at locality management so far,
but I guess a minimum is necessary. I suppose no locality will be
granted in this case after relinquish, until a new request. But the
spec says: "If two localities have requested use of the TPMwhen
the current locality relinquishes it, the locality with the highest
priority getsaccess to the TPM." Probably that doesn't make sense with
only loc 0, as you can't request, then relinquish, and expect it to be
granted immediately after.

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


> ---
>  hw/tpm/tpm_crb.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/hw/tpm/tpm_crb.c b/hw/tpm/tpm_crb.c
> index e728b55..ee6c87e 100644
> --- a/hw/tpm/tpm_crb.c
> +++ b/hw/tpm/tpm_crb.c
> @@ -145,6 +145,8 @@ static void tpm_crb_mmio_write(void *opaque, hwaddr addr,
>          case CRB_LOC_CTRL_RELINQUISH:
>              ARRAY_FIELD_DP32(s->regs, CRB_LOC_STATE,
>                               locAssigned, 0);
> +            ARRAY_FIELD_DP32(s->regs, CRB_LOC_STS,
> +                             Granted, 0);
>              break;
>          case CRB_LOC_CTRL_REQUEST_ACCESS:
>              ARRAY_FIELD_DP32(s->regs, CRB_LOC_STS,
> --
> 2.5.5
>
>
diff mbox

Patch

diff --git a/hw/tpm/tpm_crb.c b/hw/tpm/tpm_crb.c
index e728b55..ee6c87e 100644
--- a/hw/tpm/tpm_crb.c
+++ b/hw/tpm/tpm_crb.c
@@ -145,6 +145,8 @@  static void tpm_crb_mmio_write(void *opaque, hwaddr addr,
         case CRB_LOC_CTRL_RELINQUISH:
             ARRAY_FIELD_DP32(s->regs, CRB_LOC_STATE,
                              locAssigned, 0);
+            ARRAY_FIELD_DP32(s->regs, CRB_LOC_STS,
+                             Granted, 0);
             break;
         case CRB_LOC_CTRL_REQUEST_ACCESS:
             ARRAY_FIELD_DP32(s->regs, CRB_LOC_STS,