From patchwork Mon Oct 17 20:42:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarkko Sakkinen X-Patchwork-Id: 683389 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3syVWq4MLBz9sR9 for ; Tue, 18 Oct 2016 07:42:47 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=sfs-ml-1.v29.ch3.sourceforge.com) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1bwEk5-0003gS-MZ; Mon, 17 Oct 2016 20:42:41 +0000 Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1bwEk4-0003gM-MX for tpmdd-devel@lists.sourceforge.net; Mon, 17 Oct 2016 20:42:40 +0000 X-ACL-Warn: Received: from mga03.intel.com ([134.134.136.65]) by sog-mx-1.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1bwEk2-0006jm-Ls for tpmdd-devel@lists.sourceforge.net; Mon, 17 Oct 2016 20:42:40 +0000 Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga103.jf.intel.com with ESMTP; 17 Oct 2016 13:42:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,358,1473145200"; d="scan'208";a="20508700" Received: from pjordan-mobl1.ger.corp.intel.com (HELO localhost) ([10.252.14.254]) by fmsmga006.fm.intel.com with ESMTP; 17 Oct 2016 13:42:29 -0700 From: Jarkko Sakkinen To: tpmdd-devel@lists.sourceforge.net Date: Mon, 17 Oct 2016 23:42:24 +0300 Message-Id: <20161017204224.27163-1-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.9.3 X-Spam-Score: -0.3 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.3 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain X-Headers-End: 1bwEk2-0006jm-Ls Cc: open list Subject: [tpmdd-devel] [PATCH] tpm, tpm_crb: remove redundant CRB_FL_CRB_START flag X-BeenThere: tpmdd-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Tpm Device Driver maintainance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: tpmdd-devel-bounces@lists.sourceforge.net 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 --- 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;