From patchwork Sat Mar 9 05:51:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Athira Rajeev X-Patchwork-Id: 1909915 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=LT83utfR; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=112.213.38.117; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=patchwork.ozlabs.org) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TsBzB2kxJz1yWy for ; Sat, 9 Mar 2024 16:53:10 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=LT83utfR; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4TsBz94jqWz3dwr for ; Sat, 9 Mar 2024 16:53:09 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=LT83utfR; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=atrajeev@linux.vnet.ibm.com; receiver=lists.ozlabs.org) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4TsByK4m2nz3vYZ for ; Sat, 9 Mar 2024 16:52:25 +1100 (AEDT) Received: from pps.filterd (m0353726.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42957T1I008548; Sat, 9 Mar 2024 05:52:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=aCTDQxs20/top2PK9D2jW/zsY8W34gmrBdKbkadRHx8=; b=LT83utfRKkP1WP5BnDvOgRJCtSlvU/m37MWozmdllriD6TQXA5bHvro6LD4skwsBazyd el9laddqPH7SgKXQwnhb+pMHimuHcoUeTdOBNOhI4yx0MYTn+xktJk74Z3dFamGcArdP qiWFuLSqwbbNKGVIZ9wcI+rhVG4YIlEoarzXOcRmPyCeM6QQxB4/j02Vpm3DGp52Pxtt 5o5algcyIeHd5qVC9P9nXF8D8RgoulyG4190C35BPkyYEIsfy65TOKiAMJHgxG4FKzCz op18R5NdIOW431m7CVOx0C3CMkdtP1rsmax5Vxx5+T1keNI2/br+cKVwi8AXHicllOMs fg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wrhbbravk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 09 Mar 2024 05:52:19 +0000 Received: from m0353726.ppops.net (m0353726.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 4295qJOj031611; Sat, 9 Mar 2024 05:52:19 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wrhbbravg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 09 Mar 2024 05:52:19 +0000 Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 4292rZHf025387; Sat, 9 Mar 2024 05:52:18 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3wmeu097g3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 09 Mar 2024 05:52:17 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4295qChi31785410 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 9 Mar 2024 05:52:14 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2CD8920043; Sat, 9 Mar 2024 05:52:12 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B9C8720040; Sat, 9 Mar 2024 05:52:06 +0000 (GMT) Received: from localhost.localdomain (unknown [9.43.52.192]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Sat, 9 Mar 2024 05:52:06 +0000 (GMT) From: Athira Rajeev To: acme@kernel.org, jolsa@kernel.org, adrian.hunter@intel.com, irogers@google.com, namhyung@kernel.org Subject: [PATCH 1/3] tools/perf/arch/powerpc: Add load/store in powerpc annotate instructions for data type profling Date: Sat, 9 Mar 2024 11:21:34 +0530 Message-Id: <20240309055136.96556-2-atrajeev@linux.vnet.ibm.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20240309055136.96556-1-atrajeev@linux.vnet.ibm.com> References: <20240309055136.96556-1-atrajeev@linux.vnet.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: qIiRnvfJph4lc3jbhp61MtF0i-Rh-4if X-Proofpoint-GUID: _dl91ioDeLrSUDaur4L7b3QlH-Z3C29I 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-08_08,2024-03-06_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 bulkscore=0 adultscore=0 suspectscore=0 mlxlogscore=999 phishscore=0 priorityscore=1501 mlxscore=0 impostorscore=0 malwarescore=0 clxscore=1015 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2403090045 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: atrajeev@linux.vnet.ibm.com, kjain@linux.ibm.com, linux-perf-users@vger.kernel.org, maddy@linux.ibm.com, disgoel@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Add powerpc instruction nmemonic table to associate load/store instructions with move_ops. mov_ops is used to identify mem_type to associate instruction with data type and offset. Also initialize and allocate arch specific fields for nr_instructions, instructions and nr_instructions_allocate. Signed-off-by: Athira Rajeev --- .../perf/arch/powerpc/annotate/instructions.c | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/tools/perf/arch/powerpc/annotate/instructions.c b/tools/perf/arch/powerpc/annotate/instructions.c index a3f423c27cae..07af4442be38 100644 --- a/tools/perf/arch/powerpc/annotate/instructions.c +++ b/tools/perf/arch/powerpc/annotate/instructions.c @@ -1,6 +1,65 @@ // SPDX-License-Identifier: GPL-2.0 #include +/* + * powerpc instruction nmemonic table to associate load/store instructions with + * move_ops. mov_ops is used to identify mem_type to associate instruction with + * data type and offset. + */ +static struct ins powerpc__instructions[] = { + { .name = "lbz", .ops = &mov_ops, }, + { .name = "lbzx", .ops = &mov_ops, }, + { .name = "lbzu", .ops = &mov_ops, }, + { .name = "lbzux", .ops = &mov_ops, }, + { .name = "lhz", .ops = &mov_ops, }, + { .name = "lhzx", .ops = &mov_ops, }, + { .name = "lhzu", .ops = &mov_ops, }, + { .name = "lhzux", .ops = &mov_ops, }, + { .name = "lha", .ops = &mov_ops, }, + { .name = "lhax", .ops = &mov_ops, }, + { .name = "lhau", .ops = &mov_ops, }, + { .name = "lhaux", .ops = &mov_ops, }, + { .name = "lwz", .ops = &mov_ops, }, + { .name = "lwzx", .ops = &mov_ops, }, + { .name = "lwzu", .ops = &mov_ops, }, + { .name = "lwzux", .ops = &mov_ops, }, + { .name = "lwa", .ops = &mov_ops, }, + { .name = "lwax", .ops = &mov_ops, }, + { .name = "lwaux", .ops = &mov_ops, }, + { .name = "ld", .ops = &mov_ops, }, + { .name = "ldx", .ops = &mov_ops, }, + { .name = "ldu", .ops = &mov_ops, }, + { .name = "ldux", .ops = &mov_ops, }, + { .name = "stb", .ops = &mov_ops, }, + { .name = "stbx", .ops = &mov_ops, }, + { .name = "stbu", .ops = &mov_ops, }, + { .name = "stbux", .ops = &mov_ops, }, + { .name = "sth", .ops = &mov_ops, }, + { .name = "sthx", .ops = &mov_ops, }, + { .name = "sthu", .ops = &mov_ops, }, + { .name = "sthux", .ops = &mov_ops, }, + { .name = "stw", .ops = &mov_ops, }, + { .name = "stwx", .ops = &mov_ops, }, + { .name = "stwu", .ops = &mov_ops, }, + { .name = "stwux", .ops = &mov_ops, }, + { .name = "std", .ops = &mov_ops, }, + { .name = "stdx", .ops = &mov_ops, }, + { .name = "stdu", .ops = &mov_ops, }, + { .name = "stdux", .ops = &mov_ops, }, + { .name = "lhbrx", .ops = &mov_ops, }, + { .name = "sthbrx", .ops = &mov_ops, }, + { .name = "lwbrx", .ops = &mov_ops, }, + { .name = "stwbrx", .ops = &mov_ops, }, + { .name = "ldbrx", .ops = &mov_ops, }, + { .name = "stdbrx", .ops = &mov_ops, }, + { .name = "lmw", .ops = &mov_ops, }, + { .name = "stmw", .ops = &mov_ops, }, + { .name = "lswi", .ops = &mov_ops, }, + { .name = "lswx", .ops = &mov_ops, }, + { .name = "stswi", .ops = &mov_ops, }, + { .name = "stswx", .ops = &mov_ops, }, +}; + static struct ins_ops *powerpc__associate_instruction_ops(struct arch *arch, const char *name) { int i; @@ -52,6 +111,13 @@ static struct ins_ops *powerpc__associate_instruction_ops(struct arch *arch, con static int powerpc__annotate_init(struct arch *arch, char *cpuid __maybe_unused) { if (!arch->initialized) { + arch->nr_instructions = ARRAY_SIZE(powerpc__instructions); + arch->instructions = calloc(arch->nr_instructions, sizeof(struct ins)); + if (arch->instructions == NULL) + return -ENOMEM; + + memcpy(arch->instructions, (struct ins *)powerpc__instructions, sizeof(struct ins) * arch->nr_instructions); + arch->nr_instructions_allocated = arch->nr_instructions; arch->initialized = true; arch->associate_instruction_ops = powerpc__associate_instruction_ops; arch->objdump.comment_char = '#'; From patchwork Sat Mar 9 05:51:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Athira Rajeev X-Patchwork-Id: 1909916 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=ADreIOTi; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=patchwork.ozlabs.org) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TsBzz0kpZz1yWy for ; Sat, 9 Mar 2024 16:53:51 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=ADreIOTi; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4TsBzy6nnWz3vcb for ; Sat, 9 Mar 2024 16:53:50 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=ADreIOTi; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0b-001b2d01.pphosted.com; envelope-from=atrajeev@linux.vnet.ibm.com; receiver=lists.ozlabs.org) Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4TsByb3cbFz3dfy for ; Sat, 9 Mar 2024 16:52:39 +1100 (AEDT) Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 4295Hd15025051; Sat, 9 Mar 2024 05:52:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=wR8wsx8XHoyJZG6Govc76HMoUvHf7YwLRQtEF1VahdQ=; b=ADreIOTizFFqo/sRljFX6WQgVUxPbpbaEHKNs1A7DppD+gSMzMk5jKRdTgedW01BLSz3 ES7Ccj26iQ102Hpl3OR2scINbzkbT/pkRpL9K5WKshcA9torzg4xI0o7r6DNEBV2KsZg 7IL4ZU6WrPvs/x4ecmMDeOphW+KFia8hsHrcuRFcLvm+Rgz1DQarnvxQol4I0Jj/D26N zraEkq88bKnfAA0zp9I7BGAm53TqJll1tsN4bbOF/MLBD+9QshsQnLnXpcJLu67qgz/h 8QyCptv0vYunB4M0Jrr6/iZMQ+Q0FOpelrnX6MBZbbG15wFf0fFxQYMm/+HyE3bo8BAD 1g== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wrhg907j4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 09 Mar 2024 05:52:33 +0000 Received: from m0360072.ppops.net (m0360072.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 4295oFQE018476; Sat, 9 Mar 2024 05:52:32 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wrhg907j3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 09 Mar 2024 05:52:32 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 4295e8hb024211; Sat, 9 Mar 2024 05:52:32 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3wpjwsvahg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 09 Mar 2024 05:52:32 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4295qQn637683546 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 9 Mar 2024 05:52:28 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7D66A20040; Sat, 9 Mar 2024 05:52:26 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E15D920043; Sat, 9 Mar 2024 05:52:20 +0000 (GMT) Received: from localhost.localdomain (unknown [9.43.52.192]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Sat, 9 Mar 2024 05:52:20 +0000 (GMT) From: Athira Rajeev To: acme@kernel.org, jolsa@kernel.org, adrian.hunter@intel.com, irogers@google.com, namhyung@kernel.org Subject: [PATCH 2/3] tools/erf/util/annotate: Set register_char and memory_ref_char for powerpc Date: Sat, 9 Mar 2024 11:21:35 +0530 Message-Id: <20240309055136.96556-3-atrajeev@linux.vnet.ibm.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20240309055136.96556-1-atrajeev@linux.vnet.ibm.com> References: <20240309055136.96556-1-atrajeev@linux.vnet.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: J8uDUiWwdi-WPjKgVUEqfKX00d6RndVV X-Proofpoint-GUID: 12W07VxBTvcenmWkhsR2OmT_NSwAqBZ0 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-08_08,2024-03-06_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 lowpriorityscore=0 mlxscore=0 spamscore=0 impostorscore=0 mlxlogscore=999 priorityscore=1501 suspectscore=0 malwarescore=0 bulkscore=0 clxscore=1015 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2403090045 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: atrajeev@linux.vnet.ibm.com, kjain@linux.ibm.com, linux-perf-users@vger.kernel.org, maddy@linux.ibm.com, disgoel@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" To identify if the instruction has any memory reference, "memory_ref_char" field needs to be set for specific architecture. Example memory instruction: lwz r10,0(r9) Here "(" is the memory_ref_char. Set this as part of arch->objdump To get register number and access offset from the given instruction, arch->objdump.register_char is used. In case of powerpc, the register char is "r" (since reg names are r0 to r31). Hence set register_char as "r". Signed-off-by: Athira Rajeev --- tools/perf/util/annotate.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index ac002d907d81..d69bd6edafcb 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c @@ -216,6 +216,11 @@ static struct arch architectures[] = { { .name = "powerpc", .init = powerpc__annotate_init, + .objdump = { + .comment_char = '#', + .register_char = 'r', + .memory_ref_char = '(', + }, }, { .name = "riscv64", From patchwork Sat Mar 9 05:51:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Athira Rajeev X-Patchwork-Id: 1909917 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=ijh/6Fv4; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=patchwork.ozlabs.org) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TsC0m06WZz1yWy for ; Sat, 9 Mar 2024 16:54:32 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=ijh/6Fv4; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4TsC0l6PJPz3vgk for ; Sat, 9 Mar 2024 16:54:31 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=ijh/6Fv4; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0b-001b2d01.pphosted.com; envelope-from=atrajeev@linux.vnet.ibm.com; receiver=lists.ozlabs.org) Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4TsByn5yfNz3vXT for ; Sat, 9 Mar 2024 16:52:49 +1100 (AEDT) Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 4295IFZi026223; Sat, 9 Mar 2024 05:52:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=ZAfASJM3DMj0Nw73XRihZAWiZqggzq2/3ytxwz8G5Y0=; b=ijh/6Fv4XiAov275EUtua9HIlE+KoLDZvVdZcpI4oCTKqxaHF8GJdHx8ZFAQ9QNXIGFn zx4ZrFiKysD/fMbVuXU7HwSnkClLE3eUO6NtUU4s9JXUXX67qHULb4JfxgbTVdlBw9D/ YLBiZckjGcFAJKZr03Tik4eSyOt7Zw8AkheXinHz9MCWeYZe2/bZZZV2AUdAyzT0ugrr 9SQw/tKuPkPNuSLBFF0VPucvaPnFxJSBZjjDWm3wtFUJkvvAZcTYlC7m9SQKunG5H68y acZuVQAPb1mW3D+Q0z0LnaTHfnfx9YPdkdQeD74F/otJLPwIRPobR7mlgBALh4+Kqsld kg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wrhg907k8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 09 Mar 2024 05:52:44 +0000 Received: from m0360072.ppops.net (m0360072.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 4295pctS019779; Sat, 9 Mar 2024 05:52:43 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wrhg907k6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 09 Mar 2024 05:52:43 +0000 Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 4294wg82031549; Sat, 9 Mar 2024 05:52:42 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3wmgnkrqc9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 09 Mar 2024 05:52:42 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4295qb1e30867878 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 9 Mar 2024 05:52:39 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7267D20043; Sat, 9 Mar 2024 05:52:37 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 095D620040; Sat, 9 Mar 2024 05:52:32 +0000 (GMT) Received: from localhost.localdomain (unknown [9.43.52.192]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Sat, 9 Mar 2024 05:52:31 +0000 (GMT) From: Athira Rajeev To: acme@kernel.org, jolsa@kernel.org, adrian.hunter@intel.com, irogers@google.com, namhyung@kernel.org Subject: [PATCH 3/3] tools/perf/arch/powerc: Add get_arch_regnum for powerpc Date: Sat, 9 Mar 2024 11:21:36 +0530 Message-Id: <20240309055136.96556-4-atrajeev@linux.vnet.ibm.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20240309055136.96556-1-atrajeev@linux.vnet.ibm.com> References: <20240309055136.96556-1-atrajeev@linux.vnet.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: EYsWGzpW_J7gdbWkOmQVbR2RVXDzqDNa X-Proofpoint-GUID: BEzQ4XYIbiTlv39BTXJmtPBrwvgQp2_r 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-08_08,2024-03-06_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 lowpriorityscore=0 mlxscore=0 spamscore=0 impostorscore=0 mlxlogscore=999 priorityscore=1501 suspectscore=0 malwarescore=0 bulkscore=0 clxscore=1015 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2403090045 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: atrajeev@linux.vnet.ibm.com, kjain@linux.ibm.com, linux-perf-users@vger.kernel.org, maddy@linux.ibm.com, disgoel@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" The function get_dwarf_regnum() returns a DWARF register number from a register name string. This calls arch specific function get_arch_regnum to return register number for corresponding arch. Add mappings for register name to register number in powerpc code: arch/powerpc/util/dwarf-regs.c Signed-off-by: Athira Rajeev --- tools/perf/arch/powerpc/util/dwarf-regs.c | 29 +++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tools/perf/arch/powerpc/util/dwarf-regs.c b/tools/perf/arch/powerpc/util/dwarf-regs.c index 0c4f4caf53ac..d955e3e577ea 100644 --- a/tools/perf/arch/powerpc/util/dwarf-regs.c +++ b/tools/perf/arch/powerpc/util/dwarf-regs.c @@ -98,3 +98,32 @@ int regs_query_register_offset(const char *name) return roff->ptregs_offset; return -EINVAL; } + +struct dwarf_regs_idx { + const char *name; + int idx; +}; + +static const struct dwarf_regs_idx powerpc_regidx_table[] = { + { "r0", 0 }, { "r1", 1 }, { "r2", 2 }, { "r3", 3 }, { "r4", 4 }, + { "r5", 5 }, { "r6", 6 }, { "r7", 7 }, { "r8", 8 }, { "r9", 9 }, + { "r10", 10 }, { "r11", 11 }, { "r12", 12 }, { "r13", 13 }, { "r14", 14 }, + { "r15", 15 }, { "r16", 16 }, { "r17", 17 }, { "r18", 18 }, { "r19", 19 }, + { "r20", 20 }, { "r21", 21 }, { "r22", 22 }, { "r23", 23 }, { "r24", 24 }, + { "r25", 25 }, { "r26", 26 }, { "r27", 27 }, { "r27", 27 }, { "r28", 28 }, + { "r29", 29 }, { "r30", 30 }, { "r31", 31 }, +}; + +int get_arch_regnum(const char *name) +{ + unsigned int i; + + if (*name != 'r') + return -EINVAL; + + for (i = 0; i < ARRAY_SIZE(powerpc_regidx_table); i++) + if (!strcmp(powerpc_regidx_table[i].name, name)) + return powerpc_regidx_table[i].idx; + + return -ENOENT; +}