From patchwork Mon Jun 12 07:07:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tao Zhang X-Patchwork-Id: 106327 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2440019vqr; Mon, 12 Jun 2023 01:45:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Xr/QSEQOq5leCLnPN6pXOqr8z9okP/zJFMGLTmxqArz/DqEa8EXCuzNlAdVCjktY3P2u5 X-Received: by 2002:a17:907:707:b0:96a:1ec1:2c9f with SMTP id xb7-20020a170907070700b0096a1ec12c9fmr8540401ejb.12.1686559503483; Mon, 12 Jun 2023 01:45:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686559503; cv=none; d=google.com; s=arc-20160816; b=GjAgPUWtCQV6SHY4zEnqc4TMn7F0eOCE6lB59bDS/SXwAxwNdaV5vbMczQMkO7XrrA RuuLp7qCOPtb1J+mWp4VYZW+O9C4xv0DXrswSH5wVNwpw+Q/t1Rf2z9D3EK96Z7F8iZ9 ABuKr5/7h8Bp42p0l9GFSxtS/AzPUieT0ZFdtqFfhr5iHhtXiti60TbvXNzHm9Ro0ZA9 DS8KfMqcRrnp3O4oH1OrQ0aOcsHbcKWcbF/+BSuyCgs5tzwEKANNA/YtJc1gwPFqhXot 18AlciQh6pJwhvkHep/51Pk3U+pSvJbFUzg37td0uO+W2gnauwpmkEY+zoyzRbEDu+EL Y+5Q== 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=; b=huxMq5WXkmEaCCppKxVpN4OsSaWlU4Zjn5zF7laXOCxl3zznaTRp37FN9L+FPec2FP lYAK+zs08OBPNPnyMJOqJTCOIEkxdttYPxRD44kueJLhjgn3p9T1+Ptye+c6GVOw+fCC O51DduxS3omq97kFkbQsCneNxTm4uxAuaoexgFo4WrLnJCF7dDSJIYoD7+d0rL4d3q4g hnuIt6FhhGURazUn9M6QfjsJ5MHFkRyXjkd5/ctOGHFDqVt3oA1CEk/RZKih2yz+93O9 8a0ocwq7vqeCVQyFdC6Fc/XELJ5ONgT4GpiqLvmTjJUd8RUu8wOLev/XcitUfk5InA5o S46g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=i4yFgWir; 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 c20-20020a170906341400b0096f7b069067si4807699ejb.142.2023.06.12.01.44.39; Mon, 12 Jun 2023 01:45:03 -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=i4yFgWir; 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 S229489AbjFLIU5 (ORCPT + 99 others); Mon, 12 Jun 2023 04:20:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231872AbjFLITx (ORCPT ); Mon, 12 Jun 2023 04:19:53 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A14D4213; Mon, 12 Jun 2023 01:19:21 -0700 (PDT) Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35C6qhGu013550; Mon, 12 Jun 2023 07:08: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=i4yFgWirHAEwIxb/PWx4O8oYuiFAwekFvx85KroGW5+oeoYbqdvrdO3jVcIhfZonWhBl wqz3OUk6zsLd4dilGQY1IscB2/fAFCXlrx7r7U98gPkOMDs8+W6jMce4CTwx8FEy36k4 Ema8o4az7Eky7Sc7kpfZMSAqIOwBAxs7VGzGBI0ZfW2vwGpUJ3DdPZ0FP1Eb4olgNuKM 1RXtHm52B9Ykkj9/boG7ZrkIoVzqhW3dvQKvUbtePcMzroClEbPvHXBxwBUM+dXdtsn5 63+N4laKEsgfTYxKgmLJNia/HkNcxQlV6i9NEzMr6WPxKDLBe6hEQ1VUeGEZ5rDSb6w8 cw== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3r4hjbtk0h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Jun 2023 07:08:45 +0000 Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 35C78iGZ020657 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Jun 2023 07:08: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.986.42; Mon, 12 Jun 2023 00:08: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 v5 06/13] coresight-tpdm: Add reset node to TPDM node Date: Mon, 12 Jun 2023 15:07:39 +0800 Message-ID: <1686553666-5811-7-git-send-email-quic_taozha@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1686553666-5811-1-git-send-email-quic_taozha@quicinc.com> References: <1686553666-5811-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-ORIG-GUID: 1PfMZlFs1wfnfBTbE4At03qf2FscdSlZ X-Proofpoint-GUID: 1PfMZlFs1wfnfBTbE4At03qf2FscdSlZ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-12_04,2023-06-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 lowpriorityscore=0 adultscore=0 suspectscore=0 mlxlogscore=999 clxscore=1015 bulkscore=0 phishscore=0 mlxscore=0 impostorscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306120060 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768485818034254974?= X-GMAIL-MSGID: =?utf-8?q?1768485818034254974?= 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, };