Message ID | 1679551448-19160-5-git-send-email-quic_taozha@quicinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2746521wrt; Wed, 22 Mar 2023 23:19:57 -0700 (PDT) X-Google-Smtp-Source: AK7set/7jO9vCEgW0sElKbMTuPmEljSUsobFn0BjbDgAzedJsjNdV9UU9224oaKB52qsmFlgCBua X-Received: by 2002:a62:5250:0:b0:625:febb:bc25 with SMTP id g77-20020a625250000000b00625febbbc25mr5486640pfb.11.1679552397403; Wed, 22 Mar 2023 23:19:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679552397; cv=none; d=google.com; s=arc-20160816; b=H5MKR7aM+epng+NtCsn4ERU/RX7NYg1Tj3zI2ZJaom8AMwIMHBnBAQkFazrOHcRfMW 7pJwS/pYekTYiHohcDdkfDUVBuCldHmY5+tbhiu7wlD4VsKbEvaayRsbXYhi61c9Txy1 7LqHcZnYcNJPEqZKrtzt6VvYmBHQsmed+Sm9pb07lDeooCszKXZw+jmG8K4++pzyYqEP mFVGepM+kRMJI24Jm8TAzJMO6/Ek9nvxxUH/2WOqZHTbf7/QstoDaLrj+BTmcol19DWh M9FTcyX/1YVai7ek1Ylm0Wd5GauAntaJnf1JU6pApLgAXroYnDCIU79qHFzjIxAIMxIU DDQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=oBFN/K0yGGodrmLXftBijYUYQbAuGwXajspjmmU5hww=; b=Q9YXexPsTDHNBtAG5ZN4nq36FrgawhNHhw9EHsj3429Rdjg77RMAjVs9kCn+s+tMXL yrtKkyB3Cn5/ipMsXkytOt5FgZeCNGc/49DasnrUCDQpkTv+YGJENuawkD9KejErjOa7 Ai4v/kQmTGx05AuEZRfQ73MZ1CTdtuyGjGi02TUAIF3F5OQcbPSpB2sthhY2XQL80Op6 lE3B7/w+uywh7N5clQ30wvYbVvzQterUzSJqNCu9vEhLYaAvbWifbc6y1KUZHJNghyRj gCeNDiaDQprQKFkZRT78ZCA9AwpZsNkkvJ4eFps0ODWSIZlwZNaMV0F5e/b57QnsyUCZ IxTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="dsh/ZWaa"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c12-20020a63ef4c000000b005090185ad64si17546516pgk.879.2023.03.22.23.19.44; Wed, 22 Mar 2023 23:19:57 -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; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="dsh/ZWaa"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230365AbjCWGFS (ORCPT <rfc822;ezelljr.billy@gmail.com> + 99 others); Thu, 23 Mar 2023 02:05:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229690AbjCWGFL (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 23 Mar 2023 02:05:11 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C89B26C1E; Wed, 22 Mar 2023 23:05:07 -0700 (PDT) Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32MNQMOv003868; Thu, 23 Mar 2023 06:04:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=qcppdkim1; bh=oBFN/K0yGGodrmLXftBijYUYQbAuGwXajspjmmU5hww=; b=dsh/ZWaaEV9U8hENrz7xzpvFDz0U7oquutxgQHWU7V2fDyC0blna+HL/dKByW9y9ZX6A 231vTPeIpjAEGtUSPFJLhsbUbDaH42L9d7p2AqAOkpIvE6CzSnx89215Wk84Lj9mkOcI HWE0PB1Rn+2r5TYY/ky7Kpu5Yz1S0gpYzLZZALxaDUl03lxRJHdSexm6EH3Iya7XCICy P9cioH8QTexnMtr6Eo8a3Xf3As+l3tDeolbFZNlEcrwr0rTpGs0NVT0U6H3hWxjd1xH6 C51b6vPVRfNAtN3maAY/GqzplynMXe6c4rvC/RLnYZmvOFAJv8SEeCHteuImyWwxyqb1 xw== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3pg64k1eje-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Mar 2023 06:04:56 +0000 Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 32N64txC032410 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Mar 2023 06:04:55 GMT Received: from taozha-gv.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Wed, 22 Mar 2023 23:04:49 -0700 From: Tao Zhang <quic_taozha@quicinc.com> To: Mathieu Poirier <mathieu.poirier@linaro.org>, Suzuki K Poulose <suzuki.poulose@arm.com>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, Konrad Dybcio <konradybcio@gmail.com>, Mike Leach <mike.leach@linaro.org>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org> CC: Tao Zhang <quic_taozha@quicinc.com>, Jinlong Mao <quic_jinlmao@quicinc.com>, Leo Yan <leo.yan@linaro.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, <coresight@lists.linaro.org>, <linux-arm-kernel@lists.infradead.org>, <linux-kernel@vger.kernel.org>, <devicetree@vger.kernel.org>, Tingwei Zhang <quic_tingweiz@quicinc.com>, Yuanfang Zhang <quic_yuanfang@quicinc.com>, Trilok Soni <quic_tsoni@quicinc.com>, Hao Zhang <quic_hazha@quicinc.com>, <linux-arm-msm@vger.kernel.org>, <bjorn.andersson@linaro.org> Subject: [PATCH v3 04/11] coresight-tpdm: Add reset node to TPDM node Date: Thu, 23 Mar 2023 14:04:01 +0800 Message-ID: <1679551448-19160-5-git-send-email-quic_taozha@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1679551448-19160-1-git-send-email-quic_taozha@quicinc.com> References: <1679551448-19160-1-git-send-email-quic_taozha@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: Qs-zK0-6tJagLIaNKquVZdByMWMuvPHZ X-Proofpoint-ORIG-GUID: Qs-zK0-6tJagLIaNKquVZdByMWMuvPHZ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-22_21,2023-03-22_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 mlxscore=0 clxscore=1015 priorityscore=1501 adultscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 lowpriorityscore=0 impostorscore=0 suspectscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303150002 definitions=main-2303230045 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761138334837472983?= X-GMAIL-MSGID: =?utf-8?q?1761138334837472983?= |
Series |
Add support to configure TPDM DSB subunit
|
|
Commit Message
Tao Zhang
March 23, 2023, 6:04 a.m. UTC
TPDM device need a node to reset the configurations and status of
it. This change provides a node to reset the configurations and
disable the TPDM if it has been enabled.
Signed-off-by: Tao Zhang <quic_taozha@quicinc.com>
---
drivers/hwtracing/coresight/coresight-tpdm.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
Comments
On 23/03/2023 06:04, Tao Zhang wrote: > TPDM device need a node to reset the configurations and status of > it. This change provides a node to reset the configurations and > disable the TPDM if it has been enabled. > > Signed-off-by: Tao Zhang <quic_taozha@quicinc.com> > --- > drivers/hwtracing/coresight/coresight-tpdm.c | 28 ++++++++++++++++++++++++++++ > 1 file changed, 28 insertions(+) > > diff --git a/drivers/hwtracing/coresight/coresight-tpdm.c b/drivers/hwtracing/coresight/coresight-tpdm.c > index 5e1e2ba..104638d 100644 > --- a/drivers/hwtracing/coresight/coresight-tpdm.c > +++ b/drivers/hwtracing/coresight/coresight-tpdm.c > @@ -161,6 +161,33 @@ static void tpdm_datasets_setup(struct tpdm_drvdata *drvdata) > drvdata->datasets |= pidr & GENMASK(TPDM_DATASETS - 1, 0); > } > > +static ssize_t reset_store(struct device *dev, > + struct device_attribute *attr, > + const char *buf, > + size_t size) > +{ > + int ret = 0; > + unsigned long val; > + struct tpdm_drvdata *drvdata = dev_get_drvdata(dev->parent); > + > + ret = kstrtoul(buf, 10, &val); > + if (ret || val != 1) > + return -EINVAL; > + > + spin_lock(&drvdata->spinlock); > + /* Reset all datasets to ZERO, and init the default data*/ > + tpdm_init_datasets(drvdata); With the suggested rename in the previous patch, you wouldn't need a comment here. > + > + spin_unlock(&drvdata->spinlock); > + > + /* Disable tpdm if enabled */ > + if (drvdata->enable) > + coresight_disable(drvdata->csdev); Couldn't this be done via disable_source ? Please don't overload the sysfs handle. > + > + return size; > +} > +static DEVICE_ATTR_WO(reset); Documentation for the sysfs node please ? Suzuki
On 23/03/2023 14:41, Suzuki K Poulose wrote: > On 23/03/2023 06:04, Tao Zhang wrote: >> TPDM device need a node to reset the configurations and status of >> it. This change provides a node to reset the configurations and >> disable the TPDM if it has been enabled. Please justify why this "do everything" magic knob is required when there are tunables for individual controls in the later patches. Suzuki >> >> Signed-off-by: Tao Zhang <quic_taozha@quicinc.com> >> --- >> drivers/hwtracing/coresight/coresight-tpdm.c | 28 >> ++++++++++++++++++++++++++++ >> 1 file changed, 28 insertions(+) >> >> diff --git a/drivers/hwtracing/coresight/coresight-tpdm.c >> b/drivers/hwtracing/coresight/coresight-tpdm.c >> index 5e1e2ba..104638d 100644 >> --- a/drivers/hwtracing/coresight/coresight-tpdm.c >> +++ b/drivers/hwtracing/coresight/coresight-tpdm.c >> @@ -161,6 +161,33 @@ static void tpdm_datasets_setup(struct >> tpdm_drvdata *drvdata) >> drvdata->datasets |= pidr & GENMASK(TPDM_DATASETS - 1, 0); >> } >> +static ssize_t reset_store(struct device *dev, >> + struct device_attribute *attr, >> + const char *buf, >> + size_t size) >> +{ >> + int ret = 0; >> + unsigned long val; >> + struct tpdm_drvdata *drvdata = dev_get_drvdata(dev->parent); >> + >> + ret = kstrtoul(buf, 10, &val); >> + if (ret || val != 1) >> + return -EINVAL; >> + >> + spin_lock(&drvdata->spinlock); >> + /* Reset all datasets to ZERO, and init the default data*/ >> + tpdm_init_datasets(drvdata); > > With the suggested rename in the previous patch, you wouldn't need > a comment here. > >> + >> + spin_unlock(&drvdata->spinlock); >> + > > >> + /* Disable tpdm if enabled */ >> + if (drvdata->enable) >> + coresight_disable(drvdata->csdev); > > Couldn't this be done via disable_source ? Please don't overload > the sysfs handle. > >> + >> + return size; >> +} >> +static DEVICE_ATTR_WO(reset); > > Documentation for the sysfs node please ? > > Suzuki >
Hi Suzuki, On 3/23/2023 10:41 PM, Suzuki K Poulose wrote: > On 23/03/2023 06:04, Tao Zhang wrote: >> TPDM device need a node to reset the configurations and status of >> it. This change provides a node to reset the configurations and >> disable the TPDM if it has been enabled. >> >> Signed-off-by: Tao Zhang <quic_taozha@quicinc.com> >> --- >> drivers/hwtracing/coresight/coresight-tpdm.c | 28 >> ++++++++++++++++++++++++++++ >> 1 file changed, 28 insertions(+) >> >> diff --git a/drivers/hwtracing/coresight/coresight-tpdm.c >> b/drivers/hwtracing/coresight/coresight-tpdm.c >> index 5e1e2ba..104638d 100644 >> --- a/drivers/hwtracing/coresight/coresight-tpdm.c >> +++ b/drivers/hwtracing/coresight/coresight-tpdm.c >> @@ -161,6 +161,33 @@ static void tpdm_datasets_setup(struct >> tpdm_drvdata *drvdata) >> drvdata->datasets |= pidr & GENMASK(TPDM_DATASETS - 1, 0); >> } >> +static ssize_t reset_store(struct device *dev, >> + struct device_attribute *attr, >> + const char *buf, >> + size_t size) >> +{ >> + int ret = 0; >> + unsigned long val; >> + struct tpdm_drvdata *drvdata = dev_get_drvdata(dev->parent); >> + >> + ret = kstrtoul(buf, 10, &val); >> + if (ret || val != 1) >> + return -EINVAL; >> + >> + spin_lock(&drvdata->spinlock); >> + /* Reset all datasets to ZERO, and init the default data*/ >> + tpdm_init_datasets(drvdata); > > With the suggested rename in the previous patch, you wouldn't need > a comment here. I will update this in the next patch series. > >> + >> + spin_unlock(&drvdata->spinlock); >> + > > >> + /* Disable tpdm if enabled */ >> + if (drvdata->enable) >> + coresight_disable(drvdata->csdev); > > Couldn't this be done via disable_source ? Please don't overload > the sysfs handle. I will update this in the next patch series. > >> + >> + return size; >> +} >> +static DEVICE_ATTR_WO(reset); > > Documentation for the sysfs node please ? I will update this in the next patch series. > > Suzuki >
Hi Suzuki, On 3/23/2023 10:48 PM, Suzuki K Poulose wrote: > On 23/03/2023 14:41, Suzuki K Poulose wrote: >> On 23/03/2023 06:04, Tao Zhang wrote: >>> TPDM device need a node to reset the configurations and status of >>> it. This change provides a node to reset the configurations and >>> disable the TPDM if it has been enabled. > > Please justify why this "do everything" magic knob is required > when there are tunables for individual controls in the later > patches. We want to have a single knob that resets all the datasets, which saves the need to configure the individual controls one by one. Since it is often necessary to reset all the datasets, this knob will be more user-friendly. Tao > > Suzuki > >>> >>> Signed-off-by: Tao Zhang <quic_taozha@quicinc.com> >>> --- >>> drivers/hwtracing/coresight/coresight-tpdm.c | 28 >>> ++++++++++++++++++++++++++++ >>> 1 file changed, 28 insertions(+) >>> >>> diff --git a/drivers/hwtracing/coresight/coresight-tpdm.c >>> b/drivers/hwtracing/coresight/coresight-tpdm.c >>> index 5e1e2ba..104638d 100644 >>> --- a/drivers/hwtracing/coresight/coresight-tpdm.c >>> +++ b/drivers/hwtracing/coresight/coresight-tpdm.c >>> @@ -161,6 +161,33 @@ static void tpdm_datasets_setup(struct >>> tpdm_drvdata *drvdata) >>> drvdata->datasets |= pidr & GENMASK(TPDM_DATASETS - 1, 0); >>> } >>> +static ssize_t reset_store(struct device *dev, >>> + struct device_attribute *attr, >>> + const char *buf, >>> + size_t size) >>> +{ >>> + int ret = 0; >>> + unsigned long val; >>> + struct tpdm_drvdata *drvdata = dev_get_drvdata(dev->parent); >>> + >>> + ret = kstrtoul(buf, 10, &val); >>> + if (ret || val != 1) >>> + return -EINVAL; >>> + >>> + spin_lock(&drvdata->spinlock); >>> + /* Reset all datasets to ZERO, and init the default data*/ >>> + tpdm_init_datasets(drvdata); >> >> With the suggested rename in the previous patch, you wouldn't need >> a comment here. >> >>> + >>> + spin_unlock(&drvdata->spinlock); >>> + >> >> >>> + /* Disable tpdm if enabled */ >>> + if (drvdata->enable) >>> + coresight_disable(drvdata->csdev); >> >> Couldn't this be done via disable_source ? Please don't overload >> the sysfs handle. >> >>> + >>> + return size; >>> +} >>> +static DEVICE_ATTR_WO(reset); >> >> Documentation for the sysfs node please ? >> >> Suzuki >> >
diff --git a/drivers/hwtracing/coresight/coresight-tpdm.c b/drivers/hwtracing/coresight/coresight-tpdm.c index 5e1e2ba..104638d 100644 --- a/drivers/hwtracing/coresight/coresight-tpdm.c +++ b/drivers/hwtracing/coresight/coresight-tpdm.c @@ -161,6 +161,33 @@ static void tpdm_datasets_setup(struct tpdm_drvdata *drvdata) drvdata->datasets |= pidr & GENMASK(TPDM_DATASETS - 1, 0); } +static ssize_t reset_store(struct device *dev, + struct device_attribute *attr, + const char *buf, + size_t size) +{ + int ret = 0; + unsigned long val; + struct tpdm_drvdata *drvdata = dev_get_drvdata(dev->parent); + + ret = kstrtoul(buf, 10, &val); + if (ret || val != 1) + return -EINVAL; + + spin_lock(&drvdata->spinlock); + /* Reset all datasets to ZERO, and init the default data*/ + tpdm_init_datasets(drvdata); + + spin_unlock(&drvdata->spinlock); + + /* Disable tpdm if enabled */ + if (drvdata->enable) + coresight_disable(drvdata->csdev); + + return size; +} +static DEVICE_ATTR_WO(reset); + /* * value 1: 64 bits test data * value 2: 32 bits test data @@ -201,6 +228,7 @@ static ssize_t integration_test_store(struct device *dev, static DEVICE_ATTR_WO(integration_test); static struct attribute *tpdm_attrs[] = { + &dev_attr_reset.attr, &dev_attr_integration_test.attr, NULL, };