All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libacpi: Widen TPM detection
@ 2020-06-11  3:55 Jason Andryuk
  2020-06-11 11:52 ` Andrew Cooper
  0 siblings, 1 reply; 3+ messages in thread
From: Jason Andryuk @ 2020-06-11  3:55 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson, Wei Liu, Jan Beulich, Jason Andryuk

The hardcoded tpm_signature is too restrictive to detect many TPMs.  For
instance, it doesn't accept a QEMU emulated TPM (VID 0x1014 DID 0x0001).
Make the TPM detection match that in rombios which accepts a wider
range.

With this change, the TPM's TCPA ACPI table is generated and the guest
OS can automatically load the tpm_tis driver.  It also allows seabios to
detect and use the TPM.  However, seabios skips some TPM initialization
when running under Xen, so it will not populate any PCRs unless modified
to run the initialization under Xen.

Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
---
 tools/libacpi/build.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tools/libacpi/build.c b/tools/libacpi/build.c
index fa7d14e090..a61dd5583a 100644
--- a/tools/libacpi/build.c
+++ b/tools/libacpi/build.c
@@ -351,7 +351,6 @@ static int construct_secondary_tables(struct acpi_ctxt *ctxt,
     struct acpi_20_waet *waet;
     struct acpi_20_tcpa *tcpa;
     unsigned char *ssdt;
-    static const uint16_t tis_signature[] = {0x0001, 0x0001, 0x0001};
     void *lasa;
 
     /* MADT. */
@@ -413,9 +412,8 @@ static int construct_secondary_tables(struct acpi_ctxt *ctxt,
 
     /* TPM TCPA and SSDT. */
     if ( (config->table_flags & ACPI_HAS_TCPA) &&
-         (config->tis_hdr[0] == tis_signature[0]) &&
-         (config->tis_hdr[1] == tis_signature[1]) &&
-         (config->tis_hdr[2] == tis_signature[2]) )
+         (config->tis_hdr[0] != 0 && config->tis_hdr[0] != 0xffff) &&
+         (config->tis_hdr[1] != 0 && config->tis_hdr[1] != 0xffff) )
     {
         ssdt = ctxt->mem_ops.alloc(ctxt, sizeof(ssdt_tpm), 16);
         if (!ssdt) return -1;
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] libacpi: Widen TPM detection
  2020-06-11  3:55 [PATCH] libacpi: Widen TPM detection Jason Andryuk
@ 2020-06-11 11:52 ` Andrew Cooper
  2020-06-11 12:07   ` Paul Durrant
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cooper @ 2020-06-11 11:52 UTC (permalink / raw)
  To: Jason Andryuk, xen-devel; +Cc: Ian Jackson, Jan Beulich, Wei Liu, Paul Durrant

On 11/06/2020 04:55, Jason Andryuk wrote:
> The hardcoded tpm_signature is too restrictive to detect many TPMs.  For
> instance, it doesn't accept a QEMU emulated TPM (VID 0x1014 DID 0x0001).
> Make the TPM detection match that in rombios which accepts a wider
> range.
>
> With this change, the TPM's TCPA ACPI table is generated and the guest
> OS can automatically load the tpm_tis driver.  It also allows seabios to
> detect and use the TPM.  However, seabios skips some TPM initialization
> when running under Xen, so it will not populate any PCRs unless modified
> to run the initialization under Xen.
>
> Signed-off-by: Jason Andryuk <jandryuk@gmail.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

This looks like it wants backporting, so CC'ing Paul for a 4.14 release ack.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] libacpi: Widen TPM detection
  2020-06-11 11:52 ` Andrew Cooper
@ 2020-06-11 12:07   ` Paul Durrant
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Durrant @ 2020-06-11 12:07 UTC (permalink / raw)
  To: 'Andrew Cooper', 'Jason Andryuk', xen-devel
  Cc: 'Ian Jackson', 'Jan Beulich', 'Wei Liu'

> -----Original Message-----
> From: Andrew Cooper <andrew.cooper3@citrix.com>
> Sent: 11 June 2020 12:52
> To: Jason Andryuk <jandryuk@gmail.com>; xen-devel@lists.xenproject.org
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>; Wei Liu <wl@xen.org>; Jan Beulich <jbeulich@suse.com>;
> Paul Durrant <paul@xen.org>
> Subject: Re: [PATCH] libacpi: Widen TPM detection
> 
> On 11/06/2020 04:55, Jason Andryuk wrote:
> > The hardcoded tpm_signature is too restrictive to detect many TPMs.  For
> > instance, it doesn't accept a QEMU emulated TPM (VID 0x1014 DID 0x0001).
> > Make the TPM detection match that in rombios which accepts a wider
> > range.
> >
> > With this change, the TPM's TCPA ACPI table is generated and the guest
> > OS can automatically load the tpm_tis driver.  It also allows seabios to
> > detect and use the TPM.  However, seabios skips some TPM initialization
> > when running under Xen, so it will not populate any PCRs unless modified
> > to run the initialization under Xen.
> >
> > Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
> 
> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
> 
> This looks like it wants backporting, so CC'ing Paul for a 4.14 release ack.

Agreed.

Release-acked-by: Paul Durrant <paul@xen.org>



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-06-11 12:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-11  3:55 [PATCH] libacpi: Widen TPM detection Jason Andryuk
2020-06-11 11:52 ` Andrew Cooper
2020-06-11 12:07   ` Paul Durrant

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.