Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4313089rwl; Tue, 28 Mar 2023 05:44:24 -0700 (PDT) X-Google-Smtp-Source: AKy350ZWWjNvUqssK/7S3E0pF5UtkeUU4fneuwRlJtSvU+cHygoKtkAOwEjZup7jSE+iSUaYmCt0 X-Received: by 2002:a17:902:f2cc:b0:1a1:c551:bd00 with SMTP id h12-20020a170902f2cc00b001a1c551bd00mr13203787plc.35.1680007463816; Tue, 28 Mar 2023 05:44:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680007463; cv=none; d=google.com; s=arc-20160816; b=PLlpWfh27zSa0U+0LwQaD+xGQh6Y7mpmcJ3vERpQKu7MG7JJe0Wr2WNbN/tGFZi7oJ xIgahg6QH74s0fasL9dTWy8ZcZJmnkNePFGwHPcSMj/ZyL1prA6uChFo1TvT3C/z9ny0 Af9SJyJBMxGTyG+mX4fXiz5jv68srg1dAAJOhvlViUOTjHsPmUAHv0m+CujBlLH1msSf z5VxCzChzxUxr2siWzjzQfW24zGXarQ2F5zWLsodAlrXJ61w4zkVnzE6B61lzJE4gZX+ GAKoBbywCeT1hlGULOv/AkOPw9J0LnojNxW2RBYa1IWEgAzDq27ubJ9OYWzX4GXWf4LL 3n1Q== 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=xozhcbtv2pWPYEmiev23brcGZHart2HyGt12ASdIBKM=; b=1AABCOVpXOGOK86oYxCdufTiCbWoG797Z9M83L8aMsG0/bd+/wXHy+Jmovb5bMboB8 wMX2TmB0BJUjRXL4j+vW25ZkYPeyPYCnOMJcqjdaRAG0fXQ6NaVhXQj5p2wyo6SDKx+I Gb4VR/hnxDX99yN3ur/N7UT8tdvo1Oz8+ptjAieiY1koeAejDAGFA/5tyeWIz0fPbHdX 29pJOAtzHpgcx2wIG4yZWYoeb25hwuwvRc4rS63FRQ+VJE4xopVkvOoz0nPKwH5pi9VF 9hOW4xGHwKBwq+j5sBb7E/4jUhurPl+a68v8hdJcNseKqiZZg8yO7LppnfcuzlYZ2B7e OVQQ== 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 u11-20020a63df0b000000b0050af2178291si29697600pgg.66.2023.03.28.05.44.10; Tue, 28 Mar 2023 05:44:23 -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 S232457AbjC1Mm1 (ORCPT + 99 others); Tue, 28 Mar 2023 08:42:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230339AbjC1MmZ (ORCPT ); Tue, 28 Mar 2023 08:42:25 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E2C0BA5C1; Tue, 28 Mar 2023 05:41:58 -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 45B75C14; Tue, 28 Mar 2023 05:34:09 -0700 (PDT) Received: from [10.57.54.240] (unknown [10.57.54.240]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 986B73F6C4; Tue, 28 Mar 2023 05:33:21 -0700 (PDT) Message-ID: Date: Tue, 28 Mar 2023 13:33:20 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH v3 02/11] coresight-tpda: Add DSB dataset support To: Tao Zhang , Mathieu Poirier , Alexander Shishkin , Konrad Dybcio , Mike Leach , Rob Herring , Krzysztof Kozlowski , James Clark Cc: Jinlong Mao , Leo Yan , Greg Kroah-Hartman , 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, Bjorn Andersson References: <1679551448-19160-1-git-send-email-quic_taozha@quicinc.com> <1679551448-19160-3-git-send-email-quic_taozha@quicinc.com> <51ad3cb3-bd83-51c9-52bc-f700cd17103c@quicinc.com> <48f31b84-573f-fe1d-bcd7-e55ec7f47831@arm.com> <595568c3-d2bc-e37e-83b3-2adfd3fa4193@quicinc.com> <6f8b087d-77a7-512e-6504-e4841447eda9@arm.com> From: Suzuki K Poulose In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.3 required=5.0 tests=NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 28/03/2023 12:31, Tao Zhang wrote: > Hi Suzuki, > > On 3/27/2023 5:43 PM, Suzuki K Poulose wrote: >> On 27/03/2023 04:31, Tao Zhang wrote: >>> >>> On 3/26/2023 3:31 AM, Suzuki K Poulose wrote: >>>> On 24/03/2023 14:58, Tao Zhang wrote: >>>>> Hi Suzuki, >>>>> >>>>> 在 3/23/2023 7:51 PM, Suzuki K Poulose 写道: >>>>>> On 23/03/2023 06:03, Tao Zhang wrote: >>>>>>> Read the DSB element size from the device tree. Set the register >>>>>>> bit that controls the DSB element size of the corresponding port. >>>>>>> >>>>>>> Signed-off-by: Tao Zhang >>>>>>> --- >>>>>>>   drivers/hwtracing/coresight/coresight-tpda.c | 58 >>>>>>> ++++++++++++++++++++++++++++ >>>>>>>   drivers/hwtracing/coresight/coresight-tpda.h |  4 ++ >>>>>>>   2 files changed, 62 insertions(+) >>>>>>> >>>>>>> diff --git a/drivers/hwtracing/coresight/coresight-tpda.c >>>>>>> b/drivers/hwtracing/coresight/coresight-tpda.c >>>>>>> index f712e11..8dcfc4a 100644 >>>>>>> --- a/drivers/hwtracing/coresight/coresight-tpda.c >>>>>>> +++ b/drivers/hwtracing/coresight/coresight-tpda.c >>>>>>> @@ -21,6 +21,47 @@ >>>>>>>     DEFINE_CORESIGHT_DEVLIST(tpda_devs, "tpda"); >>>>>>>   +/* Search and read element data size from the TPDM node in >>>>>>> + * the devicetree. Each input port of TPDA is connected to >>>>>>> + * a TPDM. Different TPDM supports different types of dataset, >>>>>>> + * and some may support more than one type of dataset. >>>>>>> + * Parameter "inport" is used to pass in the input port number >>>>>>> + * of TPDA, and it is set to 0 in the recursize call. >>>>>>> + * Parameter "parent" is used to pass in the original call. >>>>>>> + */ >>>>>> >>>>>> I am still not clear why we need to do this recursively ? >>>>> >>>>> Some TPDMs are not directly output connected to the TPDAs. So here I >>>>> >>>>> use a recursive method to check from the TPDA input port until I find >>>>> >>>>> the connected TPDM. >>>>> >>>>> Do you have a better suggestion besides a recursive method? >>>>> >>>>>> >>>>>>> +static int tpda_set_element_size(struct tpda_drvdata *drvdata, >>>>>>> +               struct coresight_device *csdev, int inport, bool >>>>>>> parent) >>>>>> >>>>>> Please could we renamse csdev => tpda_dev >>>>> >>>>> Since this is a recursively called function, this Coresight device >>>>> is not >>>>> >>>>> necessarily TPDA, it can be other Coresight device. >>>>> >>>>>> >>>>>>> +{ >>>>>>> +    static int nr_inport; >>>>>>> +    int i; >>>>>>> +    struct coresight_device *in_csdev; >>>>>> >>>>>> similarly tpdm_dev ? >>>>> Same as above, this variable may not necessarily be a TPDM. >>>>>> >>>>>> Could we not add a check here to see if the dsb_esize[inport] is >>>>>> already >>>>>> set and then bail out, reading this over and over ? >>>>>> >>>>> I will update this in the next patch series. >>>>>>> + >>>>>>> +    if (inport > (TPDA_MAX_INPORTS - 1)) >>>>>>> +        return -EINVAL; >>>>>>> + >>>>>>> +    if (parent) >>>>>>> +        nr_inport = inport; >>>>>>> + >>>>>>> +    for (i = 0; i < csdev->pdata->nr_inconns; i++) { >>>>>>> +        in_csdev = csdev->pdata->in_conns[i].remote_dev; >>>>>> >>>>>> Please note, the names of the structure field might change in the >>>>>> next version of James' series >>>>> Got it. I will keep an eye out for the James' patch series. >>>>>> >>>>>>> +        if (!in_csdev) >>>>>>> +            break; >>>>>>> + >>>>>>> +        if (parent) >>>>>>> +            if (csdev->pdata->in_conns[i].port != inport) >>>>>>> +                continue; >>>>>>> + >>>>>>> +        if (in_csdev && strstr(dev_name(&in_csdev->dev), "tpdm")) { >>>>>> >>>>>> Isn't there a better way to distinguish a device to be TPDM ? May >>>>>> be we >>>>>> could even add a source_sub_type - SOURCE_TPDM instead of using >>>>>> SOURCE_OTHERS ? Do you expect other sources to be connected to TPDA? >>>>>> e.g., STMs ? >>>>> >>>>> I can add "SOURCE_TPDM" as a source_sub_type, but SOURCE_OTHERS needs >>>>> >>>>> to be kept since the other Coresight component we will upstream >>>>> later may >>>>> >>>>> need it. >>>>> >>>>>> >>>>>>> + of_property_read_u32(in_csdev->dev.parent->of_node, >>>>>>> +                    "qcom,dsb-element-size", >>>>>>> &drvdata->dsb_esize[nr_inport]); >>>>>>> +            break; >>>>>>> +        } >>>>>>> +        tpda_set_element_size(drvdata, in_csdev, 0, false); >>>>>> >>>>>> What is the point of this ? Is this for covering the a TPDA >>>>>> connected to >>>>>> another TPDA ? >>>>>> >>>>>> e.g., { TPDM0, TPDM1 } -> TPDA0 -> TPDA1 ? >>>>> >>>>> A TPDM may not connect to the TPDA directly, for example, >>>>> >>>>> TPDM0 ->FUNNEL0->FUNNEL1->TPDA0 >>>>> >>>>> And many TPDMs can connect to one TPDA, one input port on TPDA only >>>>> has >>>>> >>>>> one TPDM connected. Therefore, we use a recursive method to find >>>>> the TPDM >>>>> >>>>> corresponding to the input port of TPDA. >>>> >>>> How do you find out decide what to choose, if there are multiple TPDMs >>>> connected to FUNNEL0 or even FUNNEL1 ? >>>> >>>> e.g >>>> >>>> TPDM0->FUNNEL0->FUNNEL1->TPDA0 >>>>                 / >>>>           TPDM1 >>> >>> We can find out the corresponding TPDM by the input port number of TPDA. >>> >>> Each input port is connected to a TPDM. So we have an input port >>> number in >>> >>> the input parameter of the recursive lookup function >>> "tpda_set_element_size". >> >> I don't understand, how you would figure out, in the above situation. >> i.e., FUNNEL1 is connected to TPDA0, but there are two TPDMs that could >> be pumping the trace. They both arrive via FUNNEL1. So, how does that >> solve your problem ? > > In our HW design, the input ports of TPDA and TPDM are one-one-one > corresponding.  Only one > > TPDM can be found connected from one TPDA's input port. The path to a > TPDA input port doesn't > > connect more than one TPDM. It's by HW design. Your current designs may be like that. But as far as the driver is concerned, I would like to add in extra measures to ensure that it encounters a variation from the above on a future platform. So, please could you add a check to detect this case and add a WARNING ? Suzuki > > > Tao > >> >> Suzuki >> >> >>> >>>> Suzuki >>>> >>>> >>