From patchwork Thu Mar 21 08:32:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tao Zhang X-Patchwork-Id: 13598503 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2D637CD11DC for ; Thu, 21 Mar 2024 08:33:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CGGIIMOSMRMwZwcCuAMd7poO0blU9WMts/9BsZePNnk=; b=yr+XbU+hj7I2a3 /4Do7q5kxMkurQOqpWHDbB1kOTeCwf4oDuRh6WRBaTCFgpnmmGjK0REAVCnn8azcR1kbe65rJOHvi PEJQWh76Uky+UQ17VbJOhToKIwch9ehRzNvex1x3cEAqiwXoYs+hNq3eydtaIXOG2zHX5xwzmTFrc bcdCgYnTj6KmtOcqw6WMxgitd5klNe/Fytc1RD1RrLyxmgVk3/hFU17MYPYqI+3tgkNozAr2M7Uo8 gUsUt4Jz8kob4YLGXzbH7lmIwv954Pus0MrnAKHB3NzP4af4qYgTiZZSDYZucIYCaJJDnldwJHND6 SPbjdflz7JljTORNflKA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rnDrE-00000002KVX-1B1T; Thu, 21 Mar 2024 08:33:04 +0000 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rnDr9-00000002KRc-0mpl for linux-arm-kernel@lists.infradead.org; Thu, 21 Mar 2024 08:33:00 +0000 Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42L7ocJL013044; Thu, 21 Mar 2024 08:32:51 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=IGaNZqa/I3mj/VFA3aJv ae8DPRo039rcBSepgeW3wT0=; b=R3xXvejVuSDo4uy6zxrr+GsJDyffCQGlpo1/ eQPsxE+D0TzPqziqqN/HthQpmKbSUwLfSjsXywOVaxUz6gyAq6NjT9A/YgL/T5j/ Q5m0louIybEPE5JBnssevgO5g52Ft7xNG3rt0M4tywIbcTYzFfw6uWB7qXBLadUo i8Oe0IZttkPtPCmrpYOTUZPzFU7drCJ4ieBvYJRA/j1OD/hTRzlenGwkMDaejE6A 1LVp1PWE4V10zgyC6fT5cNW2RU2iVzNy/8obJ+jTa0lY48A8+0lCyWHPTT9EjzYN fi+kdfhqB0C9yqJ6OsSp8s5yy37Qz8DAPnq8paC/Sm0+1UKCmg== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3x0ba10pwg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 21 Mar 2024 08:32:51 +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 42L8WoDN000565 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 21 Mar 2024 08:32:50 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, 21 Mar 2024 01:32:45 -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 4/4] coresight-tpda: Add support multi-port input on TPDA Date: Thu, 21 Mar 2024 16:32:07 +0800 Message-ID: <1711009927-17873-5-git-send-email-quic_taozha@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1711009927-17873-1-git-send-email-quic_taozha@quicinc.com> References: <1711009927-17873-1-git-send-email-quic_taozha@quicinc.com> MIME-Version: 1.0 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: hhH7l2_2HQApscZ2O8blWgoDCff1rfuV X-Proofpoint-GUID: hhH7l2_2HQApscZ2O8blWgoDCff1rfuV X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-21_05,2024-03-18_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 phishscore=0 mlxlogscore=999 malwarescore=0 clxscore=1015 adultscore=0 mlxscore=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2403140001 definitions=main-2403210056 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240321_013259_270005_0CA1FA5B X-CRM114-Status: GOOD ( 24.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Since the funnel supports multi-port output scenarios, there may be more than one TPDM connected to one TPDA input port. In this way, when reading the element size of the TPDM, TPDA driver needs to find the correct TPDM corresponding to the input port. When TPDA finds a TPDM on an input port, it read the device tree of the TPDM and finds the configured TPDA input port number. If it is the same as the input port number passed into the function, then it is the correct TPDM that needs to be found. Signed-off-by: Tao Zhang --- drivers/hwtracing/coresight/coresight-tpda.c | 27 +++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/coresight-tpda.c b/drivers/hwtracing/coresight/coresight-tpda.c index 52b0201090fb..ba71e1ff18e3 100644 --- a/drivers/hwtracing/coresight/coresight-tpda.c +++ b/drivers/hwtracing/coresight/coresight-tpda.c @@ -84,6 +84,26 @@ static int tpdm_read_element_size(struct tpda_drvdata *drvdata, return rc; } +/* + * Check if the parameter of the input port number in "tpda_get_element_size" + * is the same as the property of the TPDA input port number defined in the device + * tree. + * Return true if they are the same or the property is not read. + * Otherwise, return false. + */ +static bool is_tpda_inport_matched(struct coresight_device *csdev, u32 tpda_inport) +{ + int rc = -EINVAL; + u32 inport_nr; + + rc = fwnode_property_read_u32(dev_fwnode(csdev->dev.parent), + "qcom,tpda-input-port", &inport_nr); + if (!rc) + return (inport_nr == tpda_inport); + + return true; +} + /* * Search and read element data size from the TPDM node in * the devicetree. Each input port of TPDA is connected to @@ -99,6 +119,10 @@ static int tpda_get_element_size(struct tpda_drvdata *drvdata, int rc = 0; int i; struct coresight_device *in; + static u32 tpda_inport; + + if (inport != -1) + tpda_inport = inport; for (i = 0; i < csdev->pdata->nr_inconns; i++) { in = csdev->pdata->in_conns[i]->src_dev; @@ -110,7 +134,8 @@ static int tpda_get_element_size(struct tpda_drvdata *drvdata, csdev->pdata->in_conns[i]->dest_port != inport) continue; - if (coresight_device_is_tpdm(in)) { + if (coresight_device_is_tpdm(in) && + (is_tpda_inport_matched(in, tpda_inport))) { if (drvdata->dsb_esize || drvdata->cmb_esize) return -EEXIST; rc = tpdm_read_element_size(drvdata, in);