From patchwork Fri Jan 19 03:22:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tao Zhang X-Patchwork-Id: 189383 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp770569dyb; Thu, 18 Jan 2024 19:26:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IGSJx6ppqlDtpg3JHe4I9aeR/LHrT3FABaH/7k2REuX4qu7sYel8IMeE6rV8BU4a484ZHFU X-Received: by 2002:a05:6808:38c7:b0:3bd:4c6f:f2da with SMTP id el7-20020a05680838c700b003bd4c6ff2damr2657110oib.65.1705634761267; Thu, 18 Jan 2024 19:26:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705634761; cv=pass; d=google.com; s=arc-20160816; b=zS0tiprbS4MH9qW7F1633GYlbcYHdazGRXD58n3KvdMPPbwehfzMNIWzTNngPlO5WT HebbWgtx2OH1Sd43SIHTsrGVdQ05ysf+GlVeWZBQjgG63svFZI7OlKDU84cC0U5nQleW 8qX2FkXhUMStxyRg4X5wGOluvXtlLb1fIHpIM6seEfOEDJqxWaQ/+IorCUWX9W6lsYMr VW6fXc3WK3o9ln03x8B67MFIWACQ5MyaqUZ/pnAM9n2UJRwmTUz27nmsT0yOMRQDEDgy AWU5AAgdWDwCVhppO4RcX0r7x8Aoy5jSJsLzdbdSQc4n6yM5Dwnjl/I4O9wBenMXF8u1 LoYA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Etc+nHsYbHNrOvqmZww3IuA9p/rkmTZ094LlxTxm4eY=; fh=eSQnxfYZD66NgboVDB7L9mVH46SSiFzLE3y556oFJtg=; b=p13OP4720Z+jv+PqU1lnPbk41/cZxoeWjWsKqQUE8lGOhFyoI8ai22J0O01SX+im7E r81bFrPFHQpsgukf3EbjBB6NWNrAmu1UNAmuX4sOtseiqfXQ35oxGn/c7oEnZhlKJMhX NgbqNnvoVvarClWGcqiRyu35WZb4XXjX+jXgrXU/cIwZyrm6U7cpJwrSJ6E+HWrEFmZU fp41wGmC3TIzKL01H8Glk2yYZ40fSiGXyIICP25ucf3RtPcDheVNp1qMvRGXec0CLx07 du3KDCJz+utqrdxBXdobi4npZpRwm3UpqYjFf9A/mkTyMUyDAu/RI/2jhoJJRiVgkYhG qGxA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Lg5KFo7V; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-30729-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30729-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id k7-20020aa78207000000b006dafe3d7330si4624820pfi.377.2024.01.18.19.26.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 19:26:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-30729-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Lg5KFo7V; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-30729-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30729-ouuuleilei=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 05BA6B21C34 for ; Fri, 19 Jan 2024 03:26:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1CB7F20B10; Fri, 19 Jan 2024 03:24:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="Lg5KFo7V" Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 7BC2C17F5; Fri, 19 Jan 2024 03:24:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705634658; cv=none; b=bdWyjPNXM0XQm7ZG4RWjR5pEIaaCxF/oFivYSI8ptg0CcoQ8pv3DxH+soivCoRAVLpNXK76cBHnwbvlQwCrMCWzD6VrKA2Hy6pnPv/yC39tQavfaf+BR4S+iF5nTJs210tYPFfChLAAZ0Qi9uc8ECXdNNHJrY6IgiCE9tuTajpI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705634658; c=relaxed/simple; bh=gnF6cbnM3yALw1/dC1rX0j/7eWAmbqyO+/vKrJPKLaU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lLkxP8b+c+CcIPEKqMFoPxC3GnCQfSxQKV5gBX2GBvilaxE1os5oo7ca46ieFBuH8avDMqNgrhKJdbVnGYOB7fnz+luNDv4poKJPJghOEL5kYkrIXUg/B99JPhKGKv3ZEsu+nH6q7Td5/VBJB+BXZuTfA2q7h5GB3AM6PgYCJuw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=Lg5KFo7V; arc=none smtp.client-ip=205.220.168.131 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 (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40J310H0006192; Fri, 19 Jan 2024 03:23:48 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=Etc+nHsYbHNrOvqmZww3 IuA9p/rkmTZ094LlxTxm4eY=; b=Lg5KFo7VBF5DwPFJ1yYpSOUn5eSdRrhXUlVz WUnumjeV0a566S5pedl6nSrKW6Jbo2YlXfStAvakT+3xdg5yRt683rZZ5k+xR1j2 EGYDkBKbbVFL1Dw1Bnjd557V2EBq1r3hXOjG5rugzNkdEKX0sKaO8XKhbmFnU4UI g4JzZ4jF7oF/dVCdWfxc/kFzR0u5EDwxq0WVTcEQSUaLIhABUh+cALAZ7mntPraG cDvKD085gqJejpyUfYAq6jRDmfqV4Un0x7PF4s0lGB7qxjRuIsqaYeNzUKyGkGME J+oCV9oisQcp3yUFxwBdHPeIrIVt6GNpWtDe/OhK4hNX1GNIYw== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3vq1s7a9d8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 19 Jan 2024 03:23:47 +0000 (GMT) Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 40J3NlYo025417 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 19 Jan 2024 03:23:47 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.40; Thu, 18 Jan 2024 19:23:42 -0800 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 v4 04/10] coresight-tpdm: Add CMB dataset support Date: Fri, 19 Jan 2024 11:22:57 +0800 Message-ID: <1705634583-17631-5-git-send-email-quic_taozha@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1705634583-17631-1-git-send-email-quic_taozha@quicinc.com> References: <1705634583-17631-1-git-send-email-quic_taozha@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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-ORIG-GUID: dV8XkT9bOtb57KBvREnVNHcGNIl6Su2s X-Proofpoint-GUID: dV8XkT9bOtb57KBvREnVNHcGNIl6Su2s 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=2024-01-18_12,2024-01-17_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=993 mlxscore=0 adultscore=0 malwarescore=0 bulkscore=0 priorityscore=1501 spamscore=0 suspectscore=0 clxscore=1015 phishscore=0 lowpriorityscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2401190012 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788487675723022984 X-GMAIL-MSGID: 1788487675723022984 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 | 28 ++++++++++++++++++++ drivers/hwtracing/coresight/coresight-tpdm.h | 13 +++++++++ 2 files changed, 41 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-tpdm.c b/drivers/hwtracing/coresight/coresight-tpdm.c index 6549f71ba150..424a2f724d82 100644 --- a/drivers/hwtracing/coresight/coresight-tpdm.c +++ b/drivers/hwtracing/coresight/coresight-tpdm.c @@ -262,6 +262,19 @@ static void tpdm_enable_dsb(struct tpdm_drvdata *drvdata) } } +static void tpdm_enable_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 1 */ + writel_relaxed(val, drvdata->base + TPDM_CMB_CR); + } +} + /* * TPDM enable operations * The TPDM or Monitor serves as data collection component for various @@ -275,6 +288,7 @@ static void __tpdm_enable(struct tpdm_drvdata *drvdata) CS_UNLOCK(drvdata->base); tpdm_enable_dsb(drvdata); + tpdm_enable_cmb(drvdata); CS_LOCK(drvdata->base); } @@ -310,12 +324,26 @@ static void tpdm_disable_dsb(struct tpdm_drvdata *drvdata) } } +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); CS_LOCK(drvdata->base); } diff --git a/drivers/hwtracing/coresight/coresight-tpdm.h b/drivers/hwtracing/coresight/coresight-tpdm.h index ddaf333fa1c2..a442d9c6e4ac 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 */ @@ -224,4 +232,9 @@ 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); +} #endif /* _CORESIGHT_CORESIGHT_TPDM_H */