Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1446804 > unrolled thread

[PATCH v4 3/5] tpm: replace tpm_gen_interrupt() with tpm_tis_gen_interrupt()

Started byJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
First post2016-07-20 01:50 +0200
Last post2016-07-24 08:40 +0200
Articles 5 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v4 3/5] tpm: replace tpm_gen_interrupt() with tpm_tis_gen_interrupt() Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-07-20 01:50 +0200
    Re: [PATCH v4 3/5] tpm: replace tpm_gen_interrupt() with  tpm_tis_gen_interrupt() Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-07-20 19:10 +0200
      Re: [PATCH v4 3/5] tpm: replace tpm_gen_interrupt() with  tpm_tis_gen_interrupt() Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-07-20 23:00 +0200
        Re: [PATCH v4 3/5] tpm: replace tpm_gen_interrupt() with  tpm_tis_gen_interrupt() Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-07-20 23:10 +0200
    Re: [PATCH v4 3/5] tpm: replace tpm_gen_interrupt() with  tpm_tis_gen_interrupt() kbuild test robot <lkp@intel.com> - 2016-07-24 08:40 +0200

#1446804 — [PATCH v4 3/5] tpm: replace tpm_gen_interrupt() with tpm_tis_gen_interrupt()

FromJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Date2016-07-20 01:50 +0200
Subject[PATCH v4 3/5] tpm: replace tpm_gen_interrupt() with tpm_tis_gen_interrupt()
Message-ID<rWMVY-22W-15@gated-at.bofh.it>
Since tpm_gen_interrupt() is only used in tpm_tis_core.c this commit
replaces it with an internal tpm_tis_gen_interrupt(). The semantics
also changed in a way that on a system error the driver initialization
is failed.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
---
 drivers/char/tpm/tpm-interface.c | 15 ---------------
 drivers/char/tpm/tpm.h           |  2 --
 drivers/char/tpm/tpm2-cmd.c      | 17 -----------------
 drivers/char/tpm/tpm_tis_core.c  | 19 +++++++++++++++----
 4 files changed, 15 insertions(+), 38 deletions(-)

diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
index 1abe2d7..f43cc3f 100644
--- a/drivers/char/tpm/tpm-interface.c
+++ b/drivers/char/tpm/tpm-interface.c
@@ -459,21 +459,6 @@ ssize_t tpm_getcap(struct tpm_chip *chip, __be32 subcap_id, cap_t *cap,
 	return rc;
 }
 
-void tpm_gen_interrupt(struct tpm_chip *chip)
-{
-	struct	tpm_cmd_t tpm_cmd;
-	ssize_t rc;
-
-	tpm_cmd.header.in = tpm_getcap_header;
-	tpm_cmd.params.getcap_in.cap = TPM_CAP_PROP;
-	tpm_cmd.params.getcap_in.subcap_size = cpu_to_be32(4);
-	tpm_cmd.params.getcap_in.subcap = TPM_CAP_PROP_TIS_TIMEOUT;
-
-	rc = tpm_transmit_cmd(chip, &tpm_cmd, TPM_INTERNAL_RESULT_SIZE,
-			      "attempting to determine the timeouts");
-}
-EXPORT_SYMBOL_GPL(tpm_gen_interrupt);
-
 #define TPM_ORD_STARTUP cpu_to_be32(153)
 #define TPM_ST_CLEAR cpu_to_be16(1)
 #define TPM_ST_STATE cpu_to_be16(2)
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
index 8b864dd..6e002c4 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -483,7 +483,6 @@ ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf,
 ssize_t tpm_transmit_cmd(struct tpm_chip *chip, void *cmd, int len,
 			 const char *desc);
 int tpm_get_timeouts(struct tpm_chip *chip);
-void tpm_gen_interrupt(struct tpm_chip *chip);
 int tpm1_auto_startup(struct tpm_chip *chip);
 int tpm_do_selftest(struct tpm_chip *chip);
 unsigned long tpm_calc_ordinal_duration(struct tpm_chip *chip, u32 ordinal);
@@ -530,6 +529,5 @@ ssize_t tpm2_get_tpm_pt(struct tpm_chip *chip, u32 property_id,
 int tpm2_auto_startup(struct tpm_chip *chip);
 void tpm2_shutdown(struct tpm_chip *chip, u16 shutdown_type);
 unsigned long tpm2_calc_ordinal_duration(struct tpm_chip *chip, u32 ordinal);
-int tpm2_gen_interrupt(struct tpm_chip *chip);
 int tpm2_probe(struct tpm_chip *chip);
 #endif
diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c
index 08c7e23..1c393ba 100644
--- a/drivers/char/tpm/tpm2-cmd.c
+++ b/drivers/char/tpm/tpm2-cmd.c
@@ -895,23 +895,6 @@ static int tpm2_do_selftest(struct tpm_chip *chip)
 }
 
 /**
- * tpm2_gen_interrupt() - generate an interrupt
- * @chip: TPM chip to use
- *
- * 0 is returned when the operation is successful. If a negative number is
- * returned it remarks a POSIX error code. If a positive number is returned
- * it remarks a TPM error.
- */
-int tpm2_gen_interrupt(struct tpm_chip *chip)
-{
-	u32 dummy;
-
-	return tpm2_get_tpm_pt(chip, 0x100, &dummy,
-			       "attempting to generate an interrupt");
-}
-EXPORT_SYMBOL_GPL(tpm2_gen_interrupt);
-
-/**
  * tpm2_probe() - probe TPM 2.0
  * @chip: TPM chip to use
  *
diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
index d66f51b..f22caf8 100644
--- a/drivers/char/tpm/tpm_tis_core.c
+++ b/drivers/char/tpm/tpm_tis_core.c
@@ -526,6 +526,18 @@ static irqreturn_t tis_int_handler(int dummy, void *dev_id)
 	return IRQ_HANDLED;
 }
 
+static int tpm_tis_gen_interrupt(struct tpm_chip *chip)
+{
+	const char *desc = "attempting to generate an interrupt";
+	u32 cap2;
+	cap_t cap;
+
+	if (chip->flags & TPM_CHIP_FLAG_TPM2)
+		return tpm2_get_tpm_pt(chip, 0x100, &cap2, desc);
+	else
+		return tpm_getcap(chip, TPM_CAP_PROP_TIS_TIMEOUT, &cap, desc);
+}
+
 /* Register the IRQ and issue a command that will cause an interrupt. If an
  * irq is seen then leave the chip setup for IRQ operation, otherwise reverse
  * everything and leave in polling mode. Returns 0 on success.
@@ -575,10 +587,9 @@ static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask,
 	/* Generate an interrupt by having the core call through to
 	 * tpm_tis_send
 	 */
-	if (chip->flags & TPM_CHIP_FLAG_TPM2)
-		tpm2_gen_interrupt(chip);
-	else
-		tpm_gen_interrupt(chip);
+	rc = tpm_tis_gen_interrupt(chip);
+	if (rc < 0)
+		return rc;
 
 	/* tpm_tis_send will either confirm the interrupt is working or it
 	 * will call disable_irq which undoes all of the above.
-- 
2.7.4

[toc] | [next] | [standalone]


#1447367 — Re: [PATCH v4 3/5] tpm: replace tpm_gen_interrupt() with tpm_tis_gen_interrupt()

FromJason Gunthorpe <jgunthorpe@obsidianresearch.com>
Date2016-07-20 19:10 +0200
SubjectRe: [PATCH v4 3/5] tpm: replace tpm_gen_interrupt() with tpm_tis_gen_interrupt()
Message-ID<rX3aq-4fX-27@gated-at.bofh.it>
In reply to#1446804
On Wed, Jul 20, 2016 at 02:44:58AM +0300, Jarkko Sakkinen wrote:
> Since tpm_gen_interrupt() is only used in tpm_tis_core.c this commit
> replaces it with an internal tpm_tis_gen_interrupt(). The semantics
> also changed in a way that on a system error the driver initialization
> is failed.

All the patches look good to me now..

Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>

Jason

[toc] | [prev] | [next] | [standalone]


#1447465 — Re: [PATCH v4 3/5] tpm: replace tpm_gen_interrupt() with tpm_tis_gen_interrupt()

FromJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Date2016-07-20 23:00 +0200
SubjectRe: [PATCH v4 3/5] tpm: replace tpm_gen_interrupt() with tpm_tis_gen_interrupt()
Message-ID<rX6KZ-6hA-5@gated-at.bofh.it>
In reply to#1447367
On Wed, Jul 20, 2016 at 11:06:24AM -0600, Jason Gunthorpe wrote:
> On Wed, Jul 20, 2016 at 02:44:58AM +0300, Jarkko Sakkinen wrote:
> > Since tpm_gen_interrupt() is only used in tpm_tis_core.c this commit
> > replaces it with an internal tpm_tis_gen_interrupt(). The semantics
> > also changed in a way that on a system error the driver initialization
> > is failed.
> 
> All the patches look good to me now..
> 
> Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>

Thanks.

/Jarkko

[toc] | [prev] | [next] | [standalone]


#1447479 — Re: [PATCH v4 3/5] tpm: replace tpm_gen_interrupt() with tpm_tis_gen_interrupt()

FromJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Date2016-07-20 23:10 +0200
SubjectRe: [PATCH v4 3/5] tpm: replace tpm_gen_interrupt() with tpm_tis_gen_interrupt()
Message-ID<rX6UG-6zY-29@gated-at.bofh.it>
In reply to#1447465
On Wed, Jul 20, 2016 at 11:54:10PM +0300, Jarkko Sakkinen wrote:
> On Wed, Jul 20, 2016 at 11:06:24AM -0600, Jason Gunthorpe wrote:
> > On Wed, Jul 20, 2016 at 02:44:58AM +0300, Jarkko Sakkinen wrote:
> > > Since tpm_gen_interrupt() is only used in tpm_tis_core.c this commit
> > > replaces it with an internal tpm_tis_gen_interrupt(). The semantics
> > > also changed in a way that on a system error the driver initialization
> > > is failed.
> > 
> > All the patches look good to me now..
> > 
> > Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
> 
> Thanks.

The patches are applied to the master branch now.

/Jarkko

[toc] | [prev] | [next] | [standalone]


#1449078 — Re: [PATCH v4 3/5] tpm: replace tpm_gen_interrupt() with tpm_tis_gen_interrupt()

Fromkbuild test robot <lkp@intel.com>
Date2016-07-24 08:40 +0200
SubjectRe: [PATCH v4 3/5] tpm: replace tpm_gen_interrupt() with tpm_tis_gen_interrupt()
Message-ID<rYleV-4z8-5@gated-at.bofh.it>
In reply to#1446804

[Multipart message — attachments visible in raw view] — view raw

Hi,

[auto build test ERROR on next-20160722]
[cannot apply to char-misc/char-misc-testing v4.7-rc7 v4.7-rc6 v4.7-rc5 v4.7-rc7]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Jarkko-Sakkinen/Use-tpm_transmit_cmd-consistently-across-kernel-call-sites/20160724-131407
config: i386-randconfig-i1-201630 (attached as .config)
compiler: gcc-4.8 (Debian 4.8.4-1) 4.8.4
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

>> ERROR: "tpm_getcap" [drivers/char/tpm/tpm_tis_core.ko] undefined!
>> ERROR: "tpm2_get_tpm_pt" [drivers/char/tpm/tpm_tis_core.ko] undefined!

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web