From patchwork Tue Jul 25 07:15:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tao Zhang X-Patchwork-Id: 125405 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp2316481vqg; Tue, 25 Jul 2023 01:16:58 -0700 (PDT) X-Google-Smtp-Source: APBJJlHOWMEEghFN9R91LbgOTjEKp3c8c7Otw4s67myuYfpsf8IPpkdMNcfXfico+NtkMI0noloE X-Received: by 2002:a05:6512:44c:b0:4f4:dbcc:54da with SMTP id y12-20020a056512044c00b004f4dbcc54damr5695811lfk.27.1690273018179; Tue, 25 Jul 2023 01:16:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690273018; cv=none; d=google.com; s=arc-20160816; b=aNAv7iinp2hgvWv/LisJPqsG9kqg5dCfrAHw+nXk27NcfRV3fn1nSjXYnBVXiYrODC gxjA2ZciOVcdDziFBSdJHDOIqCJ9R+I4MPTPE+WMSMqrnQZhgVlV6hBhnVMPIfawvEpW 92KzMw02EUGVyO6Reu6EZjqSbbHTxzt4Ah0IXIRNNJ/smww6HcG0qyx3o5DrvC27ztM1 i5tBmXMHwrFJT9yKPiWlXumelGTuOimbFn0psMa+ei5TwyqZKTXw7ZxUthbOBmlMe1ZR YltQBKdDV+tj6TxpaNRq0Ytfod+POuFRGvOBaOF/SxtI5LBQlFuQ1dUtGKvsFSYGnT7Q Gynw== 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=jcfc3+ZNk7jCww8lgKXjJoKyRBJfleFcPzEVl0RBPvo=; fh=hXfhjPaP7YtK8cx1pDaeyea4542GzczmcrIiOSp/HFc=; b=e6U1Cx58EiIVjbGcFfRp6E/RLWmHj9p4cwEK5ybV5x+0ZRRrsVGTTK00OsoBDd6oCy LwXpeJ5796hNzfwji6Uxs4QhKsmnNyTVluws4/+4AllJc06Ra3AQEJzxqCHLco9YDTtA ISuPhCDjtZftZHBHP3VKMas7YQyyCe7uwpp/60r5x2UPQNeC7vLJYPGbQ3iXjzGzGT6J FS3ziQp1QnNFa4MzVMnFGEdKfDUFjs3ld+YsuY2GStXYuc62l4ohEG92TdE0H9NSJ3Rn ZQEf5cwW+s7ZjLn+9dHfdYN2/kiSrW8hRKLU6g04uiz+e9jA6R33S6n9RVOq4K98cBSZ BRrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=IOUm47Wq; 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 i11-20020a50fc0b000000b0051e252568besi7489236edr.662.2023.07.25.01.16.34; Tue, 25 Jul 2023 01:16:58 -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=IOUm47Wq; 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 S232408AbjGYHSP (ORCPT + 99 others); Tue, 25 Jul 2023 03:18:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232409AbjGYHR1 (ORCPT ); Tue, 25 Jul 2023 03:17:27 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DA1C212D; Tue, 25 Jul 2023 00:16:57 -0700 (PDT) Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36P4tgM1017364; Tue, 25 Jul 2023 07:16:46 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=jcfc3+ZNk7jCww8lgKXjJoKyRBJfleFcPzEVl0RBPvo=; b=IOUm47Wq1PsWkYEWY/3N5iGf+uIxNEFPUcsEasXftvlOOOSEhVKH3tmutIxupvDVeBjH auyDBqPJFnPwTxf1T5EnqMxP3O5LxSCYo813UBidY4mGbTAB1qjmwYt5IAuMxOMh1mbL Ox+T1byn71Pc2nGcGXv/aK3C1UVK+mz1uowdodwlaFs//Vdkulq8CIKTbQh04XKFa3nj p7U6CKXvuiKI7k/4hHbFuOWmGoggNgeoBzDtb2l+49f39Kl7VK7xUpjoE50GedrtOIrK avPX3MAYCVVun6vhmgMpH1wNg/XTSby8+CIeokTY/2yBsJYke/nmMXmo4hovaoZ/Dqpb KQ== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3s1r4va79s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 25 Jul 2023 07:16:45 +0000 Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 36P7GiGG029540 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 25 Jul 2023 07:16:44 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.1118.30; Tue, 25 Jul 2023 00:16:39 -0700 From: Tao Zhang To: Mathieu Poirier , Suzuki K Poulose , Alexander Shishkin , Konrad Dybcio , Mike Leach , Rob Herring , Krzysztof Kozlowski CC: Tao Zhang , Jinlong Mao , Leo Yan , Greg Kroah-Hartman , , , , , Tingwei Zhang , Yuanfang Zhang , Trilok Soni , Hao Zhang , , Subject: [PATCH v7 06/13] coresight-tpdm: Add reset node to TPDM node Date: Tue, 25 Jul 2023 15:15:46 +0800 Message-ID: <1690269353-10829-7-git-send-email-quic_taozha@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1690269353-10829-1-git-send-email-quic_taozha@quicinc.com> References: <1690269353-10829-1-git-send-email-quic_taozha@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) 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: kIkKwuHzQ8oygTk2IDYdsJUuh0YdftLH X-Proofpoint-ORIG-GUID: kIkKwuHzQ8oygTk2IDYdsJUuh0YdftLH X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-25_02,2023-07-24_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 priorityscore=1501 clxscore=1015 malwarescore=0 mlxlogscore=999 lowpriorityscore=0 impostorscore=0 bulkscore=0 mlxscore=0 phishscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307250064 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772379720138861841 X-GMAIL-MSGID: 1772379720138861841 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 --- .../ABI/testing/sysfs-bus-coresight-devices-tpdm | 10 ++++++++++ drivers/hwtracing/coresight/coresight-tpdm.c | 22 ++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm b/Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm index 4a58e64..dbc2fbd0 100644 --- a/Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm +++ b/Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm @@ -11,3 +11,13 @@ Description: Accepts only one of the 2 values - 1 or 2. 1 : Generate 64 bits data 2 : Generate 32 bits data + +What: /sys/bus/coresight/devices//reset +Date: March 2023 +KernelVersion 6.5 +Contact: Jinlong Mao (QUIC) , Tao Zhang (QUIC) +Description: + (Write) Reset the dataset of the tpdm, and disable the tpdm. + + Accepts only one value - 1. + 1 : Reset the dataset of the tpdm diff --git a/drivers/hwtracing/coresight/coresight-tpdm.c b/drivers/hwtracing/coresight/coresight-tpdm.c index 52aa48a6..acc3eea 100644 --- a/drivers/hwtracing/coresight/coresight-tpdm.c +++ b/drivers/hwtracing/coresight/coresight-tpdm.c @@ -159,6 +159,27 @@ static int tpdm_datasets_setup(struct tpdm_drvdata *drvdata) return 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); + tpdm_reset_datasets(drvdata); + spin_unlock(&drvdata->spinlock); + + return size; +} +static DEVICE_ATTR_WO(reset); + /* * value 1: 64 bits test data * value 2: 32 bits test data @@ -199,6 +220,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, };