linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] tpm_tis: Some smaller fixes
@ 2012-01-20 17:58 Stefan Berger
  2012-01-20 17:58 ` [PATCH 1/2] Only probe iTPMs Stefan Berger
  2012-01-20 17:58 ` [PATCH 2/2] tpm_tis: Clean up after module_param cleanup Stefan Berger
  0 siblings, 2 replies; 5+ messages in thread
From: Stefan Berger @ 2012-01-20 17:58 UTC (permalink / raw)
  To: stefanb, tpmdd-devel, linux-kernel; +Cc: srajiv

The following two patches fix small issues with the TPM TIS driver.

Regards,
   Stefan




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

* [PATCH 1/2] Only probe iTPMs
  2012-01-20 17:58 [PATCH 0/2] tpm_tis: Some smaller fixes Stefan Berger
@ 2012-01-20 17:58 ` Stefan Berger
  2012-02-03 17:35   ` Rajiv Andrade
  2012-01-20 17:58 ` [PATCH 2/2] tpm_tis: Clean up after module_param cleanup Stefan Berger
  1 sibling, 1 reply; 5+ messages in thread
From: Stefan Berger @ 2012-01-20 17:58 UTC (permalink / raw)
  To: stefanb, tpmdd-devel, linux-kernel; +Cc: srajiv

[-- Attachment #1: tpm_intel_only.diff --]
[-- Type: text/plain, Size: 1579 bytes --]

Detect iTPMs through the vendor ID on the hardware interface and only
probe the device if the manufacturer is found to be Intel. This
obsoletes a previously added delay necessary for some TPMs but not iTPMs. 

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>

---
 drivers/char/tpm/tpm.h     |    2 ++
 drivers/char/tpm/tpm_tis.c |    8 +++++---
 2 files changed, 7 insertions(+), 3 deletions(-)

Index: linux-2.6/drivers/char/tpm/tpm.h
===================================================================
--- linux-2.6.orig/drivers/char/tpm/tpm.h
+++ linux-2.6/drivers/char/tpm/tpm.h
@@ -99,6 +99,8 @@ struct tpm_vendor_specific {
 	wait_queue_head_t int_queue;
 };
 
+#define TPM_VID_INTEL    0x8086
+
 struct tpm_chip {
 	struct device *dev;	/* Device stuff */
 
Index: linux-2.6/drivers/char/tpm/tpm_tis.c
===================================================================
--- linux-2.6.orig/drivers/char/tpm/tpm_tis.c
+++ linux-2.6/drivers/char/tpm/tpm_tis.c
@@ -368,6 +368,11 @@ static int probe_itpm(struct tpm_chip *c
 	};
 	size_t len = sizeof(cmd_getticks);
 	int rem_itpm = itpm;
+	u16 vendor = ioread16(chip->vendor.iobase + TPM_DID_VID(0));
+
+	/* probe only iTPMS */
+	if (vendor != TPM_VID_INTEL)
+		return 0;
 
 	itpm = 0;
 
@@ -390,9 +395,6 @@ static int probe_itpm(struct tpm_chip *c
 out:
 	itpm = rem_itpm;
 	tpm_tis_ready(chip);
-	/* some TPMs need a break here otherwise they will not work
-	 * correctly on the immediately subsequent command */
-	msleep(chip->vendor.timeout_b);
 	release_locality(chip, chip->vendor.locality, 0);
 
 	return rc;


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

* [PATCH 2/2] tpm_tis: Clean up after module_param cleanup
  2012-01-20 17:58 [PATCH 0/2] tpm_tis: Some smaller fixes Stefan Berger
  2012-01-20 17:58 ` [PATCH 1/2] Only probe iTPMs Stefan Berger
@ 2012-01-20 17:58 ` Stefan Berger
  2012-02-03 17:35   ` Rajiv Andrade
  1 sibling, 1 reply; 5+ messages in thread
From: Stefan Berger @ 2012-01-20 17:58 UTC (permalink / raw)
  To: stefanb, tpmdd-devel, linux-kernel
  Cc: srajiv, Stefan Berger, Mauro Carvalho Chehab, Rusty Russell

[-- Attachment #1: tpm_tis_itpm_bool_fix.diff --]
[-- Type: text/plain, Size: 1490 bytes --]

Commit 90ab5ee94171b3e28de6bb42ee30b527014e0be7 changed the
itpm module parameter from int to bool. Some other changes
need to be done to clean up after this change.

Signed-off-by: Stefan Berger <stefan@linux.vnet.ibm.com>
Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>

---
 drivers/char/tpm/tpm_tis.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Index: linux-2.6/drivers/char/tpm/tpm_tis.c
===================================================================
--- linux-2.6.orig/drivers/char/tpm/tpm_tis.c
+++ linux-2.6/drivers/char/tpm/tpm_tis.c
@@ -367,7 +367,7 @@ static int probe_itpm(struct tpm_chip *c
 		0x00, 0x00, 0x00, 0xf1
 	};
 	size_t len = sizeof(cmd_getticks);
-	int rem_itpm = itpm;
+	bool rem_itpm = itpm;
 	u16 vendor = ioread16(chip->vendor.iobase + TPM_DID_VID(0));
 
 	/* probe only iTPMS */
@@ -510,7 +510,7 @@ static int tpm_tis_init(struct device *d
 			resource_size_t len, unsigned int irq)
 {
 	u32 vendor, intfcaps, intmask;
-	int rc, i, irq_s, irq_e;
+	int rc, i, irq_s, irq_e, probe;
 	struct tpm_chip *chip;
 
 	if (!(chip = tpm_register_hardware(dev, &tpm_tis)))
@@ -540,11 +540,12 @@ static int tpm_tis_init(struct device *d
 		 vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0)));
 
 	if (!itpm) {
-		itpm = probe_itpm(chip);
-		if (itpm < 0) {
+		probe = probe_itpm(chip);
+		if (probe < 0) {
 			rc = -ENODEV;
 			goto out_err;
 		}
+		itpm = (probe == 0) ? 0 : 1;
 	}
 
 	if (itpm)


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

* Re: [PATCH 1/2] Only probe iTPMs
  2012-01-20 17:58 ` [PATCH 1/2] Only probe iTPMs Stefan Berger
@ 2012-02-03 17:35   ` Rajiv Andrade
  0 siblings, 0 replies; 5+ messages in thread
From: Rajiv Andrade @ 2012-02-03 17:35 UTC (permalink / raw)
  To: Stefan Berger; +Cc: tpmdd-devel, linux-kernel

On Fri, 20 Jan 2012, Stefan Berger wrote:

> Detect iTPMs through the vendor ID on the hardware interface and only
> probe the device if the manufacturer is found to be Intel. This
> obsoletes a previously added delay necessary for some TPMs but not iTPMs. 
> 
> Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
>

Applied to github.com:srajiv/tpm.git next

Thanks,
Rajiv


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

* Re: [PATCH 2/2] tpm_tis: Clean up after module_param cleanup
  2012-01-20 17:58 ` [PATCH 2/2] tpm_tis: Clean up after module_param cleanup Stefan Berger
@ 2012-02-03 17:35   ` Rajiv Andrade
  0 siblings, 0 replies; 5+ messages in thread
From: Rajiv Andrade @ 2012-02-03 17:35 UTC (permalink / raw)
  To: Stefan Berger
  Cc: tpmdd-devel, linux-kernel, Stefan Berger, Mauro Carvalho Chehab,
	Rusty Russell

On Fri, 20 Jan 2012, Stefan Berger wrote:

> Commit 90ab5ee94171b3e28de6bb42ee30b527014e0be7 changed the
> itpm module parameter from int to bool. Some other changes
> need to be done to clean up after this change.
> 
> Signed-off-by: Stefan Berger <stefan@linux.vnet.ibm.com>
> Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
> Cc: Rusty Russell <rusty@rustcorp.com.au>
>

Applied to github.com:srajiv/tpm.git next

Thanks,
Rajiv


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

end of thread, other threads:[~2012-02-03 17:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-20 17:58 [PATCH 0/2] tpm_tis: Some smaller fixes Stefan Berger
2012-01-20 17:58 ` [PATCH 1/2] Only probe iTPMs Stefan Berger
2012-02-03 17:35   ` Rajiv Andrade
2012-01-20 17:58 ` [PATCH 2/2] tpm_tis: Clean up after module_param cleanup Stefan Berger
2012-02-03 17:35   ` Rajiv Andrade

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).