From patchwork Thu Jun 29 20:41:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry Snitselaar X-Patchwork-Id: 13297301 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F35AEB64DD for ; Thu, 29 Jun 2023 20:43:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229936AbjF2Umy (ORCPT ); Thu, 29 Jun 2023 16:42:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229445AbjF2Umw (ORCPT ); Thu, 29 Jun 2023 16:42:52 -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 E23CE2689 for ; Thu, 29 Jun 2023 13:41:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1688071315; 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=NiRapyswkJWY4O+CHprdcjiat12/laJIOyOnzXJIyU51o+uA68oge3CRgSKA6XYyRZlrVo mFZkAUx9SE6arphFmF9M8RrR1upvuKyI/V8gikwWK2T722yjOR4nO1ajALGteKccSXI+6p 0aNQx72kwMVyjrGrquCWC1p9JjP409o= 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 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Precedence: bulk List-ID: X-Mailing-List: linux-integrity@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) {