From nobody Tue Feb 10 02:42:48 2026 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 B88D0313261 for ; Thu, 18 Dec 2025 08:10:51 +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=1766045454; cv=none; b=pe/hZzhiyMCAo6Z9jdkIYQhFRaKk0SyjOpyPN0FOR80l+UWodfagciXTJRahPRz+I/pGvOMiZ9HBnMbjMcyw6bCT2eTKmjcg9QxeJwowxhWGc4WH4Pw+BCJEGmnyLG+firN0Tn/Tdy+h1cgE3UqXMgYFAZ4yWQ+cT4Twpk2z70A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766045454; c=relaxed/simple; bh=tRqkZYK4AglbLGklSYzp72IT+4oELHjCcHihOb5pY2E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fvukUF9nLDKbDqnjUJ4ASALOJdGoJmesWGD0tEoxxSrUl8Y+/1a3I4h3oxcWG2fU7+pURv2qqFanT31n1WdGXtFMjzJFqKXied+x7AnmM+SFr0a2A/TECxAJURbs7kimXC6w9ezB0bUSQSS2e64p2s5qvVaX/Rq/20nUwJbl1rc= 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=SBLg08Ys; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=VHq2Bmqw; 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="SBLg08Ys"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="VHq2Bmqw" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5BI1YUJq680516 for ; Thu, 18 Dec 2025 08:10:50 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= eg43gO5IN/UjjpccjnXvQXg/c+wJgC9BW73EUBjlyfA=; b=SBLg08YsXHNUIl+4 l5gv6N7evKFihkwLcZf1ftil72z3Xh34Wbq2p0U7Z/B6H8jR3JuUCJR8IqoNRw1P r7KRh7XsKb80WKT+K97rRXI9MM+DgegYt7txwxlx+mdzi+LOhzbFfnVKuUTWkmeZ tOObqJScGaxGs9McEboMv8ZvZ/B1seqkN5ulv9kGPtzYWUmZW0vv6+pEKYiN0yNi xAv6WI3hE2jsQoiwUvMjPaNy/lqnRiEANKNiOmeuLYT3hfcPJ/4yXrUj8dRNs97e euwCW4umtfob+KZ9djFg2E8XvgESZbvpVNFiMFptGtaNQYug1rNR7clzj16vVTUY kotT8Q== Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4b45bhhcdr-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 18 Dec 2025 08:10:50 +0000 (GMT) Received: by mail-pg1-f197.google.com with SMTP id 41be03b00d2f7-bddf9ce4935so404611a12.1 for ; Thu, 18 Dec 2025 00:10:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1766045449; x=1766650249; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=eg43gO5IN/UjjpccjnXvQXg/c+wJgC9BW73EUBjlyfA=; b=VHq2BmqwE5NxZ6S4n4J5VTjf6ljSRyuS9vDWSdfckoJTYnLeNX4CJyDzV/mUd9OW2x 0t4PKmvWU8Lj//973f9zInz4ypuF+ailf5JHhIvFs/Vxvhfe/1RPxiYoiVM5DS7H4DjC jO40N1U1LdVkBiTOpNZwXGgL5kgmLx22aeCsVdmd75HKB1tb64z/1iuA97SVTxTQZlXN 66bX/pAS3X2qo/9z2XeF0ehIzErJKD1hWGcB1e6nsqO2x8hcUind/fy2EsssSKumr28q HO+NOVYIsMIB144IBU7UlgBawvxYFI5hs4mW2SkZzY3L4GmWl6CoqesudgAyH0PPZjqm d+Kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766045449; x=1766650249; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=eg43gO5IN/UjjpccjnXvQXg/c+wJgC9BW73EUBjlyfA=; b=EPQcSLbv9amdB+3XYsYInMgeRoe8Mi88+aJy36zCQBc7MvoOm9gLH0UoZXMtRSpdii CePMSq7MPAiq/ha8BWdZB4TGCk9fuhsZe0CNH3OTZfS5rVUaEWKJLPVADfHU2apV1BYG CXria6/LhXh8uCxB7CL5XUqob3f/AiuyNMJIqRZ5kQ4YF8WEVT6wbW7tgHq1MHiSld6v mg8gUU/RZ+yKD2OIpNJdBNpvPAx+swtcTKkCm9bgNKFOVF/KC25R87BJOmqm/z7gMjDC Z/23Dek7RR2D+Mqb7DwX6l1VF//9cgxkTfAjoSiKF9fXseHaoPeTZ3IWTj2RqaBKsil+ H5Vg== X-Forwarded-Encrypted: i=1; AJvYcCWcTIUc2Ta5tNU3xNKZ87aCXI8Z+X1Oxsrf/oHjZyuSsBWypSkJw6MTVXTABymC4nF4hRap21Y2ZnkIuyA=@vger.kernel.org X-Gm-Message-State: AOJu0YyDtRwgcMp0ilB6c0np5myc89Hi4ikIofiKaWoFZKPxUOAfpFuv Y1pLQoQ13XCo2X9nFIpqXIvI0acVqIDZeD5B9gLL4F7/fpBrOJ7dbqWdht0PM3I7QePczbyL8Fy aUHkkEplW6vNfrChtoUHkqAwoKTqXHnqwyQbQJprPJlQHJqMD0Ix3OJQ+aMu6FWYBNT4= X-Gm-Gg: AY/fxX4tjGqZbkeaQRzyABPj5pcIx8uQrD0XigvO+vw8xSi8u/c++2hDh5QfA5ZdylA dTOEGnSb5zfEU0biykfjnsoOdojKK7EHn0N5/4LrJ4x044vmFimw3FeP+SLMtRURomYHHRjQCuD VzxuK2koAavkoaHVlK7bH2VJRDTrIBweYF6JMIRms/945CJ4IvMKRHPv9atNtg4CswyVmxcvDtg yodWOpO3scemRkYT0kiQ8dDKmbiUiRPrBvo2LXjBuygTx5Cj5mkfzWRazcAtfOBrw2Ek0xQEVN1 qheGxNdCy3kgKp3+lxXBK5M4N9OGeIHuHabxGKiIayArjFcmOqOH+yuqFuBpbiblHHmcXSlQ/9v 2+QhtkCHypjLzupJDtBH2Rvl2koax1MO5a8DUFcWRPms8KXAOe+gJv8AYG+v8BeSFm1A= X-Received: by 2002:a05:7300:80c4:b0:2ab:8ef5:df2 with SMTP id 5a478bee46e88-2ac303c722fmr16589725eec.35.1766045449051; Thu, 18 Dec 2025 00:10:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IGmbDEU236FJEUDpNRG5Jnhut5mfBvSeCnLbWolEmv8DckqJfmhebTUwJmWEge8k5cfmSwZww== X-Received: by 2002:a05:7300:80c4:b0:2ab:8ef5:df2 with SMTP id 5a478bee46e88-2ac303c722fmr16589691eec.35.1766045448366; Thu, 18 Dec 2025 00:10:48 -0800 (PST) Received: from hu-yuanfang-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2b04e58d423sm2564824eec.6.2025.12.18.00.10.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Dec 2025 00:10:45 -0800 (PST) From: Yuanfang Zhang Date: Thu, 18 Dec 2025 00:09:46 -0800 Subject: [PATCH v2 06/12] coresight-replicator: Update management interface for CPU-bound devices Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251218-cpu_cluster_component_pm-v2-6-2335a6ae62a0@oss.qualcomm.com> References: <20251218-cpu_cluster_component_pm-v2-0-2335a6ae62a0@oss.qualcomm.com> In-Reply-To: <20251218-cpu_cluster_component_pm-v2-0-2335a6ae62a0@oss.qualcomm.com> To: Suzuki K Poulose , Mike Leach , James Clark , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Mathieu Poirier , Leo Yan , Alexander Shishkin , Bjorn Andersson , Konrad Dybcio Cc: kernel@oss.qualcomm.com, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Yuanfang Zhang , maulik.shah@oss.qualcomm.com X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1766045439; l=3386; i=yuanfang.zhang@oss.qualcomm.com; s=20250814; h=from:subject:message-id; bh=tRqkZYK4AglbLGklSYzp72IT+4oELHjCcHihOb5pY2E=; b=n9/JjWbuXWrmOZTTtygtYUn0byxKNWiKgxpoZO5xT5JsIF+Rk4mW38XCk/mXYP6jUZBV6KTf3 k/zADsYz0ZoAieyGH1MR1+vQyduL1eJwzebcOgQtew/FlnhwS46WQa6 X-Developer-Key: i=yuanfang.zhang@oss.qualcomm.com; a=ed25519; pk=9oS/FoPW5k0CsqSDDrPlnV+kVIOUaAe0O5pr4M1wHgY= X-Proofpoint-GUID: GZPHw4_ln5v_KHKh9tQpIYR-pYa0vF3M X-Proofpoint-ORIG-GUID: GZPHw4_ln5v_KHKh9tQpIYR-pYa0vF3M X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjE4MDA2NiBTYWx0ZWRfXxX5u0nRmwAyF BpK2YrASBWZ+B1TKHRb0M91gKj7iP9zu9Dk52VI9+QUab+kzftl6tv3s6vHtIS9Lsnkwx8wg7ys WC0UpcZ1vEnQ+bBwkwGDdHfrEXs3uxdhGynEk8GmxSj3IO0gap5JZHjRE+l4U5q4AEv5s09/NEo mmjczxAWgGBzxj4jsLjrvJ739bOEwP9b3lN2J+VidM5N1ESZOyUfr6QZJjSDpQcVVIHAod46r/Y QbNWMO9ldv9Pzhwy3gdgm3Xt6Roy0+BNtxBWTWuS3UMSsZhxwUnK1BN+l/o+RyamkvhxhghjzWs n7LvFbdggXVvkq6N1f5cjMp12DNFAnaV3KRU8uAcrf3WyAOQzl9erogPEgNJ4X8g4iicDl/0DmD vfRvXXmeWSE70OSF2427bL/i3mYtVw== X-Authority-Analysis: v=2.4 cv=SZr6t/Ru c=1 sm=1 tr=0 ts=6943b70a cx=c_pps a=rz3CxIlbcmazkYymdCej/Q==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=wP3pNCr1ah4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=5J7XQuhJkvlR0EEfeBgA:9 a=QEXdDO2ut3YA:10 a=bFCP_H2QrGi7Okbo017w: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-18_01,2025-12-17_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 malwarescore=0 suspectscore=0 spamscore=0 phishscore=0 clxscore=1015 adultscore=0 priorityscore=1501 impostorscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2510240001 definitions=main-2512180066 Standard system replicators allow direct register access from any CPU. However, replicators associated with specific CPU clusters share the cluster's power domain and require access via a CPU within that domain. Replace the standard `coresight_simple_reg*` accessors with custom handlers (`coresight_replicator_reg*`) to support these devices: - For cluster-bound replicators (indicated by `supported_cpus`), use `smp_call_function_single()` to read registers on an associated CPU. - For standard replicators, retain the direct access behavior. This ensures correct operation for per-cluster replicators while maintaining compatibility for existing system-level devices. Signed-off-by: Yuanfang Zhang --- drivers/hwtracing/coresight/coresight-replicator.c | 61 ++++++++++++++++++= +++- 1 file changed, 59 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/h= wtracing/coresight/coresight-replicator.c index f8d13894098f1e414fb0da8d6eeb1da4f0d55a8c..a9f22d0e15de21aa06c8d1e193e= 5db06091efd75 100644 --- a/drivers/hwtracing/coresight/coresight-replicator.c +++ b/drivers/hwtracing/coresight/coresight-replicator.c @@ -58,6 +58,7 @@ struct replicator_drvdata { struct replicator_smp_arg { struct replicator_drvdata *drvdata; int outport; + u32 offset; int rc; }; =20 @@ -286,9 +287,65 @@ static const struct coresight_ops replicator_cs_ops = =3D { .link_ops =3D &replicator_link_ops, }; =20 +static void replicator_read_register_smp_call(void *info) +{ + struct replicator_smp_arg *arg =3D info; + + arg->rc =3D readl_relaxed(arg->drvdata->base + arg->offset); +} + +static ssize_t coresight_replicator_reg32_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct replicator_drvdata *drvdata =3D dev_get_drvdata(dev->parent); + struct cs_off_attribute *cs_attr =3D container_of(attr, struct cs_off_att= ribute, attr); + unsigned long flags; + struct replicator_smp_arg arg =3D { 0 }; + u32 val; + int ret, cpu; + + pm_runtime_get_sync(dev->parent); + + if (!drvdata->supported_cpus) { + raw_spin_lock_irqsave(&drvdata->spinlock, flags); + val =3D readl_relaxed(drvdata->base + cs_attr->off); + raw_spin_unlock_irqrestore(&drvdata->spinlock, flags); + + } else { + arg.drvdata =3D drvdata; + arg.offset =3D cs_attr->off; + for_each_cpu(cpu, drvdata->supported_cpus) { + ret =3D smp_call_function_single(cpu, + replicator_read_register_smp_call, + &arg, 1); + if (!ret) + break; + } + if (!ret) { + val =3D arg.rc; + } else { + pm_runtime_put_sync(dev->parent); + return ret; + } + } + + pm_runtime_put_sync(dev->parent); + + return sysfs_emit(buf, "0x%x\n", val); +} + +#define coresight_replicator_reg32(name, offset) \ + (&((struct cs_off_attribute[]) { \ + { \ + __ATTR(name, 0444, coresight_replicator_reg32_show, NULL), \ + offset \ + } \ + })[0].attr.attr) + static struct attribute *replicator_mgmt_attrs[] =3D { - coresight_simple_reg32(idfilter0, REPLICATOR_IDFILTER0), - coresight_simple_reg32(idfilter1, REPLICATOR_IDFILTER1), + coresight_replicator_reg32(idfilter0, REPLICATOR_IDFILTER0), + coresight_replicator_reg32(idfilter1, REPLICATOR_IDFILTER1), NULL, }; =20 --=20 2.34.1