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 D3DD33FBEAD; Wed, 29 Apr 2026 12:52:27 +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=1777467150; cv=none; b=WW6ojv3cjws3SOfD56cj798oTydPdIj7KSQEWKGoY+IPqZxDnhQ4NrAIVvzekboazSry4dX11speUhy22fUfbrEfJPamzAvFvbvzFqIakCQ0sdu1FyyyhHlJn4g49UJd5oNPAI7xj3Z60/Jl+ZY4eB90bmp3lL32SZjzxUI6TvE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777467150; c=relaxed/simple; bh=/FkPJYOfTAd4h5YqJKfrPb5l1QNwgaBadcU/nKKIg88=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=P9/voP6ZGy82BSh2TCk7hYNXgymyfbLFq8f9nOcqyq+Jm5bmCsbTP8NHJJdme31n5KvnT7hdyH1pUYj88EZtDrUnZ360HvKorK6GWa7tUipIqWYNFqobw7wXe+TFDiDCmstfehpBoLDaSl12j0S1/aXdZN+BTscuAI3o7TXJ6bU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=SLqksZqx; 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=qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="SLqksZqx" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63T8qXAd1642983; Wed, 29 Apr 2026 12:51:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=8f0Pi81zN9t kL3OXmacgA2swuOinfVpfGGMeF5s7kw4=; b=SLqksZqxI2Pz0AfeCZM6Q3K5aVp HpVgWmmb/hYRyuYXDdgo2s4Eji4LjnVvSBf97vDotqFYPaKN02y2+P+AcOo9kDrY pk3MGOkA/qptQPEMIZhMxPJOuA1wtVdh2jMk3U+8FqtWAY3t1Bux3Hd0MyElF5r7 bigUg55L/2C0OhDDANerYLA57+3Je6kVJKyEecKX+aSx7rFo5HTzF1a0A0sSEGD9 B9BQyIDb20vT45DHW7gnsxMhy5+BV+dtae1qaNCKodzDjWaBHua2/w0bumZpaUX8 qNTmyJxfqiH+TJ8eUJfOQ8+3/3XanTSXU5GU1q2yW8QygT0Ldah+XQtjKbw== Received: from apblrppmta02.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.18.19]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ducj81jm9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Apr 2026 12:51:42 +0000 (GMT) Received: from pps.filterd (APBLRPPMTA02.qualcomm.com [127.0.0.1]) by APBLRPPMTA02.qualcomm.com (8.18.1.7/8.18.1.7) with ESMTP id 63TCpbOX010778; Wed, 29 Apr 2026 12:51:39 GMT Received: from pps.reinject (localhost [127.0.0.1]) by APBLRPPMTA02.qualcomm.com (PPS) with ESMTPS id 4ds65fvr20-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Apr 2026 12:51:39 +0000 (GMT) Received: from APBLRPPMTA02.qualcomm.com (APBLRPPMTA02.qualcomm.com [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.1.12) with ESMTP id 63TCpcSp010815; Wed, 29 Apr 2026 12:51:38 GMT Received: from hu-devc-blr-u24-a.qualcomm.com (hu-anuppate-blr.qualcomm.com [10.131.36.165]) by APBLRPPMTA02.qualcomm.com (PPS) with ESMTPS id 63TCpcgl010802 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Apr 2026 12:51:38 +0000 (GMT) Received: by hu-devc-blr-u24-a.qualcomm.com (Postfix, from userid 486687) id C3A252212C; Wed, 29 Apr 2026 18:21:36 +0530 (+0530) From: Anup Patel To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Palmer Dabbelt , Paul Walmsley , Greg KH , Alexander Shishkin , Ian Rogers Cc: Alexandre Ghiti , Peter Zijlstra , Ingo Molnar , Namhyung Kim , Mark Rutland , Jiri Olsa , Adrian Hunter , Mayuresh Chitale , Anup Patel , Atish Patra , Andrew Jones , Sunil V L , linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Anup Patel , Mayuresh Chitale Subject: [PATCH v4 06/12] rvtrace: Add function to copy into perf AUX buffer Date: Wed, 29 Apr 2026 18:21:29 +0530 Message-ID: <20260429125135.1983498-7-anup.patel@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260429125135.1983498-1-anup.patel@oss.qualcomm.com> References: <20260429125135.1983498-1-anup.patel@oss.qualcomm.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-ORIG-GUID: NCSAYNMQx2vM14rzxlhoVqKOiJQAZZ3x X-Authority-Analysis: v=2.4 cv=RI6D2Yi+ c=1 sm=1 tr=0 ts=69f1fede cx=c_pps a=Ou0eQOY4+eZoSc0qltEV5Q==:117 a=Ou0eQOY4+eZoSc0qltEV5Q==:17 a=A5OVakUREuEA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=EUspDBNiAAAA:8 a=J47OFj0AjNl56Ar9NcoA:9 X-Proofpoint-GUID: NCSAYNMQx2vM14rzxlhoVqKOiJQAZZ3x X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDI5MDEzMCBTYWx0ZWRfX9OcEn4X4rrhn Hkn6eH0CRwQaAGexpSYM+JxHtvlr9ZmhH/AQcWZkwKm6rlLCTOsLavyRLu6a7kSvA0ceDERF/Ed i5iRxKyrA+gQqHjD6PuAnC8cs7KlwRWOOGGTAEwUS0Bptn8adOxAg2cSgh4TKrmK2qPDxLmMira tGETXo1oGAi4QGDLflkbyjEn2n5/B+HFVE9GH9Tfwk7yV+uPhecWC7XlihpAY0mOn7JtXJQQhJm SdxfLsOi6ohXD/tYFqb+F4X9dhET82omY2T/kMGgEMTINwPavV5AwLH509bZqowYHnZe+B8Rsry fLvi4ccTnFixXFEJ2RkQ/vkJD2OFNwXfq4lWrADZtL0VOF3oDeqtHWDidaw7Lt2Sw0N+77mfSSo fkbBL308CciWBlabvvfrvtGlWoMUMpsXOgZFcmw5Pg/GJ+sAlpEneQ7sC4ue7eVitWMV+cTWyl6 KMIAFVp4OW7ROWD1WsQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-28_05,2026-04-28_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 lowpriorityscore=0 adultscore=0 clxscore=1015 impostorscore=0 bulkscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2604290130 The RISC-V trace ramsink will need a mechanism to copy trace data into the perf AUX buffer. Add rvtrace_path_copyto_auxbuf() function and corresponding trace driver callback copyto_auxbuf() for this purpose. Co-developed-by: Mayuresh Chitale Signed-off-by: Mayuresh Chitale Signed-off-by: Anup Patel --- drivers/hwtracing/rvtrace/rvtrace-core.c | 22 ++++++++++++++++++++++ include/linux/rvtrace.h | 21 +++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/drivers/hwtracing/rvtrace/rvtrace-core.c b/drivers/hwtracing/rvtrace/rvtrace-core.c index 733d07abffbc..6d45c90480f1 100644 --- a/drivers/hwtracing/rvtrace/rvtrace-core.c +++ b/drivers/hwtracing/rvtrace/rvtrace-core.c @@ -664,6 +664,28 @@ int rvtrace_path_stop(struct rvtrace_path *path) } EXPORT_SYMBOL_GPL(rvtrace_path_stop); +int rvtrace_path_copyto_auxbuf(struct rvtrace_path *path, + struct rvtrace_perf_auxbuf *buf, + size_t *bytes_copied) +{ + const struct rvtrace_driver *rtdrv; + struct rvtrace_component *comp; + struct rvtrace_path_node *node; + + list_for_each_entry(node, &path->comp_list, head) { + comp = node->comp; + rtdrv = to_rvtrace_driver(comp->dev.driver); + if (!rtdrv->copyto_auxbuf) + continue; + + *bytes_copied = rtdrv->copyto_auxbuf(comp, buf); + return 0; + } + + return -EOPNOTSUPP; +} +EXPORT_SYMBOL_GPL(rvtrace_path_copyto_auxbuf); + struct rvtrace_path *rvtrace_create_path(struct rvtrace_component *source, struct rvtrace_component *sink, enum rvtrace_component_mode mode) diff --git a/include/linux/rvtrace.h b/include/linux/rvtrace.h index 2a7d8afd27c8..36663c7b3e30 100644 --- a/include/linux/rvtrace.h +++ b/include/linux/rvtrace.h @@ -280,9 +280,28 @@ void rvtrace_destroy_path(struct rvtrace_path *path); int rvtrace_path_start(struct rvtrace_path *path); int rvtrace_path_stop(struct rvtrace_path *path); +/** + * struct rvtrace_perf_auxbuf - Representation of the perf AUX buffer + * @length: size of the AUX buffer + * @nr_pages: number of pages of the AUX buffer + * @base: start address of AUX buffer + * @pos: position in the AUX buffer to commit traced data + */ +struct rvtrace_perf_auxbuf { + size_t length; + int nr_pages; + void *base; + long pos; +}; + +int rvtrace_path_copyto_auxbuf(struct rvtrace_path *path, + struct rvtrace_perf_auxbuf *buf, + size_t *bytes_copied); + /** * struct rvtrace_driver - Representation of a RISC-V trace driver * id_table: Table to match components handled by the driver + * copyto_auxbuf:Callback to copy data into perf AUX buffer * start: Callback to start tracing * stop: Callback to stop tracing * probe: Driver probe() function @@ -293,6 +312,8 @@ int rvtrace_path_stop(struct rvtrace_path *path); */ struct rvtrace_driver { const struct rvtrace_component_id *id_table; + size_t (*copyto_auxbuf)(struct rvtrace_component *comp, + struct rvtrace_perf_auxbuf *buf); int (*start)(struct rvtrace_component *comp); int (*stop)(struct rvtrace_component *comp); int (*probe)(struct rvtrace_component *comp); -- 2.43.0