Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp852967pxk; Thu, 17 Sep 2020 19:07:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzlPRPSYEw2njybjHW83E/8fqquVVU6UaEMMmYAT80R+NRgVL7n0qy5vHDPNINeU+GtV6s6 X-Received: by 2002:a17:906:341b:: with SMTP id c27mr33292075ejb.286.1600394841032; Thu, 17 Sep 2020 19:07:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600394841; cv=none; d=google.com; s=arc-20160816; b=RhTKBlRBUqU33mWNMNlxKwR2G66NrHI5IP+YgHZC7sHn3RhBxrqLkTfhVCQ1z4QbtD z/7SPJfzJDmxmlhM6DWZ2vL3c87qh0a5t00SfBjVPE7hrsFmW4D6JhJcPu4DPQLXPuNv luZ/xdgrok8tC8uipIwF4LuFVo97PhyIoiSbUkLP+SOxeOGG9hrBOWOjoPOA0WoCsAGS Q0xOmIcornWurZd6hCJjlSD/Emlg9KtYGJUllK+QKuIU41XmwDBOi7sM9YhGpC+7PqHk BmdLEhdrzB2osPs8NH8Q5pKjAMv4QXjLMp8G6Fa8LSQkz5Yll0pmFqcPG65QiBIGsLPP eEig== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=n+a3H2D4UWtISQ4z8DL9eiUlWx1mShtMueVjVfk4SoE=; b=uo1h+/Jue/BLy/Ij3vnE+/dN512nBRZdXca6dUIOcHG9MuWk+8luFzycPJxKz+Wvud pgAlP20hapDZ+U42qhYAUnxAhlhg3k6C8SchjZUxLa/ADpfRD5jF0exeWkLqOK0kzAl6 7LSwtFwcTIRP0qdAIiN0LgtbQ8xKNrqMd8ZETx2xf7NjPY4iMb2KH4fPG9Q39NfJNanL YPsmNFKKk6kuPDwMqioqzL6VAGf8ehcG/ctBAeI362MsF+WTW2UZb26xTpdclN9VZsMd eaGF6/nHrX8o0ItOk9KUyDbRDVMAAmuKAfbeMOdIY6NFaaIRsn5+KSwg+d7UVEHigdgY 5aHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LOgOuLGN; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g20si1436571ejz.452.2020.09.17.19.06.57; Thu, 17 Sep 2020 19:07:21 -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=@kernel.org header.s=default header.b=LOgOuLGN; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727405AbgIRCEz (ORCPT + 99 others); Thu, 17 Sep 2020 22:04:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:52578 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727392AbgIRCEv (ORCPT ); Thu, 17 Sep 2020 22:04:51 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 03F7C23600; Fri, 18 Sep 2020 02:04:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600394690; bh=edvpvBXgzkA1HGw8xxSPpBS1Btl6werh9kXB01ts0TM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LOgOuLGNtK0lt/eN91s32G4fGuTD+sBixN3Gl0pmuhmhvEObUWgUCK0G1dKEbiltZ 1uZ8SwwwjXasnPpDc5GthRmlWKVIVPMEDuSW+/bpXsvWee/kf2YmL4C6XXww2QFxgL 2JxFjCNUPi6VnXokMWDOX/OVvKbvHZoGPJ0tLZCM= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Alexander Shishkin , Andy Shevchenko , Greg Kroah-Hartman , Sasha Levin Subject: [PATCH AUTOSEL 5.4 179/330] intel_th: Disallow multi mode on devices where it's broken Date: Thu, 17 Sep 2020 21:58:39 -0400 Message-Id: <20200918020110.2063155-179-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200918020110.2063155-1-sashal@kernel.org> References: <20200918020110.2063155-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexander Shishkin [ Upstream commit 397c7729665a3b07a7b4ce7215173df8e9112809 ] Some versions of Intel TH have an issue that prevents the multi mode of MSU from working correctly, resulting in no trace data and potentially stuck MSU pipeline. Disable multi mode on such devices. Signed-off-by: Alexander Shishkin Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/20200317062215.15598-2-alexander.shishkin@linux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/hwtracing/intel_th/intel_th.h | 2 ++ drivers/hwtracing/intel_th/msu.c | 11 +++++++++-- drivers/hwtracing/intel_th/pci.c | 8 ++++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/hwtracing/intel_th/intel_th.h b/drivers/hwtracing/intel_th/intel_th.h index 6f4f5486fe6dc..5fe694708b7a3 100644 --- a/drivers/hwtracing/intel_th/intel_th.h +++ b/drivers/hwtracing/intel_th/intel_th.h @@ -47,11 +47,13 @@ struct intel_th_output { /** * struct intel_th_drvdata - describes hardware capabilities and quirks * @tscu_enable: device needs SW to enable time stamping unit + * @multi_is_broken: device has multiblock mode is broken * @has_mintctl: device has interrupt control (MINTCTL) register * @host_mode_only: device can only operate in 'host debugger' mode */ struct intel_th_drvdata { unsigned int tscu_enable : 1, + multi_is_broken : 1, has_mintctl : 1, host_mode_only : 1; }; diff --git a/drivers/hwtracing/intel_th/msu.c b/drivers/hwtracing/intel_th/msu.c index 255f8f41c8ff7..3cd2489d398c5 100644 --- a/drivers/hwtracing/intel_th/msu.c +++ b/drivers/hwtracing/intel_th/msu.c @@ -157,7 +157,8 @@ struct msc { /* config */ unsigned int enabled : 1, wrap : 1, - do_irq : 1; + do_irq : 1, + multi_is_broken : 1; unsigned int mode; unsigned int burst_len; unsigned int index; @@ -1665,7 +1666,7 @@ static int intel_th_msc_init(struct msc *msc) { atomic_set(&msc->user_count, -1); - msc->mode = MSC_MODE_MULTI; + msc->mode = msc->multi_is_broken ? MSC_MODE_SINGLE : MSC_MODE_MULTI; mutex_init(&msc->buf_mutex); INIT_LIST_HEAD(&msc->win_list); INIT_LIST_HEAD(&msc->iter_list); @@ -1877,6 +1878,9 @@ mode_store(struct device *dev, struct device_attribute *attr, const char *buf, return -EINVAL; found: + if (i == MSC_MODE_MULTI && msc->multi_is_broken) + return -EOPNOTSUPP; + mutex_lock(&msc->buf_mutex); ret = 0; @@ -2083,6 +2087,9 @@ static int intel_th_msc_probe(struct intel_th_device *thdev) if (!res) msc->do_irq = 1; + if (INTEL_TH_CAP(to_intel_th(thdev), multi_is_broken)) + msc->multi_is_broken = 1; + msc->index = thdev->id; msc->thdev = thdev; diff --git a/drivers/hwtracing/intel_th/pci.c b/drivers/hwtracing/intel_th/pci.c index 0d26484d67955..21fdf0b935166 100644 --- a/drivers/hwtracing/intel_th/pci.c +++ b/drivers/hwtracing/intel_th/pci.c @@ -120,6 +120,10 @@ static void intel_th_pci_remove(struct pci_dev *pdev) pci_free_irq_vectors(pdev); } +static const struct intel_th_drvdata intel_th_1x_multi_is_broken = { + .multi_is_broken = 1, +}; + static const struct intel_th_drvdata intel_th_2x = { .tscu_enable = 1, .has_mintctl = 1, @@ -152,7 +156,7 @@ static const struct pci_device_id intel_th_pci_id_table[] = { { /* Kaby Lake PCH-H */ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa2a6), - .driver_data = (kernel_ulong_t)0, + .driver_data = (kernel_ulong_t)&intel_th_1x_multi_is_broken, }, { /* Denverton */ @@ -207,7 +211,7 @@ static const struct pci_device_id intel_th_pci_id_table[] = { { /* Comet Lake PCH-V */ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa3a6), - .driver_data = (kernel_ulong_t)&intel_th_2x, + .driver_data = (kernel_ulong_t)&intel_th_1x_multi_is_broken, }, { /* Ice Lake NNPI */ -- 2.25.1