Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3408100ybb; Tue, 31 Mar 2020 04:47:12 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvc6lsCHUMuKNrIQdINA+/SYsjtr5lQzXnrI/ex9zNZvPr63ZXU2DQWd4E93+8+OgdVEsR1 X-Received: by 2002:a4a:da48:: with SMTP id f8mr12859645oou.44.1585655232682; Tue, 31 Mar 2020 04:47:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585655232; cv=none; d=google.com; s=arc-20160816; b=rjAJWq0q3pJ6FRwYtC2HXDCSqbbpF++iHhZx+T/UVAL5F2gmX86sfB2PfZGd0UMdJ1 08w84IGvMg85GSJGn95d/wAlpC+eSGpXAHU28BYro/oE/DSJ1EWl7l6EEjMBUG90RIT7 g6smk2BXslTWrrV7hAbjqmKIbdoygCT9mR5DslyJ6odgDBIGjgI/bK+/QXb1tQPKM0Uj GTrj9zcWXTuxTravhV8ciwo3AjXqKdymmHdLAz7Rw5IJGDXXOiLKOgBs8yGuiKTwAFVI RWb2cE7LiZjvPP4b71e33RnyZ/ijg4nGzcgc7NeZ1neijOYdzSxDFz+V8klun283Kf4P pSaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=WnlXpoIHZPp4xNh97wfHztfNgbfQYmGzbCvnYWBtegc=; b=dG5M05B2Qr4PXfj08CSRCQo9maugt62T1yJdWghPYolCJZd0auD1drMC9josVCUbzI 8VsnMblhUKa2wgwFhNd45op6AtbVwDPUqyoWZWOS+inn/VFJk/xFso1CQjY3RZ4bzHjS wJkri6jpVTCUlLIIGXNVDrvTAEHcEtXCLKHN2b5Lw5ULgvJ7UUnH+W/eLRceCQrKnPls Te1hSVNBsW5mYOZ5QxjHPqY962qCO+iivgk2kBkJFY0yT0IKagoOeLDp6yfW4dT84S71 5iLWs4OuXn+g2GLZpQT1k0uZ/hDLKlRzrauZU/tn0Qn2X+XKHkW8XD6wffZJuNFohPl4 V3lA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d145si7031417oig.261.2020.03.31.04.47.00; Tue, 31 Mar 2020 04:47:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730666AbgCaLqY convert rfc822-to-8bit (ORCPT + 99 others); Tue, 31 Mar 2020 07:46:24 -0400 Received: from maillog.nuvoton.com ([202.39.227.15]:40868 "EHLO maillog.nuvoton.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730424AbgCaLqX (ORCPT ); Tue, 31 Mar 2020 07:46:23 -0400 Received: from NTHCCAS01.nuvoton.com (nthccas01.nuvoton.com [10.1.8.28]) by maillog.nuvoton.com (Postfix) with ESMTP id ED3961C80EF9; Tue, 31 Mar 2020 19:35:02 +0800 (CST) Received: from NTILML02.nuvoton.com (10.190.1.46) by NTHCCAS01.nuvoton.com (10.1.8.28) with Microsoft SMTP Server (TLS) id 15.0.1130.7; Tue, 31 Mar 2020 19:35:02 +0800 Received: from NTILML02.nuvoton.com (10.190.1.47) by NTILML02.nuvoton.com (10.190.1.47) with Microsoft SMTP Server (TLS) id 15.0.1130.7; Tue, 31 Mar 2020 14:34:59 +0300 Received: from taln70.nuvoton.co.il (10.191.1.70) by NTILML02.nuvoton.com (10.190.1.46) with Microsoft SMTP Server id 15.0.1130.7 via Frontend Transport; Tue, 31 Mar 2020 14:34:59 +0300 Received: from taln60.nuvoton.co.il (taln60 [10.191.1.180]) by taln70.nuvoton.co.il (Postfix) with ESMTP id E7382250; Tue, 31 Mar 2020 14:34:59 +0300 (IDT) Received: by taln60.nuvoton.co.il (Postfix, from userid 10140) id DA4D9639B2; Tue, 31 Mar 2020 14:34:29 +0300 (IDT) From: To: , , , , , , , , , CC: , , , , , , , , , , , Amir Mizinski Subject: [PATCH v4 5/7] tpm: Handle an exception for TPM Firmware Update mode. Date: Tue, 31 Mar 2020 14:32:05 +0300 Message-ID: <20200331113207.107080-6-amirmizi6@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20200331113207.107080-1-amirmizi6@gmail.com> References: <20200331113207.107080-1-amirmizi6@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Amir Mizinski An extra precaution for TPM Firmware Update Mode. For example if TPM power was cut while in Firmware update, platform should ignore selftest failure and skip TPM initialization sequence. This improvment was suggested by Benoit Houyere. Signed-off-by: Amir Mizinski --- drivers/char/tpm/tpm2-cmd.c | 4 ++++ include/linux/tpm.h | 1 + 2 files changed, 5 insertions(+) diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c index 7603295..b77e394 100644 --- a/drivers/char/tpm/tpm2-cmd.c +++ b/drivers/char/tpm/tpm2-cmd.c @@ -727,6 +727,10 @@ int tpm2_auto_startup(struct tpm_chip *chip) goto out; rc = tpm2_do_selftest(chip); + + if ((rc == TPM2_RC_UPGRADE) || (rc == TPM2_RC_COMMAND_CODE)) + return 0; + if (rc && rc != TPM2_RC_INITIALIZE) goto out; diff --git a/include/linux/tpm.h b/include/linux/tpm.h index 03e9b18..5a2e031 100644 --- a/include/linux/tpm.h +++ b/include/linux/tpm.h @@ -199,6 +199,7 @@ enum tpm2_return_codes { TPM2_RC_INITIALIZE = 0x0100, /* RC_VER1 */ TPM2_RC_FAILURE = 0x0101, TPM2_RC_DISABLED = 0x0120, + TPM2_RC_UPGRADE = 0x012D, TPM2_RC_COMMAND_CODE = 0x0143, TPM2_RC_TESTING = 0x090A, /* RC_WARN */ TPM2_RC_REFERENCE_H0 = 0x0910, -- 2.7.4 =========================================================================================== The privileged confidential information contained in this email is intended for use only by the addressees as indicated by the original sender of this email. If you are not the addressee indicated in this email or are not responsible for delivery of the email to such a person, please kindly reply to the sender indicating this fact and delete all copies of it from your computer and network server immediately. Your cooperation is highly appreciated. It is advised that any unauthorized use of confidential information of Nuvoton is strictly prohibited; and any information in this email irrelevant to the official business of Nuvoton shall be deemed as neither given nor endorsed by Nuvoton.