All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: "Peter Hüwe" <PeterHuewe@gmx.de>
Cc: Ashley Lai <ashley@ashleylai.com>,
	Marcel Selhorst <tpmdd@selhorst.net>,
	tpmdd-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org,
	josh.triplett@intel.com, christophe.ricard@gmail.com,
	jason.gunthorpe@obsidianresearch.com, linux-api@vger.kernel.org,
	trousers-tech@lists.sourceforge.net,
	Will Arthur <will.c.arthur@intel.com>
Subject: Re: [PATCH v9 6/8] tpm: TPM 2.0 baseline support
Date: Fri, 5 Dec 2014 16:13:03 +0200	[thread overview]
Message-ID: <20141205141303.GF6993@intel.com> (raw)
In-Reply-To: <201412050017.40668.PeterHuewe@gmx.de>

Hey

is it cool if I prepare a separate set of fixes for all issues
in v9? I do not see any problem that could not be fixed without
major structural changes.

/Jarkko

On Fri, Dec 05, 2014 at 12:17:40AM +0100, Peter Hüwe wrote:
> Am Donnerstag, 4. Dezember 2014, 06:55:16 schrieb Jarkko Sakkinen:
> > TPM 2.0 devices are separated by adding a field 'flags' to struct
> > tpm_chip and defining a flag TPM_CHIP_FLAG_TPM2 for tagging them.
> > 
> > This patch adds the following internal functions:
> > 
> > - tpm2_get_random()
> > - tpm2_get_tpm_pt()
> > - tpm2_pcr_extend()
> > - tpm2_pcr_read()
> > - tpm2_startup()
> > 
> > Additionally, the following exported functions are implemented for
> > implementing TPM 2.0 device drivers:
> > 
> > - tpm2_do_selftest()
> > - tpm2_calc_ordinal_durations()
> > - tpm2_gen_interrupt()
> > 
> > The existing functions that are exported for the use for existing
> > subsystems have been changed to check the flags field in struct
> > tpm_chip and use appropriate TPM 2.0 counterpart if
> > TPM_CHIP_FLAG_TPM2 is est.
> > 
> > The code for tpm2_calc_ordinal_duration() and tpm2_startup() were
> > originally written by Will Arthur.
> > 
> > Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> > Signed-off-by: Will Arthur <will.c.arthur@intel.com>
> > ---
> >  drivers/char/tpm/Makefile        |   2 +-
> >  drivers/char/tpm/tpm-chip.c      |  27 +-
> >  drivers/char/tpm/tpm-interface.c |  24 +-
> >  drivers/char/tpm/tpm.h           |  61 +++++
> >  drivers/char/tpm/tpm2-cmd.c      | 542
> > +++++++++++++++++++++++++++++++++++++++ 5 files changed, 641
> > insertions(+), 15 deletions(-)
> >  create mode 100644 drivers/char/tpm/tpm2-cmd.c
> > 
> > diff --git a/drivers/char/tpm/Makefile b/drivers/char/tpm/Makefile
> > index c715596..88848ed 100644
> > --- a/drivers/char/tpm/Makefile
> > +++ b/drivers/char/tpm/Makefile
> > @@ -2,7 +2,7 @@
> >  # Makefile for the kernel tpm device drivers.
> >  #
> >  obj-$(CONFIG_TCG_TPM) += tpm.o
> > -tpm-y := tpm-interface.o tpm-dev.o tpm-sysfs.o tpm-chip.o
> > +tpm-y := tpm-interface.o tpm-dev.o tpm-sysfs.o tpm-chip.o tpm2-cmd.o
> >  tpm-$(CONFIG_ACPI) += tpm_ppi.o
> > 
> >  ifdef CONFIG_ACPI
> > diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c
> > index 7741e28..3f3f2de 100644
> > --- a/drivers/char/tpm/tpm-chip.c
> > +++ b/drivers/char/tpm/tpm-chip.c
> > @@ -195,15 +195,18 @@ int tpm_chip_register(struct tpm_chip *chip)
> >  	if (rc)
> >  		return rc;
> > 
> > -	rc = tpm_sysfs_add_device(chip);
> > -	if (rc)
> > -		goto del_misc;
> > +	/* Populate sysfs for TPM1 devices. */
> > +	if (!(chip->flags & TPM_CHIP_FLAG_TPM2)) {
> > +		rc = tpm_sysfs_add_device(chip);
> > +		if (rc)
> > +			goto del_misc;
> > 
> > -	rc = tpm_add_ppi(chip);
> > -	if (rc)
> > -		goto del_sysfs;
> > +		rc = tpm_add_ppi(chip);
> > +		if (rc)
> > +			goto del_sysfs;
> > 
> > -	chip->bios_dir = tpm_bios_log_setup(chip->devname);
> > +		chip->bios_dir = tpm_bios_log_setup(chip->devname);
> > +	}
> > 
> >  	/* Make the chip available. */
> >  	spin_lock(&driver_lock);
> > @@ -236,10 +239,12 @@ void tpm_chip_unregister(struct tpm_chip *chip)
> >  	spin_unlock(&driver_lock);
> >  	synchronize_rcu();
> > 
> > -	if (chip->bios_dir)
> > -		tpm_bios_log_teardown(chip->bios_dir);
> > -	tpm_remove_ppi(chip);
> > -	tpm_sysfs_del_device(chip);
> > +	if (!(chip->flags & TPM_CHIP_FLAG_TPM2)) {
> > +		if (chip->bios_dir)
> > +			tpm_bios_log_teardown(chip->bios_dir);
> > +		tpm_remove_ppi(chip);
> > +		tpm_sysfs_del_device(chip);
> > +	}
> > 
> >  	tpm_dev_del_device(chip);
> >  }
> > diff --git a/drivers/char/tpm/tpm-interface.c
> > b/drivers/char/tpm/tpm-interface.c index b6f6b17..8a14887 100644
> > --- a/drivers/char/tpm/tpm-interface.c
> > +++ b/drivers/char/tpm/tpm-interface.c
> > @@ -360,7 +360,10 @@ ssize_t tpm_transmit(struct tpm_chip *chip, const char
> > *buf, if (chip->vendor.irq)
> >  		goto out_recv;
> > 
> > -	stop = jiffies + tpm_calc_ordinal_duration(chip, ordinal);
> > +	if (chip->flags & TPM_CHIP_FLAG_TPM2)
> > +		stop = jiffies + tpm2_calc_ordinal_duration(chip, ordinal);
> > +	else
> > +		stop = jiffies + tpm_calc_ordinal_duration(chip, ordinal);
> >  	do {
> >  		u8 status = chip->ops->status(chip);
> >  		if ((status & chip->ops->req_complete_mask) ==
> > @@ -483,7 +486,7 @@ static const struct tpm_input_header tpm_startup_header
> > = { static int tpm_startup(struct tpm_chip *chip, __be16 startup_type) {
> >  	struct tpm_cmd_t start_cmd;
> > -	start_cmd.header.in = tpm_startup_header;
> > +
> WHY?!? This renders tpm_startup useless.
> 
> So NACK for this part.
> >  	start_cmd.params.startup_in.startup_type = startup_type;
> >  	return tpm_transmit_cmd(chip, &start_cmd, TPM_INTERNAL_RESULT_SIZE,
> >  				"attempting to start the TPM");
> 
> I'll get you an TPM1.2 :)
> 
> Thanks
> Peter

WARNING: multiple messages have this Message-ID (diff)
From: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: "Peter Hüwe" <PeterHuewe-Mmb7MZpHnFY@public.gmane.org>
Cc: Ashley Lai <ashley-fm2HMyfA2y6tG0bUXCXiUA@public.gmane.org>,
	Marcel Selhorst <tpmdd-yWjUBOtONefk1uMJSBkQmQ@public.gmane.org>,
	tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	josh.triplett-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	christophe.ricard-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	jason.gunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org,
	linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	trousers-tech-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	Will Arthur
	<will.c.arthur-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH v9 6/8] tpm: TPM 2.0 baseline support
Date: Fri, 5 Dec 2014 16:13:03 +0200	[thread overview]
Message-ID: <20141205141303.GF6993@intel.com> (raw)
In-Reply-To: <201412050017.40668.PeterHuewe-Mmb7MZpHnFY@public.gmane.org>

Hey

is it cool if I prepare a separate set of fixes for all issues
in v9? I do not see any problem that could not be fixed without
major structural changes.

/Jarkko

On Fri, Dec 05, 2014 at 12:17:40AM +0100, Peter Hüwe wrote:
> Am Donnerstag, 4. Dezember 2014, 06:55:16 schrieb Jarkko Sakkinen:
> > TPM 2.0 devices are separated by adding a field 'flags' to struct
> > tpm_chip and defining a flag TPM_CHIP_FLAG_TPM2 for tagging them.
> > 
> > This patch adds the following internal functions:
> > 
> > - tpm2_get_random()
> > - tpm2_get_tpm_pt()
> > - tpm2_pcr_extend()
> > - tpm2_pcr_read()
> > - tpm2_startup()
> > 
> > Additionally, the following exported functions are implemented for
> > implementing TPM 2.0 device drivers:
> > 
> > - tpm2_do_selftest()
> > - tpm2_calc_ordinal_durations()
> > - tpm2_gen_interrupt()
> > 
> > The existing functions that are exported for the use for existing
> > subsystems have been changed to check the flags field in struct
> > tpm_chip and use appropriate TPM 2.0 counterpart if
> > TPM_CHIP_FLAG_TPM2 is est.
> > 
> > The code for tpm2_calc_ordinal_duration() and tpm2_startup() were
> > originally written by Will Arthur.
> > 
> > Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> > Signed-off-by: Will Arthur <will.c.arthur-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> > ---
> >  drivers/char/tpm/Makefile        |   2 +-
> >  drivers/char/tpm/tpm-chip.c      |  27 +-
> >  drivers/char/tpm/tpm-interface.c |  24 +-
> >  drivers/char/tpm/tpm.h           |  61 +++++
> >  drivers/char/tpm/tpm2-cmd.c      | 542
> > +++++++++++++++++++++++++++++++++++++++ 5 files changed, 641
> > insertions(+), 15 deletions(-)
> >  create mode 100644 drivers/char/tpm/tpm2-cmd.c
> > 
> > diff --git a/drivers/char/tpm/Makefile b/drivers/char/tpm/Makefile
> > index c715596..88848ed 100644
> > --- a/drivers/char/tpm/Makefile
> > +++ b/drivers/char/tpm/Makefile
> > @@ -2,7 +2,7 @@
> >  # Makefile for the kernel tpm device drivers.
> >  #
> >  obj-$(CONFIG_TCG_TPM) += tpm.o
> > -tpm-y := tpm-interface.o tpm-dev.o tpm-sysfs.o tpm-chip.o
> > +tpm-y := tpm-interface.o tpm-dev.o tpm-sysfs.o tpm-chip.o tpm2-cmd.o
> >  tpm-$(CONFIG_ACPI) += tpm_ppi.o
> > 
> >  ifdef CONFIG_ACPI
> > diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c
> > index 7741e28..3f3f2de 100644
> > --- a/drivers/char/tpm/tpm-chip.c
> > +++ b/drivers/char/tpm/tpm-chip.c
> > @@ -195,15 +195,18 @@ int tpm_chip_register(struct tpm_chip *chip)
> >  	if (rc)
> >  		return rc;
> > 
> > -	rc = tpm_sysfs_add_device(chip);
> > -	if (rc)
> > -		goto del_misc;
> > +	/* Populate sysfs for TPM1 devices. */
> > +	if (!(chip->flags & TPM_CHIP_FLAG_TPM2)) {
> > +		rc = tpm_sysfs_add_device(chip);
> > +		if (rc)
> > +			goto del_misc;
> > 
> > -	rc = tpm_add_ppi(chip);
> > -	if (rc)
> > -		goto del_sysfs;
> > +		rc = tpm_add_ppi(chip);
> > +		if (rc)
> > +			goto del_sysfs;
> > 
> > -	chip->bios_dir = tpm_bios_log_setup(chip->devname);
> > +		chip->bios_dir = tpm_bios_log_setup(chip->devname);
> > +	}
> > 
> >  	/* Make the chip available. */
> >  	spin_lock(&driver_lock);
> > @@ -236,10 +239,12 @@ void tpm_chip_unregister(struct tpm_chip *chip)
> >  	spin_unlock(&driver_lock);
> >  	synchronize_rcu();
> > 
> > -	if (chip->bios_dir)
> > -		tpm_bios_log_teardown(chip->bios_dir);
> > -	tpm_remove_ppi(chip);
> > -	tpm_sysfs_del_device(chip);
> > +	if (!(chip->flags & TPM_CHIP_FLAG_TPM2)) {
> > +		if (chip->bios_dir)
> > +			tpm_bios_log_teardown(chip->bios_dir);
> > +		tpm_remove_ppi(chip);
> > +		tpm_sysfs_del_device(chip);
> > +	}
> > 
> >  	tpm_dev_del_device(chip);
> >  }
> > diff --git a/drivers/char/tpm/tpm-interface.c
> > b/drivers/char/tpm/tpm-interface.c index b6f6b17..8a14887 100644
> > --- a/drivers/char/tpm/tpm-interface.c
> > +++ b/drivers/char/tpm/tpm-interface.c
> > @@ -360,7 +360,10 @@ ssize_t tpm_transmit(struct tpm_chip *chip, const char
> > *buf, if (chip->vendor.irq)
> >  		goto out_recv;
> > 
> > -	stop = jiffies + tpm_calc_ordinal_duration(chip, ordinal);
> > +	if (chip->flags & TPM_CHIP_FLAG_TPM2)
> > +		stop = jiffies + tpm2_calc_ordinal_duration(chip, ordinal);
> > +	else
> > +		stop = jiffies + tpm_calc_ordinal_duration(chip, ordinal);
> >  	do {
> >  		u8 status = chip->ops->status(chip);
> >  		if ((status & chip->ops->req_complete_mask) ==
> > @@ -483,7 +486,7 @@ static const struct tpm_input_header tpm_startup_header
> > = { static int tpm_startup(struct tpm_chip *chip, __be16 startup_type) {
> >  	struct tpm_cmd_t start_cmd;
> > -	start_cmd.header.in = tpm_startup_header;
> > +
> WHY?!? This renders tpm_startup useless.
> 
> So NACK for this part.
> >  	start_cmd.params.startup_in.startup_type = startup_type;
> >  	return tpm_transmit_cmd(chip, &start_cmd, TPM_INTERNAL_RESULT_SIZE,
> >  				"attempting to start the TPM");
> 
> I'll get you an TPM1.2 :)
> 
> Thanks
> Peter

  reply	other threads:[~2014-12-05 14:14 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-04  5:55 [PATCH v9 0/8] TPM 2.0 support Jarkko Sakkinen
2014-12-04  5:55 ` Jarkko Sakkinen
2014-12-04  5:55 ` [PATCH v9 1/8] tpm: merge duplicate transmit_cmd() functions Jarkko Sakkinen
2014-12-04  5:55 ` [PATCH v9 2/8] tpm: two-phase chip management functions Jarkko Sakkinen
2014-12-04  5:55 ` [PATCH v9 3/8] tpm: fix raciness of PPI interface lookup Jarkko Sakkinen
2014-12-04 20:34   ` Peter Hüwe
2014-12-04 20:34     ` Peter Hüwe
2014-12-04  5:55 ` [PATCH v9 4/8] tpm: rename chip->dev to chip->pdev Jarkko Sakkinen
2014-12-04  5:55   ` Jarkko Sakkinen
2014-12-04 20:49   ` Peter Hüwe
2014-12-04 20:49     ` Peter Hüwe
2014-12-04  5:55 ` [PATCH v9 5/8] tpm: device class for tpm Jarkko Sakkinen
2014-12-04  5:55 ` [PATCH v9 6/8] tpm: TPM 2.0 baseline support Jarkko Sakkinen
2014-12-04 23:17   ` Peter Hüwe
2014-12-04 23:17     ` Peter Hüwe
2014-12-05 14:13     ` Jarkko Sakkinen [this message]
2014-12-05 14:13       ` Jarkko Sakkinen
2014-12-05 14:35       ` Aw: " Peter Huewe
2014-12-05 14:35         ` Peter Huewe
2014-12-06 11:54         ` Jarkko Sakkinen
2014-12-06 11:54           ` Jarkko Sakkinen
2014-12-04  5:55 ` [PATCH v9 7/8] tpm: TPM 2.0 CRB Interface Jarkko Sakkinen
2014-12-04 20:19   ` Peter Hüwe
2014-12-05 13:10     ` Jarkko Sakkinen
2014-12-05 13:10       ` Jarkko Sakkinen
2014-12-04 22:55   ` Peter Hüwe
2014-12-04 22:55     ` Peter Hüwe
2014-12-04  5:55 ` [PATCH v9 8/8] tpm: TPM 2.0 FIFO Interface Jarkko Sakkinen
2014-12-04 15:25   ` [tpmdd-devel] " Scot Doyle
2014-12-04 15:25     ` Scot Doyle
2014-12-05 13:05     ` Jarkko Sakkinen
2014-12-05 13:05       ` Jarkko Sakkinen
2014-12-04 21:46   ` Peter Hüwe
2014-12-05 13:06     ` Jarkko Sakkinen
2014-12-05 13:06       ` Jarkko Sakkinen
2014-12-04 22:18   ` Peter Hüwe
2014-12-04 22:18     ` Peter Hüwe
2014-12-04 22:28     ` [tpmdd-devel] " Peter Hüwe
2014-12-04 22:28       ` Peter Hüwe
2014-12-05 15:01       ` Aw: " Peter Huewe
2014-12-05 15:01         ` Peter Huewe
2014-12-05 20:44         ` Stefan Berger
2014-12-05 20:44           ` Stefan Berger
2014-12-09 15:47         ` Jarkko Sakkinen
2014-12-09 15:47           ` 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=20141205141303.GF6993@intel.com \
    --to=jarkko.sakkinen@linux.intel.com \
    --cc=PeterHuewe@gmx.de \
    --cc=ashley@ashleylai.com \
    --cc=christophe.ricard@gmail.com \
    --cc=jason.gunthorpe@obsidianresearch.com \
    --cc=josh.triplett@intel.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tpmdd-devel@lists.sourceforge.net \
    --cc=tpmdd@selhorst.net \
    --cc=trousers-tech@lists.sourceforge.net \
    --cc=will.c.arthur@intel.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 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.