From patchwork Tue Jun 7 03:37:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ed Swierk X-Patchwork-Id: 631310 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 3rNybb2jd2z9t3t for ; Tue, 7 Jun 2016 14:03:23 +1000 (AEST) 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 1bA8EY-0008NF-Ar; Tue, 07 Jun 2016 04:03:18 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1bA8EW-0008N9-GX for tpmdd-devel@lists.sourceforge.net; Tue, 07 Jun 2016 04:03:16 +0000 Received-SPF: pass (sog-mx-2.v43.ch3.sourceforge.com: domain of skyportsystems.com designates 209.85.220.45 as permitted sender) client-ip=209.85.220.45; envelope-from=eswierk@skyportsystems.com; helo=mail-pa0-f45.google.com; Received: from mail-pa0-f45.google.com ([209.85.220.45]) by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:AES128-SHA:128) (Exim 4.76) id 1bA8EV-0005sP-Jf for tpmdd-devel@lists.sourceforge.net; Tue, 07 Jun 2016 04:03:16 +0000 Received: by mail-pa0-f45.google.com with SMTP id xk1so41696522pac.2 for ; Mon, 06 Jun 2016 21:03:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6w/KFZrLNsQi0ejs6zKYjelnt2WjgSTgElADjr/0zR8=; b=aEEfdbnSCTVfaEs/IyHyHVqrCIGCYkM0ifWBvoLYZzksI4d3aTuR4XajtSnblbyj9E CH3r8JHfL1JnKaj90mYqMWUht9P1djNt8E/jujnq6bBI0tw8oxphvMHnbcnT630o3+FH xffMuvD0v+OXnVF6xxqFNsp2ScExb7hnTx5n7LzMA77xLeIBbI2g0C2LH348cg6XT0CT EFOH7sk3J64weBrArtcN7wNWB0QCcpId/2jK83C8Sdxec1myNiHnd5gMfIjM14TJffTe 82130mFcX73L+3LpFVjBaD+L4t1tVokxQo7b4BwT0wlhc9gk8GNYtyStnGx+tF5wf4ES 8Jgg== X-Gm-Message-State: ALyK8tJ8fmEM8U+IfUZOFbh/RFe7w+1WAAGuKJjfL0rJBwWDu4Flpi6ACXyXu0ExDRDpKTR8 X-Received: by 10.66.138.16 with SMTP id qm16mr28381451pab.28.1465270682913; Mon, 06 Jun 2016 20:38:02 -0700 (PDT) Received: from eswierk-sc.localdomain (67-207-112-138.static.wiline.com. [67.207.112.138]) by smtp.gmail.com with ESMTPSA id fl1sm28516535pab.43.2016.06.06.20.38.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 06 Jun 2016 20:38:02 -0700 (PDT) From: Ed Swierk To: tpmdd-devel@lists.sourceforge.net Date: Mon, 6 Jun 2016 20:37:26 -0700 Message-Id: <1465270649-22498-2-git-send-email-eswierk@skyportsystems.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1465270649-22498-1-git-send-email-eswierk@skyportsystems.com> References: <1465270649-22498-1-git-send-email-eswierk@skyportsystems.com> X-Spam-Score: -1.6 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-Headers-End: 1bA8EV-0005sP-Jf Subject: [tpmdd-devel] [PATCH v3 1/4] tpm_tis: Improve reporting of IO errors 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 Mysterious TPM behavior can be difficult to track down through all the layers of software. Add error messages for conditions that should never happen. Also include the manufacturer ID along with other chip data printed during init. Signed-off-by: Ed Swierk Reviewed-by: Jarkko Sakkinen --- drivers/char/tpm/tpm_tis.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c index 65f7eec..088fa86 100644 --- a/drivers/char/tpm/tpm_tis.c +++ b/drivers/char/tpm/tpm_tis.c @@ -299,6 +299,8 @@ static int tpm_tis_recv(struct tpm_chip *chip, u8 *buf, size_t count) expected = be32_to_cpu(*(__be32 *) (buf + 2)); if (expected > count) { + dev_err(chip->pdev, "Response too long (wanted %zd, got %d)\n", + count, expected); size = -EIO; goto out; } @@ -366,6 +368,8 @@ static int tpm_tis_send_data(struct tpm_chip *chip, u8 *buf, size_t len) &chip->vendor.int_queue, false); status = tpm_tis_status(chip); if (!itpm && (status & TPM_STS_DATA_EXPECT) == 0) { + dev_err(chip->pdev, "Chip not accepting %zd bytes\n", + len - count); rc = -EIO; goto out_err; } @@ -378,6 +382,7 @@ static int tpm_tis_send_data(struct tpm_chip *chip, u8 *buf, size_t len) &chip->vendor.int_queue, false); status = tpm_tis_status(chip); if ((status & TPM_STS_DATA_EXPECT) != 0) { + dev_err(chip->pdev, "Chip not accepting last byte\n"); rc = -EIO; goto out_err; } @@ -689,8 +694,9 @@ static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info, vendor = ioread32(chip->vendor.iobase + TPM_DID_VID(0)); chip->vendor.manufacturer_id = vendor; - dev_info(dev, "%s TPM (device-id 0x%X, rev-id %d)\n", + dev_info(dev, "%s TPM (manufacturer-id 0x%X, device-id 0x%X, rev-id %d)\n", (chip->flags & TPM_CHIP_FLAG_TPM2) ? "2.0" : "1.2", + chip->vendor.manufacturer_id, vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0))); if (!itpm) {