Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3288471pxb; Tue, 19 Jan 2021 20:09:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJz8YKY+3M8M9Yd+/IupLXOip7r1kfwlrdHnWRF/N6elZJTKm6zVH3Qt29dOkz0Z7dnTN6pN X-Received: by 2002:a17:907:3e1b:: with SMTP id hp27mr4657709ejc.506.1611115770695; Tue, 19 Jan 2021 20:09:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611115770; cv=none; d=google.com; s=arc-20160816; b=dT0KPk3aw0TfrlLQGfJKPCDpPWcdKIYIFJjGuQnUo6qedI4DjTYSEm72lqvHhhqK8u trpEB8kB4t0sjuct6OZvqpJm/tBQi5PLlYSRmHGthsd4lXYxxYxyzgZvkZDutyU/ZgHf xHd6ahj8j+C5A/8Oqm2A0eMrzagULXHdXWmY66UFXMSxTXdaHiRstJTYxkjIKPzgIys2 0eouk9Ejf41HoXlMbYeUfZ8ojqM3hs20xxyJAByzJu08B+lWRH+yBP+QLczXvTx6f4uY STypoTquA+jUsbGHbSkd6FzQ48h1ralMETFCyZUZRCl1CnD1erYXeXdjxphSUzVS3b4y fF+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=XBp0AD+0m2s/p9tIj6CPpumpCOiNnMMVUqVhOWNZPGU=; b=HJTvBnUQgfF/x5bWt8pXjWlr8CBw/+Ejc+6nSlsmv+Qr/CxfNLJu/vdfwE6uOYWpFf 6FjVinx1A+JmNQ6E6AIt4A3GS3ELztq5VkKHX3QeGkynb6g2rBT0s/FYRm2aGNLSxhMu PbaiNqekUZFGNxvo/yIh8ptiRU4l70F/XpXVUKSzXquo9MLXllNVXXvzBwCMIGpKvLeu g+WbOx7OvrR378Vh/UpO7PI5MdXVjGafin2BeSzz9hpLCc0YcDpikMJAdY25VjfvnoKW MZWQOEFtpL278rqDpe9wq5ZROxgI/0rU4hJ/O0Hc4WjcjYgzzPeBoZ7T6qOZQ28xktfT oj7w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gq19si228856ejb.623.2021.01.19.20.08.56; Tue, 19 Jan 2021 20:09:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731579AbhATEF7 (ORCPT + 99 others); Tue, 19 Jan 2021 23:05:59 -0500 Received: from out30-54.freemail.mail.aliyun.com ([115.124.30.54]:53985 "EHLO out30-54.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731536AbhATEFK (ORCPT ); Tue, 19 Jan 2021 23:05:10 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R141e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04426;MF=tianjia.zhang@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0UMIdHZ._1611115429; Received: from 30.25.183.227(mailfrom:tianjia.zhang@linux.alibaba.com fp:SMTPD_---0UMIdHZ._1611115429) by smtp.aliyun-inc.com(127.0.0.1); Wed, 20 Jan 2021 12:03:50 +0800 Subject: Re: [PATCH] tpm/tpm_tis: Fix variable reset during IRQ probing To: Jarkko Sakkinen Cc: Peter Huewe , Jason Gunthorpe , linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, Jia Zhang References: <20210113120021.59045-1-tianjia.zhang@linux.alibaba.com> <44c35c27-0cd4-e451-1b9c-d6fe48e58e51@linux.alibaba.com> From: Tianjia Zhang Message-ID: <60b7bb82-c762-cf67-6b73-7ecb2a0f1085@linux.alibaba.com> Date: Wed, 20 Jan 2021 12:03:49 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/15/21 5:23 PM, Jarkko Sakkinen wrote: > On Thu, Jan 14, 2021 at 12:12:16PM +0800, Tianjia Zhang wrote: >> >> >> On 1/14/21 10:51 AM, Jarkko Sakkinen wrote: >>> On Wed, Jan 13, 2021 at 08:00:21PM +0800, Tianjia Zhang wrote: >>>> In tpm_tis_core_init(), tpm2_probe() will be called first, this >>>> function will eventually call tpm_tis_send(), and then >>>> tpm_tis_probe_irq_single() will detect whether the interrupt is >>>> normal, mainly the installation interrupted, set `priv->irq_tested` >>>> to false. The logic will eventually be executed to tpm_tis_send() >>>> to trigger an interrupt. >>>> >>>> There is currently such a scenario, which will cause the IRQ probe >>>> code to never be executed, so that the TPM device is in polling >>>> mode: after setting irq_tested to false, an interrupt occurs >>>> between entering the ttpm_tis_send() function, and the interrupt >>>> will be first set irq_tested to true will cause the IRQ probe code >>>> to never be executed. >>> >>> Can you describe the scenario more detail? >>> >> >> The problematic scenario we encountered is like this. The following figure >> shows the execution flow of tpm_tis_core_init(). An interrupt occurred >> before the IRQ probe. This interrupt was caused by tpm2_probe(), but it was >> triggered before the IRQ probe was executed, and the interrupt handler would >> set irq_tested to true, so the IRQ probe code can never execute, that is, >> the code marked 2 in the figure will never happen. > > TPM_INT_ENABLE is cleared on reset [*]. > > [*] Section 5.9.1 > https://trustedcomputinggroup.org/resource/pc-client-work-group-pc-client-specific-tpm-interface-specification-tis/ > > /Jarkko > Hi, I got it, this seems to be a firmware issue. Thanks for your reply. Best regards, Tianjia