Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp21288029rwd; Thu, 29 Jun 2023 13:51:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5RIoUCygr16gb9vhm9t+oi+AjdDZrZMnlG0zp5rUJlBTeMaXGPkUeJKK+s0nfwLvqBmN0x X-Received: by 2002:a05:6a20:4c23:b0:126:9f81:1192 with SMTP id fm35-20020a056a204c2300b001269f811192mr634628pzb.43.1688071882822; Thu, 29 Jun 2023 13:51:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688071882; cv=none; d=google.com; s=arc-20160816; b=fIRAgqcCzafh2V0CtJZIdE549t+aW1umBQuzGuSDEELv1fraHXe+mfpL6ZLaFaOlmj F7NnoJnGgNADVFl7FBNEXMCKhXi1Kr36szGvlCbr9kk24WK8m+SzeXXD7udEtB2svnsX a3me8RItopHeE3aRG+6gtn2kEA9i8GipbNjgQdj9twfq+6gzLa7zPkGx8zPn+z6xtsUZ NvHIJp8LlCLrC/5jimTGmbVQVAPbqLTMCfIdNJDzlEHCQ8bt8iYuO3fzuIcG/jBIQpQ/ zwzdJjE/Q3tnZAQHsL1cMV8R+WGHWXjZ8tiMhWkMZdHuJBeeIzDGovy48+l0nde1SoTM Y8cA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Y1w2wveQj5ZjtvSYiiPZCbehKWVYDK8itGEibs3X60w=; fh=6HxxLE2UU64o4cyLCi5L2VQ3ezE0r/Ommy5s/Z0sZ+s=; b=h9O8/DxNyZarsfzoJieJAzMPFEDMK285sleHZayLDARJ2PBqyW73FmV3/huyBaD2+B OGYqPl7LAU7w5NLbN43Ei1+rXO321D0JWNBSBBX1BhTMTDB4a120dP0Pt1am+zXfi36N 0SKDF0ude2sMSn4qzCi4Pz2ios8noH1lGtos1qv+V6rbJsg7y31v8928H6pHZjPQthS+ EInVVgmXwdr3C/sKBYHrAcwRrVe1ZFH3FnjYoM7vtsaTpVroJqfQrNmpIBtzknQQJ68h D2JxVJVf5ZkHl0WJIaGJ5WbBeZqQSPAIHqWSlenUl9dk2ndwbQI9V7qv2YtkGDwvjqSW 9OxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RDNnQW0v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g6-20020a056a0023c600b0068094fd5451si3758874pfc.188.2023.06.29.13.51.10; Thu, 29 Jun 2023 13:51:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RDNnQW0v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230525AbjF2UnB (ORCPT + 99 others); Thu, 29 Jun 2023 16:43:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229710AbjF2Umx (ORCPT ); Thu, 29 Jun 2023 16:42:53 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A580C30DD for ; Thu, 29 Jun 2023 13:41:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1688071317; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=Y1w2wveQj5ZjtvSYiiPZCbehKWVYDK8itGEibs3X60w=; b=RDNnQW0v+Gx8qJnb9kuirXyMARnYI6ku+1+ujDv4rfvDlSHLz/k7CTFzwgzTGEjoQtoEPm ZFONSr/Q7bDT0ElvTE7sM5ikQP6tJBAXhyFRsgnlFNhPSniGuWJcdrt8epb7/KJcl6YZTl e9UWyi/tU/4QvFGP8jpc1VM+asFCJuY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-396-OIXoYfhEM3SMriDDhuPqcQ-1; Thu, 29 Jun 2023 16:41:51 -0400 X-MC-Unique: OIXoYfhEM3SMriDDhuPqcQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1DC6A803FDF; Thu, 29 Jun 2023 20:41:51 +0000 (UTC) Received: from cantor.redhat.com (unknown [10.2.17.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id A1012C00049; Thu, 29 Jun 2023 20:41:49 +0000 (UTC) From: Jerry Snitselaar To: linux-kernel@vger.kernel.org, linux-integrity@vger.kernel.org Cc: Jarkko Sakkinen , "Jason A. Donenfeld" , Jason Gunthorpe , Peter Huewe , stable@vger.kernel.org, Linux regressions mailing list , Mario Limonciello , "Aneesh Kumar K . V" , Sachin Sant Subject: [PATCH] tpm: return false from tpm_amd_is_rng_defective on non-x86 platforms Date: Thu, 29 Jun 2023 13:41:47 -0700 Message-Id: <20230629204147.1852823-1-jsnitsel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org tpm_amd_is_rng_defective is for dealing with an issue related to the AMD firmware TPM, so on non-x86 architectures just have it inline and return false. Cc: Jarkko Sakkinen Cc: "Jason A. Donenfeld" Cc: Jason Gunthorpe Cc: Peter Huewe Cc: stable@vger.kernel.org Cc: Linux regressions mailing list Cc: Mario Limonciello Reported-by: Aneesh Kumar K. V Reported-by: Sachin Sant Closes: https://lore.kernel.org/lkml/99B81401-DB46-49B9-B321-CF832B50CAC3@linux.ibm.com/ Fixes: f1324bbc4011 ("tpm: disable hwrng for fTPM on some AMD designs") Signed-off-by: Jerry Snitselaar --- drivers/char/tpm/tpm-chip.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c index cd48033b804a..cf5499e51999 100644 --- a/drivers/char/tpm/tpm-chip.c +++ b/drivers/char/tpm/tpm-chip.c @@ -518,6 +518,7 @@ static int tpm_add_legacy_sysfs(struct tpm_chip *chip) * 6.x.y.z series: 6.0.18.6 + * 3.x.y.z series: 3.57.y.5 + */ +#ifdef CONFIG_X86 static bool tpm_amd_is_rng_defective(struct tpm_chip *chip) { u32 val1, val2; @@ -566,6 +567,12 @@ static bool tpm_amd_is_rng_defective(struct tpm_chip *chip) return true; } +#else +static inline bool tpm_amd_is_rng_defective(struct tpm_chip *chip) +{ + return false; +} +#endif /* CONFIG_X86 */ static int tpm_hwrng_read(struct hwrng *rng, void *data, size_t max, bool wait) { -- 2.38.1