All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: tpmdd-devel@lists.sourceforge.net
Cc: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>,
	Peter Huewe <peterhuewe@gmx.de>,
	Marcel Selhorst <tpmdd@selhorst.net>,
	Jason Gunthorpe <jgunthorpe@obsidianresearch.com>,
	linux-kernel@vger.kernel.org (open list)
Subject: [PATCH] tpm, tpm_crb: remove redundant CRB_FL_CRB_START flag
Date: Mon, 17 Oct 2016 23:42:24 +0300	[thread overview]
Message-ID: <20161017204224.27163-1-jarkko.sakkinen@linux.intel.com> (raw)

Because all the existing hardware have HID MSFT0101 we end up always
setting CRB_FL_CRB_START flag as a workaround for 4th Gen Core CPUs.
Even if ACPI start is used, the driver will always issue also CRB start.

This commit makes the invocation of CRB start unconditional.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
---
 drivers/char/tpm/tpm_crb.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c
index 65040d7..5928ec8 100644
--- a/drivers/char/tpm/tpm_crb.c
+++ b/drivers/char/tpm/tpm_crb.c
@@ -72,7 +72,6 @@ enum crb_status {
 
 enum crb_flags {
 	CRB_FL_ACPI_START	= BIT(0),
-	CRB_FL_CRB_START	= BIT(1),
 };
 
 struct crb_priv {
@@ -226,8 +225,11 @@ static int crb_send(struct tpm_chip *chip, u8 *buf, size_t len)
 	/* Make sure that cmd is populated before issuing start. */
 	wmb();
 
-	if (priv->flags & CRB_FL_CRB_START)
-		iowrite32(CRB_START_INVOKE, &priv->cca->start);
+
+	/* At least some of the 4th Gen Core CPUs that report only needing ACPI
+	 * start require also CRB start so we always set it just in case.
+	 */
+	iowrite32(CRB_START_INVOKE, &priv->cca->start);
 
 	if (priv->flags & CRB_FL_ACPI_START)
 		rc = crb_do_acpi_start(chip);
@@ -407,14 +409,6 @@ static int crb_acpi_add(struct acpi_device *device)
 	if (!priv)
 		return -ENOMEM;
 
-	/* The reason for the extra quirk is that the PTT in 4th Gen Core CPUs
-	 * report only ACPI start but in practice seems to require both
-	 * ACPI start and CRB start.
-	 */
-	if (sm == ACPI_TPM2_COMMAND_BUFFER || sm == ACPI_TPM2_MEMORY_MAPPED ||
-	    !strcmp(acpi_device_hid(device), "MSFT0101"))
-		priv->flags |= CRB_FL_CRB_START;
-
 	if (sm == ACPI_TPM2_START_METHOD ||
 	    sm == ACPI_TPM2_COMMAND_BUFFER_WITH_START_METHOD)
 		priv->flags |= CRB_FL_ACPI_START;
-- 
2.9.3

WARNING: multiple messages have this Message-ID (diff)
From: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Cc: open list <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: [PATCH] tpm, tpm_crb: remove redundant CRB_FL_CRB_START flag
Date: Mon, 17 Oct 2016 23:42:24 +0300	[thread overview]
Message-ID: <20161017204224.27163-1-jarkko.sakkinen@linux.intel.com> (raw)

Because all the existing hardware have HID MSFT0101 we end up always
setting CRB_FL_CRB_START flag as a workaround for 4th Gen Core CPUs.
Even if ACPI start is used, the driver will always issue also CRB start.

This commit makes the invocation of CRB start unconditional.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
---
 drivers/char/tpm/tpm_crb.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c
index 65040d7..5928ec8 100644
--- a/drivers/char/tpm/tpm_crb.c
+++ b/drivers/char/tpm/tpm_crb.c
@@ -72,7 +72,6 @@ enum crb_status {
 
 enum crb_flags {
 	CRB_FL_ACPI_START	= BIT(0),
-	CRB_FL_CRB_START	= BIT(1),
 };
 
 struct crb_priv {
@@ -226,8 +225,11 @@ static int crb_send(struct tpm_chip *chip, u8 *buf, size_t len)
 	/* Make sure that cmd is populated before issuing start. */
 	wmb();
 
-	if (priv->flags & CRB_FL_CRB_START)
-		iowrite32(CRB_START_INVOKE, &priv->cca->start);
+
+	/* At least some of the 4th Gen Core CPUs that report only needing ACPI
+	 * start require also CRB start so we always set it just in case.
+	 */
+	iowrite32(CRB_START_INVOKE, &priv->cca->start);
 
 	if (priv->flags & CRB_FL_ACPI_START)
 		rc = crb_do_acpi_start(chip);
@@ -407,14 +409,6 @@ static int crb_acpi_add(struct acpi_device *device)
 	if (!priv)
 		return -ENOMEM;
 
-	/* The reason for the extra quirk is that the PTT in 4th Gen Core CPUs
-	 * report only ACPI start but in practice seems to require both
-	 * ACPI start and CRB start.
-	 */
-	if (sm == ACPI_TPM2_COMMAND_BUFFER || sm == ACPI_TPM2_MEMORY_MAPPED ||
-	    !strcmp(acpi_device_hid(device), "MSFT0101"))
-		priv->flags |= CRB_FL_CRB_START;
-
 	if (sm == ACPI_TPM2_START_METHOD ||
 	    sm == ACPI_TPM2_COMMAND_BUFFER_WITH_START_METHOD)
 		priv->flags |= CRB_FL_ACPI_START;
-- 
2.9.3


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot

             reply	other threads:[~2016-10-17 20:42 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-17 20:42 Jarkko Sakkinen [this message]
2016-10-17 20:42 ` [PATCH] tpm, tpm_crb: remove redundant CRB_FL_CRB_START flag Jarkko Sakkinen
2016-10-17 22:51 ` Jarkko Sakkinen
2016-10-19 10:28   ` [tpmdd-devel] " Winkler, Tomas
2016-10-19 10:28     ` Winkler, Tomas
2016-10-19 16:09     ` [tpmdd-devel] " Jarkko Sakkinen
2016-10-19 16:09       ` Jarkko Sakkinen
2016-10-20 13:59       ` Jarkko Sakkinen
2016-10-20 13:59         ` Jarkko Sakkinen
2016-10-20 14:00         ` [tpmdd-devel] " Jarkko Sakkinen
2016-10-20 14:00           ` Jarkko Sakkinen
2016-10-20 20:24           ` Jason Gunthorpe
2016-10-20 20:24             ` Jason Gunthorpe
2016-10-21 15:11             ` [tpmdd-devel] " Jarkko Sakkinen
2016-10-21 15:11               ` Jarkko Sakkinen
2016-10-25 20:31               ` Jarkko Sakkinen
2016-10-25 20:31                 ` 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=20161017204224.27163-1-jarkko.sakkinen@linux.intel.com \
    --to=jarkko.sakkinen@linux.intel.com \
    --cc=jgunthorpe@obsidianresearch.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterhuewe@gmx.de \
    --cc=tpmdd-devel@lists.sourceforge.net \
    --cc=tpmdd@selhorst.net \
    /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.