From patchwork Wed Sep 16 19:17:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11780627 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D4820159A for ; Wed, 16 Sep 2020 19:19:41 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 97C2C2075E for ; Wed, 16 Sep 2020 19:19:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="QIYT6pXl"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ggy8YTLP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 97C2C2075E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=XrvIEaqzxvv71Jmv4/WQcch/9F1A9SgFhlq2HqTckl8=; b=QIYT6pXlzIjMHgM+r0ZHhP2jR 5ZhqfFu48+YvKU7+rPW6+VoMQBuYV6EC1TqIi4uNFl0eKRJj+KrJCi15EF4Hxaz/StTMMtY2bZOwk UQ+4ujLEnzMr2+azUVGuPQ51PodjAsC8WfnbrpIXISRvDDkBcbT/BaGxl/QbyrVs3rbo4l9ZhF9QC ZP4zP+zefeI501ddihv2O+9hFK8MrVgZJk22iJsy8J+Onm9aF8l39YIbTj+8nO28/TvNwWZRiyWfS 3EJn3vT6X7Vhrn2t/QGa/S7nOObyJojo5DwAcTFaS/B661YuYGtr0rqgublF2/6QpNciB7k4rIKiF QUkwz49/A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIcwB-00058g-If; Wed, 16 Sep 2020 19:17:51 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIcw2-00055Q-V9 for linux-arm-kernel@lists.infradead.org; Wed, 16 Sep 2020 19:17:43 +0000 Received: by mail-pl1-x643.google.com with SMTP id u9so3713360plk.4 for ; Wed, 16 Sep 2020 12:17:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cY9qq0UTJdrHZLOBosy7Hke2d1u48dWNW8TgCKuAPxU=; b=ggy8YTLP75CQgZYBBvnkkAh/RNppSuBP82IpD3hpb0RqQuBBlzPVkUqa06MTenRfCe eLvMmOOupzFhjWnNz9YYBOro9CKDTZw6aA2xg774/JrPgYbJ9AkekzHXArr7IQaejlKu PUdgn3k6A+EkwVQkJxhGa807Qgl//q6W6olinhCBIY3y8h5hmycpTjoflf6ej0WQuM0+ 2cQRwBxQrZnZ3bE1TbAHulzA8U2gUl2NY4kXKCocQFtZKuXjVWw8M5/W8P7xqF2eMskr pP5c4d4u2LTxSjTwb1SHfgJxd1uSNxmdrL1B2qFmQxKrmvrx48n3yKgjRmRbfMKvu33C vrzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cY9qq0UTJdrHZLOBosy7Hke2d1u48dWNW8TgCKuAPxU=; b=sM1OJKq/PvFtHcnaN9vHPB7l4VBiXLnYHvmAZFs+0VG4175gjTndBIplVnE4ZIba52 3ciyI3zpEsXpZu+oykrcCELAcIzLOHcMS2TPi+Mf4VLJDnh8uqHvT5n2aYtsAGhDC8Zw 63Y0lXECK6DRIPNnSEfRtcbSUkob44lY3NNNYAZ6OlfjLIUltYs+H8V0obL42WQBcNZW NhA3i+YeIV6VmFamFH4mtSrHBw5HVxHnD3d0h5kvjv3eSd4DhbxydL+RVM0LWL5r7bb2 fU+qrvTNbwotXGhZ5bGTMV1N4eL2F8J8PnaEW/4m45EOnu2vpZ/obr8t+s7xrh0b+xPo iKAw== X-Gm-Message-State: AOAM5306X+xUEeFLBYu54Yk3MHtAMHAJxvDbH2uIT4hlQPx7UxAFBSC4 Vap72QcimOepqoOlGdOJE24IBFqn/r43iQ== X-Google-Smtp-Source: ABdhPJwOWdYxJTkhuLXAeymfRUBOsd1OQDTqSARmHDegoDAnAfvj8i7Jwj2ec4u2ERzOxsalpoVQUQ== X-Received: by 2002:a17:902:d913:b029:d0:cbe1:e712 with SMTP id c19-20020a170902d913b02900d0cbe1e712mr25790469plz.32.1600283860693; Wed, 16 Sep 2020 12:17:40 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id b2sm11373688pfp.3.2020.09.16.12.17.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 12:17:40 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 01/16] coresight: etm4x: Fix etm4_count race by moving cpuhp callbacks to init Date: Wed, 16 Sep 2020 13:17:22 -0600 Message-Id: <20200916191737.4001561-2-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200916191737.4001561-1-mathieu.poirier@linaro.org> References: <20200916191737.4001561-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200916_151743_018340_E3EACFD8 X-CRM114-Status: GOOD ( 22.72 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:643 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Sai Prakash Ranjan etm4_count keeps track of number of ETMv4 registered and on some systems, a race is observed on etm4_count variable which can lead to multiple calls to cpuhp_setup_state_nocalls_cpuslocked(). This function internally calls cpuhp_store_callbacks() which prevents multiple registrations of callbacks for a given state and due to this race, it returns -EBUSY leading to ETM probe failures like below. coresight-etm4x: probe of 7040000.etm failed with error -16 This race can easily be triggered with async probe by setting probe type as PROBE_PREFER_ASYNCHRONOUS and with ETM power management property "arm,coresight-loses-context-with-cpu". Prevent this race by moving cpuhp callbacks to etm driver init since the cpuhp callbacks doesn't have to depend on the etm4_count and can be once setup during driver init. Similarly we move cpu_pm notifier registration to driver init and completely remove etm4_count usage. Also now we can use non cpuslocked version of cpuhp callbacks with this movement. Fixes: 9b6a3f3633a5 ("coresight: etmv4: Fix CPU power management setup in probe() function") Fixes: 58eb457be028 ("hwtracing/coresight-etm4x: Convert to hotplug state machine") Suggested-by: Suzuki K Poulose Signed-off-by: Sai Prakash Ranjan Reviewed-by: Stephen Boyd Tested-by: Stephen Boyd Reviewed-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm4x.c | 65 +++++++++---------- 1 file changed, 31 insertions(+), 34 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index 96425e818fc2..45d169a2512c 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -48,8 +48,6 @@ module_param(pm_save_enable, int, 0444); MODULE_PARM_DESC(pm_save_enable, "Save/restore state on power down: 1 = never, 2 = self-hosted"); -/* The number of ETMv4 currently registered */ -static int etm4_count; static struct etmv4_drvdata *etmdrvdata[NR_CPUS]; static void etm4_set_default_config(struct etmv4_config *config); static int etm4_set_event_filters(struct etmv4_drvdata *drvdata, @@ -1397,28 +1395,25 @@ static struct notifier_block etm4_cpu_pm_nb = { .notifier_call = etm4_cpu_pm_notify, }; -/* Setup PM. Called with cpus locked. Deals with error conditions and counts */ -static int etm4_pm_setup_cpuslocked(void) +/* Setup PM. Deals with error conditions and counts */ +static int __init etm4_pm_setup(void) { int ret; - if (etm4_count++) - return 0; - ret = cpu_pm_register_notifier(&etm4_cpu_pm_nb); if (ret) - goto reduce_count; + return ret; - ret = cpuhp_setup_state_nocalls_cpuslocked(CPUHP_AP_ARM_CORESIGHT_STARTING, - "arm/coresight4:starting", - etm4_starting_cpu, etm4_dying_cpu); + ret = cpuhp_setup_state_nocalls(CPUHP_AP_ARM_CORESIGHT_STARTING, + "arm/coresight4:starting", + etm4_starting_cpu, etm4_dying_cpu); if (ret) goto unregister_notifier; - ret = cpuhp_setup_state_nocalls_cpuslocked(CPUHP_AP_ONLINE_DYN, - "arm/coresight4:online", - etm4_online_cpu, NULL); + ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, + "arm/coresight4:online", + etm4_online_cpu, NULL); /* HP dyn state ID returned in ret on success */ if (ret > 0) { @@ -1427,21 +1422,15 @@ static int etm4_pm_setup_cpuslocked(void) } /* failed dyn state - remove others */ - cpuhp_remove_state_nocalls_cpuslocked(CPUHP_AP_ARM_CORESIGHT_STARTING); + cpuhp_remove_state_nocalls(CPUHP_AP_ARM_CORESIGHT_STARTING); unregister_notifier: cpu_pm_unregister_notifier(&etm4_cpu_pm_nb); - -reduce_count: - --etm4_count; return ret; } -static void etm4_pm_clear(void) +static void __init etm4_pm_clear(void) { - if (--etm4_count != 0) - return; - cpu_pm_unregister_notifier(&etm4_cpu_pm_nb); cpuhp_remove_state_nocalls(CPUHP_AP_ARM_CORESIGHT_STARTING); if (hp_online) { @@ -1497,22 +1486,12 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id) if (!desc.name) return -ENOMEM; - cpus_read_lock(); etmdrvdata[drvdata->cpu] = drvdata; if (smp_call_function_single(drvdata->cpu, etm4_init_arch_data, drvdata, 1)) dev_err(dev, "ETM arch init failed\n"); - ret = etm4_pm_setup_cpuslocked(); - cpus_read_unlock(); - - /* etm4_pm_setup_cpuslocked() does its own cleanup - exit on error */ - if (ret) { - etmdrvdata[drvdata->cpu] = NULL; - return ret; - } - if (etm4_arch_supported(drvdata->arch) == false) { ret = -EINVAL; goto err_arch_supported; @@ -1559,7 +1538,6 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id) err_arch_supported: etmdrvdata[drvdata->cpu] = NULL; - etm4_pm_clear(); return ret; } @@ -1597,4 +1575,23 @@ static struct amba_driver etm4x_driver = { .probe = etm4_probe, .id_table = etm4_ids, }; -builtin_amba_driver(etm4x_driver); + +static int __init etm4x_init(void) +{ + int ret; + + ret = etm4_pm_setup(); + + /* etm4_pm_setup() does its own cleanup - exit on error */ + if (ret) + return ret; + + ret = amba_driver_register(&etm4x_driver); + if (ret) { + pr_err("Error registering etm4x driver\n"); + etm4_pm_clear(); + } + + return ret; +} +device_initcall(etm4x_init); From patchwork Wed Sep 16 19:17:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11780607 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2A5D9159A for ; Wed, 16 Sep 2020 19:18:08 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A6C712075E for ; Wed, 16 Sep 2020 19:18:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="rn7yMHqP"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="U626TRHm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A6C712075E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=9ILzaeP5Rz9dvVwoCbOiNN2JrYkEAg+JKXjA8c5lAiI=; b=rn7yMHqPRvj/DIbxw0fCWqosE qrB4tOM4Z/lHQWKfUWFvkstS0MzMxYElEc7s2VgaHu958v61wDcHguhwJbZTKKebQ7kGVr/DeHwfW YRr++h/NYIy5Sii4xHHqlAt1b1idkW+nbPz43fd7XIe9LUVDoXbXtv/Y7iLfGkv03EccSr5LvHivA lCGhIG3jb2eykfSwVs4F33LxXup3r1hXDRG4lsYffOa1a6dDDbH/Kkw0wAUQw1mmBWAb7JA3zmhkZ CQmDnKXyC7yBgMcugccYp79NJ8MfcDdysUlFORKyoa9+Dqx2/0W1N1O5V+zNY9rhdSKDx686DixnT ahbC/25Nw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIcwF-0005AP-W1; Wed, 16 Sep 2020 19:17:56 +0000 Received: from mail-pj1-x1044.google.com ([2607:f8b0:4864:20::1044]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIcw5-000561-5r for linux-arm-kernel@lists.infradead.org; Wed, 16 Sep 2020 19:17:47 +0000 Received: by mail-pj1-x1044.google.com with SMTP id md22so1808379pjb.0 for ; Wed, 16 Sep 2020 12:17:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zx/tRahkEP1ZuMIl3SnwL71U4RtbDAoiNGLgupaBarI=; b=U626TRHmq+dValxTL/wxQGez4XilqyapSenwhZd08kDwFTFiUjAv297n7tj3r+Wj3l kONbPUFOnlqEE81iPzu1w1aIVA5pH+FHhI/CKOmpC4Z1xPeQLqV/nXHIppqli7bcQYma Eknf+HeeKvZqAn0AOV9cPMni+JWnHAN+HlwOr07XYJILofpviCyF/NCOiD/v+yTCpZr1 L3h1XYk62XIXSgFTedflfw2Rk9apbzIbyTBes1YaqK//ENPKh1jdIXgswZbYD+LQa6Pq UMtw0edbobNVD4BlfuG3JX3ShOnM9Ce9R5Hj+QdV9WNhY1I3isw64vJeb7iaN415hLHe WYyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zx/tRahkEP1ZuMIl3SnwL71U4RtbDAoiNGLgupaBarI=; b=P2t8nXd6ChXZ+Qpdd65xwmjKN2HwpQtvoIiYbprZkpV20BOjmP1cD5aOmWqS9b/iur WXks+qX+E5I4Zk6h7POv2EG21jhYY35gZi1ir7nPzCeDSq4y3ktadfLidXTRRu8LP3HA Sw/Wp53cRiITfc6eicZ9OA6wQ4T3UY3um9SterESmPsZqRe2fdH2KfR6vKLNFJNtM63F kciJ+SFV8EipcEpGVoCyVe1zFmzIiQtV3UvDexj28/zFFrelEPoe47h331bkfX8C5Zz7 fJI/qVsAqeLT7GdIilvuCq42Cv5/+eBNQTlWOl7kKA/3U0119stsCd62S0CWrfwHB2v3 qr7A== X-Gm-Message-State: AOAM532z2CH8QCNQOeO/nWrt4FhY3vVDPyQIIgABEANlka6/UmoTlyaO 3QWNLepyKrkjY8aXzrm9hgg08g== X-Google-Smtp-Source: ABdhPJwwyxa6q5cJWUmAVgT0vuDVnsHuBPjDmEaxttGpGRNdARKtaR8d32GydHCyu5cf97Qw6sEpFA== X-Received: by 2002:a17:902:8602:b029:d1:e5e7:be65 with SMTP id f2-20020a1709028602b02900d1e5e7be65mr7578928plo.63.1600283862043; Wed, 16 Sep 2020 12:17:42 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id b2sm11373688pfp.3.2020.09.16.12.17.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 12:17:41 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 02/16] coresight: stm: Support marked packet Date: Wed, 16 Sep 2020 13:17:23 -0600 Message-Id: <20200916191737.4001561-3-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200916191737.4001561-1-mathieu.poirier@linaro.org> References: <20200916191737.4001561-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200916_151745_306035_BAD1E090 X-CRM114-Status: GOOD ( 13.82 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:1044 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Tingwei Zhang STP_PACKET_MARKED is not supported by STM currently. Add STM_FLAG_MARKED to support marked packet in STM. Signed-off-by: Tingwei Zhang Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-stm.c | 11 +++++++---- include/uapi/linux/coresight-stm.h | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c index 673d2f56ed1e..2ba819a47cf6 100644 --- a/drivers/hwtracing/coresight/coresight-stm.c +++ b/drivers/hwtracing/coresight/coresight-stm.c @@ -412,6 +412,7 @@ static ssize_t notrace stm_generic_packet(struct stm_data *stm_data, void __iomem *ch_addr; struct stm_drvdata *drvdata = container_of(stm_data, struct stm_drvdata, stm); + unsigned int stm_flags; if (!(drvdata && local_read(&drvdata->mode))) return -EACCES; @@ -421,8 +422,9 @@ static ssize_t notrace stm_generic_packet(struct stm_data *stm_data, ch_addr = stm_channel_addr(drvdata, channel); - flags = (flags == STP_PACKET_TIMESTAMPED) ? STM_FLAG_TIMESTAMPED : 0; - flags |= test_bit(channel, drvdata->chs.guaranteed) ? + stm_flags = (flags & STP_PACKET_TIMESTAMPED) ? + STM_FLAG_TIMESTAMPED : 0; + stm_flags |= test_bit(channel, drvdata->chs.guaranteed) ? STM_FLAG_GUARANTEED : 0; if (size > drvdata->write_bytes) @@ -432,7 +434,7 @@ static ssize_t notrace stm_generic_packet(struct stm_data *stm_data, switch (packet) { case STP_PACKET_FLAG: - ch_addr += stm_channel_off(STM_PKT_TYPE_FLAG, flags); + ch_addr += stm_channel_off(STM_PKT_TYPE_FLAG, stm_flags); /* * The generic STM core sets a size of '0' on flag packets. @@ -444,7 +446,8 @@ static ssize_t notrace stm_generic_packet(struct stm_data *stm_data, break; case STP_PACKET_DATA: - ch_addr += stm_channel_off(STM_PKT_TYPE_DATA, flags); + stm_flags |= (flags & STP_PACKET_MARKED) ? STM_FLAG_MARKED : 0; + ch_addr += stm_channel_off(STM_PKT_TYPE_DATA, stm_flags); stm_send(ch_addr, payload, size, drvdata->write_bytes); break; diff --git a/include/uapi/linux/coresight-stm.h b/include/uapi/linux/coresight-stm.h index 8847dbf24151..7ff3709c01b8 100644 --- a/include/uapi/linux/coresight-stm.h +++ b/include/uapi/linux/coresight-stm.h @@ -5,6 +5,7 @@ #include #define STM_FLAG_TIMESTAMPED _BITUL(3) +#define STM_FLAG_MARKED _BITUL(4) #define STM_FLAG_GUARANTEED _BITUL(7) /* From patchwork Wed Sep 16 19:17:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11780629 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 26C1E6CA for ; Wed, 16 Sep 2020 19:19:48 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EDE342075E for ; Wed, 16 Sep 2020 19:19:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="tKAjYFhL"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Y9ZKLVzN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EDE342075E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=zo2opuubXr/2h9QqLKnQ0L4n5fpKT2JSlFVWoJrOzBo=; b=tKAjYFhL+xIfij70S7ufc5ime T7XC/ZNxriTI9DaoG5GTpiOm2sQC/rEpZrKdXoAUQWC/cXUT8rsf4tlxyreQcVWhMy95xySwCydpm ojaP3h5tghlP2I5qhx+IsKAaTW8Gyn7iJqe45w6705pNQUp7OsdnSHJhsLwqnNDPSfVLZSCo17aFI MzV2OwyUKHQYCOZnHsWu7LaJd3VgECDzIuJ10jIvYe5MGaHbMjw/VeLQmlbBCz0FO9d3zZb5qpUeS jfO42HBZIV4X0C8Q2qL+KKGSLdkmwMZZtqxM/wDc1VYYM4c+V0j0yy+FGf0XKjnUoDAc12T7cQxu/ CRd2Em81g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIcwN-0005CP-EA; Wed, 16 Sep 2020 19:18:03 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIcw5-000568-GN for linux-arm-kernel@lists.infradead.org; Wed, 16 Sep 2020 19:17:47 +0000 Received: by mail-pl1-x641.google.com with SMTP id bg9so3715306plb.2 for ; Wed, 16 Sep 2020 12:17:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zqVd5aJCn3jWe+cLGn+cDLVmuUTYejBKrMGwZzLg0eA=; b=Y9ZKLVzNc/nkjU1/CyaKQ2tsDuZ0qQO9dBf3jmNBAa/cCQJif4eqy8Jxu69IhNVDJg UBOYI1objMHVqMgcvVNtWvxjibaeJklTvMR6wCpGQglJ7ukuDB5kYD7KGDPLPFCJbPQf ZjwpBBylRtHkxubA8fHTvzqi2lNMHxTpb+iW/cDAw3Xnhd5tmbOqoryKGpbJHZNO/9gv CtQ+fENL3YHadXcs+XoasGrdd3GRDpIsh3UKYZVirD4WyoHOkIausNQ+7NsXSJOAoe/6 jFXSSfXrPJvWsalQjI1MKsAwScRfkcS8UudrVthiSLmP+H9ONpev/dOaBNfgUB/f9DIZ zMmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zqVd5aJCn3jWe+cLGn+cDLVmuUTYejBKrMGwZzLg0eA=; b=h89AB94LTbbjSib38qoxza/AiwqldEDN+f2dO+S6iU5uJ/Uoz1KSWXZMAwjh0e+4ta wqhcgsaOhz6SfzA0VyZQw1PM9uo4Zb4mOAOvQkSXtIcixGhV38A/rZXvnZ44LGjA60cO XJ6tBVIRHDYy0a3BHnMLMRxKLQbfRk3HDKalWQT4n6ZIx9HoRbhgejExB4Bc7pGQhVZj sH4feIaK5rHT+AN4Z0lxsq6qprlL7YzAMZ8uum8N+M1mneeWesg71ciBPrxVO7x50qkm RBx5BCWfeXThKRSbEF8bx5EBiZ+LAxKyK35eLQ4mcuc+J2/xgYDt4CEXnaefkTo+t9mQ N5LQ== X-Gm-Message-State: AOAM533V6qvRmq4NxSy4EmJ8iWNZN79PkYhXMpOHSPBvyOvKllaJsfz0 e3mcWUGj2xEbAst/sZJostzXlbleVeTo/w== X-Google-Smtp-Source: ABdhPJzLYqy0aga5oYoEC1V8aQ1YRhCJMYbaeWrOEjaU8Z2bhDPgdxNoE8d76Iew49j9klf7Dl2C6w== X-Received: by 2002:a17:902:a70c:b029:d1:e5e7:be56 with SMTP id w12-20020a170902a70cb02900d1e5e7be56mr7873079plq.48.1600283863147; Wed, 16 Sep 2020 12:17:43 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id b2sm11373688pfp.3.2020.09.16.12.17.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 12:17:42 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 03/16] coresight: fix offset by one error in counting ports Date: Wed, 16 Sep 2020 13:17:24 -0600 Message-Id: <20200916191737.4001561-4-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200916191737.4001561-1-mathieu.poirier@linaro.org> References: <20200916191737.4001561-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200916_151745_623152_FDA4F6A3 X-CRM114-Status: GOOD ( 18.91 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:641 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Mian Yousaf Kaukab Since port-numbers start from 0, add 1 to port-number to get the port count. Fix following crash when Coresight is enabled on ACPI based systems: [ 61.061736] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000008 ... [ 61.135494] pc : acpi_coresight_parse_graph+0x1c4/0x37c [ 61.140705] lr : acpi_coresight_parse_graph+0x160/0x37c [ 61.145915] sp : ffff800012f4ba40 [ 61.145917] x29: ffff800012f4ba40 x28: ffff00becce62f98 [ 61.159896] x27: 0000000000000005 x26: ffff00becd8a7c88 [ 61.165195] x25: ffff00becd8a7d88 x24: ffff00becce62f80 [ 61.170492] x23: ffff800011ef99c0 x22: ffff009efb8bc010 [ 61.175790] x21: 0000000000000018 x20: 0000000000000005 [ 61.181087] x19: ffff00becce62e80 x18: 0000000000000020 [ 61.186385] x17: 0000000000000001 x16: 00000000000002a8 [ 61.191682] x15: ffff000838648550 x14: ffffffffffffffff [ 61.196980] x13: 0000000000000000 x12: ffff00becce62d87 [ 61.202277] x11: 00000000ffffff76 x10: 000000000000002e [ 61.207575] x9 : ffff8000107e1a68 x8 : ffff00becce63000 [ 61.212873] x7 : 0000000000000018 x6 : 000000000000003f [ 61.218170] x5 : 0000000000000000 x4 : 0000000000000000 [ 61.223467] x3 : 0000000000000000 x2 : 0000000000000000 [ 61.228764] x1 : ffff00becce62f80 x0 : 0000000000000000 [ 61.234062] Call trace: [ 61.236497] acpi_coresight_parse_graph+0x1c4/0x37c [ 61.241361] coresight_get_platform_data+0xdc/0x130 [ 61.246225] tmc_probe+0x138/0x2dc [ 61.246227] amba_probe+0xdc/0x220 [ 61.255779] really_probe+0xe8/0x49c [ 61.255781] driver_probe_device+0xec/0x140 [ 61.255782] device_driver_attach+0xc8/0xd0 [ 61.255785] __driver_attach+0xac/0x180 [ 61.265857] bus_for_each_dev+0x78/0xcc [ 61.265859] driver_attach+0x2c/0x40 [ 61.265861] bus_add_driver+0x150/0x244 [ 61.265863] driver_register+0x80/0x13c [ 61.273591] amba_driver_register+0x60/0x70 [ 61.273594] tmc_driver_init+0x20/0x2c [ 61.281582] do_one_initcall+0x50/0x230 [ 61.281585] do_initcalls+0x104/0x144 [ 61.291831] kernel_init_freeable+0x168/0x1dc [ 61.291834] kernel_init+0x1c/0x120 [ 61.299215] ret_from_fork+0x10/0x18 [ 61.299219] Code: b9400022 f9400660 9b277c42 8b020000 (f9400404) [ 61.307381] ---[ end trace 63c6c3d7ec6a9b7c ]--- [ 61.315225] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b Fixes: d375b356e687 ("coresight: Fix support for sparsely populated ports") Reported-by: Ruediger Oertel Signed-off-by: Mian Yousaf Kaukab Reviewed-by: Suzuki K Poulose Tested-by: Jeremy Linton Reviewed-by: Jeremy Linton Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-platform.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c index bfd44231d7ad..227e234a2470 100644 --- a/drivers/hwtracing/coresight/coresight-platform.c +++ b/drivers/hwtracing/coresight/coresight-platform.c @@ -711,11 +711,11 @@ static int acpi_coresight_parse_graph(struct acpi_device *adev, return dir; if (dir == ACPI_CORESIGHT_LINK_MASTER) { - if (ptr->outport > pdata->nr_outport) - pdata->nr_outport = ptr->outport; + if (ptr->outport >= pdata->nr_outport) + pdata->nr_outport = ptr->outport + 1; ptr++; } else { - WARN_ON(pdata->nr_inport == ptr->child_port); + WARN_ON(pdata->nr_inport == ptr->child_port + 1); /* * We do not track input port connections for a device. * However we need the highest port number described, @@ -723,8 +723,8 @@ static int acpi_coresight_parse_graph(struct acpi_device *adev, * record for an output connection. Hence, do not move * the ptr for input connections */ - if (ptr->child_port > pdata->nr_inport) - pdata->nr_inport = ptr->child_port; + if (ptr->child_port >= pdata->nr_inport) + pdata->nr_inport = ptr->child_port + 1; } } From patchwork Wed Sep 16 19:17:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11780609 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 15D3659D for ; Wed, 16 Sep 2020 19:18:21 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C1EEA20770 for ; Wed, 16 Sep 2020 19:18:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="y2IXWYFq"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="iH9cQ5U4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C1EEA20770 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=SsffnJThsTmrrDwBUBZiu3yaKfjEW080RQvvWvFKdJE=; b=y2IXWYFqFwHzYDlGSSC4jnMr2 cg9Nvk20PK4ncgsPkImpJvyAm1i6DYFikh9dthlXvQBhJBUok+K4mR8zEwZZ8ZmbCtWv4Kv8ZE0tJ kYpoShubQLKN364zPOxS4ujcK6FdD8kp2fTEXDwRQRBuk2/eLJcdCCRJy15nh7o2/TILeasA9fPnf Er8OmfR1kYi66EaGNObvp+ZyIJWO0Moq6wrWKfwpi7SFCQMpA72I6qCU+r1KdJWz9KZrSUFnl2PKR +0ZSoLGveeRXEgvvuVQRdbnXoJUw/Gvt/VMiojVisfW5vYDTTz+DkXO23z/6OJMvYcdfyrbm1D5OG iJuLqXJ6w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIcwR-0005De-Rx; Wed, 16 Sep 2020 19:18:07 +0000 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIcw6-00056D-68 for linux-arm-kernel@lists.infradead.org; Wed, 16 Sep 2020 19:17:48 +0000 Received: by mail-pl1-x642.google.com with SMTP id bd2so3717897plb.7 for ; Wed, 16 Sep 2020 12:17:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VYd9vsMIvM6W5z8VipRqt8JWUGSGOZvBgZLW0lx/IbU=; b=iH9cQ5U4dGRFKXsPt3w+wBosrROiy65k54Hywk8fFXi0rhVWuLOjYURh48SacwT4nr GeS+UM+eROmeW3fcAAx7b94mQWRaFyb9LEBqFqY2swbSXdZBAGcZQiDxNDuEzELgzR9y wahfNd2kd7DpXN7MUg93g45g2YyC34Q9dCIbtsraSbKKxQ8+5PK4QAJtn5cVm4NNj3rD V62iYnUkZ44FMB8kyzAZGbg3pzHUMYRwApN/w9/wH0DE0v+roIYFmftuVjwM6m5+67Ge I4apC8B7COaMhJEfMJ2CcXG6wCP61yYRNm9UElWlwWGCUshDQn3x2dcKH6xOzzsOXvO+ E7RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VYd9vsMIvM6W5z8VipRqt8JWUGSGOZvBgZLW0lx/IbU=; b=Ve1CPA74wwnnWTHWMUverqsj3XUb/I+1EYCzu8Z9Bvm+aEFXsqNBFruN6HmyT/vNK7 mKO/L4aQzF6IZ/5l3brar6BuX8BNnGCIwBYR5GUnjAoTg8oUTeSfp+FXsRtxUY7OieyR rof3PzN8VCc7ihHZ/gJ4UzrfXK6L3o8e4UjxO5IbDjA96cgxRFo4wVD90Q157PFL/oCX J/4zkFhRQ5zaVZcTa2uvFn9yNmJb93RMyl2jyHruLQ42vRi9yf74LWMzzK6sa87kVKkg gIL3GA1CHyRS/piJcyzuogg/ueg9ZU+ph/X25k90mF5HaLfb5TTx0aFCRmc+fuFrWR1/ wxjA== X-Gm-Message-State: AOAM531KTB6ost7Nf0cgMezycpa8w4pziZoIBKWuShRMR3c2Tt12Ki8h 9QStvXM9Z5eIf57fwh2geBtDiQ== X-Google-Smtp-Source: ABdhPJymzfClG8oNPG52tCxmHebQozrzANmAu9DQgH72QUmoWldyvmcLEKwbPXxWKBriQhgns7dUrA== X-Received: by 2002:a17:902:8545:b029:d1:f2e3:8dd4 with SMTP id d5-20020a1709028545b02900d1f2e38dd4mr2961002plo.65.1600283864060; Wed, 16 Sep 2020 12:17:44 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id b2sm11373688pfp.3.2020.09.16.12.17.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 12:17:43 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 04/16] coresight: etm4x: Add Support for HiSilicon ETM device Date: Wed, 16 Sep 2020 13:17:25 -0600 Message-Id: <20200916191737.4001561-5-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200916191737.4001561-1-mathieu.poirier@linaro.org> References: <20200916191737.4001561-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200916_151746_320114_69A5C4AA X-CRM114-Status: GOOD ( 12.65 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:642 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Qi Liu Add ETMv4 periperhal ID for HiSilicon Hip08 and Hip09 platform. Hip08 contains ETMv4.2 device and Hip09 contains ETMv4.5 device. Signed-off-by: Qi Liu Acked-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm4x.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index 45d169a2512c..f027ceed9793 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -1564,6 +1564,8 @@ static const struct amba_id etm4_ids[] = { CS_AMBA_UCI_ID(0x000bb805, uci_id_etm4),/* Qualcomm Kryo 4XX Cortex-A55 */ CS_AMBA_UCI_ID(0x000bb804, uci_id_etm4),/* Qualcomm Kryo 4XX Cortex-A76 */ CS_AMBA_UCI_ID(0x000cc0af, uci_id_etm4),/* Marvell ThunderX2 */ + CS_AMBA_UCI_ID(0x000b6d01, uci_id_etm4),/* HiSilicon-Hip08 */ + CS_AMBA_UCI_ID(0x000b6d02, uci_id_etm4),/* HiSilicon-Hip09 */ {}, }; From patchwork Wed Sep 16 19:17:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11780631 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9B8EF59D for ; Wed, 16 Sep 2020 19:19:58 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 596142075E for ; Wed, 16 Sep 2020 19:19:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="t9YbpRT7"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="bArPy8Nl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 596142075E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=BrH1AaZEnDeWbBIFxwxUsRWQ/CCPX796WMcwGJClJWs=; b=t9YbpRT7vutbvYeMJHe3HEoQv 54k24JVOmrkDyCldV2oToXXfDdNgE4vvhIrHXjNQNq3AwuMJb97s+nLKxNuT90NSMny2zUFrvM3Ye Cax2/qtxdiAaPkkJIEbWvmELMQaO6YQxtkJ+vmy2oehtgJUJgG1yIFzgE6BUZLXff7TLaCGvAU4+q r6hy0ZczLmG3YvGkN5pHJ1zMTh+oPlCTpsQyXaWBOCMjxQom1F3vnt8okY5pPvJ6qR25YzZOajYAH GdgD70+ShXYZ8h9Frnk4GhatkLJmN9k3VA+0KiqQ95/eiaZXihz306bxOKIlcKYVS0v/WJ6vQ/GGO WfJVolVhw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIcwW-0005FE-UL; Wed, 16 Sep 2020 19:18:13 +0000 Received: from mail-pj1-x1042.google.com ([2607:f8b0:4864:20::1042]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIcw7-00056m-6y for linux-arm-kernel@lists.infradead.org; Wed, 16 Sep 2020 19:17:49 +0000 Received: by mail-pj1-x1042.google.com with SMTP id b17so2019112pji.1 for ; Wed, 16 Sep 2020 12:17:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JtOdjzk2AjLKKx8fR1wiVnJLztwSFAhfdF2zzVQT4WQ=; b=bArPy8Nlme0HHLA+psQxCWzsczi82wThoDcWgLRGfYdXivtIGIe6HXIlWyeGHfsGgn R/YYPSm1m1UV+z7W7EThJm96k/+RYf6MGr0x3EYMcLA/yXFvUn5kucWYY1cSwdbq82QW nmom4rug9qS6T0mEtEZdv4YTASbpMSHt0KAnVekuvGFr0z4YqtxcpFXMLss8k9CKBf+l aHGdvyaddYcQBfdhpe9Gi/Al+UjRyUFD7RCCSzZonzy7Ow1R1JeM2PzJBbTkMuZeebrC SLNpCKeC4j14ffjhcQF3oC+PGoS6Iejecvwdhaqzip11uReuPVdFENNFY6aDOLD7ywmE rurw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JtOdjzk2AjLKKx8fR1wiVnJLztwSFAhfdF2zzVQT4WQ=; b=clOAsyVUWbghpRV3Gai6DdFefZV5aiKYqTwqNhaS9rVMS7BGtb0qOJK2gAuPRuDPBB xr6wdNvBRkxGkM4EbVA5YexDbQfDT4MdZjmSmvhcEYpRBtab+AReEOL3reJStKzhiF4s tfcCAQlW0vSC/Qy0QXgM2t/QbLNmqrkBrZABxM9iaPicb6IBRgISFs9KQ9tbih9ZLq7s h2sxkT545mwZr52QjHNtrBd63M1Osln3IJ7HNQZkaNmH37ThhWMK4s8opV/Sns5o+LM3 0qLV22txvWccQk7NTUxUMGoyCsDiLicL9WA7fRpxumwpKf/QFHLwzb4Olt7oa5ysAKeS F8mw== X-Gm-Message-State: AOAM530iCYpBcPFxQB8xu5ZQAug7eey0PA8nMrTZF/iqb3q736guXo8H JsbbBe44GV8R3IdyV01ZrNU+9kpJIErUBg== X-Google-Smtp-Source: ABdhPJxtYWXM55bbRMdbJcs1S4l9lg8eh9p4tiUeKPoE0W9ygP3Q8NplZVDmsrgrvwbSXxe8nRr7qQ== X-Received: by 2002:a17:90a:fc6:: with SMTP id 64mr5487062pjz.194.1600283865126; Wed, 16 Sep 2020 12:17:45 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id b2sm11373688pfp.3.2020.09.16.12.17.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 12:17:44 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 05/16] coresight: cti: disclaim device only when it's claimed Date: Wed, 16 Sep 2020 13:17:26 -0600 Message-Id: <20200916191737.4001561-6-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200916191737.4001561-1-mathieu.poirier@linaro.org> References: <20200916191737.4001561-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200916_151747_318886_7CC7AB2A X-CRM114-Status: GOOD ( 14.27 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:1042 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Tingwei Zhang Coresight_claim_device() is called in cti_starting_cpu() only when CTI is enabled while coresight_disclaim_device() is called uncontionally in cti_dying_cpu(). This triggered below WARNING. Only call disclaim device when CTI device is enabled to fix it. [ 75.989643] WARNING: CPU: 1 PID: 14 at kernel/drivers/hwtracing/coresight/coresight.c:209 coresight_disclaim_device_unlocked+0x10/0x24 [ 75.989697] CPU: 1 PID: 14 Comm: migration/1 Not tainted 5.9.0-rc1-gff1304be0a05-dirty #21 [ 75.989709] Hardware name: Thundercomm Dragonboard 845c (DT) [ 75.989737] pstate: 80c00085 (Nzcv daIf +PAN +UAO BTYPE=--) [ 75.989758] pc : coresight_disclaim_device_unlocked+0x10/0x24 [ 75.989775] lr : coresight_disclaim_device+0x24/0x38 [ 75.989783] sp : ffff800011cd3c90 . [ 75.990018] Call trace: [ 75.990041] coresight_disclaim_device_unlocked+0x10/0x24 [ 75.990066] cti_dying_cpu+0x34/0x4c [ 75.990101] cpuhp_invoke_callback+0x84/0x1e0 [ 75.990121] take_cpu_down+0x90/0xe0 [ 75.990154] multi_cpu_stop+0x134/0x160 [ 75.990171] cpu_stopper_thread+0xb0/0x13c [ 75.990196] smpboot_thread_fn+0x1c4/0x270 [ 75.990222] kthread+0x128/0x154 [ 75.990251] ret_from_fork+0x10/0x18 Fixes: e9b880581d55 ("coresight: cti: Add CPU Hotplug handling to CTI driver") Signed-off-by: Tingwei Zhang Reviewed-by: Mike Leach Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-cti.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/coresight-cti.c b/drivers/hwtracing/coresight/coresight-cti.c index 3ccc703dc940..d6fea6efec71 100644 --- a/drivers/hwtracing/coresight/coresight-cti.c +++ b/drivers/hwtracing/coresight/coresight-cti.c @@ -742,7 +742,8 @@ static int cti_dying_cpu(unsigned int cpu) spin_lock(&drvdata->spinlock); drvdata->config.hw_powered = false; - coresight_disclaim_device(drvdata->base); + if (drvdata->config.hw_enabled) + coresight_disclaim_device(drvdata->base); spin_unlock(&drvdata->spinlock); return 0; } From patchwork Wed Sep 16 19:17:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11780613 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 62F1459D for ; Wed, 16 Sep 2020 19:18:37 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 137402075E for ; Wed, 16 Sep 2020 19:18:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="BSM6Vjo5"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="POX3iV6n" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 137402075E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=t297vnjGhXt0B2t3AOnuUgulEjnpvaI2o8iW4QhZJ+c=; b=BSM6Vjo5vXM2nX8E0G/kymstB Sah61xrNkhGocXE+QmQglm4xsxd/tqGHCZvCeIUmc6/kEpFMQZiwW2lsBGOy/v4oZy6q7WDtrnWrU 26Fye8dy7D+93FrsI5GkDAFxghQVRsneaLLQ9TyBIdPN/vYK9T4FxBvab1Zz8bo7AoxJMU1ro48nY W0+AsWoHtRPGZq/SYYXEmprO+u+DrsMHaiS2CkU+wO0nJCd8GxjpubSaK64L5UdxK37w34583wk5G qfObwhKYL+ppwEdfcSbd/TR3t8YHFnWpNUiqBaW6rGdHfWz+pZVr/N+55tbOGheI71TF/1wlUhR7p tfU4zWO2A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIcwg-0005I6-42; Wed, 16 Sep 2020 19:18:22 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIcw7-00057B-Sq for linux-arm-kernel@lists.infradead.org; Wed, 16 Sep 2020 19:17:49 +0000 Received: by mail-pl1-x643.google.com with SMTP id y6so3715579plt.9 for ; Wed, 16 Sep 2020 12:17:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Uwz7uDiSpijhZG4h1tserEStKWNE3HZkcr8/salV8us=; b=POX3iV6nlCb0dIrYb1Gn/NjEpUNZlcqETAyRE7QwmNxuJnURWKse4aRCc0oxZFvFxQ NLxaRsFQ33H8dikTXbDpTdr75xDM5Q4EqDHzbHxwNqVMkBh8KcTjq+r8d9FX76CcJ5tl YqqT4UjP4undHKXoQnkb02v1e4PD5RlDaxnd1dxy2BJevRKMMSagD/is5TW3e+fYJRZx kA0FhRzYob0WRAdz+hl2TaUtTJEcqhReLPa89j61Z29U9bSM4uspgI8LiQOKdZFE6hyo SYW251azdWJqq9g5xpvAoh6VxBNlUIJJAJ5uVeV7kxzntD2wKM5+bVcrtMClsubV13Fr 6btA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Uwz7uDiSpijhZG4h1tserEStKWNE3HZkcr8/salV8us=; b=ELyWRgOHqAvLDtGKwfQ8XoMvECZEC33wMjXamsQ0X0jJ3Ext8Cye3OfzX8bT8yiL0N Wnl+k6nP0Ac7UvuRUjJeVt8mbW8+x8VZBHFEULzmlblY9axOHDJsPB3Yar0BGbvlV8Z8 6/8k7FbHeygvIfssFEYzh6pVg4Qi52BUha/43SFiLGOnVlORnqRZkdd3vlBMiY6ayiaw 8jujDjwleKroiLE9HLy9O/WFEQJ/biFX1TMi4B+t2BlWv21nILNiLMnS1uF+CNokgIkk rp1ipjY2AZlnHRiijZEx6JSrmrr5xjj/a7+pQTT0ffe4wmwoe9eKxNB4mrrLsmoKqyfC NZcA== X-Gm-Message-State: AOAM530tYiDP2aFyBp+oDldZF94DPftXhQIpzehdFBGi7c2f/i+gUEbE +LYhF0QIvOUdeNJDvPp0jbtX1Q== X-Google-Smtp-Source: ABdhPJymvRW+Zat6n+q9jRaLx3Lamg31OZ5/XkFmEre09r7lk2LGVcjpGdqpqkkE0ExchqtAUQeQSg== X-Received: by 2002:a17:90b:3105:: with SMTP id gc5mr5357689pjb.225.1600283866159; Wed, 16 Sep 2020 12:17:46 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id b2sm11373688pfp.3.2020.09.16.12.17.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 12:17:45 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 06/16] coresight: cti: remove pm_runtime_get_sync() from CPU hotplug Date: Wed, 16 Sep 2020 13:17:27 -0600 Message-Id: <20200916191737.4001561-7-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200916191737.4001561-1-mathieu.poirier@linaro.org> References: <20200916191737.4001561-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200916_151748_012257_351F3F86 X-CRM114-Status: GOOD ( 13.96 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:643 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Tingwei Zhang Below BUG is triggered by call pm_runtime_get_sync() in cti_cpuhp_enable_hw(). It's in CPU hotplug callback with interrupt disabled. Pm_runtime_get_sync() calls clock driver to enable clock which could sleep. Remove pm_runtime_get_sync() in cti_cpuhp_enable_hw() since pm_runtime_get_sync() is called in cti_enabld and pm_runtime_put() is called in cti_disabled. No need to increase pm count when CPU gets online since it's not decreased when CPU is offline. [ 105.800279] BUG: scheduling while atomic: swapper/1/0/0x00000002 [ 105.800290] Modules linked in: [ 105.800327] CPU: 1 PID: 0 Comm: swapper/1 Tainted: G W 5.9.0-rc1-gff1304be0a05-dirty #21 [ 105.800337] Hardware name: Thundercomm Dragonboard 845c (DT) [ 105.800353] Call trace: [ 105.800414] dump_backtrace+0x0/0x1d4 [ 105.800439] show_stack+0x14/0x1c [ 105.800462] dump_stack+0xc0/0x100 [ 105.800490] __schedule_bug+0x58/0x74 [ 105.800523] __schedule+0x590/0x65c [ 105.800538] schedule+0x78/0x10c [ 105.800553] schedule_timeout+0x188/0x250 [ 105.800585] qmp_send.constprop.10+0x12c/0x1b0 [ 105.800599] qmp_qdss_clk_prepare+0x18/0x20 [ 105.800622] clk_core_prepare+0x48/0xd4 [ 105.800639] clk_prepare+0x20/0x34 [ 105.800663] amba_pm_runtime_resume+0x54/0x90 [ 105.800695] __rpm_callback+0xdc/0x138 [ 105.800709] rpm_callback+0x24/0x78 [ 105.800724] rpm_resume+0x328/0x47c [ 105.800739] __pm_runtime_resume+0x50/0x74 [ 105.800768] cti_starting_cpu+0x40/0xa4 [ 105.800795] cpuhp_invoke_callback+0x84/0x1e0 [ 105.800814] notify_cpu_starting+0x9c/0xb8 [ 105.800834] secondary_start_kernel+0xd8/0x164 [ 105.800933] CPU1: Booted secondary processor 0x0000000100 [0x517f803c] Fixes: e9b880581d55 ("coresight: cti: Add CPU Hotplug handling to CTI driver") Signed-off-by: Tingwei Zhang Reviewed-by: Mike Leach Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-cti.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-cti.c b/drivers/hwtracing/coresight/coresight-cti.c index d6fea6efec71..c4e9cc7034ab 100644 --- a/drivers/hwtracing/coresight/coresight-cti.c +++ b/drivers/hwtracing/coresight/coresight-cti.c @@ -141,9 +141,7 @@ static int cti_enable_hw(struct cti_drvdata *drvdata) static void cti_cpuhp_enable_hw(struct cti_drvdata *drvdata) { struct cti_config *config = &drvdata->config; - struct device *dev = &drvdata->csdev->dev; - pm_runtime_get_sync(dev->parent); spin_lock(&drvdata->spinlock); config->hw_powered = true; @@ -163,7 +161,6 @@ static void cti_cpuhp_enable_hw(struct cti_drvdata *drvdata) /* did not re-enable due to no claim / no request */ cti_hp_not_enabled: spin_unlock(&drvdata->spinlock); - pm_runtime_put(dev->parent); } /* disable hardware */ From patchwork Wed Sep 16 19:17:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11780615 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 875E059D for ; Wed, 16 Sep 2020 19:19:20 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 370212075E for ; Wed, 16 Sep 2020 19:19:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="yBxU1YAz"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="GTGP5UbU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 370212075E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=1/+B/SXgc4JKNeCOd3pPrjRf8oNLoAQU1epJkUZZF/U=; b=yBxU1YAz68UPkadgNeDTtuwo+ BskkwscSnjq2FocQ9RqIexQQ68gbThYdYIXUDkhNY7sE+EjOgJ9k8iLnk3HpERZN2SSBHOKSMgjw6 Z8LA+MaPZo6lSEAXD8FJ8hVQ8Fjlv8gpuwL6aEvWfvBRnoRAPTaKVI9kVPGNsI9iaHyv34DU301ep k2imwe1nuC8Mbg958zNG3KvmkvIzUj0+BuT18E3vvBxUCzBIoJ0Q6CIEwVElghlm6JO0ucPyrhVDc v+/sGLAxdOwzl3Jw2I+D1O9PmvA4tKXBCifCk6q2sR5Nn5ia8jGMf7sKkwdo1yq41IvXl3vRo6wE4 ORno8hesg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIcxK-0005YQ-An; Wed, 16 Sep 2020 19:19:02 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIcw9-00057o-Hd for linux-arm-kernel@lists.infradead.org; Wed, 16 Sep 2020 19:17:50 +0000 Received: by mail-pg1-x542.google.com with SMTP id l71so1962980pge.4 for ; Wed, 16 Sep 2020 12:17:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hMJpZJO+2jiFbj8wcLuUaO2zDrxZ7Y0vpl9oHvf3HWM=; b=GTGP5UbUl6DVcepsjEQDw63YIXpk6nBZ7o3Wei+3/VinKwNlvopmyWceSpRvUe513y wH11+u1eI7b7L37gaxadfb91MFPg4Sc6utEOff4kYaOIPde0MaDeNYgRqY8uvRf8r0rx PDfpcKzE4qWU3RDGFuvM+Y+TzfE+vu4ZngZ7G2KlSqrnwEUR4XSa+asd7pFJZji9aspX nsOtizA1EhA5ACB2S03hUAJB9AmUGzRuVfcShA9eAWAyWs0pTk1sd5lQtba8rOQIUMwb IQeHKFWje2GpFB7mYRT05BjXRNwDbzkLAp50VDqyycSMYuR3ZXdk7K7e/ImWhS3/nUEj qkuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hMJpZJO+2jiFbj8wcLuUaO2zDrxZ7Y0vpl9oHvf3HWM=; b=ooiJUxAMMEtqwV8KKUa055ca8+hkddZgEb54YGUkFjsq/UnDuYDmGxoMpNqTDVjToY nvS8G/q1qefyGdQDI7ovn7w+EDxUawZCLVJf3AR3IJul7XhSZ0/G/MIvEvPafKJVADyu tkrxWwkHB59yIKnag+v7fb+znwarhg0CLoEXXKRUXZpi6uZJefv8cJBarDPcGjrbWy9u SNzhbQjWdif8uErqkEl8z2Jul1/Jp+UeH60GsPXF1JS9RJPPKnYrrxHvCPAnOcTmaFPx gPA15vbbd8BmCINCpKdOETNoUOWUcg6FzLyr6zYHkBtLVDvFrz+cCp0waxVJXkxfDwpp Rjqw== X-Gm-Message-State: AOAM532xgZ8kP5wBOQdEODYsSfAeTqNSAXWY3cBB0UEYwErlPAYL6nuf 16eF8xhXVGaNlldoR2FMzVaGr74pL8ZmFQ== X-Google-Smtp-Source: ABdhPJzWt/qy7GvIwMAy8Zb248zpCpwAEUbHaVHNwAuqZd34yzLd+Cg/+m/JJ7VA+j9Hav+2Y7ZQcg== X-Received: by 2002:a62:7f13:0:b029:13e:d13d:a087 with SMTP id a19-20020a627f130000b029013ed13da087mr23721856pfd.30.1600283867426; Wed, 16 Sep 2020 12:17:47 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id b2sm11373688pfp.3.2020.09.16.12.17.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 12:17:46 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 07/16] coresight: etm4x: Ensure default perf settings filter user/kernel Date: Wed, 16 Sep 2020 13:17:28 -0600 Message-Id: <20200916191737.4001561-8-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200916191737.4001561-1-mathieu.poirier@linaro.org> References: <20200916191737.4001561-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200916_151749_602186_076CD0F0 X-CRM114-Status: GOOD ( 16.96 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:542 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Mike Leach Moving from using an address filter to trace the default "all addresses" range to no filtering to acheive the same result, has caused the perf filtering of kernel/user address spaces from not working unless an explicit address filter was used. This is due to the original code using a side-effect of the address filtering rather than setting the global TRCVICTLR exception level filtering. The use of the mode sysfs file is also similarly affected. A helper function is added to fix both instances. Fixes: ae2041510d5d ("coresight: etmv4: Update default filter and initialisation") Reported-by: Leo Yan Signed-off-by: Mike Leach Reviewed-by: Leo Yan Tested-by: Leo Yan Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm4x.c | 32 +++++++++++++------ drivers/hwtracing/coresight/coresight-etm4x.h | 3 ++ 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index f027ceed9793..63cb1e0d5953 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -52,6 +52,7 @@ static struct etmv4_drvdata *etmdrvdata[NR_CPUS]; static void etm4_set_default_config(struct etmv4_config *config); static int etm4_set_event_filters(struct etmv4_drvdata *drvdata, struct perf_event *event); +static u64 etm4_get_access_type(struct etmv4_config *config); static enum cpuhp_state hp_online; @@ -783,6 +784,22 @@ static void etm4_init_arch_data(void *info) CS_LOCK(drvdata->base); } +/* Set ELx trace filter access in the TRCVICTLR register */ +static void etm4_set_victlr_access(struct etmv4_config *config) +{ + u64 access_type; + + config->vinst_ctrl &= ~(ETM_EXLEVEL_S_VICTLR_MASK | ETM_EXLEVEL_NS_VICTLR_MASK); + + /* + * TRCVICTLR::EXLEVEL_NS:EXLEVELS: Set kernel / user filtering + * bits in vinst_ctrl, same bit pattern as TRCACATRn values returned by + * etm4_get_access_type() but with a relative shift in this register. + */ + access_type = etm4_get_access_type(config) << ETM_EXLEVEL_LSHIFT_TRCVICTLR; + config->vinst_ctrl |= (u32)access_type; +} + static void etm4_set_default_config(struct etmv4_config *config) { /* disable all events tracing */ @@ -800,6 +817,9 @@ static void etm4_set_default_config(struct etmv4_config *config) /* TRCVICTLR::EVENT = 0x01, select the always on logic */ config->vinst_ctrl = BIT(0); + + /* TRCVICTLR::EXLEVEL_NS:EXLEVELS: Set kernel / user filtering */ + etm4_set_victlr_access(config); } static u64 etm4_get_ns_access_type(struct etmv4_config *config) @@ -1064,7 +1084,7 @@ static int etm4_set_event_filters(struct etmv4_drvdata *drvdata, void etm4_config_trace_mode(struct etmv4_config *config) { - u32 addr_acc, mode; + u32 mode; mode = config->mode; mode &= (ETM_MODE_EXCL_KERN | ETM_MODE_EXCL_USER); @@ -1076,15 +1096,7 @@ void etm4_config_trace_mode(struct etmv4_config *config) if (!(mode & ETM_MODE_EXCL_KERN) && !(mode & ETM_MODE_EXCL_USER)) return; - addr_acc = config->addr_acc[ETM_DEFAULT_ADDR_COMP]; - /* clear default config */ - addr_acc &= ~(ETM_EXLEVEL_NS_APP | ETM_EXLEVEL_NS_OS | - ETM_EXLEVEL_NS_HYP); - - addr_acc |= etm4_get_ns_access_type(config); - - config->addr_acc[ETM_DEFAULT_ADDR_COMP] = addr_acc; - config->addr_acc[ETM_DEFAULT_ADDR_COMP + 1] = addr_acc; + etm4_set_victlr_access(config); } static int etm4_online_cpu(unsigned int cpu) diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h index b8283e1d6d88..5259f96fd28a 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.h +++ b/drivers/hwtracing/coresight/coresight-etm4x.h @@ -192,6 +192,9 @@ #define ETM_EXLEVEL_NS_HYP BIT(14) #define ETM_EXLEVEL_NS_NA BIT(15) +/* access level control in TRCVICTLR - same bits as TRCACATRn but shifted */ +#define ETM_EXLEVEL_LSHIFT_TRCVICTLR 8 + /* secure / non secure masks - TRCVICTLR, IDR3 */ #define ETM_EXLEVEL_S_VICTLR_MASK GENMASK(19, 16) /* NS MON (EL3) mode never implemented */ From patchwork Wed Sep 16 19:17:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11780635 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 54BBE59D for ; Wed, 16 Sep 2020 19:20:37 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1F0642076B for ; Wed, 16 Sep 2020 19:20:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="DhyUHcVc"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="nFj128Hp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1F0642076B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=wSO6zvf0kHJA4jqFCHNkZoOHAfgb5N3qQQFLY4naPN8=; b=DhyUHcVcAvpQx30sB2VIFeccZ ih4tMGKMsFUr9QOMHsoHt8tmMUOTRcdXvI+wDGgatdAA8VFfn727jfOTnTgzWzlj7UwRSOn4U0k0p iz3kq7xl33h1he9lyEEaKBukXxgcTh4gDyIuVc7hHK1Xd4BekAgOhd9YorBcxeURuN9WjZdgrVrYn ezyyESTKicO9PLZRg3EluE4m2/DsumLayHOrObuEuDGh1zTC5QTPOzL0G3C6tp3+vusdxGChnLkTt A+h0LsAqj5l+CyniFNGw+yShoUhi++gLSmyjDDEiKpmu87aRX8WWP608mClFXVQdsmuaFkCkswlTW WIcspIt7Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIcwt-0005MB-KI; Wed, 16 Sep 2020 19:18:35 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIcwA-00057x-Iv for linux-arm-kernel@lists.infradead.org; Wed, 16 Sep 2020 19:17:51 +0000 Received: by mail-pf1-x441.google.com with SMTP id b124so4515511pfg.13 for ; Wed, 16 Sep 2020 12:17:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0uNOvGB6rUb/6Wge2+zVi2CVioKcm2kY4sTfTs2ztTc=; b=nFj128Hpt/ngFdgL72D8VO/D730YM7ANn/edQINa2cXvgEwmgYFnSZMkXaJVuCe59Z r+feZtf+0MAPDm46d2xzx5bnRsHNumFHEH5RQFKfdM+Cin0R89gxg0cUqQt5J9CmoJB4 mot0FWrSiCH4Cdke16zQylNGIMUj7BliwwyqwyYClSKGlcBQlQGWUgP0SG/1m5HWOMAe eCQCFRaGaAjZTzhLSgma2Qn0i9h7xbWO9121lYc6dcJ9lmCdPMw0bfW11TfXnrhC3Mls 60NT9PgtUgFbDFe63GmNVWmXSDPq6ef2MSaHO/IftMTYLk3nMRbs/IBZJHtqFE3iGJw+ /QAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0uNOvGB6rUb/6Wge2+zVi2CVioKcm2kY4sTfTs2ztTc=; b=tblza+fBNPuaUFAaGzBQk8VN0Da/6I98WUm29ETU7DuH9I9fg2YADheW/Hk2BseLFk /mqksGHpS+I5ZF8SAKd6RTtORzRlYDY9vrtsE1jAxV1nYkV2NFe29G5vfq59qrsd6Px6 diOC1U+fFTZ106Iitr3hJ1WEAMQwSdoLxF4sKY9onatNWHngvkFcgruoYdTd1Hlk1ER2 zY8zIcT7zyn5Ij2x1N99rmFR/hNcUX6LyAV5SimYAFWJoNeOeAZLiR8Ic4YAeY+z6DAv yaJ6Nvd4rmFm6DcKr5V29If+SL1bG5RxNODkU4zYyZd67E9IJT34toBr3cotuNQ2E7DS 8Z2Q== X-Gm-Message-State: AOAM531i88VCclLQUUfDVf664CtT4sL8/AQABvSpwf98p238xHqLRxyb a/1G/ah+P/L045lRsyxxmFDD5g== X-Google-Smtp-Source: ABdhPJx0MiHiiGTPhNQdOx875EloCFk/Qn3vdbGOL8WQgxcaBGrvx0ggnF6mqJ8WhqZweIupkKPE+Q== X-Received: by 2002:a62:503:0:b029:13e:d13d:a0f9 with SMTP id 3-20020a6205030000b029013ed13da0f9mr23556330pff.21.1600283868487; Wed, 16 Sep 2020 12:17:48 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id b2sm11373688pfp.3.2020.09.16.12.17.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 12:17:48 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 08/16] coresight: etm4x: Fix issues within reset interface of sysfs Date: Wed, 16 Sep 2020 13:17:29 -0600 Message-Id: <20200916191737.4001561-9-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200916191737.4001561-1-mathieu.poirier@linaro.org> References: <20200916191737.4001561-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200916_151750_662483_B3ACE750 X-CRM114-Status: GOOD ( 15.09 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:441 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Jonathan Zhou The member @nr_addr_cmp is not a bool value, using operator '>' instead to avoid unexpected failure. Cc: Mathieu Poirier Cc: Suzuki K Poulose Cc: Mike Leach Cc: Shaokun Zhang Cc: lizixian@hisilicon.com Fixes: a77de2637c9e ("coresight: etm4x: moving sysFS entries to a dedicated file") Signed-off-by: Jonathan Zhou Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm4x-sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c index b673e738bc9a..a588cd6de01c 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c @@ -206,7 +206,7 @@ static ssize_t reset_store(struct device *dev, * each trace run. */ config->vinst_ctrl = BIT(0); - if (drvdata->nr_addr_cmp == true) { + if (drvdata->nr_addr_cmp > 0) { config->mode |= ETM_MODE_VIEWINST_STARTSTOP; /* SSSTATUS, bit[9] */ config->vinst_ctrl |= BIT(9); From patchwork Wed Sep 16 19:17:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11780623 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 49AAA159A for ; Wed, 16 Sep 2020 19:19:32 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 058DE2075E for ; Wed, 16 Sep 2020 19:19:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="iyFrJq7S"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="pe50ZNHf" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 058DE2075E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=gzJrb26TbX2ouNlMwTipvWU9JO+n1sd1A6Ax+kGNnU8=; b=iyFrJq7SB1a45POe672b/EQmu 55gepcUCdP4dCrkrKeZgIxsVQ2vs/2ksGJhopmGn3eKY3u81P+SQJsACMZ0fcx2aL67KY7Csis9Hn +lL/ztRl/CCrkYUrRl/CXmD95oHYwZlb4a6MuO5Vi99PZrgA3Z5gjB3XepTRZWplT8kiBEd9lIZaP ChCcLZliBTF3Hta2LJV8iw7T2Q9nph5hGUvyF5SruRqOP/7pQE/Sj9IfbCrBEboOg6Tc9VmYHmUfW yoMI3FcyaNuCquBh+Wap1G98uQZ+R4tXhMZr/toj2R1QJ878Xfl7w8lFrl+fbnN9heJ0ihUCSYb4P T4nJ1abgA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIcxc-0005ea-0v; Wed, 16 Sep 2020 19:19:20 +0000 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIcwB-00058O-CS for linux-arm-kernel@lists.infradead.org; Wed, 16 Sep 2020 19:17:54 +0000 Received: by mail-pl1-x642.google.com with SMTP id u9so3713548plk.4 for ; Wed, 16 Sep 2020 12:17:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hW2rx2qlWMb00+NZjVDOtwBqZo3cFuEztlDfxIo5LGk=; b=pe50ZNHfLR7enisj2deltRCUPVcMiupajZ1bdGgoLDVGoIFLLrvd/cgGsxMISC06Go OKHLb/RXGTyDwyZUqdYlwcXMTRLsdXG8KvvClJ/q1wy2rdmqRMCrSsEeavh2LEjNyZEk lEYQ3MQ7po7dKt9mvzNKduvx87rjAk3SCXdV9Q5b7gmwsJIYtVuKneP+9JAWNDpsykjA 6rb3Tz0KijSlziIu+9XeYHzm+qKsBfTpWFPvsLkkIYn5yIrabg7lTLCqAGrP5X+Mv+N6 3bKs/NWH4CqrKD1LuhxDYvuTYa+vxnSxFHdRyovhvkfAyNkO6WZpZKFN88KkfHFb1JK4 /r8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hW2rx2qlWMb00+NZjVDOtwBqZo3cFuEztlDfxIo5LGk=; b=KCQmqsc7Yq7zKxriUcuciGuBizHDBOOK+nqeFS7G+ocK4a+NGCSzGOnS4sQRIyT/Yq e4tWdiIkNh/pFWlTfSr1VCKEDhEMwAGsXVvfR6+AQxc08TEEjoinZ4A9suFymhwCpX1w P+b1YLY1cTJm2B3SQrKfE1GGF++WBsyo/QItWiC+35c0mxmh0hd/9zLKlsTJRwoTOJEv BXJy+gEUPIumjAXfU/9t8WVajhTyAad9ackPNSGgi7I19iPHWktVuOS4vo4BHxqrSSMe Yx/yghyCJuI/3FpCiEYv/779+XkTQ6KngpA/qqT9QljRxHBN25G883DnrCF0o/zckWzy yY2g== X-Gm-Message-State: AOAM531/iIIb9Nox87Dkmt34LHsAnsSXQZaxR/LidljTFwx90eXZHwly dxDqbXpvaekJGrxr1BAhPhB7Og== X-Google-Smtp-Source: ABdhPJzSbGhnR1NOlWyUYSHPjqf68ZvVCgirP9Y5ifby+wfXgSqO9diUbLaO9Ihm5EQ0NPOHxIit1g== X-Received: by 2002:a17:902:ff02:b029:d0:89f3:28d2 with SMTP id f2-20020a170902ff02b02900d089f328d2mr24564215plj.14.1600283869636; Wed, 16 Sep 2020 12:17:49 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id b2sm11373688pfp.3.2020.09.16.12.17.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 12:17:49 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 09/16] coresight: cti: Write regsiters directly in cti_enable_hw() Date: Wed, 16 Sep 2020 13:17:30 -0600 Message-Id: <20200916191737.4001561-10-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200916191737.4001561-1-mathieu.poirier@linaro.org> References: <20200916191737.4001561-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200916_151751_492737_D4F6946E X-CRM114-Status: GOOD ( 16.05 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:642 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Tingwei Zhang Deadlock as below is triggered by one CPU holds drvdata->spinlock and calls cti_enable_hw(). Smp_call_function_single() is called in cti_enable_hw() and tries to let another CPU write CTI registers. That CPU is trying to get drvdata->spinlock in cti_cpu_pm_notify() and doesn't response to IPI from smp_call_function_single(). [ 988.335937] CPU: 6 PID: 10258 Comm: sh Tainted: G W L 5.8.0-rc6-mainline-16783-gc38daa79b26b-dirty #1 [ 988.346364] Hardware name: Thundercomm Dragonboard 845c (DT) [ 988.352073] pstate: 20400005 (nzCv daif +PAN -UAO BTYPE=--) [ 988.357689] pc : smp_call_function_single+0x158/0x1b8 [ 988.362782] lr : smp_call_function_single+0x124/0x1b8 ... [ 988.451638] Call trace: [ 988.454119] smp_call_function_single+0x158/0x1b8 [ 988.458866] cti_enable+0xb4/0xf8 [coresight_cti] [ 988.463618] coresight_control_assoc_ectdev+0x6c/0x128 [coresight] [ 988.469855] coresight_enable+0x1f0/0x364 [coresight] [ 988.474957] enable_source_store+0x5c/0x9c [coresight] [ 988.480140] dev_attr_store+0x14/0x28 [ 988.483839] sysfs_kf_write+0x38/0x4c [ 988.487532] kernfs_fop_write+0x1c0/0x2b0 [ 988.491585] vfs_write+0xfc/0x300 [ 988.494931] ksys_write+0x78/0xe0 [ 988.498283] __arm64_sys_write+0x18/0x20 [ 988.502240] el0_svc_common+0x98/0x160 [ 988.506024] do_el0_svc+0x78/0x80 [ 988.509377] el0_sync_handler+0xd4/0x270 [ 988.513337] el0_sync+0x164/0x180 This change write CTI registers directly in cti_enable_hw(). Config->hw_powered has been checked to be true with spinlock holded. CTI is powered and can be programmed until spinlock is released. Fixes: 6a0953ce7de9 ("coresight: cti: Add CPU idle pm notifer to CTI devices") Signed-off-by: Tingwei Zhang [Re-ordered variable declaration] Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-cti.c | 24 +++++---------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-cti.c b/drivers/hwtracing/coresight/coresight-cti.c index c4e9cc7034ab..47f3c9abae30 100644 --- a/drivers/hwtracing/coresight/coresight-cti.c +++ b/drivers/hwtracing/coresight/coresight-cti.c @@ -86,22 +86,16 @@ void cti_write_all_hw_regs(struct cti_drvdata *drvdata) CS_LOCK(drvdata->base); } -static void cti_enable_hw_smp_call(void *info) -{ - struct cti_drvdata *drvdata = info; - - cti_write_all_hw_regs(drvdata); -} - /* write regs to hardware and enable */ static int cti_enable_hw(struct cti_drvdata *drvdata) { struct cti_config *config = &drvdata->config; struct device *dev = &drvdata->csdev->dev; + unsigned long flags; int rc = 0; pm_runtime_get_sync(dev->parent); - spin_lock(&drvdata->spinlock); + spin_lock_irqsave(&drvdata->spinlock, flags); /* no need to do anything if enabled or unpowered*/ if (config->hw_enabled || !config->hw_powered) @@ -112,19 +106,11 @@ static int cti_enable_hw(struct cti_drvdata *drvdata) if (rc) goto cti_err_not_enabled; - if (drvdata->ctidev.cpu >= 0) { - rc = smp_call_function_single(drvdata->ctidev.cpu, - cti_enable_hw_smp_call, - drvdata, 1); - if (rc) - goto cti_err_not_enabled; - } else { - cti_write_all_hw_regs(drvdata); - } + cti_write_all_hw_regs(drvdata); config->hw_enabled = true; atomic_inc(&drvdata->config.enable_req_count); - spin_unlock(&drvdata->spinlock); + spin_unlock_irqrestore(&drvdata->spinlock, flags); return rc; cti_state_unchanged: @@ -132,7 +118,7 @@ static int cti_enable_hw(struct cti_drvdata *drvdata) /* cannot enable due to error */ cti_err_not_enabled: - spin_unlock(&drvdata->spinlock); + spin_unlock_irqrestore(&drvdata->spinlock, flags); pm_runtime_put(dev->parent); return rc; } From patchwork Wed Sep 16 19:17:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11780639 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C06496CA for ; Wed, 16 Sep 2020 19:21:17 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7AB1120770 for ; Wed, 16 Sep 2020 19:21:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="GwVhLsko"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="KZJOSshq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7AB1120770 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=y/Vq2AdEuHMerP0j2F2/G8kRv2WR9s5YhNrx7oHIGo8=; b=GwVhLskomzuX2IhaNmXELabLo UixePbXQ8roQCWPuZy8fKyO++Hq0+8s1lNe2viHrYbTxPXEPZ8kNGoiAqo5mH4PiHXzigoqwQK7dq rmciZYsLR77rEv8iMX5Nv7B+uphhwClWX0KN8AjtNMs2iYk6Ub1eNzDWjew9iOXdR/vUbyHK0H5j0 MSBU21ZQS+LbWFWUE7o22mo5JJUFimoRCpG8TWc9yvEM2gxA9OwlH4vX0EkE54zpZ7hRVaqIzyyxE YBIfuBrvjZ4x0Rlppkomz0Sfxh+Qq93V7MPES8AHPTS/ojLg99zu4/Qkq5uNAGAeFt5kdLXH1I/Oe PbOpUTeig==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIcxg-0005j7-9L; Wed, 16 Sep 2020 19:19:24 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIcwC-00058z-SJ for linux-arm-kernel@lists.infradead.org; Wed, 16 Sep 2020 19:17:56 +0000 Received: by mail-pf1-x444.google.com with SMTP id k8so1200418pfk.2 for ; Wed, 16 Sep 2020 12:17:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4vmHBZCLmqwGh1JrNfyEzOHsM8+Nrv3dx8TspskyRXo=; b=KZJOSshqj5FFzQ7czSqunHffeDNfegzos7p7XFd0SdxE2EBbpS1IWYdpTpcJn0XxQ5 ClNb0/mXssumjBRQnZn0J9dLOQRFd/5F8t7zo2TpN+f1fYlb8lk1PbcNZwqOM5Ztk5Xx fed76TqxxRzzx6PmfQIoGWuypcKRpYh5cuyAX8gxwTEpXwDyFjLhNKrBtPyqqrqa3nOy 3BJ2goSv5DwQtrv5N0k2/XdNGuivWFd2ZLHJ+aOM4mQ5lP726zDZk+W6NQXilOrsLN0v OD+cOR75uc9azOko6WqLYItsoa/pjRaslja7dbL0jtAFuzGJv0MlFdOGsIsUWOmuOICf pwOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4vmHBZCLmqwGh1JrNfyEzOHsM8+Nrv3dx8TspskyRXo=; b=ZpCoSs/NTiOS4e5I33zWK1Mn1qW6QPaKd6v+IT8fvaSHSQx3wA54CA3KmvlkQEElnE +j/Ag4rd+jYee3p5rOG6rrQO6Qsd652pRZ7j9Uz2HHJBAurtHSgitbgM2l3/5wr4hMR7 yHnrFFmFOYhwfkHzF3ewY3hbYkaTbM7RuOXZgOfMsRCclVLBXX9m+tY9KMXrpjn6xYTq 43evRzXw16KyqGaj8l/HA1lZkI/cg1ZquU0GsWb7AmyWEhDPYRBWPyCsU6XQfzeCZvHx DcswLLkZpzGVC4ZtMGK36mMzisRfwtOYWsJwlewtw5oAQoQmYn0JsqIYONwAAQNXyq1w +DNw== X-Gm-Message-State: AOAM5316t7DoWF2a/PwWG26loA82RaDHBQOx564+tOKUvH8DEK+ckkh/ rIq5LMLwVyquWuAgv9ZX2jvj1UZWZ0PPbw== X-Google-Smtp-Source: ABdhPJwqgLEEt/Zs/+PIDGya7dvTCcQaxAtK24x78juhCiKYpfkL4WT80mdnASV/NVVQMbx8iH/JdA== X-Received: by 2002:a63:4a43:: with SMTP id j3mr20191746pgl.42.1600283870703; Wed, 16 Sep 2020 12:17:50 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id b2sm11373688pfp.3.2020.09.16.12.17.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 12:17:50 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 10/16] coresight: etm4x: Handle unreachable sink in perf mode Date: Wed, 16 Sep 2020 13:17:31 -0600 Message-Id: <20200916191737.4001561-11-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200916191737.4001561-1-mathieu.poirier@linaro.org> References: <20200916191737.4001561-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200916_151752_961679_69DA672D X-CRM114-Status: GOOD ( 17.18 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:444 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Suzuki K Poulose If the specified/hinted sink is not reachable from a subset of the CPUs, we could end up unable to trace the event on those CPUs. This is the best effort we could do until we support 1:1 configurations. Fail gracefully in such cases avoiding a WARN_ON, which can be easily triggered by the user on certain platforms (Arm N1SDP), with the following trace paths : CPU0 \ -- Funnel0 --> ETF0 --> / \ CPU1 \ MainFunnel CPU2 / \ / -- Funnel1 --> ETF1 --> / CPU1 $ perf record --per-thread -e cs_etm/@ETF0/u -- could trigger the following WARNING, when the event is scheduled on CPU2. [10919.513250] ------------[ cut here ]------------ [10919.517861] WARNING: CPU: 2 PID: 24021 at drivers/hwtracing/coresight/coresight-etm-perf.c:316 etm_event_start+0xf8/0x100 ... [10919.564403] CPU: 2 PID: 24021 Comm: perf Not tainted 5.8.0+ #24 [10919.570308] pstate: 80400089 (Nzcv daIf +PAN -UAO BTYPE=--) [10919.575865] pc : etm_event_start+0xf8/0x100 [10919.580034] lr : etm_event_start+0x80/0x100 [10919.584202] sp : fffffe001932f940 [10919.587502] x29: fffffe001932f940 x28: fffffc834995f800 [10919.592799] x27: 0000000000000000 x26: fffffe0011f3ced0 [10919.598095] x25: fffffc837fce244c x24: fffffc837fce2448 [10919.603391] x23: 0000000000000002 x22: fffffc8353529c00 [10919.608688] x21: fffffc835bb31000 x20: 0000000000000000 [10919.613984] x19: fffffc837fcdcc70 x18: 0000000000000000 [10919.619281] x17: 0000000000000000 x16: 0000000000000000 [10919.624577] x15: 0000000000000000 x14: 00000000000009f8 [10919.629874] x13: 00000000000009f8 x12: 0000000000000018 [10919.635170] x11: 0000000000000000 x10: 0000000000000000 [10919.640467] x9 : fffffe00108cd168 x8 : 0000000000000000 [10919.645763] x7 : 0000000000000020 x6 : 0000000000000001 [10919.651059] x5 : 0000000000000002 x4 : 0000000000000001 [10919.656356] x3 : 0000000000000000 x2 : 0000000000000000 [10919.661652] x1 : fffffe836eb40000 x0 : 0000000000000000 [10919.666949] Call trace: [10919.669382] etm_event_start+0xf8/0x100 [10919.673203] etm_event_add+0x40/0x60 [10919.676765] event_sched_in.isra.134+0xcc/0x210 [10919.681281] merge_sched_in+0xb0/0x2a8 [10919.685017] visit_groups_merge.constprop.140+0x15c/0x4b8 [10919.690400] ctx_sched_in+0x15c/0x170 [10919.694048] perf_event_sched_in+0x6c/0xa0 [10919.698130] ctx_resched+0x60/0xa0 [10919.701517] perf_event_exec+0x288/0x2f0 [10919.705425] begin_new_exec+0x4c8/0xf58 [10919.709247] load_elf_binary+0x66c/0xf30 [10919.713155] exec_binprm+0x15c/0x450 [10919.716716] __do_execve_file+0x508/0x748 [10919.720711] __arm64_sys_execve+0x40/0x50 [10919.724707] do_el0_svc+0xf4/0x1b8 [10919.728095] el0_sync_handler+0xf8/0x124 [10919.732003] el0_sync+0x140/0x180 Even though we don't support using separate sinks for the ETMs yet (e.g, for 1:1 configurations), we should at least honor the user's choice and handle the limitations gracefully, by simply skipping the tracing on ETMs which can't reach the requested sink. Cc: Mathieu Poirier Cc: Mike Leach Fixes: f9d81a657bb8 ("coresight: perf: Allow tracing on hotplugged CPUs") Reported-by: Jeremy Linton Tested-by: Jeremy Linton Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm-perf.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c index 1a3169e69bb1..9d61a71da96f 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -321,6 +321,16 @@ static void etm_event_start(struct perf_event *event, int flags) if (!event_data) goto fail; + /* + * Check if this ETM is allowed to trace, as decided + * at etm_setup_aux(). This could be due to an unreachable + * sink from this ETM. We can't do much in this case if + * the sink was specified or hinted to the driver. For + * now, simply don't record anything on this ETM. + */ + if (!cpumask_test_cpu(cpu, &event_data->mask)) + goto fail_end_stop; + path = etm_event_cpu_path(event_data, cpu); /* We need a sink, no need to continue without one */ sink = coresight_get_sink(path); From patchwork Wed Sep 16 19:17:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11780625 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 66D8459D for ; Wed, 16 Sep 2020 19:19:41 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 289242075E for ; Wed, 16 Sep 2020 19:19:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="3Gloa4QP"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="YtgtRm6T" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 289242075E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=8JKLBh71iPapRPuMkHKD/ERSPdMC58sEX8zUVyazKeY=; b=3Gloa4QPNXuLhF+ob6zlFKnGA Y67cHPGZ1Zqpo5cSQpyS4W/Zms19CIRxixWydJ5DbsTy2iwbJKK7yxhUSAxG/wWsZS5gAkEVnQgiw guSWkCC1CBiratyfOO1cKyZ3ZZrZWMb2lJi4i7a4xMOg9HkRobOaJzscx/pwuHb42wH0IRO0ZGK5x SY9vn7880pAoDxn3EuEzLt6xKK6XybeZYwWUDyDQcY6ez8t2Uy3puWc2cpAB6G+9INwChgTGjfwWp V9fgvnbmOwWHlQbwNDQYlIeYZvFfUahMj2jVQJJWmB8XW8TrMY/ZRQQ2eutOmMxbRgdLvmBo5pQIf GC1frsdQg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIcxk-0005le-8G; Wed, 16 Sep 2020 19:19:28 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIcwD-00059O-BD for linux-arm-kernel@lists.infradead.org; Wed, 16 Sep 2020 19:17:57 +0000 Received: by mail-pl1-x641.google.com with SMTP id k13so3716775plk.3 for ; Wed, 16 Sep 2020 12:17:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jRmm8bmeMmrl//Bh/Ohg4sjapVcVZVx2mLqHhA1BT1E=; b=YtgtRm6TEPQvXCCQlKgRxDG0S9XeFfuisPV0mES7rQozmfBpG5lrpS588yY1oBbI5j xlID4XzrtSFfGPpHD0b3cOkkmXzZ8p5fuNJQciDrQex4Sg0WcT/XHxsver3FlqKWyfmJ Sxv9k3XT9xtRmkNnCBfsdESg/J7TCgKnbH8MWiu+yIyB1CtJRFou8LGJxebilCWiWOvp gK52G2bLycPM7FhnDbG1EJxVM3LZiTLkXhvHuDRuetHavFy7Ytwq5WI1Y5uA5J3XiUuL AJHC4XV8l19lO380HPRoBKQw7dmCupL8GHaHt7xMkywIkcQGKWJlKM0XYI225SJXhA9g Duew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jRmm8bmeMmrl//Bh/Ohg4sjapVcVZVx2mLqHhA1BT1E=; b=hoz0hVpojGHWLH9HJNTQhH+tm30o5GnZCJDnAn4TI0WUHLmEmw5vlV3chCzk1miXEr 9aY+A3IpL4NtXSogZ18pBMLEEol21Bvi9obpWXTL4Mmy8qVK9bKfGYi27+wYdrFwgEAP sUPtTM+JzZpBi98st6K6MWFfwY+IiKc9kGy4fKrOzUVI1TcQPxm066isASwIIplnXyw5 MUXp+9U+O8XZGOsA+li9j+GsjFdnfOSgfWGmgG9r7q7X9Ai8aHfDv/DnQf1Jc2GctUXy gJvmKGWsrONMpsTNJhlaKyrDN7XwVzbMqXeZ8HtrGhfkefQuqPrhx0XqxTt5oamv+uBS eTyA== X-Gm-Message-State: AOAM53250AEBnvWEWYkTLEuBXkygB1FTNgT6dd2KF8Ab+/mewmI1jK5a gHBM0zd7QORoiHfLX/iwKLgtWqEWgVnL+w== X-Google-Smtp-Source: ABdhPJyS90vU7UFhu+3Ljfr6q8tDhE2e9b1N/bzcYtV307XVKEF5v+8dvOcsbZ6QSd7yIayFFIe7yw== X-Received: by 2002:a17:902:bf4b:b029:d1:cc21:985b with SMTP id u11-20020a170902bf4bb02900d1cc21985bmr13973978pls.32.1600283871628; Wed, 16 Sep 2020 12:17:51 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id b2sm11373688pfp.3.2020.09.16.12.17.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 12:17:51 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 11/16] coresight: etm4x: Fix issues on trcseqevr access Date: Wed, 16 Sep 2020 13:17:32 -0600 Message-Id: <20200916191737.4001561-12-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200916191737.4001561-1-mathieu.poirier@linaro.org> References: <20200916191737.4001561-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200916_151753_430157_2DF64E52 X-CRM114-Status: GOOD ( 14.54 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:641 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Jonathan Zhou The TRCSEQEVR(3) is reserved, using '@nrseqstate - 1' instead to avoid accessing the reserved register. Cc: Mathieu Poirier Cc: Suzuki K Poulose Cc: Mike Leach Cc: Shaokun Zhang Cc: lizixian@hisilicon.com Fixes: f188b5e76aae ("coresight: etm4x: Save/restore state across CPU low power states") Signed-off-by: Jonathan Zhou [Fixed capital letter in title] Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm4x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index 63cb1e0d5953..b29ad4f7fac2 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -1193,7 +1193,7 @@ static int etm4_cpu_save(struct etmv4_drvdata *drvdata) state->trcvdsacctlr = readl(drvdata->base + TRCVDSACCTLR); state->trcvdarcctlr = readl(drvdata->base + TRCVDARCCTLR); - for (i = 0; i < drvdata->nrseqstate; i++) + for (i = 0; i < drvdata->nrseqstate - 1; i++) state->trcseqevr[i] = readl(drvdata->base + TRCSEQEVRn(i)); state->trcseqrstevr = readl(drvdata->base + TRCSEQRSTEVR); @@ -1298,7 +1298,7 @@ static void etm4_cpu_restore(struct etmv4_drvdata *drvdata) writel_relaxed(state->trcvdsacctlr, drvdata->base + TRCVDSACCTLR); writel_relaxed(state->trcvdarcctlr, drvdata->base + TRCVDARCCTLR); - for (i = 0; i < drvdata->nrseqstate; i++) + for (i = 0; i < drvdata->nrseqstate - 1; i++) writel_relaxed(state->trcseqevr[i], drvdata->base + TRCSEQEVRn(i)); From patchwork Wed Sep 16 19:17:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11780641 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2911459D for ; Wed, 16 Sep 2020 19:21:26 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DD40820770 for ; Wed, 16 Sep 2020 19:21:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="3gdhh0Jm"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="cU5lUHEP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DD40820770 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=3sy2f7w+mn47UEDD89Jx8FQdbm4uI2eH1/0b4d/Bi2A=; b=3gdhh0JmvEbFrbpVig/QrGdcd quAJ/NqGiG340caOVTWsDYqj6gXCdikG9AceYbnmbgiLes7L+M/2ebvG3lHc0UsI08Ll6wSoPcrjd Q3WcPoAy3+fC1YhuRQtT6BW4A96PCs+Iui2M5QevKQKdgry24N+zXbFArFTWP+9dh3ZjOXdpYtXyq xYWwbjUUv9hNGX5aOfOYQ3s2eAePzaOBHI7INxSr2X+tU9THUAHTM9xdHm8ea3i0LzhEZY4Jh06YK o0RIQKBfXIlhvRHTrJt4Q8H6bEzZ8gsKzUahrRhFdWc4zxOXnmKbtEO6a0w3VsDEMfUQzUUU3BOTF IrN8DmYFA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIcxo-0005oS-M3; Wed, 16 Sep 2020 19:19:32 +0000 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIcwE-00059i-Oa for linux-arm-kernel@lists.infradead.org; Wed, 16 Sep 2020 19:17:58 +0000 Received: by mail-pg1-x534.google.com with SMTP id k14so4445487pgi.9 for ; Wed, 16 Sep 2020 12:17:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rl5dMloMz4/NrTqcJ51FK8aDPkUbtuzPHAb3Uft2pLU=; b=cU5lUHEPFXE/NLjcdddCxNuONhpIxWDJz6dg8XOIPqSCGejkHIzb/whU2aiDa1eTOM P78S7U33cGQyBuD4j/HF7JOmSN3PJe0F6UkiNXaM4XHwH1rS62xSQaVEV/M8xrrb3PNt +fq+6JY3wT+7SHgp7fhIQb2DbqNHrSvlGZ+catRh/ZFFGtDhPUrIMU9UxAtKED/m+Fny iQ2N+yBiTsMUaLt5iB40fCw9apIa10XTQMoFgVQpE57tS7tB9MMIjuNAKYzbPdybFOa4 uf+DweWgNiYRtn7ksPvN3yqBhMvqjiqrcpLvpvhyngPafAlc+rF8UTfHNsYU5nJt1BFz sp+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rl5dMloMz4/NrTqcJ51FK8aDPkUbtuzPHAb3Uft2pLU=; b=eeQnmhvqmz2xaJUr1EkBJrdWLaqdhL7+LYspZXL4dwSA7k9KY9QOsC1Co9b5DsyaA+ TxVGc1hmzuFEPS9cZNk46D5pCyoA8VBUSWotQjMY2pLhvYpW3ASOk3c6IbPBBh7tupq8 xz2zXpgEKbB9NLckrmn/NxNewiG9fozJZ/Re9SMMtDL/W8ePbWKyfh+SYitLFZEuZLdG DNpcyfnaYgHyQ9RwrIvijwgW0h3ko6Re3Ih3y/6DSTYfyRB34dKE405VSX5SU+bQC4Xz JjHgF9yb5eLR1Rs6vqFVHiDuFulDLQpoXpw/Q6J1/IvS/dygCJiBt/c1j5lAERkq7r6X a3yQ== X-Gm-Message-State: AOAM532+BzKCNhTy/a8GvcZ4hIrtvmRuvnkQQZcPtcLsGi57f/MoZHvY 1nKao/iWeFo3D3rJy0+wQEsV3g== X-Google-Smtp-Source: ABdhPJwpEuE++znhk48RHGYA3f6rhRl25oYeQg+VPPiZA6ejE217Jo2U+vXnmlYJWW8H5gcoWePGKQ== X-Received: by 2002:a63:743:: with SMTP id 64mr6369658pgh.393.1600283872676; Wed, 16 Sep 2020 12:17:52 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id b2sm11373688pfp.3.2020.09.16.12.17.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 12:17:52 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 12/16] MAINTAINERS: Add CoreSight mailing list Date: Wed, 16 Sep 2020 13:17:33 -0600 Message-Id: <20200916191737.4001561-13-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200916191737.4001561-1-mathieu.poirier@linaro.org> References: <20200916191737.4001561-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200916_151754_984637_EAAD6709 X-CRM114-Status: GOOD ( 11.69 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:534 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Add CoreSight mailing list so that people can participate in patch reviews and know what features are coming next. Signed-off-by: Mathieu Poirier --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 286fd7263982..54cb47e8a0b2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1746,6 +1746,7 @@ ARM/CORESIGHT FRAMEWORK AND DRIVERS M: Mathieu Poirier R: Suzuki K Poulose R: Mike Leach +L: coresight@lists.linaro.org (moderated for non-subscribers) L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) S: Maintained F: Documentation/ABI/testing/sysfs-bus-coresight-devices-* From patchwork Wed Sep 16 19:17:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11780643 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 66C2859D for ; Wed, 16 Sep 2020 19:21:36 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2570120770 for ; Wed, 16 Sep 2020 19:21:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="OvCHxlrw"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="uz9UmhCU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2570120770 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=bTKoDD7Git9752/nD5bq98L6zuwPvhv/JIdINxFmT8M=; b=OvCHxlrwDOuQWeTO5mvGW/fhX Ox1v2uDnNy+Ed0GI/44+BsCNJ+/1eZmr/pPfYegGqlUpde6slcHo623WzabNoAjGgH6k0WIC1NhfU +bPXs+Gk/YgLlbsM1mMGnLmvSnFS3Ahd7zXhOLtoxBpmgfxl9vc3DO4vCsP5+Ynwy0LRYP9jCeKEb TbWu6OCiBkm8GChjSJYPY8M5xc88A/ZKDpBn6n5sIvzvPERRDDu/+m/WJVWvMz3uQfSApR4MaCSVR 26fBu+v3Ntwfp+FsUNPjd2TDSoDlK4SJ9BArQYKG5N7V6XkQVVYrKdek0aRtzMrsDoF+6h3jbQR19 juK4IoRyA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIcxx-0005tt-IT; Wed, 16 Sep 2020 19:19:42 +0000 Received: from mail-pj1-x1043.google.com ([2607:f8b0:4864:20::1043]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIcwF-0005A0-Og for linux-arm-kernel@lists.infradead.org; Wed, 16 Sep 2020 19:18:00 +0000 Received: by mail-pj1-x1043.google.com with SMTP id gf14so2007192pjb.5 for ; Wed, 16 Sep 2020 12:17:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3pZ12hyTPUbEewJ2vo5m/+iaoNS+QCjKSOOA3CDCSbA=; b=uz9UmhCU59o1i0ZyaHwAVp/P3DPyDzCFGSNqI/pgzewML7SW5Iw+rwSRPblApPA85S 6Y48LZ4ro8MjjqtD6eRWAFh8pQwGkK8+AleZGgf+DXSCvS4uZ/2GeNic+8xdKxhh1A6y mzFUM4RtJeJdAZR83Dsvakh6kSAz4uOjeqbzbHBGauG59xDq86+juLKcOcm9r+9OrxW+ RUUys+ECWzZoJFSuM8jsvaf5NNRnyS1HlSkECXGPXRBF+xM9cZ/gS7IkJ0brnLwqGODp 3bEMPqbsuhuNEjtvxlNVKmwe5RVDNMLuW918kVVbNL/rQWReInaoVuCTfQUVcV4i24bY 84Ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3pZ12hyTPUbEewJ2vo5m/+iaoNS+QCjKSOOA3CDCSbA=; b=VaElfUcEszYpQkix1UKgZv8Pf5Ilp235GXz41hRGoNq+vxF9uu8AvDMgRQKGYiKyGk lr1eIp4KrMqToGh5S/QStmepyd6TdzWyUDWB4RSY/tm2QmSekEOr1FZ5EZCAHZbhW7Nq U5Yp2lam1JNhER83CJDEuEjiVLVuIKueRoaUBIxPi+2GVUP/GL/A/PAgKGPo4+eLxpW0 RP3cptlWHBPXuG0WoblzF6Qo3PviKiak1eQ5CT1P2/A9Mogx0lG65Mo+DKk3sMJrwKjc 3LmSyDd/T9llw7Bw1u+nQw3LaAtkLj/HEaIP8MFPopJA5rHgxYvB9pPEMBTK2yfv69yl 0WbA== X-Gm-Message-State: AOAM533MshOWPFisWBWp4/v9mY0sNjQBEDWZcy/eespGWuTDDW65hHSd eLiaLud2HjrJ512mKHS8X8OCGA== X-Google-Smtp-Source: ABdhPJxbdvq0wppKGz04055Y5+Xt0cmUDntX1qlg5ZVAhPgd+wbp41Lx4eRytRYrTTtXiPCASRM4vw== X-Received: by 2002:a17:902:fe98:b029:d1:e5e7:be1a with SMTP id x24-20020a170902fe98b02900d1e5e7be1amr7927010plm.77.1600283873686; Wed, 16 Sep 2020 12:17:53 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id b2sm11373688pfp.3.2020.09.16.12.17.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 12:17:53 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 13/16] coresight: etm: perf: Sink selection using sysfs is deprecated Date: Wed, 16 Sep 2020 13:17:34 -0600 Message-Id: <20200916191737.4001561-14-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200916191737.4001561-1-mathieu.poirier@linaro.org> References: <20200916191737.4001561-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200916_151755_860426_7420988C X-CRM114-Status: GOOD ( 12.44 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:1043 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Linu Cherian When using the perf interface, sink selection using sysfs is deprecated. Signed-off-by: Linu Cherian Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm-perf.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c index 9d61a71da96f..b4e5758b6c12 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -222,8 +222,6 @@ static void *etm_setup_aux(struct perf_event *event, void **pages, if (event->attr.config2) { id = (u32)event->attr.config2; sink = coresight_get_sink_by_id(id); - } else { - sink = coresight_get_enabled_sink(true); } mask = &event_data->mask; From patchwork Wed Sep 16 19:17:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11780645 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2044B6CA for ; Wed, 16 Sep 2020 19:22:00 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D618520770 for ; Wed, 16 Sep 2020 19:21:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="l6+eW2hz"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Y2CwCZsA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D618520770 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=bDEjoX3MWZ7wF2tLkdUEYgh+DiseY1VXrNmPFI/Eus8=; b=l6+eW2hz8MnW6p21Wx5o56rOz tbL/sXanbnx/5CkSpzS2p0edQ63FsaJnUxizsTlmgorm3+49Ifbxb8n+OQO8fpDsq8DZqrFpL1s0/ jA3iythY1CmrcdxxAVvEIOSZKY0zv6VG3dEngI8l96Cbb7xPaPPbi22M5wrh55bqFg9nlQzUeiQd4 M2cxYyKAKURRQYLTNYsGsFk5yt85V6X14ZmtRwnOqLqJP1FStIBS2g99A6ZsEkZsMNsddubzg+3oq BDizdLB96OdokdZsBjA3j5c5/hBFGFG1GhGj3bMbE4iwJkrauKk/SoSR2bc9yM2oUF2nnrT4u9rFB YrMALlgFw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIcyN-00067B-9R; Wed, 16 Sep 2020 19:20:07 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIcwH-0005AT-0q for linux-arm-kernel@lists.infradead.org; Wed, 16 Sep 2020 19:18:01 +0000 Received: by mail-pg1-x543.google.com with SMTP id j34so4451767pgi.7 for ; Wed, 16 Sep 2020 12:17:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HpYyj4qZKMiQrhkLmQ6jFNs4bPCRuP5wWzHJHDFeRMc=; b=Y2CwCZsAcwL5yqfKlkrrTLM87XSObjfgOYnf3++11MOnqNwUDN+/euYza6Jd0qJPV6 Mxx7Gbb65RsAlajTUnpHMG64ZObFOv8JUCcn0pdKi6TThp2Pkwz3iHUXaF09EepAV/Ln lg06q0kdbpaYMCIx3wNYSZ4JIBwt68DptwOL7nGemLWuFeRZoJHWKJbsyYYboHo0JeW/ HwZVeYLaMwwMoqQIOSdubsUo7GbsFchYGWsJzKoa3BqxDB+nQYuEgQ6a19oQ8d7FY0uR evfPC/bmm6cAH3ia6yPr+g4H8LDVVp4mi1R6srr/rSOg9J8tGEz3TrdpaXjvVyf+4IjY M43w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HpYyj4qZKMiQrhkLmQ6jFNs4bPCRuP5wWzHJHDFeRMc=; b=jXEYid3oGhKPEoefKjiF4oU1bR7HK2/9GrSi+b+8H7ndokUusvMW6BszdyMpAp35vN TdlbWzfK1Q1qDneOI6TJkxTeaGo/kBYEC2Hiy3/CDq1UIaEWDHUWN7eLPk+7oNULqMBZ 00LcFs33u4OC7UJnc3Q5DkcYOoi/Fg0cI+glgW4x6j93NiUEkljckXUWz8mW+bnymb6e MBiKVJPNyLafyBUw9bewIq9z7xSUD58ljNWh2/wv0SmTbW/Jf98WrXy9k1uLHFSHV4uF Vk3n79G2x5RlWTeKImtqt7VNEYPOxPCI/4wyPsam2JumUoDo8VezlMUr77H5o3uLa5PW uwBg== X-Gm-Message-State: AOAM530qm3YXmLTwsM/n9rTDiY5dLEw+Z5EIerpFqLszvkYhSW+ierm6 wH9icZSlyL2RKcWhlzjmsoCf5g== X-Google-Smtp-Source: ABdhPJxhVg9lL5+jHQDhFsvgwbVsVERYt3fgy0p5D2jJAdzA5r5HWAclfuC7mHhGrQAkWMpDAzTDOg== X-Received: by 2002:a63:6782:: with SMTP id b124mr20671377pgc.308.1600283874707; Wed, 16 Sep 2020 12:17:54 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id b2sm11373688pfp.3.2020.09.16.12.17.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 12:17:54 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 14/16] coresight: Make sysfs functional on topologies with per core sink Date: Wed, 16 Sep 2020 13:17:35 -0600 Message-Id: <20200916191737.4001561-15-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200916191737.4001561-1-mathieu.poirier@linaro.org> References: <20200916191737.4001561-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200916_151757_116894_DBF58CBA X-CRM114-Status: GOOD ( 21.64 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:543 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Linu Cherian Coresight driver assumes sink is common across all the ETMs, and tries to build a path between ETM and the first enabled sink found using bus based search. This breaks sysFS usage on implementations that has multiple per core sinks in enabled state. To fix this, coresight_get_enabled_sink API is updated to do a connection based search starting from the given source, instead of bus based search. With sink selection using sysfs depecrated for perf interface, provision for reset is removed as well in this API. Signed-off-by: Linu Cherian [Fixed indentation problem and removed obsolete comment] Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-priv.h | 3 +- drivers/hwtracing/coresight/coresight.c | 62 +++++++++----------- 2 files changed, 29 insertions(+), 36 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h index f2dc625ea585..5fe773c4d6cc 100644 --- a/drivers/hwtracing/coresight/coresight-priv.h +++ b/drivers/hwtracing/coresight/coresight-priv.h @@ -148,7 +148,8 @@ static inline void coresight_write_reg_pair(void __iomem *addr, u64 val, void coresight_disable_path(struct list_head *path); int coresight_enable_path(struct list_head *path, u32 mode, void *sink_data); struct coresight_device *coresight_get_sink(struct list_head *path); -struct coresight_device *coresight_get_enabled_sink(bool reset); +struct coresight_device * +coresight_get_enabled_sink(struct coresight_device *source); struct coresight_device *coresight_get_sink_by_id(u32 id); struct coresight_device * coresight_find_default_sink(struct coresight_device *csdev); diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index e9c90f2de34a..bb4f9e0a5438 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -540,50 +540,46 @@ struct coresight_device *coresight_get_sink(struct list_head *path) return csdev; } -static int coresight_enabled_sink(struct device *dev, const void *data) +static struct coresight_device * +coresight_find_enabled_sink(struct coresight_device *csdev) { - const bool *reset = data; - struct coresight_device *csdev = to_coresight_device(dev); + int i; + struct coresight_device *sink; if ((csdev->type == CORESIGHT_DEV_TYPE_SINK || csdev->type == CORESIGHT_DEV_TYPE_LINKSINK) && - csdev->activated) { - /* - * Now that we have a handle on the sink for this session, - * disable the sysFS "enable_sink" flag so that possible - * concurrent perf session that wish to use another sink don't - * trip on it. Doing so has no ramification for the current - * session. - */ - if (*reset) - csdev->activated = false; + csdev->activated) + return csdev; - return 1; + /* + * Recursively explore each port found on this element. + */ + for (i = 0; i < csdev->pdata->nr_outport; i++) { + struct coresight_device *child_dev; + + child_dev = csdev->pdata->conns[i].child_dev; + if (child_dev) + sink = coresight_find_enabled_sink(child_dev); + if (sink) + return sink; } - return 0; + return NULL; } /** - * coresight_get_enabled_sink - returns the first enabled sink found on the bus - * @deactivate: Whether the 'enable_sink' flag should be reset - * - * When operated from perf the deactivate parameter should be set to 'true'. - * That way the "enabled_sink" flag of the sink that was selected can be reset, - * allowing for other concurrent perf sessions to choose a different sink. + * coresight_get_enabled_sink - returns the first enabled sink using + * connection based search starting from the source reference * - * When operated from sysFS users have full control and as such the deactivate - * parameter should be set to 'false', hence mandating users to explicitly - * clear the flag. + * @source: Coresight source device reference */ -struct coresight_device *coresight_get_enabled_sink(bool deactivate) +struct coresight_device * +coresight_get_enabled_sink(struct coresight_device *source) { - struct device *dev = NULL; - - dev = bus_find_device(&coresight_bustype, NULL, &deactivate, - coresight_enabled_sink); + if (!source) + return NULL; - return dev ? to_coresight_device(dev) : NULL; + return coresight_find_enabled_sink(source); } static int coresight_sink_by_id(struct device *dev, const void *data) @@ -988,11 +984,7 @@ int coresight_enable(struct coresight_device *csdev) goto out; } - /* - * Search for a valid sink for this session but don't reset the - * "enable_sink" flag in sysFS. Users get to do that explicitly. - */ - sink = coresight_get_enabled_sink(false); + sink = coresight_get_enabled_sink(csdev); if (!sink) { ret = -EINVAL; goto out; From patchwork Wed Sep 16 19:17:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11780633 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4E60059D for ; Wed, 16 Sep 2020 19:20:06 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 048902075E for ; Wed, 16 Sep 2020 19:20:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="NwQ6UlSI"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="k1qCnGcV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 048902075E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=aCYHn7CwqLc38gtVq/HQ1CkuMZ+m8Wam1BRuj43ss3w=; b=NwQ6UlSIrC5UkgvV4h8Cj1+Xv uqpUI8rOZoacr9Bg+Jrc5Rxzek5N36tUxLCiKRJepbd9IK9ZZoFARnzdCFl+Kt3ddPImmqsooNLIY nOydlgYSeMJlHMgZ5blGe8lkVr0boTCi0zmMlAjuTExWLUUQt8/NP/kggJe4mcdlHrVFejc21xKQq voP6QZJgv2nPJZhD3VR5KZ9fwx1wDvl6gXg0UvKg7ePv2NrbFPOqlPy2M7QDeWhg7W9cfLRIfHVQ/ cDBjpT/TULWDKXThpLeG6C3MA8JCe6UjFfFtLL/b1tArovCD5ODf4E6JQ5/dLwyC32+glruvowZTP J7Ym/EgIA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIcy3-0005yB-RA; Wed, 16 Sep 2020 19:19:47 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIcwH-0005Ao-Ph for linux-arm-kernel@lists.infradead.org; Wed, 16 Sep 2020 19:18:01 +0000 Received: by mail-pg1-x541.google.com with SMTP id s65so4483612pgb.0 for ; Wed, 16 Sep 2020 12:17:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Oe49LMKwv41Q/rKpDAMKCy8PmysOJZGeIA2wNQPMFDo=; b=k1qCnGcV5ydKrYSZmb7z6t2rf8NDhB199Q+CTrqhlDFZH1YPgkXkqdcpHFUUMmFZB2 nhHFszfE//oADI2Sw4apMJE43ezjbPXDFOSqMKV1tVsDWi21ugWht5ff3u12bcaMI+6/ gKwT/4ikJcrErNs8nJDnc/0BGa1jVMx5GqFC5UCkfiMj/OTRXgkyY0erUNFP2t6Ful5I G46dXB435jwkzFyT7iIb/wnTkDJHrtgI3kNHCmCl8lgAplNoM+u4lgjCX7WrMk8LgJYp CSkJ3xoPSXG5ph1DGvftMQa6B/pQ4TFw5+sxZz/tDOGsJ89AT1CbFS3M1cGBoWJez54+ iqSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Oe49LMKwv41Q/rKpDAMKCy8PmysOJZGeIA2wNQPMFDo=; b=rQBqnji3Qk3YWZ+lY9+ObfWNTUML+6HFiTLzN3SIngBpEdvaT5l2QJp4tryYqbZhV3 UX832r5s02h9epUXru2fi/slzcGX8rdDQvbtUzWPWg9Hp+AFM+JCYVJQaVXa2m1Y05PA trEI9KE+ohjgx/pOHXVTfGmfBnd0kLIN8xL7EBBHzoKn/dLBRFnZCAi1QEfWXYlj0YSX pmeMeFjAoQ5sPPvSy5EusF97/yoBorCmwDvxtWUwSA9coSFq/vWPDh6A/pIormlMfW1h 44K3CAutUeNnn81UmeEbupSXEqJAhpIARZRuPavCta/cvQbhEgBju780Z2uFvVvlUUlF EPFg== X-Gm-Message-State: AOAM533XYehttSoC8xpUromFVW+SLWxJDQhO3v6VG+VMV2HXCywrDThJ qFOgEWLw16XssFQp3pVMa9wzKA== X-Google-Smtp-Source: ABdhPJz4/2EA/zzbsQeVkyxz0UVvQIol29EhFlEroXCYa/7jZJoZG06NJLqej/NQ51x9sw2Vhfh2Ig== X-Received: by 2002:a63:3643:: with SMTP id d64mr2586988pga.207.1600283875709; Wed, 16 Sep 2020 12:17:55 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id b2sm11373688pfp.3.2020.09.16.12.17.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 12:17:55 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 15/16] coresight: etm4x: Fix mis-usage of nr_resource in sysfs interface Date: Wed, 16 Sep 2020 13:17:36 -0600 Message-Id: <20200916191737.4001561-16-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200916191737.4001561-1-mathieu.poirier@linaro.org> References: <20200916191737.4001561-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200916_151757_896140_5F5E5337 X-CRM114-Status: GOOD ( 15.44 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:541 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Jonathan Zhou The member @nr_resource represents how many resource selector pairs, and the pair 0 is always implemented and reserved. So let's multiply by 2 when resetting the selector configuration. And also update the validation of the input @idx. Cc: Mathieu Poirier Cc: Suzuki K Poulose Cc: Mike Leach Cc: Shaokun Zhang Cc: lizixian@hisilicon.com Cc: stable@vger.kernel.org Signed-off-by: Jonathan Zhou [Fixed typographical error in changelog, added stable] Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm4x-sysfs.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c index a588cd6de01c..989ce7b8ade7 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c @@ -236,7 +236,7 @@ static ssize_t reset_store(struct device *dev, } config->res_idx = 0x0; - for (i = 0; i < drvdata->nr_resource; i++) + for (i = 2; i < 2 * drvdata->nr_resource; i++) config->res_ctrl[i] = 0x0; config->ss_idx = 0x0; @@ -1663,8 +1663,11 @@ static ssize_t res_idx_store(struct device *dev, if (kstrtoul(buf, 16, &val)) return -EINVAL; - /* Resource selector pair 0 is always implemented and reserved */ - if ((val == 0) || (val >= drvdata->nr_resource)) + /* + * Resource selector pair 0 is always implemented and reserved, + * namely an idx with 0 and 1 is illegal. + */ + if ((val < 2) || (val >= 2 * drvdata->nr_resource)) return -EINVAL; /* From patchwork Wed Sep 16 19:17:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11780637 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8858459D for ; Wed, 16 Sep 2020 19:20:42 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 11D382076B for ; Wed, 16 Sep 2020 19:20:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ltzeisA8"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Luh/b7D+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 11D382076B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=5vog5/F/aWVk1mBz9ZWgt9kVHnClhhIYatPIT+IFsKE=; b=ltzeisA8zH6AOyRprybc8j0Y0 cxj7umXOzwbw3ZNOXHs8BCxTiQQBROSblP6KIjslJhoqwhK/2Rc1TL1tRXaOI8V6jk7iu1Y5P0nh0 sy05z8xWWpbBFTJy9c01eUOSO7kdGYlQirrX4R8L8p6xPEVEc1BvFCJRX07ulMq7XVbhRVyzCJRB3 vDRr9eM/lXvbnh1tJEN4PAetsTKPhbanDmmhUBdx5IZAp48arB2RmbEEXtPXpJqkBf4YT4/Xp5sgw w2uje9dEAcg5QqTK5RuxolYTlnMP3ZoHWOvcUM2IRc4m+d60ZFufCa4BkDbKgis91Nr0E8UnA3JiE L0lYSwXaA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIcyd-0006JR-S1; Wed, 16 Sep 2020 19:20:23 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIcwJ-0005BF-23 for linux-arm-kernel@lists.infradead.org; Wed, 16 Sep 2020 19:18:01 +0000 Received: by mail-pf1-x443.google.com with SMTP id x123so4545316pfc.7 for ; Wed, 16 Sep 2020 12:17:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FvuIkxfcV8X2+0uLwFbqf+4k5/cPYO6E0EaPLwQPqlo=; b=Luh/b7D+Lf+LfdLUezJT3ubo9A0S1/9jkPh4OV9s9bnQg34RQf9lIOzHtwy58a3ulp vFwptqbcVUkLtuoZS4du3f378wGMkGi0BKtlxX4XZ2NayetoyaM5RqqvR7paTs7oTERa Vs9sb40BXq+/+v3s83tb1D3a5EyuMew+WHnYpDJDdubbPp6yV1bIeYCNcHoc+TBr6+P4 y4scvLjawCyis9UHi93mzAfUM3EnrMI69Yl9h+VrYtpRGD3Ie/oeySvn+suNg341hsmG N4z1L7vOP0Rxpsq1HMBQnnK1B1QxbwBUmnxPr2FTshphyoB//hlEVe0zi6WUO5TKMRk5 q6/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FvuIkxfcV8X2+0uLwFbqf+4k5/cPYO6E0EaPLwQPqlo=; b=csNPkiRBrWmi0YOauR+bo9Hhpe5huAC5SofjhCJtU7DFhfBsdpaaHi4S1RHafhVGQw HznCreXYHfOZBL96j46bMFT+vAULx8E5V30AqAZe1vYqz4rCoHyqRsvRvkTl0X/t6/b8 ZLiOkt3d8CgMGx4HIOJ2pIud5v7HTx1MZRFJN0RE2ed1fuhORpaUqOrePDEcq/Yr4n1t lPv7HYRrv+6pBFMiaxZZUgDEVyTvyKMrxmubYVa8mzYSjcINndUKG5rFOHN2Tt+jBuje MswkR5zqhFFYYrpC4MYCqVrgUpJ4hY2SVCsSkewI4E+/8JytbPf4+ork3jjKm0lcbks3 I9TQ== X-Gm-Message-State: AOAM531WX5/JMU2RnxgLBn6pKfFk9gFMngzd6k+/yi01k6i9zuO0BA+q 3ijVzVBrGPQqFKo9V0ppgIfK+A== X-Google-Smtp-Source: ABdhPJzHmItbqylQSYz5sL8T8+nFutv+uJU4HY+dHmj307pl4G6qohVb9lC8U4O6R4MHQjbNdSkUpw== X-Received: by 2002:a65:685a:: with SMTP id q26mr10324522pgt.28.1600283876831; Wed, 16 Sep 2020 12:17:56 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id b2sm11373688pfp.3.2020.09.16.12.17.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 12:17:56 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 16/16] coresight: etm4x: Fix number of resources check for ETM 4.3 and above Date: Wed, 16 Sep 2020 13:17:37 -0600 Message-Id: <20200916191737.4001561-17-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200916191737.4001561-1-mathieu.poirier@linaro.org> References: <20200916191737.4001561-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200916_151759_153823_1DA7BBF1 X-CRM114-Status: GOOD ( 15.57 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:443 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Mike Leach The initialisation code checks TRCIDR4 to determine the number of resource selectors available on the system. Since ETM v 4.3, the value 0 has a different meaning. This patch takes into account this change. Cc: stable@vger.kernel.org Signed-off-by: Mike Leach [Removed '.' in patch title, added stable] Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm4x.c | 8 +++++++- drivers/hwtracing/coresight/coresight-etm4x.h | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index b29ad4f7fac2..f5ab13aaecea 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -742,8 +742,14 @@ static void etm4_init_arch_data(void *info) * The number of resource pairs conveyed by the HW starts at 0, i.e a * value of 0x0 indicate 1 resource pair, 0x1 indicate two and so on. * As such add 1 to the value of NUMRSPAIR for a better representation. + * + * For ETM v4.3 and later, 0x0 means 0, and no pairs are available - + * the default TRUE and FALSE resource selectors are omitted. + * Otherwise for values 0x1 and above the number is N + 1 as per v4.2. */ - drvdata->nr_resource = BMVAL(etmidr4, 16, 19) + 1; + drvdata->nr_resource = BMVAL(etmidr4, 16, 19); + if ((drvdata->arch < ETM4X_ARCH_4V3) || (drvdata->nr_resource > 0)) + drvdata->nr_resource += 1; /* * NUMSSCC, bits[23:20] the number of single-shot * comparator control for tracing. Read any status regs as these diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h index 5259f96fd28a..eefc7371c6c4 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.h +++ b/drivers/hwtracing/coresight/coresight-etm4x.h @@ -200,6 +200,9 @@ /* NS MON (EL3) mode never implemented */ #define ETM_EXLEVEL_NS_VICTLR_MASK GENMASK(22, 20) +/* Interpretation of resource numbers change at ETM v4.3 architecture */ +#define ETM4X_ARCH_4V3 0x43 + /** * struct etmv4_config - configuration information related to an ETMv4 * @mode: Controls various modes supported by this ETM.