Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1903218rwd; Fri, 2 Jun 2023 01:40:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5JQtDfccXHyJERhehsHmArXrwzdo+eSE/smXEcuQ8hNihDEhC0s8003/kDPR+gSw0yysJ3 X-Received: by 2002:a05:6a20:728d:b0:10e:786c:8219 with SMTP id o13-20020a056a20728d00b0010e786c8219mr14188751pzk.3.1685695255834; Fri, 02 Jun 2023 01:40:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685695255; cv=none; d=google.com; s=arc-20160816; b=L5GUXJCku+IS9gZFBZ933pvwChzbo/KzBMVQzbvbZG63uXPqFohjeb/sC4n0KIuIDY ec19gRzvW2q3gkabSsMDJAHTZ8BK/Hm1Ddhn8ieqe/92khAC64jsAHBXZcaSyS/BxKQu 9CmcdmtHUeT+gfFhy0jSg3XzGQXVCacJ/FSfmq7rRHUso5dzGBPRRX9aFsqVjA1ANjG6 akSLX2Pp+HND/hswNrV7s5/suuqiFI2/24TBO5rybHNQ0tEe1Umia9Yudb1MiEte2wSA tKIJFyghsmfRWpyLYCDGh9OfHld6wllvR8O41Fzk4qgYxPn39Dh45PqoaoqtWdmR8fh2 cLhA== 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:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=Iq8yfDyuugqiYdvd7XL6TiazAWFn0ZbxppVnsU3Fq74=; b=tgMe2UQFl5MAEr1C9uxpveilW4EGTiQ/dfXeYe7Dftft9prlXlDg6/p1m9krjKqxxf LqPWNJ+AmqnIR7SEVp2gJUUV/Fct43Z61vu5lFTpYGjdJ6EESCOZCOahRYGrfb9AVH7T yDgLf9U1A0mP1UVb21txDrXnyw/jYpX9i+SO5LhJSwBRmVXS97H/LT6mxiRI7S8niyzz bteX9AAPq4J8mPEeVB1oRYqpRLR2bwWWS4RWap15QECIyJ+a4Mfr68zNFnpokubTVNhq FZFiQFwfy5QR8ZKI6anMcu7uj75qNLC2ucSNMFQSi1A/cUaCwd+vYmgpxP6zALI/8N6/ KNvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=UTeeVMZm; 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 b7-20020a656687000000b00540ca2b00c6si627852pgw.733.2023.06.02.01.40.42; Fri, 02 Jun 2023 01:40:55 -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=@quicinc.com header.s=qcppdkim1 header.b=UTeeVMZm; 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 S233999AbjFBIb5 (ORCPT + 99 others); Fri, 2 Jun 2023 04:31:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234296AbjFBIbi (ORCPT ); Fri, 2 Jun 2023 04:31:38 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26D4AE47; Fri, 2 Jun 2023 01:31:32 -0700 (PDT) Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3527sDlY011933; Fri, 2 Jun 2023 08:31:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=Iq8yfDyuugqiYdvd7XL6TiazAWFn0ZbxppVnsU3Fq74=; b=UTeeVMZmvQPYs/wju/3K09w00xyO2Q4Yct3KjXyhGl1mHoiS4UeUUIxvUihILXcJfrS6 RkRyJKdbfee2GfHtHSDsZA+s8ZZ3lFybCCYZGY54a6ZAENifWEzag53gLzBWvGalQxlu 3u1SswHM9hT8J6PNWB2xuY64Pdu8+QTq16lOo1N9fiTWo2IuoTr23WjkaNoakV2xoSwu U1L+BpCNAXhiGO01Q5hU/kHbc+2fTbcIjd+I9HrZJIaxuM4UUV4oh07Gti+DOzb4FJRN QOvrMX+FIu+SvDK6W9wcJdVnwBncNwECeR01SeoF8s6yRAq09ni+jHXeKuAOqH4AzHxy 4g== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3qxugrt5kn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 02 Jun 2023 08:31:17 +0000 Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3528VG8j031633 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 2 Jun 2023 08:31:16 GMT Received: from [10.239.133.211] (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.42; Fri, 2 Jun 2023 01:31:11 -0700 Message-ID: <53af2f66-dce0-511d-2e93-738b78f081d5@quicinc.com> Date: Fri, 2 Jun 2023 16:31:09 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH v4 06/11] coresight-tpdm: Add node to set dsb programming mode Content-Language: en-US To: Suzuki K Poulose , Mathieu Poirier , Alexander Shishkin , Konrad Dybcio , Mike Leach , Rob Herring , Krzysztof Kozlowski CC: Jinlong Mao , Greg Kroah-Hartman , , , , , Tingwei Zhang , Yuanfang Zhang , Trilok Soni , Hao Zhang , , References: <1682586037-25973-1-git-send-email-quic_taozha@quicinc.com> <1682586037-25973-7-git-send-email-quic_taozha@quicinc.com> <4e413a50-001d-cfbf-99a4-7e612f44ed38@arm.com> <053da70b-3d01-a3e5-4703-4e5cf23831ed@quicinc.com> <222b86c9-2a6f-cb9f-8803-406a724614c7@arm.com> From: Tao Zhang In-Reply-To: <222b86c9-2a6f-cb9f-8803-406a724614c7@arm.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit 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: PF-7yRO1rID3N0wCsfvXgbbbZ6aQ0BJ1 X-Proofpoint-GUID: PF-7yRO1rID3N0wCsfvXgbbbZ6aQ0BJ1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-02_05,2023-05-31_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 mlxlogscore=999 lowpriorityscore=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 spamscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2306020064 X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 6/2/2023 4:25 PM, Suzuki K Poulose wrote: > On 02/06/2023 03:58, Tao Zhang wrote: >> >> On 6/1/2023 5:23 PM, Suzuki K Poulose wrote: >>> On 27/04/2023 10:00, Tao Zhang wrote: >>>> Add node to set and show programming mode for TPDM DSB subunit. >>>> Once the DSB programming mode is set, it will be written to the >>>> register DSB_CR. >>>> >>>> Signed-off-by: Tao Zhang >>>> --- >>>>   .../ABI/testing/sysfs-bus-coresight-devices-tpdm   | 15 ++++++ >>>>   drivers/hwtracing/coresight/coresight-tpdm.c       | 62 >>>> ++++++++++++++++++++++ >>>>   drivers/hwtracing/coresight/coresight-tpdm.h       | 16 ++++++ >>>>   3 files changed, 93 insertions(+) >>>> >>>> diff --git >>>> a/Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm >>>> b/Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm >>>> index 77e67f2..348e167 100644 >>>> --- a/Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm >>>> +++ b/Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm >>>> @@ -45,3 +45,18 @@ Description: >>>>           Accepts only one of the 2 values -  0 or 1. >>>>           0 : Set the DSB trigger type to false >>>>           1 : Set the DSB trigger type to true >>>> + >>>> +What: /sys/bus/coresight/devices//dsb_mode >>>> +Date:        March 2023 >>>> +KernelVersion    6.3 >>>> +Contact:    Jinlong Mao (QUIC) , Tao >>>> Zhang (QUIC) >>>> +Description: >>>> +        (Write) Set the mode of DSB tpdm. Read the mode of DSB >>>> +        tpdm. >>>> + >>>> +        Accepts the value needs to be greater than 0. What data >>>> +        bits do is listed below. >>>> +        Bit[0:1] : Test mode control bit for choosing the inputs. >>>> +        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. >>>> diff --git a/drivers/hwtracing/coresight/coresight-tpdm.c >>>> b/drivers/hwtracing/coresight/coresight-tpdm.c >>>> index 14f4352..1bacaa5 100644 >>>> --- a/drivers/hwtracing/coresight/coresight-tpdm.c >>>> +++ b/drivers/hwtracing/coresight/coresight-tpdm.c >>>> @@ -4,6 +4,7 @@ >>>>    */ >>>>     #include >>>> +#include >>>>   #include >>>>   #include >>>>   #include >>>> @@ -43,6 +44,32 @@ static void tpdm_reset_datasets(struct >>>> tpdm_drvdata *drvdata) >>>>       } >>>>   } >>>>   +static void set_dsb_test_mode(struct tpdm_drvdata *drvdata, u32 >>>> *val) >>>> +{ >>>> +    u32 mode; >>>> + >>>> +    mode = TPDM_DSB_MODE_TEST(drvdata->dsb->mode); >>>> +    *val &= ~TPDM_DSB_TEST_MODE; >>>> +    *val |= FIELD_PREP(TPDM_DSB_TEST_MODE, mode); >>>> +} >>>> + >>>> +static void set_dsb_hpsel_mode(struct tpdm_drvdata *drvdata, u32 >>>> *val) >>>> +{ >>>> +    u32 mode; >>>> + >>>> +    mode = TPDM_DSB_MODE_HPBYTESEL(drvdata->dsb->mode); >>>> +    *val &= ~TPDM_DSB_HPSEL; >>>> +    *val |= FIELD_PREP(TPDM_DSB_HPSEL, mode); >>>> +} >>>> + >>>> +static void set_dsb_perf_mode(struct tpdm_drvdata *drvdata, u32 *val) >>>> +{ >>>> +    if (drvdata->dsb->mode & TPDM_DSB_MODE_PERF) >>>> +        *val |= TPDM_DSB_CR_MODE; >>>> +    else >>>> +        *val &= ~TPDM_DSB_CR_MODE; >>>> +} >>>> + >>>>   static void set_trigger_type(struct tpdm_drvdata *drvdata, u32 *val) >>>>   { >>>>       if (drvdata->dsb->trig_type) >>>> @@ -64,6 +91,12 @@ static void tpdm_enable_dsb(struct tpdm_drvdata >>>> *drvdata) >>>>       writel_relaxed(val, drvdata->base + TPDM_DSB_TIER); >>>>         val = readl_relaxed(drvdata->base + TPDM_DSB_CR); >>>> +    /* Set the test accurate mode */ >>>> +    set_dsb_test_mode(drvdata, &val); >>>> +    /* Set the byte lane for high-performance mode */ >>>> +    set_dsb_hpsel_mode(drvdata, &val); >>>> +    /* Set the performance mode */ >>>> +    set_dsb_perf_mode(drvdata, &val); >>>>       /* Set trigger type */ >>>>       set_trigger_type(drvdata, &val); >>>>       /* Set the enable bit of DSB control register to 1 */ >>>> @@ -252,6 +285,34 @@ static struct attribute_group tpdm_attr_grp = { >>>>       .attrs = tpdm_attrs, >>>>   }; >>>>   +static ssize_t dsb_mode_show(struct device *dev, >>>> +                  struct device_attribute *attr, >>>> +                  char *buf) >>>> +{ >>>> +    struct tpdm_drvdata *drvdata = dev_get_drvdata(dev->parent); >>>> + >>>> +    return sysfs_emit(buf, "%lx\n", >>>> +             (unsigned long)drvdata->dsb->mode); >>>> +} >>>> + >>>> +static ssize_t dsb_mode_store(struct device *dev, >>>> +                   struct device_attribute *attr, >>>> +                   const char *buf, >>>> +                   size_t size) >>>> +{ >>>> +    struct tpdm_drvdata *drvdata = dev_get_drvdata(dev->parent); >>>> +    unsigned long val; >>>> + >>>> +    if ((kstrtoul(buf, 0, &val)) || val < 0) >>>> +        return -EINVAL; >>>> + >>>> +    spin_lock(&drvdata->spinlock); >>>> +    drvdata->dsb->mode = val & TPDM_MODE_ALL; >>>> +    spin_unlock(&drvdata->spinlock); >>>> +    return size; >>>> +} >>>> +static DEVICE_ATTR_RW(dsb_mode); >>>> + >>>>   static ssize_t dsb_trig_type_show(struct device *dev, >>>>                        struct device_attribute *attr, char *buf) >>>>   { >>>> @@ -323,6 +384,7 @@ static ssize_t dsb_trig_ts_store(struct device >>>> *dev, >>>>   static DEVICE_ATTR_RW(dsb_trig_ts); >>>>     static struct attribute *tpdm_dsb_attrs[] = { >>>> +    &dev_attr_dsb_mode.attr, >>>>       &dev_attr_dsb_trig_ts.attr, >>>>       &dev_attr_dsb_trig_type.attr, >>>>       NULL, >>>> diff --git a/drivers/hwtracing/coresight/coresight-tpdm.h >>>> b/drivers/hwtracing/coresight/coresight-tpdm.h >>>> index 68f33bd..79df07e 100644 >>>> --- a/drivers/hwtracing/coresight/coresight-tpdm.h >>>> +++ b/drivers/hwtracing/coresight/coresight-tpdm.h >>>> @@ -15,11 +15,25 @@ >>>>     /* Enable bit for DSB subunit */ >>>>   #define TPDM_DSB_CR_ENA        BIT(0) >>>> +/* Enable bit for DSB subunit perfmance mode */ >>>> +#define TPDM_DSB_CR_MODE        BIT(1) >>>>   /* Enable bit for DSB subunit trigger type */ >>>>   #define TPDM_DSB_CR_TRIG_TYPE        BIT(12) >>>> + >>>>   /* Enable bit for DSB subunit trigger timestamp */ >>>>   #define TPDM_DSB_TIER_XTRIG_TSENAB        BIT(1) >>>>   +/* DSB programming modes */ >>>> +/* Test mode control bit*/ >>>> +#define TPDM_DSB_MODE_TEST(val)    (val & GENMASK(1, 0)) >>>> +/* Perforceman mode */ >>> >>> minor nit: typo ^^ >> I will update this in the next patch series. >>> >>>> +#define TPDM_DSB_MODE_PERF BIT(3) >>>> +/* High performance mode */ >>>> +#define TPDM_DSB_MODE_HPBYTESEL(val)    (val & GENMASK(8, 4)) >>>> +#define TPDM_MODE_ALL            (0xFFFFFFF) >>> >>> GENMASK(27, 0) ? >>> >>> Also, why do we cover bits 27-0 ? >> >> The TPDM mode is only represented by [0:8]bits. >> >> Can I replace it with "#define TPDM_DSB_MODE(val)    (VAL & >> GENMASK(8, 0))"? > > #define TPDM_DSB_MODE_MASK        GENMASK(8, 0) ? Sure, I will change it in the next patch series. Best, Tao > > Suzuki > _______________________________________________ > CoreSight mailing list -- coresight@lists.linaro.org > To unsubscribe send an email to coresight-leave@lists.linaro.org