From patchwork Wed Jul 13 16:19:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ed Swierk X-Patchwork-Id: 9228019 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 38FAD6088F for ; Wed, 13 Jul 2016 16:57:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 28ABF27FAD for ; Wed, 13 Jul 2016 16:57:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1284D27FB7; Wed, 13 Jul 2016 16:57:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 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 mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A025427FAD for ; Wed, 13 Jul 2016 16:57:43 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-2.v29.ch3.sourceforge.com) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1bNNTi-0002KN-0L; Wed, 13 Jul 2016 16:57:42 +0000 Received: from sog-mx-4.v43.ch3.sourceforge.com ([172.29.43.194] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1bNMvd-0006QV-Gp for tpmdd-devel@lists.sourceforge.net; Wed, 13 Jul 2016 16:22:29 +0000 Received-SPF: pass (sog-mx-4.v43.ch3.sourceforge.com: domain of skyportsystems.com designates 209.85.220.51 as permitted sender) client-ip=209.85.220.51; envelope-from=eswierk@skyportsystems.com; helo=mail-pa0-f51.google.com; Received: from mail-pa0-f51.google.com ([209.85.220.51]) by sog-mx-4.v43.ch3.sourceforge.com with esmtps (TLSv1:AES128-SHA:128) (Exim 4.76) id 1bNMt6-0002IR-K0 for tpmdd-devel@lists.sourceforge.net; Wed, 13 Jul 2016 16:19:53 +0000 Received: by mail-pa0-f51.google.com with SMTP id dx3so19253058pab.2 for ; Wed, 13 Jul 2016 09:19:52 -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=p5NDwk8FjDUKJDJ+xcYPMe3KwNGxBttz5ntktom47Ug=; b=Gf/kg4Pv8RiM4983KGgqZAFpeRZZ5bgkp3zhTrOoD8nkUPCtdZuIVKq9uvbOLi1dYE i7TnYEajmurdTiZfal4/Re8xkNoEdxDla//JKSmResP0GRW6KWPjBo6IIZ/Yft8on85Y V/+upTfOB2BXyutJOda3QvjbqHfRpEKcC29690fWN8JrU+IBYneAUvYwxJ0PT1027+ug XWeBR+aSdCil1e6WRMSXKvI1Mk3h/0Mit1ea+0VfZB0opZQzPhyLP02LCLyDOUuZSdbM uJlHGUKCVxVnkPg+RXqTFs4AwA8tPoTv6HF/r58YQqB4/2+hmKNe+jGzxIG0/WguZTtU yZwA== X-Gm-Message-State: ALyK8tI0Oir1RF1eBBe2LmaYvP4YuvF4cEnpNJo/u88d4xw+LUSDBNS6yG2julwCbTaPuOOD X-Received: by 10.66.104.34 with SMTP id gb2mr15124992pab.12.1468426786815; Wed, 13 Jul 2016 09:19:46 -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 15sm6015473pfz.36.2016.07.13.09.19.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 13 Jul 2016 09:19:46 -0700 (PDT) From: Ed Swierk To: tpmdd-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org Date: Wed, 13 Jul 2016 09:19:32 -0700 Message-Id: <1468426776-42762-2-git-send-email-eswierk@skyportsystems.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1468426776-42762-1-git-send-email-eswierk@skyportsystems.com> References: <1466557831-113440-1-git-send-email-eswierk@skyportsystems.com> <1468426776-42762-1-git-send-email-eswierk@skyportsystems.com> X-Headers-End: 1bNMt6-0002IR-K0 Subject: [tpmdd-devel] [PATCH v9 1/5] 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 X-Virus-Scanned: ClamAV using ClamSMTP 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_core.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c index 8110b52..e62fdeb 100644 --- a/drivers/char/tpm/tpm_tis_core.c +++ b/drivers/char/tpm/tpm_tis_core.c @@ -217,6 +217,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->dev, "Response too long (wanted %zd, got %d)\n", + count, expected); size = -EIO; goto out; } @@ -283,6 +285,8 @@ static int tpm_tis_send_data(struct tpm_chip *chip, u8 *buf, size_t len) &priv->int_queue, false); status = tpm_tis_status(chip); if (!itpm && (status & TPM_STS_DATA_EXPECT) == 0) { + dev_err(&chip->dev, "Chip not accepting %zd bytes\n", + len - count); rc = -EIO; goto out_err; } @@ -297,6 +301,7 @@ static int tpm_tis_send_data(struct tpm_chip *chip, u8 *buf, size_t len) &priv->int_queue, false); status = tpm_tis_status(chip); if (!itpm && (status & TPM_STS_DATA_EXPECT) != 0) { + dev_err(&chip->dev, "Chip not accepting last byte\n"); rc = -EIO; goto out_err; } @@ -707,8 +712,9 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, if (rc < 0) goto out_err; - 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", + priv->manufacturer_id, vendor >> 16, rid); if (!(priv->flags & TPM_TIS_ITPM_POSSIBLE)) {