Received: by 2002:a05:7412:d008:b0:f9:6acb:47ec with SMTP id bd8csp428082rdb; Wed, 20 Dec 2023 00:58:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IEb9W+NHxCqIMDCnhZl4AYAla15VRuOgt9/sX9Jjo6vTnI0WW4sLjJB1+sfEjRQKFNaVZg2 X-Received: by 2002:a17:90b:1c12:b0:28b:99d5:ce67 with SMTP id oc18-20020a17090b1c1200b0028b99d5ce67mr2166270pjb.11.1703062694237; Wed, 20 Dec 2023 00:58:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703062694; cv=none; d=google.com; s=arc-20160816; b=REVAdRvme8zNU502xu/FQuiHpGq+jhlZoolp6UreperOe+t2yR+ij7AgGK4r7DqKC8 2xg3xIdXaq/lwA5lrs5X6WqLi87/Mzzg/+hWAucNzvOVI8rkCK/zq6I6knCJpT8vuDPP EFhKqDubxIHWzzH14eDgwPttFZb15VBrmF13X8vWJ1fuZwaG7TOTFq2kHnCk0vQ1gk2D hTmlip331JIqcpYcHP2kSXQDDL1niPJVnePMJsoLbhht1uaMf4YSigGOwbv1t5PkWcvR gR6WHLfWY5eyEO6NTJuFfDXEwFQL8HJzfaJyU8VrE84JVqYnZGs/1xvV+4yK9bBlzilF GblQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=4qNF4u2dvT4HUSq/K5oCUAMNkc5Mlfnef5M+7zwqRu4=; fh=xPZ0YANAcRPGPX4IB0yOZmK5WLFQL1lh99y02pFk1x4=; b=IhTKzZ4fviByk6gkachyarHc1Ot8KJ1A6I2S29FqPLhC1Q32sUEibclLjv3CogE/Ym n2Gtv6+P7vHajNAef8IX8QR4zpCHfwi5NVAxoSE+EpCBiM1eieplfoMYlPUXUYtz6U+7 fVjyC8z5ej5ARG8A7HLAZiSWXXOkUn3QpDrraGQrjIatkBCmJGHeEXbrKE57OWa+PNSr 9gtrz83apgdkiDxnZn4igDXZczQ+t07g6em+MGAX1dN7VigaBnIsI5HLAvwkEQsXn6FR K4dsAuDFbmFQ7tDYuCOBFtsRErZuUk3jE10I/5SGHFYty1Q3gRIxXyLKAboskGJHGgiq MgrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=mKYviiHG; spf=pass (google.com: domain of linux-kernel+bounces-6614-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6614-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id gz8-20020a17090b0ec800b0028b8e72c97asi2653174pjb.56.2023.12.20.00.58.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 00:58:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-6614-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=mKYviiHG; spf=pass (google.com: domain of linux-kernel+bounces-6614-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6614-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id B9C8728404D for ; Wed, 20 Dec 2023 08:58:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C45201EB46; Wed, 20 Dec 2023 08:57:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="mKYviiHG" X-Original-To: linux-kernel@vger.kernel.org Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A0D41DA4B; Wed, 20 Dec 2023 08:57:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BK6dtXQ014865; Wed, 20 Dec 2023 08:56:49 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=4qNF4u2dvT4HUSq/K5oCUAMNkc5Mlfnef5M+7zwqRu4=; b=mK YviiHGv+NCpGOff3jCnXy1jiXS0pEKg1JmdiayRwN916Ev8LRerNoEw3i4a7cfHj lxbb+4e2t6Rze0gnKZnEy3RUxmNbb/31jiROsPienvmHeIiM8e4fMdApD6HUTDim HP89j/0htP0O4U5/IcF1KeTikTgSCe3zYRHFbzPYxKxMZ2JLaoZScNLIo5NWB6iE 0YqUgY4OUbn+BgtQY3sVnOUV2p32bxIuhEDebtoaS8MuLq3qJGWg44eZCQVJJQRx KXFZti2HadS7cB4WBpq+suafX3UOQNZ3u64ucBdbQb6NkKDPbBZMjiralm3urj6u J/fwgnvUDJrBaAxy8H0w== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3v3pkyrsn0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Dec 2023 08:56:48 +0000 (GMT) Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3BK8ulhR024469 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Dec 2023 08:56:47 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.1118.40; Wed, 20 Dec 2023 00:56:42 -0800 Message-ID: <0d4e2aa7-23e3-4851-bc43-80e7737f3a1a@quicinc.com> Date: Wed, 20 Dec 2023 16:56:42 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 3/8] coresight-tpdm: Add CMB dataset support Content-Language: en-US To: Suzuki K Poulose , Mathieu Poirier , Alexander Shishkin , Konrad Dybcio , Mike Leach , Rob Herring , Krzysztof Kozlowski CC: Jinlong Mao , Leo Yan , "Greg Kroah-Hartman" , , , , , Tingwei Zhang , Yuanfang Zhang , Trilok Soni , Song Chai , , References: <1700533494-19276-1-git-send-email-quic_taozha@quicinc.com> <1700533494-19276-4-git-send-email-quic_taozha@quicinc.com> <8dcafd9a-ff90-439a-9337-fb957d2fcad1@quicinc.com> From: Tao Zhang In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) 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-GUID: INlAPihp8gCgic1HGFwRnBjVIw_xawDi X-Proofpoint-ORIG-GUID: INlAPihp8gCgic1HGFwRnBjVIw_xawDi X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-09_02,2023-12-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 lowpriorityscore=0 bulkscore=0 adultscore=0 clxscore=1015 priorityscore=1501 suspectscore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312200060 On 12/19/2023 9:56 PM, Suzuki K Poulose wrote: > On 19/12/2023 09:22, Tao Zhang wrote: >> >> On 12/18/2023 6:34 PM, Suzuki K Poulose wrote: >>> On 21/11/2023 02:24, Tao Zhang wrote: >>>> CMB (continuous multi-bit) is one of TPDM's dataset type. CMB subunit >>>> can be enabled for data collection by writing 1 to the first bit of >>>> CMB_CR register. This change is to add enable/disable function for >>>> CMB dataset by writing CMB_CR register. >>>> >>>> Reviewed-by: James Clark >>>> Signed-off-by: Tao Zhang >>>> Signed-off-by: Jinlong Mao >>>> --- >>>>   drivers/hwtracing/coresight/coresight-tpdm.c | 31 >>>> ++++++++++++++++++++ >>>>   drivers/hwtracing/coresight/coresight-tpdm.h |  8 +++++ >>>>   2 files changed, 39 insertions(+) >>>> >>>> diff --git a/drivers/hwtracing/coresight/coresight-tpdm.c >>>> b/drivers/hwtracing/coresight/coresight-tpdm.c >>>> index 97654aa4b772..c8bb38822e08 100644 >>>> --- a/drivers/hwtracing/coresight/coresight-tpdm.c >>>> +++ b/drivers/hwtracing/coresight/coresight-tpdm.c >>>> @@ -131,6 +131,11 @@ static bool tpdm_has_dsb_dataset(struct >>>> tpdm_drvdata *drvdata) >>>>       return (drvdata->datasets & TPDM_PIDR0_DS_DSB); >>>>   } >>>>   +static bool tpdm_has_cmb_dataset(struct tpdm_drvdata *drvdata) >>>> +{ >>>> +    return (drvdata->datasets & TPDM_PIDR0_DS_CMB); >>>> +} >>>> + >>>>   static umode_t tpdm_dsb_is_visible(struct kobject *kobj, >>>>                      struct attribute *attr, int n) >>>>   { >>>> @@ -267,6 +272,17 @@ static void tpdm_enable_dsb(struct >>>> tpdm_drvdata *drvdata) >>>>       writel_relaxed(val, drvdata->base + TPDM_DSB_CR); >>>>   } >>>>   +static void tpdm_enable_cmb(struct tpdm_drvdata *drvdata) >>>> +{ >>>> +    u32 val; >>>> + >>>> +    val = readl_relaxed(drvdata->base + TPDM_CMB_CR); >>>> +    val |= TPDM_CMB_CR_ENA; >>>> + >>>> +    /* Set the enable bit of CMB control register to 1 */ >>>> +    writel_relaxed(val, drvdata->base + TPDM_CMB_CR); >>>> +} >>>> + >>>>   /* >>>>    * TPDM enable operations >>>>    * The TPDM or Monitor serves as data collection component for >>>> various >>>> @@ -281,6 +297,8 @@ static void __tpdm_enable(struct tpdm_drvdata >>>> *drvdata) >>>>         if (tpdm_has_dsb_dataset(drvdata)) >>>>           tpdm_enable_dsb(drvdata); >>>> +    if (tpdm_has_cmb_dataset(drvdata)) >>>> +        tpdm_enable_cmb(drvdata); >>> >>> Don't we need to add this check in the "property read" section ? >>> Otherwise, we could generate warnings unnecessarily ? >>> >>> i.e, if (tpdm_has_cmb_..()) >>>       rc |= fwnode_..read_property(cmb-elem-size...) >>> >>> Similarly for DSB. >> >> TPDM and TPDA are two independent hardware. If you want to modify >> them in this way, the >> > > You don't have to, as long as the header files are included ? > > Read my response in the other patch, where it applies. Got it. I will update in the next patch series. Best, Tao > > Suzuki > >> two independent drivers will be coupled to each other. At the same >> time, this configuration >> >> is manually set in the devicetree by the users, and this check cannot >> avoid manual setting errors. >> >>   Even if the configuration is wrong, it will not cause the driver to >> stop working, it will only cause >> >> the data to be lost from the TPDM. >> >>> >>>>       CS_LOCK(drvdata->base); >>>>   } >>>> @@ -314,6 +332,17 @@ static void tpdm_disable_dsb(struct >>>> tpdm_drvdata *drvdata) >>>>       writel_relaxed(val, drvdata->base + TPDM_DSB_CR); >>>>   } >>>>   +static void tpdm_disable_cmb(struct tpdm_drvdata *drvdata) >>>> +{ >>>> +    u32 val; >>>> + >>>> +    val = readl_relaxed(drvdata->base + TPDM_CMB_CR); >>>> +    val &= ~TPDM_CMB_CR_ENA; >>>> + >>>> +    /* Set the enable bit of CMB control register to 0 */ >>>> +    writel_relaxed(val, drvdata->base + TPDM_CMB_CR); >>>> +} >>>> + >>>>   /* TPDM disable operations */ >>>>   static void __tpdm_disable(struct tpdm_drvdata *drvdata) >>>>   { >>>> @@ -321,6 +350,8 @@ static void __tpdm_disable(struct tpdm_drvdata >>>> *drvdata) >>>>         if (tpdm_has_dsb_dataset(drvdata)) >>>>           tpdm_disable_dsb(drvdata); >>>> +    if (tpdm_has_cmb_dataset(drvdata)) >>>> +        tpdm_disable_cmb(drvdata); >>> >>> minor nit: Instead of having these : >>> >>>     if (tpdm_has_XY_() >>>         tpdm_{enable/disable}_XY_() >>> I prefer : >>> >>>     tpdm_{enable/disable}_XY_ >>> >>> and the helper take care of returning early if the feature is >>> not present. >> Does the following sample modification meet your expectation? >> static void tpdm_disable_dsb(struct tpdm_drvdata *drvdata) >> { >>      u32 val; >> >>      if (tpdm_has_dsb_dataset(drvdata)) { >>          /* Set the enable bit of DSB control register to 0 */ >>          val = readl_relaxed(drvdata->base + TPDM_DSB_CR); >>          val &= ~TPDM_DSB_CR_ENA; >>          writel_relaxed(val, drvdata->base + TPDM_DSB_CR); >>      } >> } >> >> static void tpdm_disable_cmb(struct tpdm_drvdata *drvdata) >> { >>      u32 val; >> >>      if (tpdm_has_cmb_dataset(drvdata)) { >>          val = readl_relaxed(drvdata->base + TPDM_CMB_CR); >>          val &= ~TPDM_CMB_CR_ENA; >> >>          /* Set the enable bit of CMB control register to 0 */ >>          writel_relaxed(val, drvdata->base + TPDM_CMB_CR); >>      } >> } >> >> /* TPDM disable operations */ >> static void __tpdm_disable(struct tpdm_drvdata *drvdata) >> { >>      CS_UNLOCK(drvdata->base); >> >>      tpdm_disable_dsb(drvdata); >>      tpdm_disable_cmb(drvdata); >> > > Yes, thats exactly I was looking for. Got it. I will update in the next patch series. Best, Tao > >>      CS_LOCK(drvdata->base); >> >> } >> >> >> Best, >> >> Tao >> >>> >>> >>> Suzuki >>> >>> >>>>         CS_LOCK(drvdata->base); >>>>   } >>>> diff --git a/drivers/hwtracing/coresight/coresight-tpdm.h >>>> b/drivers/hwtracing/coresight/coresight-tpdm.h >>>> index 4115b2a17b8d..0098c58dfdd6 100644 >>>> --- a/drivers/hwtracing/coresight/coresight-tpdm.h >>>> +++ b/drivers/hwtracing/coresight/coresight-tpdm.h >>>> @@ -9,6 +9,12 @@ >>>>   /* The max number of the datasets that TPDM supports */ >>>>   #define TPDM_DATASETS       7 >>>>   +/* CMB Subunit Registers */ >>>> +#define TPDM_CMB_CR        (0xA00) >>>> + >>>> +/* Enable bit for CMB subunit */ >>>> +#define TPDM_CMB_CR_ENA        BIT(0) >>>> + >>>>   /* DSB Subunit Registers */ >>>>   #define TPDM_DSB_CR        (0x780) >>>>   #define TPDM_DSB_TIER        (0x784) >>>> @@ -79,10 +85,12 @@ >>>>    * >>>>    * PERIPHIDR0[0] : Fix to 1 if ImplDef subunit present, else 0 >>>>    * PERIPHIDR0[1] : Fix to 1 if DSB subunit present, else 0 >>>> + * PERIPHIDR0[2] : Fix to 1 if CMB subunit present, else 0 >>>>    */ >>>>     #define TPDM_PIDR0_DS_IMPDEF    BIT(0) >>>>   #define TPDM_PIDR0_DS_DSB    BIT(1) >>>> +#define TPDM_PIDR0_DS_CMB    BIT(2) >>>>     #define TPDM_DSB_MAX_LINES    256 >>>>   /* MAX number of EDCR registers */ >>> >