Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp307879lqp; Thu, 21 Mar 2024 01:34:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVlE/wON/xBMEJecsP/OXleMGKymNNscWWxV/Top5IG3QSBkPGi0EdVgj9TvcE+m9E0hSRBjQxiP5uD9e2J6zrF8voPOaIbMjWI+IEhGg== X-Google-Smtp-Source: AGHT+IGDgneL0R71zhoLYl5mpoK513QlvpL0wLu1cTJ8EUYCuzBSdgU7G+AHeX1KXIKEwHJzBK8i X-Received: by 2002:a05:620a:11a7:b0:789:e6cc:7565 with SMTP id c7-20020a05620a11a700b00789e6cc7565mr19466566qkk.19.1711010062747; Thu, 21 Mar 2024 01:34:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711010062; cv=pass; d=google.com; s=arc-20160816; b=r1FVSZd8jizvFhzsBU0a5iVfE8Kdan/oeLptwJRJ1tjRRXbIjiz/5rCq2JEik6AK0w 9zqk6GFGBrm4ppNNKt65jsZCF6QmxnudTQ7URu8hKs3ISiBo4V1hE0mkhbZsn9dXnnkC 8Wd6szN807Uk0OwmXlDGyRjYPPOXwxBRd3T1hxjDPs6OPkGM2jP4b0kFBR77/12//o5h i2/OopMo1HvplsEIa8QkNqb5qYeFb/jc735Z+iHXjmY3st4bnY5fYO1oSiIf4D9nlb+k XXBuPXn0oVb2Pmkhel4Ye1/Zo/6hKadwVEb7jhMasY1CAXp4Jp5rlUnOVbpQB6FJtFCj QvfQ== 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=IGaNZqa/I3mj/VFA3aJvae8DPRo039rcBSepgeW3wT0=; fh=eSQnxfYZD66NgboVDB7L9mVH46SSiFzLE3y556oFJtg=; b=uthbGnnNGyxROHKn6g9Y1iQNB7WbfexQB7G48xduzYvNCq8yNTBqPekIq6bb23xML4 kwODz6c7ioeNT0Ty0vPO5Oo5vZ+jlnFFIPh7OYBzR6p7+EV8eIDGwZ4gYu22kowhCuph kHfzH8vd3IC8RJ06W4shzCGibbsJLRD9dr73C3+SF9PEg+iY+06IJ/IByk0Vedg7pFDT bKTQ0ETcRVA2G7kulUSDqoSRf54L+mNPG/yPwDRKSCJvOmfBliokjGoIdnn9+8q9o6A7 cPERTo2kGRVKTobenKRgH9sOjkHcN1xBy5vu9fOpfYLst1ULXFa9OkUjElWAwjnhanTw jptA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=R3xXvejV; 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-109795-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109795-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d29-20020a05620a205d00b0078a01ee19f4si7844056qka.773.2024.03.21.01.34.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 01:34:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-109795-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=R3xXvejV; 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-109795-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109795-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 6D1D61C20BEA for ; Thu, 21 Mar 2024 08:34:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5CFFB18658; Thu, 21 Mar 2024 08:33:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="R3xXvejV" 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 D385E5645B; Thu, 21 Mar 2024 08:33:01 +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=1711009983; cv=none; b=N3TtetauolqClfgpppYchUKqpaa+YjbX28VdSN+kHrHlwfi+Gq/6t23zKOrl77L3JT8BwEMV9SYriYYLjypD/oseu122rhY4gspRlhWaFwdsYFmM14sFEs5olp/nh0Uk6jDIC6RqBMmVprROYnvPAQKdMeP60udFlhBK1bQbhDw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711009983; c=relaxed/simple; bh=vx2vwBCl0vH0JYk/uQOxu5ro861vYZpASDGOQB/yfR8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=P9dgr0e+LRS0BH0/iL250kO35DixIckvEdICjzspm8iQAhSX3yj6257qEfAouZ1wt5ukb4Ky9sQzsrgvKQcxgbqJrsS1rkcanIdR8fEb87yvl91W0K6BLnhrPpH9wM14am1uPVWjqqUwrtX1KvHeWuinGyIfo1b6jd4oU/DhPjc= 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=R3xXvejV; 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 (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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain 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 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); -- 2.17.1