Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp736201pxu; Thu, 15 Oct 2020 15:27:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmCRROZy29JKEtawySkyv19ZWL4wRf+1zpZzwKowDDbLUlC/fydtAQTH42svVVPN8gGcmw X-Received: by 2002:a05:6402:1455:: with SMTP id d21mr637130edx.279.1602800837803; Thu, 15 Oct 2020 15:27:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602800837; cv=none; d=google.com; s=arc-20160816; b=mFWYuJMeuSzhpVSmIkUJJEZzr+QH5kst8rLcDXn3Gg2WYg3L81fSq//FRge2lGu7u6 Yrm8+htJqyxP59n2QougoPcHzzOwsRnwdmUJjX5QADM8+2vTok7ngAWtxYl2gnfrMzl9 2rR7/EOQmtY2Bf9c/OltSY9J6Z0qEYJXEruaXZbB+SIjf880WIj0Cz8bg527IYVqBYZC ZC5HLuXH+P8BNsP5FIu7jSBoQVsJEIlT8kxYIf3fd1caaZazr0H7l7Rz4G0KZV7yYWiJ ctZXFstMT1HvUZkwDQMwEY0womCls4shfYyJ8oSsxyxfQfhgqx7GndWjtZhS+QY7MD46 zqHA== 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=mpuNHZgzNVhYq85pnOEXEuCpteLYCDH+aPUQTLrccAI=; b=otmyE6wuaSRi7QsHN/wEsP9Ut5L84gZZuzQ3wSx3eiu/pwrqjB87p7F9qt0Jov/mKV yqjocUaUXR7mvgr8HOGZhTkLPUcKDaP07hZrSy0GfPXrdGg16GlE1nRvpdWPdTCTrLyF yaiBqOn2MM96FkAqI4f7StQccpmxDKZ+QVLndEs/pSw+ISM7vcBP5uAUzjUMOJt/UJ6L ppNssL7M9sjYpOnHOBW5yObNxcKeMau3XrLQwU/7HhR09Uu+G0gptsW3ufTN1tUJmBUe 2qFLaiD4cpP/dbDMIfhV82lb8g9i9BkTjvmdAkUig1oqXPvDATupc4g6J2VegqqzL63n rP6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=W5CH9HZ0; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q1si244029edc.21.2020.10.15.15.26.56; Thu, 15 Oct 2020 15:27:17 -0700 (PDT) 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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=W5CH9HZ0; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729857AbgJOVoi (ORCPT + 99 others); Thu, 15 Oct 2020 17:44:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:50268 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729254AbgJOVoi (ORCPT ); Thu, 15 Oct 2020 17:44:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602798276; 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=mpuNHZgzNVhYq85pnOEXEuCpteLYCDH+aPUQTLrccAI=; b=W5CH9HZ0ol6EkKrRb9yLwofaXd3bTn4aC7rGn1B+TITBbd0x8PmuYfNuZvJOPdTnYJ0vM2 Exnw+iYTArvz26NOhcMLYMJPXq+69lboz063OtyJW6ITeTUfgNoFabXk40hcOcLyhjGG4k IgPSDOsRbT5GiaM1sYzcmuwh9x9Pz0o= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-353-Ftts9uMfPl-YR3YS8Fd97A-1; Thu, 15 Oct 2020 17:44:35 -0400 X-MC-Unique: Ftts9uMfPl-YR3YS8Fd97A-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B3D34186841C; Thu, 15 Oct 2020 21:44:33 +0000 (UTC) Received: from jsnitsel.users.ipa.redhat.com (ovpn-112-224.phx2.redhat.com [10.3.112.224]) by smtp.corp.redhat.com (Postfix) with ESMTP id F009176649; Thu, 15 Oct 2020 21:44:32 +0000 (UTC) From: Jerry Snitselaar To: linux-integrity@vger.kernel.org Cc: linux-kernel@vger.kernel.org, jarkko@kernel.org, Peter Huewe , Jason Gunthorpe , Hans de Goede , James Bottomley Subject: [PATCH] tpm_tis: Disable interrupts on ThinkPad T490s Date: Thu, 15 Oct 2020 14:44:30 -0700 Message-Id: <20201015214430.17937-1-jsnitsel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is a misconfiguration in the bios of the gpio pin used for the interrupt in the T490s. When interrupts are enabled in the tpm_tis driver code this results in an interrupt storm. This was initially reported when we attempted to enable the interrupt code in the tpm_tis driver, which previously wasn't setting a flag to enable it. Due to the reports of the interrupt storm that code was reverted and we went back to polling instead of using interrupts. Now that we know the T490s problem is a firmware issue, add code to check if the system is a T490s and disable interrupts if that is the case. This will allow us to enable interrupts for everyone else. If the user has a fixed bios they can force the enabling of interrupts with tpm_tis.interrupts=1 on the kernel command line. Cc: jarkko@kernel.org Cc: Peter Huewe Cc: Jason Gunthorpe Cc: Hans de Goede Reviewed-by: James Bottomley Signed-off-by: Jerry Snitselaar --- drivers/char/tpm/tpm_tis.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c index 0b214963539d..4ed6e660273a 100644 --- a/drivers/char/tpm/tpm_tis.c +++ b/drivers/char/tpm/tpm_tis.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "tpm.h" #include "tpm_tis_core.h" @@ -49,8 +50,8 @@ static inline struct tpm_tis_tcg_phy *to_tpm_tis_tcg_phy(struct tpm_tis_data *da return container_of(data, struct tpm_tis_tcg_phy, priv); } -static bool interrupts = true; -module_param(interrupts, bool, 0444); +static int interrupts = -1; +module_param(interrupts, int, 0444); MODULE_PARM_DESC(interrupts, "Enable interrupts"); static bool itpm; @@ -63,6 +64,28 @@ module_param(force, bool, 0444); MODULE_PARM_DESC(force, "Force device probe rather than using ACPI entry"); #endif +static int tpm_tis_disable_irq(const struct dmi_system_id *d) +{ + if (interrupts == -1) { + pr_notice("tpm_tis: %s detected: disabling interrupts.\n", d->ident); + interrupts = 0; + } + + return 0; +} + +static const struct dmi_system_id tpm_tis_dmi_table[] = { + { + .callback = tpm_tis_disable_irq, + .ident = "ThinkPad T490s", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T490s"), + }, + }, + {} +}; + #if defined(CONFIG_PNP) && defined(CONFIG_ACPI) static int has_hid(struct acpi_device *dev, const char *hid) { @@ -192,6 +215,8 @@ static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info) int irq = -1; int rc; + dmi_check_system(tpm_tis_dmi_table); + rc = check_acpi_tpm2(dev); if (rc) return rc; -- 2.28.0