Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3899292rwb; Mon, 21 Nov 2022 00:38:54 -0800 (PST) X-Google-Smtp-Source: AA0mqf462DuYBLXDJAm9DqLlrwopYPaDIdzxVlrMgijubk0MSvQ5DcBftWunTosxHB0fdK0TRaLt X-Received: by 2002:a17:903:92:b0:186:72bd:371f with SMTP id o18-20020a170903009200b0018672bd371fmr4470950pld.131.1669019934092; Mon, 21 Nov 2022 00:38:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669019934; cv=none; d=google.com; s=arc-20160816; b=iAWwlFFt11sy1uAdRSEcGED7a2diARAs70WFBUshxi5X5lFywScD8q1kCPoL3QEPkE DoWlseuFBWChTb66i5luGApNyQVvPBUehEcKpBqxUZidoX79sDbwoye9I/M36uo8duEQ OvV4Y75JiUYd6eIIAzTKUprjqFbCk1b+a1AStiT3WzMtWEEAd1NI/RDrns+W1fn17Dur OQF8jZU0uEMumaNgAZnnWjEdXr97Pn6lqdCp/iXzyI3Ug7/8GNqvxJGzuQtc0g1s1YTe 3vidxNzvCmUnUpB0+8QxS4tJ/IEdkWTr50NRG/bJnDRCtSgHKnxcsmV9BSA0Rfw2ui+A zUzw== 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=hegrGXJ0LEcfWohRCi4h//rnGmV3ckU7/bZip4cr41U=; b=xH5s07N75EwC1frkcPd3fRLYbPTORnso8YWnAGfprFpXB75Z30PMCOKnjktwb4I0wv EYSRWp7iE9u131rmGuF+azEbHlUuPuzhYAbmY94p0v6efS3vKordZEnjQH/rThxYukG7 QrE8KxUcAk0r13loKhFR7HOfChEDqg64tYz7f0C04Gl6gtU3QarABZuasvVq6EDxrx6e A2N8tRmIwsijUwWPBPvI3UX9fJ6ApoBK62GvahOz38BZW8CX2dLRwnu/YJf8cN4mHxhy UqMWNNyys/Hlv+zOxd46XvYkUCG2+y76KdFIvjHXKPuFIsiRNcvR6exuF8JsYowDvuET REYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=keKh5sZI; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b9-20020a63d809000000b004774b5b58cesi5609947pgh.876.2022.11.21.00.38.41; Mon, 21 Nov 2022 00:38:54 -0800 (PST) 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=keKh5sZI; 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 S230045AbiKUIXC (ORCPT + 91 others); Mon, 21 Nov 2022 03:23:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229910AbiKUIWt (ORCPT ); Mon, 21 Nov 2022 03:22:49 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEB6A63C3; Mon, 21 Nov 2022 00:22:47 -0800 (PST) Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AL7QFO8031412; Mon, 21 Nov 2022 08:22:38 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=hegrGXJ0LEcfWohRCi4h//rnGmV3ckU7/bZip4cr41U=; b=keKh5sZI2U6IAdsNQRa540zYGdJ1RiZ1B+QjaDi1wgrsk4NPD3hw5pbRhq+0M5pGnzG7 8Ys4MDo4LP5fPiGp8Kyo/oxR36cci9PK7/PQOs8/DtGvOXUQXs0C2BpsfG2dM1jmmLz4 TtfuO5n2dFs4Rem7+mOgAxM6xvKc59UCp+v0uvjM6ZYWqibJQPs4EoiMkTRF5e2JOpZi Kkuh/QqhRb1i0fKViXdx5GXh5t+20GG6k21AuOCcOygDv2uvHz+tlh0KMThKbAMRZaWU PDxifwoOu5gj1N1C2gQ8YdCmg/tRYIi8FSs96Ikqj8kTMCPxzG1rf+w9+VPw3Xj7kkc4 +A== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3kxrtqbthn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 21 Nov 2022 08:22:37 +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 2AL8MaMN027968 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 21 Nov 2022 08:22:36 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.36; Mon, 21 Nov 2022 00:22:31 -0800 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 v1 4/9] coresight-tpdm: Add reset node to TPDM node Date: Mon, 21 Nov 2022 16:21:08 +0800 Message-ID: <1669018873-4718-5-git-send-email-quic_taozha@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1669018873-4718-1-git-send-email-quic_taozha@quicinc.com> References: <1669018873-4718-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-ORIG-GUID: IJxRbkPoMaDSr4fUWMOgt5YdFY2wmGEr X-Proofpoint-GUID: IJxRbkPoMaDSr4fUWMOgt5YdFY2wmGEr X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-21_05,2022-11-18_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1015 malwarescore=0 bulkscore=0 phishscore=0 priorityscore=1501 impostorscore=0 suspectscore=0 mlxlogscore=999 lowpriorityscore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211210065 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS 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 TPDM device need a node to reset the configurations and status of it. So as to avoid the previous configurations affecting the current use, the configurations need to be reset first. And in some scenarios, it may be necessary to reset the TPDM configurations to complete the verification of certain function. This change provides a node to reset the configurations and disable the TPDM if it has been enabled. Signed-off-by: Tao Zhang --- drivers/hwtracing/coresight/coresight-tpdm.c | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-tpdm.c b/drivers/hwtracing/coresight/coresight-tpdm.c index 60de21d..5d5f442 100644 --- a/drivers/hwtracing/coresight/coresight-tpdm.c +++ b/drivers/hwtracing/coresight/coresight-tpdm.c @@ -161,6 +161,37 @@ static void tpdm_init_default_data(struct tpdm_drvdata *drvdata) } } +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, 0, &val); + if (ret || (val != 1)) + return -EINVAL; + + spin_lock(&drvdata->spinlock); + /* Reset all datasets to ZERO */ + if (drvdata->dsb != NULL) + memset(drvdata->dsb, 0, sizeof(struct dsb_dataset)); + + /* Init the default data */ + tpdm_init_default_data(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 +232,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, }; -- 2.7.4