From patchwork Thu Sep 14 05:43:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tao Zhang X-Patchwork-Id: 139332 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp133451vqi; Wed, 13 Sep 2023 22:51:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFsuh04a55grEcEm45ENTOyBN8+efNy3xoR6vF5Gccarh/wrIr8zXTEMzsUjnwSb1rGk7IL X-Received: by 2002:a05:6a00:2289:b0:68a:3c7a:129e with SMTP id f9-20020a056a00228900b0068a3c7a129emr5346055pfe.27.1694670683335; Wed, 13 Sep 2023 22:51:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694670683; cv=none; d=google.com; s=arc-20160816; b=pNJi+YNFHHvkXbKc0BcUXjCyd7GIjGvlDasPkd/90jXyiJcAdR4UqKyxmNANiIGgXj RcSABJxOL8/o8DRvYbvyZqc4WBBz5z4B9O/2bw5hWuOucEiS4dcZjNz3MRQrh4HFONY6 IO97T+fhZMpHAVF19xsJ60NpT+vYC4NJdmSvFun70QPi4X2EBSnA7joRjrAP0jJv0nYD 1HIvdtbEMQe+OKKlUUVb2ifMuRlG+qCrBnAV7sYBUsV+676R6UZPkHDsyN5/DlieUo92 wekuUwpYOxGalcD1xGjOEqMWk83eYrsuz3m129pI1ahftqvLwesfuaWmfKEJ7AezOxFE F+6Q== 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=LI3eJVseO+N9eMjqI+zPz/zS+ZhH1l5JDAw14TDHSok=; fh=n/cywDBrV54XLbQm/aXN5C7dSeQ+T0voxuinVQDvrSM=; b=lG+tM+ValIcmZ/Z8aY1o+fHYBdgbWhSwWPpoZHAMkMXtFn7IEogqKQMhvXPZ+a1XLb vzAhQWx3U2VkwmsKa1AnFkEg9PeP1V4kc69d+vqSAQ0CisVHcOxA/eAhXhTpHBnAOn7j LLELrylyS+IN8ef7MYSaXJOVJJ80Vkl5J7MLmgoJ5rY9mkPoY1ZEVDGK9ZnfDMS7PWTz vG7wvYaxmu3SvhXxzkq8Rp7Qz/labBC7vVhSfPS1/lPGCkG5b6nYshhkMDZdPjTqm6YZ Qn6ej4lNn+WASV9Ro9FIyVf4TxgTMXurzZtUeEAwcqwlGWQ94rk6e9+Dz0U29ovvXL2g SJOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=EnlT1j4A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id cl4-20020a056a0032c400b006901504b68esi875245pfb.166.2023.09.13.22.51.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 22:51:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=EnlT1j4A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 25CA0812AD1F; Wed, 13 Sep 2023 22:44:55 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234707AbjINFos (ORCPT + 35 others); Thu, 14 Sep 2023 01:44:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235007AbjINFok (ORCPT ); Thu, 14 Sep 2023 01:44:40 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A1FAE58; Wed, 13 Sep 2023 22:44:34 -0700 (PDT) Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38E3aZqT032711; Thu, 14 Sep 2023 05:44:23 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=LI3eJVseO+N9eMjqI+zPz/zS+ZhH1l5JDAw14TDHSok=; b=EnlT1j4AWQ7MNCo3PN0ZBUOvqcLoALy9VQQsuBxfaTrmP2KLS9GA85TReiQzBZukLszX ZHhTBOaovDIWgPi/+qW6QWD4teR+WxTTwRdbWuV24bfWVAAAJmKa3tUGNMLqMurcBBWa budVyoFt1Z/MV8mRBZ8b45dOiW+wegr15EuE3fkVlCKi7+2fDAl41VdaZAPo5NjMqQsW aSlmuyobCwcKTb6CDQp7YiBvZM44mahwm2VjfRDCQor2OlLonSjffvQ/mZHk9hzny+Q9 aF31BWedqIWvt7UTWKlAPZyTvkThsrfYT9cfRuaOSjCnPBfU/4xTK2AlcAToxdh9EqkM OA== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3t3003kjfm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 Sep 2023 05:44:22 +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 38E5iLWZ010513 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 Sep 2023 05:44:21 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; Wed, 13 Sep 2023 22:44:16 -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 v9 06/13] coresight-tpdm: Add reset node to TPDM node Date: Thu, 14 Sep 2023 13:43:17 +0800 Message-ID: <1694670204-11515-7-git-send-email-quic_taozha@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1694670204-11515-1-git-send-email-quic_taozha@quicinc.com> References: <1694670204-11515-1-git-send-email-quic_taozha@quicinc.com> MIME-Version: 1.0 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-ORIG-GUID: YSUIe8FB7ODlFvbcuKcM7K1wvLF_TZfD X-Proofpoint-GUID: YSUIe8FB7ODlFvbcuKcM7K1wvLF_TZfD X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-14_03,2023-09-13_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 clxscore=1015 adultscore=0 malwarescore=0 priorityscore=1501 lowpriorityscore=0 spamscore=0 phishscore=0 bulkscore=0 suspectscore=0 mlxscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309140049 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 13 Sep 2023 22:44:55 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776991006651507906 X-GMAIL-MSGID: 1776991006651507906 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..ef8b5a6 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_dataset +Date: March 2023 +KernelVersion 6.7 +Contact: Jinlong Mao (QUIC) , Tao Zhang (QUIC) +Description: + (Write) Reset the dataset of 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 951ad4d..9c65e4c 100644 --- a/drivers/hwtracing/coresight/coresight-tpdm.c +++ b/drivers/hwtracing/coresight/coresight-tpdm.c @@ -162,6 +162,27 @@ static int tpdm_datasets_setup(struct tpdm_drvdata *drvdata) return 0; } +static ssize_t reset_dataset_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, 0, &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_dataset); + /* * value 1: 64 bits test data * value 2: 32 bits test data @@ -202,6 +223,7 @@ static ssize_t integration_test_store(struct device *dev, static DEVICE_ATTR_WO(integration_test); static struct attribute *tpdm_attrs[] = { + &dev_attr_reset_dataset.attr, &dev_attr_integration_test.attr, NULL, };