From mboxrd@z Thu Jan 1 00:00:00 1970 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 E02992D837B for ; Fri, 19 Dec 2025 09:24:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766136267; cv=none; b=l+W2HATz0rfkWa5w/HctTJ0qjx3VO/RwUXnt5n5IUHjvzCVcDVJEzlZVPF06YH0mo9piX3/ECC0oeN0AWmO/2qRQo4o3dNOUyvmRoGcDge7SJuMKiHwoYqSZT0L7kC5OOcIx+VIiaLJr8HmBDp9mX1f3fwNJrKfHXnr+Gr1YjgU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766136267; c=relaxed/simple; bh=LgbFen8QkJa57MlcXSSYnglkQbLSOclS8v20wXODME0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Yp2jCeKikQLlYvVgJfO4HDeAhUD0D5rVaF4b6nXlEOzq5dEW2o8/DvThE2xXqZNslN8mZVVe0Aj/N8YFDmecEUWZckKlmZ1G2OzHCY9LAgCoCvygxn0svhtnYYuEc+ZiOMLbeDhK9DZPFSGEr3u7B7NzaJzv6kKhay0+uSNZg1I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=aCDgLARS; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=NQmNVoFV; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="aCDgLARS"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="NQmNVoFV" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5BJ4c0N03318764 for ; Fri, 19 Dec 2025 09:24:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= DOfwEI0tIm3WYzjLDVlBlTv1S+vqhrY0X0rRzcUt1/4=; b=aCDgLARS3jQj54UJ L6gWb/8+Zn7EWzsA7zGPjFEF3ux+FijNYfSxC4l2oKnQwQxGYdvkbhvsQgEcshMA QkeCjd/Y4XPtQiWgTcNNXXZXNQ8wP5IU0H1BwcKpQOmDGWlAkxYlKrx20IyjwFe8 osd94TAxaIuWEimju+EcXFw9676ozmgchZpJz9HYI2AAEQxFs69fKv0ns+tI8n4c FS9UPWhrNDBeHovozQtlVc2tKeiZWURJR/B5h2xyaboUe64N5kI1BfP7VQtMuDSm Dy6hSmq1+YNwYx8XjAUxdtp/GBtlI2zn1DNiCOJ6D1NInVSc3zaG2/13xxPlq4YR ww9Y4w== Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4b4r2et22g-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 19 Dec 2025 09:24:23 +0000 (GMT) Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-34c43f8ef9bso2496667a91.1 for ; Fri, 19 Dec 2025 01:24:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1766136263; x=1766741063; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=DOfwEI0tIm3WYzjLDVlBlTv1S+vqhrY0X0rRzcUt1/4=; b=NQmNVoFVKf+yCJaXTU1X/PdLg1cFs7j64GdJjalFY2jIP4LPXHQR7F2qwnErNyULz+ Nm70ZEnFNqsGbEjU3JkjIWtJd7KysVxJso+iVj/Y+x7BfVoSmW9dY7x46evl2x3j/5j0 sGSAUv3up15DvVRuW+souOal+oTPdWP4loqlGUgyYw9YK502qPDDUdSLN1O3xQIWEOrA wjHIVHiWGri0pPtlsrwpsfczKWFrr8t8vQmNwUFjRfFYdGVADcKu8Hfvm+lUUehgV9Dd 46PcB2fluT6Lz8T1P4V0GgmGaDkMDJ3h3VATQCBEKSgqT05YA0p5q3BkjZdnwMK3mwzr wVbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766136263; x=1766741063; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=DOfwEI0tIm3WYzjLDVlBlTv1S+vqhrY0X0rRzcUt1/4=; b=l0eOoebP/hB54DGJTZjz7vscP7qods6e9NRWHH4/YgIW+ZgFrcROW6GYUXPrK+DfqJ 2VfNXlScH2CqyXh2W+NSesaD2EdHurr2waDQ99w57rx6YFX6dvj1XSF0Gw0heMhEA/aW apWm1dfLnxvfaXODM/4ca6sIdemKzofsvVAzFAyxDLxj+jyKxcM0ZLSfk7o4HxGrQwyJ Yo+/z392U0jDiYJXccJ8ediDm1uuYL0N8/btLShVN9XsPvMEH80KQOGwZpbCzbEcns5m 80iB5LqxAUIOXnvxwdKXVpFXkbqVGtt7jkGhUicIj8qYRM2YRuuMBjrR3Xe2YZaxvqFX K7TQ== X-Forwarded-Encrypted: i=1; AJvYcCUScqKcbc/9JyEZcjId5UCrcEpQvV9TzILzvmfyJpywJ1VVsSZi3fJXlGB7J4FZduJDsiP7YQ2YJmEcbWY=@vger.kernel.org X-Gm-Message-State: AOJu0YwGON5b5THC7itrE4sCnFRuAyZsw5RQFi1aA+iQG98KQY0uB96X tvBcDlqEXlSz1SFCGG4rsSmD94UyxRrvK5DWVW+euCM5wci/OgMnHTKDFw666/RWoqis/DEjG5c H38hUTFHCclLz6I2t4w1naYlKTffxXCJUU4DIf4EaIOQojJ79coptq7yS3iDA8ll9acs= X-Gm-Gg: AY/fxX6PqinR9BW6u6pRlsWUJjZCYeiczi6kdO7wPu6DAOatFehw+2dudC+evJJeSjC pQPpklHytGpbAQD+q7fNmrhLHK7KHMdGlhbqFswZtrtNkGJTDygNGC5AkEq8cEX1duEa1tmwiig OScIWBAiowEBb/HcgJ+GmQLX29hFW///uC5koEhsVdWyYDRWP0rsXGn8TTf0LllEM2cuIhEqmi4 jdixIqHNVJ2j/HY6t4SSLMWlHsuVSRm4iIu7/jfSLGF8yaFVKA6hP1HCutMf/i8WjTcC9eHbEFE 7SHQpEAen89VwuMuVdVu0BCguo/cOx3hD43I8StsniVFJ0bK1PLI7VlprX40LAsJh93aPUFuWvh fxfMRJzGxtVJMzV844pX/dXgFcR/YKs9ze+tpGRQftp6VeKLohQaOUqKc5GkLZ8WeiKN7ylYaAZ 8= X-Received: by 2002:a17:90a:c106:b0:34c:2f40:c662 with SMTP id 98e67ed59e1d1-34e71e2955bmr5077760a91.14.1766136262586; Fri, 19 Dec 2025 01:24:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IFaHhZUaMUo8PyEk/p7xL6WeDX8rPW0yBK8DGzdCz4GjR2TbHsdfsLYyys2Yz/uQfK3XDzmBw== X-Received: by 2002:a17:90a:c106:b0:34c:2f40:c662 with SMTP id 98e67ed59e1d1-34e71e2955bmr5077738a91.14.1766136262041; Fri, 19 Dec 2025 01:24:22 -0800 (PST) Received: from [10.133.33.174] (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-34e70dbcb6esm4744373a91.9.2025.12.19.01.24.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 19 Dec 2025 01:24:21 -0800 (PST) Message-ID: Date: Fri, 19 Dec 2025 17:24:15 +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 v8 2/8] coresight: core: add a new API to retrieve the helper device To: Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Tingwei Zhang , Mao Jinlong , Bjorn Andersson , Konrad Dybcio Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org References: <20251211-enable-byte-cntr-for-ctcu-v8-0-3e12ff313191@oss.qualcomm.com> <20251211-enable-byte-cntr-for-ctcu-v8-2-3e12ff313191@oss.qualcomm.com> Content-Language: en-US From: Jie Gan In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Proofpoint-GUID: jWYlhSYl3fxvSyoONXi_qEGfio47QfSa X-Proofpoint-ORIG-GUID: jWYlhSYl3fxvSyoONXi_qEGfio47QfSa X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjE5MDA3NiBTYWx0ZWRfX7Hm3zTDDDeUS riRG2DVh1mLZ9UZbjEzcYrMGRg8HMvddbAzOihouTsWIzdgSZvjvixcEeDYz2J+J1FM3kygMrvk deDsSyp30fAiOF35sFNA0o0AIfTMOapnRTt9e58ISIf2d8PJsVnGDemclepc6qyZo4+Kv+/MXps 0b9pJnVi+IM4bBzH6piioWdNq5AngCHdOm96JiLKBkurGK+DiGXPbOfWFK8YRWZ2DUrGREfcbFA LTDbLp1BPFK+z6CY56uYrd0+wWratyQKcwQ74NyJYClBDZ1djKZGxxTnn6lOvE5wuNhDS58/AE+ RLfOQQyJKoceJDginRy8+8rBhbFHWQubLqM6JM4/L14yvjAC+jTFKPuvQnXIuvoYx6hUFYpgpeR zg/bL7/5wh+sTu8pQhl4tY867w/yVsmu185lH5DH1cqHaHY32qntjgfKbO9bXQ6YTxJUGFQ1d9v HsUJNZzfM/3rBcKuVVA== X-Authority-Analysis: v=2.4 cv=Tp7rRTXh c=1 sm=1 tr=0 ts=694519c7 cx=c_pps a=UNFcQwm+pnOIJct1K4W+Mw==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=wP3pNCr1ah4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=t5fKABB059AxcEZLcEgA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=uKXjsCUrEbL0IQVhDsJ9:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-12-19_02,2025-12-17_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 clxscore=1015 impostorscore=0 malwarescore=0 spamscore=0 phishscore=0 priorityscore=1501 lowpriorityscore=0 suspectscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2512120000 definitions=main-2512190076 On 12/19/2025 1:50 AM, Suzuki K Poulose wrote: > On 11/12/2025 06:10, Jie Gan wrote: >> Retrieving the helper device of the specific coresight device based on >> its helper_subtype because a single coresight device may has multiple >> types >> of the helper devices. >> >> Reviewed-by: Mike Leach >> Signed-off-by: Jie Gan >> --- >>   drivers/hwtracing/coresight/coresight-core.c | 35 ++++++++++++++++++ >> ++++++++++ >>   drivers/hwtracing/coresight/coresight-priv.h |  2 ++ >>   2 files changed, 37 insertions(+) >> >> diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/ >> hwtracing/coresight/coresight-core.c >> index 0e8448784c62..667883ccb4b7 100644 >> --- a/drivers/hwtracing/coresight/coresight-core.c >> +++ b/drivers/hwtracing/coresight/coresight-core.c >> @@ -585,6 +585,41 @@ struct coresight_device >> *coresight_get_sink(struct coresight_path *path) >>   } >>   EXPORT_SYMBOL_GPL(coresight_get_sink); >> +/** >> + * coresight_get_helper: find the helper device of the assigned csdev. >> + * >> + * @csdev: The csdev the helper device is conntected to. >> + * @type:  helper_subtype of the expected helper device. >> + * >> + * Retrieve the helper device for the specific csdev based on its >> + * helper_subtype. >> + * >> + * Return: the helper's csdev upon success or NULL for fail. >> + */ >> +struct coresight_device *coresight_get_helper(struct coresight_device >> *csdev, >> +                          enum coresight_dev_subtype_helper subtype) > > We have almost a similar function in coresight-core.c : > > coresight_find_output_type(pdata, type, subtype). > > Please could we reuse that, instead of adding similar funcitons ? > > Please be careful about the mutex. > Thanks for the suggestion. I reviewed coresight_find_output_type, and I believe we can reuse it to retrieve the CTCU device. Thanks, Jie > Suzuki > >> +{ >> +    int i; >> +    struct coresight_device *helper; >> + >> +    /* protect the connections */ >> +    mutex_lock(&coresight_mutex); >> +    for (i = 0; i < csdev->pdata->nr_outconns; ++i) { >> +        helper = csdev->pdata->out_conns[i]->dest_dev; >> +        if (!helper || !coresight_is_helper(helper)) >> +            continue; >> + >> +        if (helper->subtype.helper_subtype == subtype) { >> +            mutex_unlock(&coresight_mutex); >> +            return helper; >> +        } >> +    } >> +    mutex_unlock(&coresight_mutex); >> + >> +    return NULL; >> +} >> +EXPORT_SYMBOL_GPL(coresight_get_helper); >> + >>   /** >>    * coresight_get_in_port: Find the input port number at @csdev where >> a @remote >>    * device is connected to. >> diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/ >> hwtracing/coresight/coresight-priv.h >> index cbf80b83e5ce..8e39a4dc7256 100644 >> --- a/drivers/hwtracing/coresight/coresight-priv.h >> +++ b/drivers/hwtracing/coresight/coresight-priv.h >> @@ -157,6 +157,8 @@ void coresight_path_assign_trace_id(struct >> coresight_path *path, >>                      enum cs_mode mode); >>   int coresight_get_in_port(struct coresight_device *csdev, >>                 struct coresight_device *remote); >> +struct coresight_device *coresight_get_helper(struct coresight_device >> *csdev, >> +                          enum coresight_dev_subtype_helper subtype); >>   #if IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM3X) >>   int etm_readl_cp14(u32 off, unsigned int *val); >> >