Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1848334iog; Tue, 14 Jun 2022 14:59:50 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sQvUUylNz6rq0+okXUlIzAB+eFkH5nn6/sIR+vD8tFmKGeViAzX8zasMB7TLFbBEAMOEVK X-Received: by 2002:a17:90b:d98:b0:1e3:2a7f:4ce1 with SMTP id bg24-20020a17090b0d9800b001e32a7f4ce1mr6707167pjb.226.1655243990153; Tue, 14 Jun 2022 14:59:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655243990; cv=none; d=google.com; s=arc-20160816; b=Rw57q6yx7AgkYsKqPwoTVfFWE3UF/tMinm1P1tk397eiGjU5oRkXWXevVi1nyMi+Ux tKfVlYz3KoukSvz5m3wHOlp+rjlhNtJAVC95lafDQfI6yGdk8+m5UBdIuR9L+N2d19qv Aq0WakA/JbpgRSnDYJNYFFJFt7XXM/q4d47KDuC7cfqXj557IVVdvmLKjU8kExm+8zLh YgNgZQeSUCCFWBOf8ydfNZ7rtpO1sTgXguGuvx+HLqrmtB+4Rd6xn3ew2EXQlj25UZBz sobfEbjHTAbNQmZ/RA2BeaA6Aq9v/8mSvnh+kjVVgKRQvUQjYGVXlZLHx10e0h5KyK2t uE8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=qZCzDAS6EUwT1x0fzH9/IuXAOmeEXaywn0sXehkmZ+U=; b=xvyRzvRkN1yEuhUh90HylVJDNLaGKS7OaMPFlkAGqH9+QvlTI8sQHk74gmO7bWAXJ0 +gSjA4lrwAN18m/YwS/LsNoxB8vIVMg4D6QLkF2V5yFh1ORCcE/GKAf2e/VJMBDdGlE1 Ou8Dqyu6LwG5Hy/ehRVzdWuDMoRwYO20aqbSMINqk/7WOrXCx4kplQdNYW2ti6tQdVSn bJg8DuzXZ8KVNjJzk/9TRXZtGwcdh8fdidKFsFU9xo0ci+WC7Zen3AGYyjP22OEs37A+ 4H9srSSa0mOzDAsvKUMeI6NvQ+xzPdJdcTYmT/JDhi236vt+cQGrZJqaTvxN1zyaA0x/ lUIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t7-20020a63f347000000b003fc66830014si14555039pgj.795.2022.06.14.14.59.37; Tue, 14 Jun 2022 14:59:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233937AbiFNVvc (ORCPT + 99 others); Tue, 14 Jun 2022 17:51:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358361AbiFNVvb (ORCPT ); Tue, 14 Jun 2022 17:51:31 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6DAB552503; Tue, 14 Jun 2022 14:51:27 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EA0C61763; Tue, 14 Jun 2022 14:51:26 -0700 (PDT) Received: from [10.57.84.206] (unknown [10.57.84.206]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DA0F13F73B; Tue, 14 Jun 2022 14:51:19 -0700 (PDT) Message-ID: Date: Tue, 14 Jun 2022 22:51:18 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH v10 02/10] Coresight: Add coresight TPDM source driver To: Mao Jinlong , Mathieu Poirier , Alexander Shishkin , Konrad Dybcio , Mike Leach Cc: Leo Yan , Greg Kroah-Hartman , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Tingwei Zhang , Yuanfang Zhang , Tao Zhang , Trilok Soni , Hao Zhang , linux-arm-msm@vger.kernel.org, Bjorn Andersson References: <20220611004331.7343-1-quic_jinlmao@quicinc.com> <20220611004331.7343-3-quic_jinlmao@quicinc.com> From: Suzuki K Poulose In-Reply-To: <20220611004331.7343-3-quic_jinlmao@quicinc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/06/2022 01:43, Mao Jinlong wrote: > Add driver to support Coresight device TPDM (Trace, Profiling and > Diagnostics Monitor). TPDM is a monitor to collect data from > different datasets. This change is to add probe/enable/disable > functions for tpdm source. > > Signed-off-by: Tao Zhang > Signed-off-by: Mao Jinlong > --- > drivers/hwtracing/coresight/Kconfig | 12 ++ > drivers/hwtracing/coresight/Makefile | 1 + > drivers/hwtracing/coresight/coresight-core.c | 5 +- > drivers/hwtracing/coresight/coresight-tpdm.c | 149 +++++++++++++++++++ > drivers/hwtracing/coresight/coresight-tpdm.h | 26 ++++ > include/linux/coresight.h | 1 + > 6 files changed, 193 insertions(+), 1 deletion(-) > create mode 100644 drivers/hwtracing/coresight/coresight-tpdm.c > create mode 100644 drivers/hwtracing/coresight/coresight-tpdm.h > > diff --git a/drivers/hwtracing/coresight/Kconfig b/drivers/hwtracing/coresight/Kconfig > index 514a9b8086e3..b2b72a35e416 100644 > --- a/drivers/hwtracing/coresight/Kconfig > +++ b/drivers/hwtracing/coresight/Kconfig > @@ -201,4 +201,16 @@ config CORESIGHT_TRBE > > To compile this driver as a module, choose M here: the module will be > called coresight-trbe. > + > +config CORESIGHT_TPDM > + tristate "CoreSight Trace, Profiling & Diagnostics Monitor driver" > + select CORESIGHT_LINKS_AND_SINKS > + help > + This driver provides support for configuring monitor. Monitors are > + primarily responsible for data set collection and support the > + ability to collect any permutation of data set types. > + > + To compile this driver as a module, choose M here: the module will be > + called coresight-tpdm. > + > endif > diff --git a/drivers/hwtracing/coresight/Makefile b/drivers/hwtracing/coresight/Makefile > index 329a0c704b87..6bb9b1746bc7 100644 > --- a/drivers/hwtracing/coresight/Makefile > +++ b/drivers/hwtracing/coresight/Makefile > @@ -25,5 +25,6 @@ obj-$(CONFIG_CORESIGHT_CPU_DEBUG) += coresight-cpu-debug.o > obj-$(CONFIG_CORESIGHT_CATU) += coresight-catu.o > obj-$(CONFIG_CORESIGHT_CTI) += coresight-cti.o > obj-$(CONFIG_CORESIGHT_TRBE) += coresight-trbe.o > +obj-$(CONFIG_CORESIGHT_TPDM) += coresight-tpdm.o > coresight-cti-y := coresight-cti-core.o coresight-cti-platform.o \ > coresight-cti-sysfs.o > diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c > index 23ab16dd9b5d..1d2b5b84bb5d 100644 > --- a/drivers/hwtracing/coresight/coresight-core.c > +++ b/drivers/hwtracing/coresight/coresight-core.c > @@ -1047,7 +1047,8 @@ static int coresight_validate_source(struct coresight_device *csdev, > } > > if (subtype != CORESIGHT_DEV_SUBTYPE_SOURCE_PROC && > - subtype != CORESIGHT_DEV_SUBTYPE_SOURCE_SOFTWARE) { > + subtype != CORESIGHT_DEV_SUBTYPE_SOURCE_SOFTWARE && > + subtype != CORESIGHT_DEV_SUBTYPE_SOURCE_OTHERS) { > dev_err(&csdev->dev, "wrong device subtype in %s\n", function); > return -EINVAL; > } > @@ -1116,6 +1117,7 @@ int coresight_enable(struct coresight_device *csdev) > per_cpu(tracer_path, cpu) = path; > break; > case CORESIGHT_DEV_SUBTYPE_SOURCE_SOFTWARE: > + case CORESIGHT_DEV_SUBTYPE_SOURCE_OTHERS: > /* > * Use the hash of source's device name as ID > * and map the ID to the pointer of the path. > @@ -1165,6 +1167,7 @@ void coresight_disable(struct coresight_device *csdev) > per_cpu(tracer_path, cpu) = NULL; > break; > case CORESIGHT_DEV_SUBTYPE_SOURCE_SOFTWARE: > + case CORESIGHT_DEV_SUBTYPE_SOURCE_OTHERS: > hash = hashlen_hash(hashlen_string(NULL, dev_name(&csdev->dev))); > /* Find the path by the hash. */ > path = idr_find(&path_idr, hash); > diff --git a/drivers/hwtracing/coresight/coresight-tpdm.c b/drivers/hwtracing/coresight/coresight-tpdm.c > new file mode 100644 > index 000000000000..eb8998affa90 > --- /dev/null > +++ b/drivers/hwtracing/coresight/coresight-tpdm.c > @@ -0,0 +1,149 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "coresight-priv.h" > +#include "coresight-tpdm.h" > + > +DEFINE_CORESIGHT_DEVLIST(tpdm_devs, "tpdm"); > + > +/* TPDM enable operations */ > +static int tpdm_enable(struct coresight_device *csdev, > + struct perf_event *event, u32 mode) > +{ > + struct tpdm_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); > + > + spin_lock(&drvdata->spinlock); > + if (drvdata->enable) { > + spin_unlock(&drvdata->spinlock); > + return -EBUSY; > + } > + > + drvdata->enable = true; > + spin_unlock(&drvdata->spinlock); > + > + dev_info(drvdata->dev, "TPDM tracing enabled\n"); Please make all of these dev_dbg(). We don't want these messages flooding the dmesg for everytime the device is turned on/off. > + return 0; > +} > + > +/* TPDM disable operations */ > +static void tpdm_disable(struct coresight_device *csdev, > + struct perf_event *event) > +{ > + struct tpdm_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); > + > + spin_lock(&drvdata->spinlock); > + if (!drvdata->enable) { > + spin_unlock(&drvdata->spinlock); > + return; > + } > + > + drvdata->enable = false; > + spin_unlock(&drvdata->spinlock); > + > + dev_info(drvdata->dev, "TPDM tracing disabled\n"); Same as above. Otherwise looks good to me. Suzuki