linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael Niewöhner" <linux@mniewoehner.de>
To: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Cc: Mimi Zohar <zohar@linux.ibm.com>,
	James Bottomley <James.Bottomley@HansenPartnership.com>,
	peterhuewe@gmx.de, jgg@ziepe.ca, arnd@arndb.de,
	linux-integrity@vger.kernel.org,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Nayna Jain <nayna@linux.ibm.com>
Subject: Re: [BUG] Nuvoton NCPT650 TPM 2.0 mode not working
Date: Sun, 18 Nov 2018 15:10:06 +0100	[thread overview]
Message-ID: <467833cc47247a55595d72426f46eeac1406eb04.camel@mniewoehner.de> (raw)
In-Reply-To: <20181118081833.GH5897@linux.intel.com>

On Sun, 2018-11-18 at 10:18 +0200, Jarkko Sakkinen wrote:
> On Fri, Nov 16, 2018 at 10:06:28PM +0100, Michael Niewöhner wrote:
> > On Wed, 2018-11-14 at 21:46 +0100, Michael Niewöhner wrote:
> > > Hi all,
> > > 
> > > I tried that patch mentioned by Mimi but it does not change anything for
> > > me.
> > > 
> > > Then I did some more tests with different kernel configs and finally got
> > > TPM
> > > working by
> > > a) compiling TPM as modules and rmmod tpm* and re-modprobe tpm_tis.
> > > 
> > > (initramfs) dmesg | grep -i tpm
> > > [    0.000000] efi:  ACPI 2.0=0x9ea7e000 ACPI=0x9ea7e000 SMBIOS=0x9f5eb000
> > > SMBIOS 3.0=0x9f5ea000 ESRT=0x9c07d918 MEMATTR=0x9bea3018
> > > TPMEventLog=0x97cbb018
> > > [    0.003793] ACPI: TPM2 0x000000009EAB7F70 000034 (v03 LENOVO TC-
> > > S06   00001260 AMI 00000000)
> > > (initramfs) rmmod tpm_crb tpm_tis tpm_tis_core tpm
> > > (initramfs) modprobe tpm_tis
> > > [   44.956905] tpm_tis MSFT0101:00: 2.0 TPM (device-id 0xFE, rev-id 2)
> > > 
> > > b) compiling TPM-support in-kernel and manually bind the ACPI device
> > > 
> > > (initramfs) dmesg | grep -i tpm
> > > [    0.000000] efi: ACPI 2.0=0x9ea7e000 ACPI=0x9ea7e000 SMBIOS=0x9f5eb000
> > > SMBIOS
> > > 3.0=0x9f5ea000 ESRT=0x9c07d918 MEMATTR=0x9bea3018 TPMEventLog=0x97cbb018
> > > [    0.003546] ACPI: TPM2 0x000000009EAB7F70 000034 (v03 LENOVO TC-S06
> > > 00001260
> > > AMI 00000000)
> > > (initramfs) echo MSFT0101:00 >/sys/bus/platform/drivers/tpm_tis/bind
> > > [  233.076079] tpm_tis MSFT0101:00: 2.0 TPM (device-id 0xFE, rev-id 2)
> > > 
> > > 
> > > It seems to me, the kernel tries to enable the TPM to early...
> > > 
> > > 
> > > Michael
> > 
> > Looks like the manual driver bind works more or less but e.g reading hwrng
> > does
> > not work...
> > 
> > # echo MSFT0101:00 >/sys/bus/platform/drivers/tpm_tis/bind
> > [  148.293302] tpm_tis MSFT0101:00: 2.0 TPM (device-id 0xFE, rev-id 2)
> > # cat /sys/devices/virtual/misc/hw_random/rng_current
> > tpm-rng-0
> > # cat /dev/hwrng >/dev/null 
> > cat: /dev/hwrng: Operation not permitted
> 
> Can you check with trace-cmd start -p function -l 'tpm*'?
> 
> /Jarkko


Hi Jarko,

what output do you need exactly?

root@debian:~# trace-cmd record -p function -l 'tpm*'
  plugin 'function'
Hit Ctrl^C to stop recording
^CCPU0 data recorded at offset=0x464000
    0 bytes in size
CPU1 data recorded at offset=0x464000
    0 bytes in size
CPU2 data recorded at offset=0x464000
    0 bytes in size
CPU3 data recorded at offset=0x464000
    4096 bytes in size
CPU4 data recorded at offset=0x465000
    4096 bytes in size
CPU5 data recorded at offset=0x466000
    0 bytes in size
CPU6 data recorded at offset=0x466000
    0 bytes in size
CPU7 data recorded at offset=0x466000
    0 bytes in size
root@debian:~# trace-cmd report
CPU 0 is empty
CPU 1 is empty
CPU 2 is empty
CPU 5 is empty
CPU 6 is empty
CPU 7 is empty
cpus=8
             cat-3324  [003]   265.547715: function:             tpm_hwrng_read
             cat-3324  [003]   265.547721: function:             tpm_get_random
             cat-3324  [003]   265.547721:
function:                tpm_find_get_ops
             cat-3324  [003]   265.547721:
function:                   tpm_try_get_ops
             cat-3324  [003]   265.547721:
function:                tpm2_get_random
             cat-3324  [003]   265.547722:
function:                   tpm_transmit_cmd
             cat-3324  [003]   265.547722:
function:                      tpm_transmit
             cat-3324  [003]   265.547722:
function:                         tpm_tis_clkrun_enable
             cat-3324  [003]   265.547723:
function:             tpm_tcg_read_bytes

< snip ... many times the same lines: cat-3324 ... function: tpm_tcg_read_bytes
>

             cat-3324  [004]   266.291087:
function:             tpm_tcg_read_bytes
             cat-3324  [004]   266.296347:
function:             tpm_tis_clkrun_enable
             cat-3324  [004]   266.296349: function:             tpm_put_ops

Michael



  reply	other threads:[~2018-11-18 14:10 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-11 17:55 [BUG] Nuvoton NCPT650 TPM 2.0 mode not working Michael Niewöhner
2018-11-11 18:24 ` James Bottomley
2018-11-11 18:50   ` Michael Niewöhner
2018-11-11 18:57     ` James Bottomley
2018-11-11 20:09       ` Michael Niewöhner
2018-11-11 20:29         ` James Bottomley
2018-11-11 20:34           ` Michael Niewöhner
2018-11-11 21:11             ` Michael Niewöhner
2018-11-11 21:42               ` Mimi Zohar
2018-11-14 20:46                 ` Michael Niewöhner
2018-11-16 21:06                   ` Michael Niewöhner
2018-11-18  8:18                     ` Jarkko Sakkinen
2018-11-18 14:10                       ` Michael Niewöhner [this message]
2018-11-19 13:49                         ` Jarkko Sakkinen
2018-11-25 20:06                           ` Michael Niewöhner
2018-11-26 19:15                             ` Michael Niewöhner
2018-11-26 21:13                               ` Jarkko Sakkinen
2018-11-13 10:50               ` Jarkko Sakkinen
2019-01-11 15:40     ` Mimi Zohar
2019-01-12  9:52       ` Michael Niewöhner
2019-01-12 10:49         ` Michael Niewöhner
2018-11-11 18:33 ` Mimi Zohar
2018-11-11 18:51   ` Michael Niewöhner
2018-11-13 10:28 ` Jarkko Sakkinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=467833cc47247a55595d72426f46eeac1406eb04.camel@mniewoehner.de \
    --to=linux@mniewoehner.de \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=arnd@arndb.de \
    --cc=jarkko.sakkinen@linux.intel.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nayna@linux.ibm.com \
    --cc=peterhuewe@gmx.de \
    --cc=zohar@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).