Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp873417rwp; Thu, 13 Jul 2023 02:26:35 -0700 (PDT) X-Google-Smtp-Source: APBJJlFoHqluFW7skO+jHlVh4f5Xl+2oLgyhZNIg1k5bGss35rv1HmZ0KXLicNSKuhWtSUAeB34Z X-Received: by 2002:a05:6a20:7d94:b0:121:ca90:df01 with SMTP id v20-20020a056a207d9400b00121ca90df01mr392106pzj.40.1689240395458; Thu, 13 Jul 2023 02:26:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689240395; cv=none; d=google.com; s=arc-20160816; b=W4AIFRVBZUasWRjWzs23Nq1joSodPClEO5y5jTnCtpB6iO++tIgir7BofDIyTOt+rM Ygy/aTkDNHiScjuAXe80J2y0qVZwShWZYnplfNdecCaC+RX0FHFAIWTMe5wcRj21W/2O xAhyL9AJB1xM1P7OIyH9Y4Ah76k31xc4zGumVarrcXplA5M8lAx4jZUAPXxGMrctYpzC TPh23n/qKAlwkNxhYd775iRPgxjoSqGBiqLS1dxEaEYh+28ikvtfFjFRNPyrsWLr1wHS OhfcaLFSXC67CrglzGGmmV1fPys7bh+IbcP+rk3hWpzUBCcieb4fpu4LpkyVv2Grkb5v 3tXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=mvy/EMrBnpulduSmMNLqJP+nI2s3mvHLILhwx65lZzg=; fh=vu9Zn2ISxcrPAqXbLS61/UERajK+yWKAas4u6KreSd0=; b=AcqjNY8AB9zwfMUdVW6D2Ea18jwcQqeuXbrGn2ETXci+lE9KOSzWolKWx8BqRKINJR 0yHaLpKET31mNBPrqu1YKIHr1KG5+EYsrkAjpndc9/DSAqdQe+jeOIVi9yu6BiL7919o inGOvFd09T3LOoD0Ikldq4wiJSgr1QwTNZHbG5r36w3ewySif6vaAMpBlnKBBrsMgC6q Fv5xsA9Q9PFSIAJH0y1pEGobcVD2bXJL/7ZyGHQmB+PURTWxq22mR8VnQyB57btxXNSR P8Hd77MQU4Tms6/tCBMqqRTDDpQSwmJQzHSCG4V1aeCCOdjCnaoma1DHTXpDyYePj6Fn fAeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="n/4CMkr4"; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kw3-20020a170902f90300b001b8a591d5b9si4882646plb.133.2023.07.13.02.26.23; Thu, 13 Jul 2023 02:26:35 -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=@linaro.org header.s=google header.b="n/4CMkr4"; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233939AbjGMIzM (ORCPT + 99 others); Thu, 13 Jul 2023 04:55:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233741AbjGMIzK (ORCPT ); Thu, 13 Jul 2023 04:55:10 -0400 Received: from mail-yb1-xb33.google.com (mail-yb1-xb33.google.com [IPv6:2607:f8b0:4864:20::b33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1ED51BB for ; Thu, 13 Jul 2023 01:55:08 -0700 (PDT) Received: by mail-yb1-xb33.google.com with SMTP id 3f1490d57ef6-caf3a97aa3dso428001276.1 for ; Thu, 13 Jul 2023 01:55:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689238508; x=1691830508; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=mvy/EMrBnpulduSmMNLqJP+nI2s3mvHLILhwx65lZzg=; b=n/4CMkr4qcI041dReHtmELq5ltPXDA8cbnDEnrDVW/N4+L5e3L8ni+CbAxQU/e4eP5 s81fZfsz295AJttgBoNxIGX7U2yru2axJ6M4pCLjn7tHYzkeHlvKC/0TD8ek3UphWmVp 05dFtg+DPS8skpG2b2VeGgh/Pt+5p38QTvjygKPWS47F5bmcjEH87Js6jWz5+SLT+dPZ PZJPf0M1fHyqW5i/uzrhIrvPn5QbXq9KgS12S/A896e+ZLcYxOz2AkgHYX21oDVgDRQh 6NlYsNu4CcVtjDqZ28LpwMt2g4ZdYNNt1tV22wathsGULaafqPHisoq8qZ2VlxDtkLZm u/VA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689238508; x=1691830508; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=mvy/EMrBnpulduSmMNLqJP+nI2s3mvHLILhwx65lZzg=; b=e3WYW/DCbRACSA0W6KVhgyww2f/veLV4bhJ8EUgb9InsFOh3iv5u8zTTTtIjOzXNRC 2C2wtczy/rrtQcxS9kd/2KZcEOOOK/+L+jGh4Crq49TuZptmHLQIbMXh5MDTnWECc9kk EIj7msVg06n3gi+Id/ZoqsmvEldU9w48KH3ES5BgAznVxaMJuDunslKdOyuRXgwG2PW8 CZ9SkokT4VpwijLuBdeWZPwMUoKLvXgtt9YaxXKZNFGptZjiVm2mZpIB354OzaVMzBLY z3DlX4xFa709EhWszMtcpmIv5D8n7SKmzZdttNw2JLcF1PxVJoc+pEI7g+HQ7UPn1XLs +Ysg== X-Gm-Message-State: ABy/qLaYYLn0colKV4xFWRdMR/zHQBdl7ysldmQvG2T6B4XZCWhWlaQJ NNmu7eWdU62jq1XK8cq54pUo1CvywYTKuazEWBvzZg== X-Received: by 2002:a0d:c884:0:b0:579:e8de:3580 with SMTP id k126-20020a0dc884000000b00579e8de3580mr1101134ywd.9.1689238507937; Thu, 13 Jul 2023 01:55:07 -0700 (PDT) MIME-Version: 1.0 References: <1687246361-23607-1-git-send-email-quic_taozha@quicinc.com> <1687246361-23607-10-git-send-email-quic_taozha@quicinc.com> <2023062024-sincere-tripod-95dc@gregkh> <3aca4a55-0dc7-b34c-d2c0-111a96c33ec3@quicinc.com> In-Reply-To: From: Mike Leach Date: Thu, 13 Jul 2023 09:54:56 +0100 Message-ID: Subject: Re: [PATCH v6 09/13] Add nodes for dsb edge control To: Tao Zhang Cc: Suzuki K Poulose , Greg Kroah-Hartman , Mathieu Poirier , Alexander Shishkin , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Jinlong Mao , Leo Yan , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Tingwei Zhang , Yuanfang Zhang , Trilok Soni , Hao Zhang , linux-arm-msm@vger.kernel.org, andersson@kernel.org Content-Type: text/plain; charset="UTF-8" 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,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 HI Tao, On Wed, 12 Jul 2023 at 14:53, Tao Zhang wrote: > > > On 6/20/2023 9:41 PM, Suzuki K Poulose wrote: > > On 20/06/2023 09:31, Tao Zhang wrote: > >> > >> On 6/20/2023 3:37 PM, Greg Kroah-Hartman wrote: > >>> On Tue, Jun 20, 2023 at 03:32:37PM +0800, Tao Zhang wrote: > >>>> Add the nodes to set value for DSB edge control and DSB edge > >>>> control mask. Each DSB subunit TPDM has maximum of n(n<16) EDCR > >>>> resgisters to configure edge control. DSB edge detection control > >>>> 00: Rising edge detection > >>>> 01: Falling edge detection > >>>> 10: Rising and falling edge detection (toggle detection) > >>>> And each DSB subunit TPDM has maximum of m(m<8) ECDMR registers to > >>>> configure mask. Eight 32 bit registers providing DSB interface > >>>> edge detection mask control. > >>>> > >>>> Signed-off-by: Tao Zhang > >>>> --- > >>>> .../ABI/testing/sysfs-bus-coresight-devices-tpdm | 32 +++++ > >>>> drivers/hwtracing/coresight/coresight-tpdm.c | 143 > >>>> ++++++++++++++++++++- > >>>> drivers/hwtracing/coresight/coresight-tpdm.h | 22 ++++ > >>>> 3 files changed, 196 insertions(+), 1 deletion(-) > >>>> > >>>> diff --git > >>>> a/Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm > >>>> b/Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm > >>>> index 2a82cd0..34189e4a 100644 > >>>> --- a/Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm > >>>> +++ b/Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm > >>>> @@ -60,3 +60,35 @@ Description: > >>>> Bit[3] : Set to 0 for low performance mode. > >>>> Set to 1 for high performance mode. > >>>> Bit[4:8] : Select byte lane for high performance mode. > >>>> + > >>>> +What: /sys/bus/coresight/devices//dsb_edge_ctrl > >>>> +Date: March 2023 > >>>> +KernelVersion 6.5 > >>>> +Contact: Jinlong Mao (QUIC) , Tao > >>>> Zhang (QUIC) > >>>> +Description: > >>>> + Read/Write a set of the edge control registers of the DSB > >>>> + in TPDM. > >>>> + > >>>> + Expected format is the following: > >>>> + > >>> sysfs is "one value", not 3. Please never have to parse a sysfs file. > >> > >> Do you mean sysfs file can only accept "one value"? > >> > >> I see that more than one value are written to the sysfs file > >> "trigout_attach". > >> > >>> > >>>> +static ssize_t dsb_edge_ctrl_show(struct device *dev, > >>>> + struct device_attribute *attr, > >>>> + char *buf) > >>>> +{ > >>>> + struct tpdm_drvdata *drvdata = dev_get_drvdata(dev->parent); > >>>> + ssize_t size = 0; > >>>> + unsigned long bytes; > >>>> + int i; > >>>> + > >>>> + spin_lock(&drvdata->spinlock); > >>>> + for (i = 0; i < TPDM_DSB_MAX_EDCR; i++) { > >>>> + bytes = sysfs_emit_at(buf, size, > >>>> + "Index:0x%x Val:0x%x\n", i, > >>> Again, no, one value, no "string" needed to parse anything. > >> > >> I also see other sysfs files can be read more than one value in other > >> drivers. > >> > >> Is this "one value" limitation the usage rule of Linux sysfs system? > >> > >> Or am I misunderstanding what you mean? > > > > Please fix the other sysfs tunables in the following patches. > > List a new solution for the similar cases below, please see if this > design is reasonable? > > 1. Two SysFS files("dsb_edge_ctrl_idx" and "dsb_edge_ctrl_val") will be > created in this case. > > 2. First write to the node "dsb_edge_ctrl_idx" to set the index number > of the edge detection. > > 3. Then write to the node "dsb_edge_ctrl_val" to set the value of the > edge detection. > > For example, if we need need to set "Falling edge detection" to the edge > detection #220-#222, we can issue the following commands. > > echo 0xdc > tpdm1/dsb_edge_ctrl_idx > > echo 0x1 > tpdm1/dsb_edge_ctrl_val > > echo 0xdd > tpdm1/dsb_edge_ctrl_idx > > echo 0x1 > tpdm1/dsb_edge_ctrl_val > > echo 0xde > tpdm1/dsb_edge_ctrl_idx > > echo 0x1 > tpdm1/dsb_edge_ctrl_val > > If this design is acceptable, we will rewrite other similar nodes based > on this solution. > This index / value model is used in the coresight drivers so should be OK - eg etm4 has cntr_idx / cntrldvr / cntr_val / cntr_ctrl, where index selects the counter, and the other val registers are applied to that counter. Mike > Let me know if you have any concerns or good suggestions for this solution. > > > Best, > > Tao > > > > > Kind regards > > Suzuki > > > > -- Mike Leach Principal Engineer, ARM Ltd. Manchester Design Centre. UK