From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F48CC7EE23 for ; Tue, 23 May 2023 14:48:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235471AbjEWOs6 (ORCPT ); Tue, 23 May 2023 10:48:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232287AbjEWOs5 (ORCPT ); Tue, 23 May 2023 10:48:57 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8CA7ACD; Tue, 23 May 2023 07:48:55 -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 EE5CF139F; Tue, 23 May 2023 07:49:39 -0700 (PDT) Received: from [10.57.73.71] (unknown [10.57.73.71]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5CB453F840; Tue, 23 May 2023 07:48:52 -0700 (PDT) Message-ID: Date: Tue, 23 May 2023 15:48:50 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH v4 02/11] coresight-tpda: Add DSB dataset support From: Suzuki K Poulose To: Tao Zhang , Mathieu Poirier , Alexander Shishkin , Konrad Dybcio , Mike Leach , Rob Herring , Krzysztof Kozlowski 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, andersson@kernel.org References: <1682586037-25973-1-git-send-email-quic_taozha@quicinc.com> <1682586037-25973-3-git-send-email-quic_taozha@quicinc.com> <444bc278-a3e3-7d99-6020-7c3337371f66@arm.com> In-Reply-To: <444bc278-a3e3-7d99-6020-7c3337371f66@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org On 23/05/2023 11:07, Suzuki K Poulose wrote: > On 27/04/2023 10:00, 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-core.c |  1 + >>   drivers/hwtracing/coresight/coresight-tpda.c | 92 >> +++++++++++++++++++++++++--- >>   drivers/hwtracing/coresight/coresight-tpda.h |  4 ++ >>   drivers/hwtracing/coresight/coresight-tpdm.c |  2 +- >>   include/linux/coresight.h                    |  1 + >>   5 files changed, 90 insertions(+), 10 deletions(-) >> >> diff --git a/drivers/hwtracing/coresight/coresight-core.c >> b/drivers/hwtracing/coresight/coresight-core.c >> index 2af416b..f1eacbb 100644 >> --- a/drivers/hwtracing/coresight/coresight-core.c >> +++ b/drivers/hwtracing/coresight/coresight-core.c >> @@ -1092,6 +1092,7 @@ static int coresight_validate_source(struct >> coresight_device *csdev, >>       if (subtype != CORESIGHT_DEV_SUBTYPE_SOURCE_PROC && >>           subtype != CORESIGHT_DEV_SUBTYPE_SOURCE_SOFTWARE && >> +        subtype != CORESIGHT_DEV_SUBTYPE_SOURCE_TPDM && >>           subtype != CORESIGHT_DEV_SUBTYPE_SOURCE_OTHERS) { >>           dev_err(&csdev->dev, "wrong device subtype in %s\n", function); >>           return -EINVAL; > > Please see the comment at the bottom. > >> diff --git a/drivers/hwtracing/coresight/coresight-tpda.c >> b/drivers/hwtracing/coresight/coresight-tpda.c >> index 8d2b9d2..af9c72f 100644 >> --- a/drivers/hwtracing/coresight/coresight-tpda.c >> +++ b/drivers/hwtracing/coresight/coresight-tpda.c >> @@ -21,6 +21,56 @@ >>   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. >> + */ >> +static int tpda_set_element_size(struct tpda_drvdata *drvdata, >> +               struct coresight_device *csdev, int inport, bool parent) The name parent is a bit confusing. It could imply parent device ? That is kind of inverse ? because, parent = true, indicates the parent device of tpda, which is not true. Could we simply say bool match_inport => When true, the dest_port of the connection from the csdev must match the inport ? And ... >> +{ >> +    static int nr_inport; >> +    int i; >> +    static bool tpdm_found; >> +    struct coresight_device *in_csdev; >> + >> +    if (inport > (TPDA_MAX_INPORTS - 1)) >> +        return -EINVAL; >> + >> +    if (parent) { >> +        nr_inport = inport; >> +        tpdm_found = false; >> +    } >> + >> +    for (i = 0; i < csdev->pdata->nr_inconns; i++) { >> +        in_csdev = csdev->pdata->in_conns[i]->src_dev; >> +        if (!in_csdev) >> +            break; >> + >> +        if (parent) >> +            if (csdev->pdata->in_conns[i]->dest_port != inport) >> +                continue; The above can become : if (match_inport && csdev->pdata->in_conns[i]->dest_port != inport) continue; Suzuki