Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2283520rda; Tue, 24 Oct 2023 19:55:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEKDNPZUOEEZgvmBYcMa1humROwGF3SuS36WWenrIOyviSHRvM3GD5i8GqCglUFNlykW5q+ X-Received: by 2002:a0d:d954:0:b0:5ad:7fc2:4787 with SMTP id b81-20020a0dd954000000b005ad7fc24787mr3107257ywe.15.1698202502640; Tue, 24 Oct 2023 19:55:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698202502; cv=none; d=google.com; s=arc-20160816; b=hPMteUjLT2dC/IqdE/FRSlvAgPJRKQvjT4q3wskvYrEMxEbl0VHWNLkMrm/3A/WwqO 5dgK5bNlL+IUgZK6XynnFxvbf+/3++U2K6doHNe5BXLXKaLpm+iWigEjNTqCw9MtFd6o qQw49J2yLDukvI3ouv62+toNNXMzGRgkeCpgvpG0tTQrrSU2MNLUb+HR7g9mJ+xYicNp ptiIe7NfnBYAZRTIHjy/SaZb8onSzUaXXNPnK/CTm32q0dfSj3DxxlRPjVJo2cvd5m26 gKoWMav4oefGfq7SjlL/i6XW2il7ODaNTuyzjNhJh7a2cvYIEafEgzhJylIsekmLoevL brYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=zwH5OXD6+jbQL7/KVxvUhoreIYic6lom9Itcwkhhfwo=; fh=eSQnxfYZD66NgboVDB7L9mVH46SSiFzLE3y556oFJtg=; b=RItkGAJuwqlf5W+ng7z+Ps8SvVJJNdl8d33yyP9+mN8w2/A7JFaZhvz++dJePlvBA8 seKrbhbgtdc0IrQ1HaNb0RTnRoA2YMhXeiotaFnDe28I5ecjU28TbzBWtaP1qhnoas2d 7SiEMqnpshIjduOBqvEWVCpm3pN8kezudHgW8sb4zKv8WQ3pQzbn1jFA6/BeaiCR97OA +3f9pMILouqEjnSgXZkNTjpFPzbLj9rIyymuT3xn8QGSccJ6TXCErpcuK+m3NGwCENz8 fUcvWg/w4747+ZdA0PbC8Bux1sSHLOi5dzUtX96oygUAvVI+2qXOnPB7FgC3kvHW483T juHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=PiVPzjqo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id k4-20020a816f04000000b0059f2c8a0504si9590066ywc.567.2023.10.24.19.55.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 19:55:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=PiVPzjqo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id F2E7B803DB16; Tue, 24 Oct 2023 19:54:59 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232234AbjJYCyq (ORCPT + 99 others); Tue, 24 Oct 2023 22:54:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232180AbjJYCym (ORCPT ); Tue, 24 Oct 2023 22:54:42 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4257170C; Tue, 24 Oct 2023 19:54:29 -0700 (PDT) Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39P1Q5C1007422; Wed, 25 Oct 2023 02:54:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=qcppdkim1; bh=zwH5OXD6+jbQL7/KVxvUhoreIYic6lom9Itcwkhhfwo=; b=PiVPzjqoNUi5xbxXDHo5VH8R1sXO0Jaxcj96OfWMRMbGlCKy8F4RokJQsZDlOtu7SRxu mm9LQFPzm0xGZYdvir2WRGkUFLCF9LhNPwMBkIMDEQZ4V1E2W8+MTI5Wiz1jCI/BGFdb ThRRTc295G2XfGgezNVrcbDsi17xeDV+GkhmiIHkFW9IOCB8ClW+Srr6ThtNgUkcvNio Xg2l0FLgbmMnlIImZWEdS0DdIxGwD5x03qu9+D8hUo9Vc0UbxDUn4BvgxshAlSFyB7KD Ma6lOqvLngin1y4CY9E2f/jE1a7S0E3gSXquoOn8boZVQ+7oIXdqm5nCRhCuseXJ56Jq 3Q== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3txk9k8uaa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 25 Oct 2023 02:54:20 +0000 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 39P2s6ah009841 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 25 Oct 2023 02:54:06 GMT Received: from taozha-gv.qualcomm.com (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.39; Tue, 24 Oct 2023 19:54:01 -0700 From: Tao Zhang To: Mathieu Poirier , Suzuki K Poulose , Alexander Shishkin , Konrad Dybcio , Mike Leach , Rob Herring , Krzysztof Kozlowski CC: Tao Zhang , Jinlong Mao , Leo Yan , Greg Kroah-Hartman , , , , , Tingwei Zhang , Yuanfang Zhang , Trilok Soni , Song Chai , , Subject: [PATCH v2 3/8] coresight-tpdm: Add CMB dataset support Date: Wed, 25 Oct 2023 10:53:23 +0800 Message-ID: <1698202408-14608-4-git-send-email-quic_taozha@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1698202408-14608-1-git-send-email-quic_taozha@quicinc.com> References: <1698202408-14608-1-git-send-email-quic_taozha@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain 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-GUID: uCXsuq4vCsiLQNNYMeMgXjW-l1VpUNHh X-Proofpoint-ORIG-GUID: uCXsuq4vCsiLQNNYMeMgXjW-l1VpUNHh X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-25_01,2023-10-24_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 suspectscore=0 adultscore=0 impostorscore=0 malwarescore=0 priorityscore=1501 spamscore=0 mlxlogscore=999 phishscore=0 mlxscore=0 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2310170001 definitions=main-2310250023 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 24 Oct 2023 19:55:00 -0700 (PDT) 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. 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 97654aa..c8bb388 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); 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); CS_LOCK(drvdata->base); } diff --git a/drivers/hwtracing/coresight/coresight-tpdm.h b/drivers/hwtracing/coresight/coresight-tpdm.h index 4115b2a1..0098c58 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 */ -- 2.7.4