Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp6577075rwi; Mon, 24 Oct 2022 03:25:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7NTbKORE4GepEqTmd17eR4+Lw7bMyr/XW4syIaSROX8l/F0FRYRU4N3rcuVLj2o++pKs5Z X-Received: by 2002:a17:902:9005:b0:181:898b:646d with SMTP id a5-20020a170902900500b00181898b646dmr33173646plp.97.1666607122997; Mon, 24 Oct 2022 03:25:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666607122; cv=none; d=google.com; s=arc-20160816; b=JBWcVmaZT0jirY7it1KHDUt39xC0qViVpEnvr8bqPiGa534STk5rkydHsZLxvSwpoB hhepGSs2HWGlRC2qJ+Ce30vQrbkNKuB3wz5DjCB9sVSQ3AgxgLDdBHQwHJFzj/L55doV c+fUsB0MxCWsyvzT8GPmpRpMPLAMMGEUQlFzAUrKA8JEMNNzUZSgemAmyg9yIXSEwY0z PE9ZNZ5m4I/Yg9f9IDk4MgIczDF/GTA7haB0zcYpahLrlGT/8TTOJxCg5b4kfIL+66WO AuZ/PlRaEs8VcU/pS2MjzYIGdQUebVk/jpYcfNevSrLAzuAeN3enSRvXh7L0ekmRUApL mEzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=Uo03nYySlASCB4Ux3oPxY4KMgC0DbZMBJWLTgi/zX40=; b=wpmbaKRgQX5r5s+KE1VvKlwqK63KdA3xdnCxlKUPN9FVzOF+OzTi05MI7jbycxChHa kCmkL5bVTxjWTWR9pk+F87babBmtw5aN3yAbqroXKvf6A1po+HPTUym56scO2PZWmOI9 YQ8k26DcG/DVR6NWPo6AIccM5RPYDX9DLUuaZQm2YstM7uE9HLcaoX8dCa5DMXkp3V6R GmXe8IbUqHfP0lC2yeksUGnlzTpkmuwUJ6lPu9fcbyIS8V6jT25NbYCPoCBeo+T5I/DK BS45W57Tv2nT+bIXaGLdvoLlZV/Dw8kMgVy1Jh20LIh5xvAWo7WM6o0ausY31WLbLRHh 85pQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x3-20020a1709027c0300b00186b280a430si1132451pll.242.2022.10.24.03.25.11; Mon, 24 Oct 2022 03:25:22 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230070AbiJXKMC (ORCPT + 99 others); Mon, 24 Oct 2022 06:12:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230234AbiJXKLc (ORCPT ); Mon, 24 Oct 2022 06:11:32 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9FC025143C; Mon, 24 Oct 2022 03:11:24 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C911DED1; Mon, 24 Oct 2022 03:10:58 -0700 (PDT) Received: from [10.57.68.77] (unknown [10.57.68.77]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id ACD103F7B4; Mon, 24 Oct 2022 03:10:49 -0700 (PDT) Message-ID: Date: Mon, 24 Oct 2022 11:10:48 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Re: [PATCH 4/9] coresight-tpdm: Add reset node to TPDM node To: Tao Zhang , Mathieu Poirier , Alexander Shishkin , Konrad Dybcio , Mike Leach Cc: Jinlong Mao , Leo Yan , Greg Kroah-Hartman , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Tingwei Zhang , Yuanfang Zhang , Trilok Soni , Hao Zhang , linux-arm-msm@vger.kernel.org, bjorn.andersson@linaro.org References: <1662626705-13097-1-git-send-email-quic_taozha@quicinc.com> <1662626705-13097-5-git-send-email-quic_taozha@quicinc.com> From: Suzuki K Poulose In-Reply-To: <1662626705-13097-5-git-send-email-quic_taozha@quicinc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE 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 On 08/09/2022 09:45, 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. It is not clear to me *why* this is needed. Please could you elaborate on the use case of this ? See my questions below. > > 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 69ea453..74cc653 100644 > --- a/drivers/hwtracing/coresight/coresight-tpdm.c > +++ b/drivers/hwtracing/coresight/coresight-tpdm.c > @@ -152,6 +152,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) minor nit: Alignment > +{ > + int ret = 0; > + unsigned long val; > + struct tpdm_drvdata *drvdata = dev_get_drvdata(dev->parent); > + > + ret = kstrtoul(buf, 10, &val); So, any integer value written to the sysfs knob triggers the rest ? It may be better to restrict this to "1". > + if (ret) > + return ret; > + > + 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); Why is this needed ? Does the DSB device configuration change on the fly ? > + > + spin_unlock(&drvdata->spinlock); > + > + /* Disable tpdm if enabled */ > + if (drvdata->enable) > + coresight_disable(drvdata->csdev); Why is this needed ? Isn't this supposed to be triggered from the "path" when the trace session is complete ? Suzuki > + > + return size; > +} > +static DEVICE_ATTR_WO(reset); > + > /* > * value 1: 64 bits test data > * value 2: 32 bits test data > @@ -192,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.attr, > &dev_attr_integration_test.attr, > NULL, > };