From nobody Sun Nov 24 22:52:36 2024 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2097.outbound.protection.outlook.com [40.107.236.97]) (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 6F7441BBBE0; Thu, 31 Oct 2024 21:35:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.97 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730410528; cv=fail; b=dSJmiayOX2US6VxPoZfsNUAfBaPmR0thaKmaUxmtwpSudGYvvZUtCGDSLLwa/ACVsO70Qr60ipankX2gvXgMTdKkFq/pEr0QpXyT7bqb5hyrH3ZckJVPohQo7CRVAFBhLM/wOvQRoZUv4v0S5YVAoA1YH+1liMfIdUbsIcSHNTk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730410528; c=relaxed/simple; bh=mm3CNEIqFYkIZQQpGSzYFx+U/XH9iIyz1geF/izAKRY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=AS6d5JS1S8eDJ6H7apXWkViR8KqJ69DbmYRAZctCuIGMevg1ck2wnFMSkvJ6SdSB5nzOOpIJ7KUEsU08taxm1H7llbfEfnnmhDiL0A+eBz71dfw1yvQNqlulxV9Eb3FKsio7AGXH5bCDTBuK1ezz4PC51wOnIUBMajHPqKl9Wqo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=os.amperecomputing.com; spf=pass smtp.mailfrom=os.amperecomputing.com; dkim=pass (1024-bit key) header.d=os.amperecomputing.com header.i=@os.amperecomputing.com header.b=GVQDXzlo; arc=fail smtp.client-ip=40.107.236.97 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=os.amperecomputing.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=os.amperecomputing.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=os.amperecomputing.com header.i=@os.amperecomputing.com header.b="GVQDXzlo" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vQ2KLbWQXG3mtSJ5qg/wk13OvicU6uVfZgNEosu4OnKXQx8G/h7CO5R1t+GYbxdR9gw5CFTCFLJR7/Oqj1GLHyeQNtexDgocZfQCsaKqznekBlQU1dcirSpgKhDInB7BzwlyNM68K496KkYS/hK+ExQ6OKpIpE5vZgu5a5GpCmnvyTRfmd2kMrbi2bKGzSR61c9uPrPF58nasabyCr7h5V26QjNbEdWF15cKXejVBtwltSRdBLQV2Js2iUIqzH4LSrUzJZHTP3RD9wE54n65iyeV4rg1L4zXgD/68g338rTUBtZW22vI3+ZR5Vk8YBP7Nd0qUdSLJVYWBuvUvUZX5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=iKWhnbY97SP1R6VGqf2ndEnIPTuONU8Xny6/jErYNPg=; b=yW/S3wIiKItJKRQF+wMRvlXjVeU4+avvMn3yVOFzUAyKz9A3DP8jbdgiR2h5g0ZpZL5IP3zvtytw6W9cqgRWCPDqyyAr4vVct39z0zuBLYAPfCua7zM98XNssZCkdHv2nB3L5JUvnLV4i1B+i7eyqccxr3X4K1kubMrlFUZPOVqt9u7Kbyg4BxfbDrUiu73nd0+o4QTtAz0w74kKhQJAEZzsB+DCjOrVgMdYdhZrUbSofeN4/azXl7xosOA61kAWcKSvS189go9hRi4U9mlRc5nA9FKY5006SY92xf72ZiEhwiqUDpvQXZZ5JyDDDgPwEAWLHZARDKfRY1G2/P5MAA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iKWhnbY97SP1R6VGqf2ndEnIPTuONU8Xny6/jErYNPg=; b=GVQDXzlokkiCdTsWlmERJ6YZT+YfHk6yiMaZoQnBSTkhGW0wleH65KalHp5FgLWW3ZO1PedctMmY0+y6rdif0P3KLzGFfRUdxshX3J4fz/c+F0oBWqWsGgjtVUkZFxOCaTHjg/UN5wCfkFK8ON+C5ej8Ju/KRdpwDRLQq69tAVU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from MW4PR01MB6228.prod.exchangelabs.com (2603:10b6:303:76::7) by DM4PR01MB7761.prod.exchangelabs.com (2603:10b6:8:68::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.9; Thu, 31 Oct 2024 21:35:17 +0000 Received: from MW4PR01MB6228.prod.exchangelabs.com ([fe80::13ba:df5b:8558:8bba]) by MW4PR01MB6228.prod.exchangelabs.com ([fe80::13ba:df5b:8558:8bba%3]) with mapi id 15.20.8137.008; Thu, 31 Oct 2024 21:35:17 +0000 From: Ilkka Koskinen To: John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , "Liang, Kan" , Graham Woodward Cc: Ilkka Koskinen , linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] perf arm-spe: Prepare for adding data source packet implementations for other cores Date: Thu, 31 Oct 2024 21:35:32 +0000 Message-ID: <20241031213533.11148-2-ilkka@os.amperecomputing.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241031213533.11148-1-ilkka@os.amperecomputing.com> References: <20241031213533.11148-1-ilkka@os.amperecomputing.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: CH5P222CA0013.NAMP222.PROD.OUTLOOK.COM (2603:10b6:610:1ee::14) To MW4PR01MB6228.prod.exchangelabs.com (2603:10b6:303:76::7) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW4PR01MB6228:EE_|DM4PR01MB7761:EE_ X-MS-Office365-Filtering-Correlation-Id: 1a682dd1-d95c-4c7c-4b91-08dcf9f3e9da X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|7416014|376014|52116014|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?bh6cHB4vFAP9ruuZTnJ2bn57GBX8JVmUBYYlshRLjgvnQ1TKHvMK3qNFzhLu?= =?us-ascii?Q?MD2O7cV/XcrGupDTuiN4KMhVouqtnySl7aTwnQ/I+C7zLaUW34I1aOb3WBFF?= =?us-ascii?Q?c3KpW8575rA9te2v7jWoA/OUQGER58AD52EKHo/z8eokwEeTUn5x9Ul3Q7Nq?= =?us-ascii?Q?QpM23YQMP3jGMvR62GWucAzISOdxnYsrpKPhM+SJBNWa5vkumLjP0TVIxCXk?= =?us-ascii?Q?OuYKmj91Nrb/zISaMXb037rciPkHqyTVDVVAsX34rKGG1RAKSo1C0W1tq/yH?= =?us-ascii?Q?LZDTXzW+zA7xbob0AGUkKf9ErI2IEIft8TMialUSl5s4oUPyswsYQTN2iZkJ?= =?us-ascii?Q?5E3m/EeUqq8P6ryaZ4RFF65Dyr8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r9YR7JwG6txctplAOELs4dJ7bxJwrP13dAUXJL8XmX/Nxrqr4p2wtE?= =?us-ascii?Q?5Hn1jMsz7VCvOgh6CN8/5mq+xZmh5I/lLgCDICinBItMUeLm+K8X+lahZJal?= =?us-ascii?Q?GP2BhMChIe8GoyzxETFzezRml3TP?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW4PR01MB6228.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(7416014)(376014)(52116014)(38350700014)(921020);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?gp0xYGZAvFbjFhZ7OGXf8jswEeID0ZHBY9FTOkPk5FKT88Xg88c3zdo30tXb?= =?us-ascii?Q?+XY7Afe+afMMrZgH/wQ9+9w55TlYmxYM1/kjUrKK1NRglY6mhh/tUdBtq/8D?= =?us-ascii?Q?PaS/p+lKW2LB7/MorYhjlx2m8WzaE+H71Yx7wB+51vnaB96udTdMpvxfKkff?= =?us-ascii?Q?VDMYV3aq1KfBBe/0JHcTh88hxF3ZAD7umCDmA3tkoPgGa68YHN97BpZFiWq/?= =?us-ascii?Q?CM9p7LraPlwbiPb90HKRGC+CGyJtOuIqRjEr9PTOn/S1VaB5PMcoqgRhZ3D2?= =?us-ascii?Q?auaV+rM5LX77P/mI/CCU4ZtnBaNxkBY/5TenFqbYJpmcJB9fb0Fwy83ud+tE?= =?us-ascii?Q?07e4UZK8iq+mnDmYUXtShiPC2DqmRBWLIu9Re611qsDy5Ce3c9yqbe7NN3+g?= =?us-ascii?Q?IAmTPh+jD0ql+c5tYfDHlVVeIohLve/ft205ZUoLtCYoxU08cxtE/mw0Dslg?= =?us-ascii?Q?gWdVDRLWg9NLpuPFGqjzpdbUAKyAfI7K0AsmOh2YtVTVYAeW7kXnuy6qnJXW?= =?us-ascii?Q?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6fz8srXI7ayv3BE?= =?us-ascii?Q?aoce90WmUvMG/ZGWrGYg/hNmMGxGSXogqRtgTlB12pqx1HF0sSER0PoTVkM5?= =?us-ascii?Q?UL6GqVI2eVrF0W5f2tt4zL0A2fzHIxghjgH7IqaNwK1wDyC5jCqYWcxeagpO?= =?us-ascii?Q?zBAZASpV6XIEcv90GofdNhuwoKzUe3+tQR939i5YiorHI5XqwaqVxUyaFm6P?= =?us-ascii?Q?IoGBsalyqElcjqvFGjtAzkg=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1a682dd1-d95c-4c7c-4b91-08dcf9f3e9da X-MS-Exchange-CrossTenant-AuthSource: MW4PR01MB6228.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2024 21:35:17.6316 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: XpeI4y0+PVqdGOtqbMyGwv3klUMi/c+ZMvqNozRWv3ZSrF0Bc3MCuovIcQ3AAhb+t6p9LLMA2dZSgp7D74o7DQEleV2ZECaLxM6qaPYw5pbYRnbqcuzMhMjlP2F9ESHf X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR01MB7761 Content-Type: text/plain; charset="utf-8" Split Data Source Packet handling to prepare adding support for other implementations. Signed-off-by: Ilkka Koskinen --- tools/perf/util/arm-spe.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c index dbf13f47879c..9586416be30a 100644 --- a/tools/perf/util/arm-spe.c +++ b/tools/perf/util/arm-spe.c @@ -555,7 +555,8 @@ static void arm_spe__synth_memory_level(const struct ar= m_spe_record *record, data_src->mem_lvl |=3D PERF_MEM_LVL_REM_CCE1; } =20 -static bool arm_spe__is_common_ds_encoding(struct arm_spe_queue *speq) +static bool arm_spe__is_ds_encoding_supported(struct arm_spe_queue *speq, + const struct midr_range *cpus) { struct arm_spe *spe =3D speq->spe; bool is_in_cpu_list; @@ -592,7 +593,7 @@ static bool arm_spe__is_common_ds_encoding(struct arm_s= pe_queue *speq) midr =3D metadata[ARM_SPE_CPU_MIDR]; } =20 - is_in_cpu_list =3D is_midr_in_range_list(midr, common_ds_encoding_cpus); + is_in_cpu_list =3D is_midr_in_range_list(midr, cpus); if (is_in_cpu_list) return true; else @@ -603,7 +604,8 @@ static u64 arm_spe__synth_data_source(struct arm_spe_qu= eue *speq, const struct arm_spe_record *record) { union perf_mem_data_src data_src =3D { .mem_op =3D PERF_MEM_OP_NA }; - bool is_common =3D arm_spe__is_common_ds_encoding(speq); + bool is_common =3D arm_spe__is_ds_encoding_supported(speq, + common_ds_encoding_cpus); =20 if (record->op & ARM_SPE_OP_LD) data_src.mem_op =3D PERF_MEM_OP_LOAD; --=20 2.47.0 From nobody Sun Nov 24 22:52:36 2024 Received: from BL0PR05CU006.outbound.protection.outlook.com (mail-eastusazon11021140.outbound.protection.outlook.com [52.101.52.140]) (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 531C81BBBE0; Thu, 31 Oct 2024 21:35:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.52.140 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730410539; cv=fail; b=uNbqPy7UscNY9n8DRTNx8MLxjegPIAiWCJFBZGPN48JiziidimhQKFXx+YkxaXZ4BLZqU8IStFk+kqJLeKVQ2TvpaVkmJFu+lwerxyQyle+p8YJHq+QcbmvsWEBLASQOhceiC7oLAjApqSD8nNBVoKM3meNpeWABY5Lf01UEQCw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730410539; c=relaxed/simple; bh=omV2AR2gfqjWTiG1RkJcOifMFSgoYPeg7HpVJAGUN2w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=Lz7tYFx1X4A0wVADp08yNHkUxa+NSlGE+Ka9yXWZcOi9A/8vCazmB5ff1fIHnKOwRWuqBgJ4VZfILW3fG2MsLnmq+ZbLa327c9ZOfVqBASIm4WsgpxPYyIsPcIHGDe5rnNkRUhv0fEuYTgTKmd0VIhDAy9K43L9BX6SZUvdUjTk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=os.amperecomputing.com; spf=pass smtp.mailfrom=os.amperecomputing.com; dkim=pass (1024-bit key) header.d=os.amperecomputing.com header.i=@os.amperecomputing.com header.b=W5cGWHUt; arc=fail smtp.client-ip=52.101.52.140 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=os.amperecomputing.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=os.amperecomputing.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=os.amperecomputing.com header.i=@os.amperecomputing.com header.b="W5cGWHUt" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ZqOIuPwqj0YAxl+Lxuj4TOer2yRLpmi9osaL5ioz9rdWCwSXDWWe1KNglc5UV4Zi1pb5o5GL/0DsZdv0E949fX6ToZtHTSweDIaIkSPFbLiOGSgHPPcAynFur1WYZhr+yUi/U8tvcsNWVwTLBOcnQRNOj4+ZKt15Qe+4IonqiEhEwgRKlGD7YkLbjslpArZTKnu/k0wlYqhEFzopNctdIgR+amhWRVurrFO1j4Tp015LHt2K1+hxIYO1n2W4849uLZV2nvT8IHGhvfIvmYhYkGy3ZlpxZDChf3jx3gTpduGUWtL6N7dDb8fT5BQ6q4d7xHtQXN2tmZo/o4iY34QO+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mBibkdyjZV/1/ppByaipvOqsJDfDzCiJZNCKX7z2dUI=; b=s3o9FfZkbbO4vwkIrLf/A4tJcmxs2NDDPDesrP5XLsdvrAsWRAhrHDpJ6w+bXkcT1phvR7sr55R7kgjYydZzUwzcgv63YEmxwLghtwEtEEOy++dNaRFaGX4DgQxtBDAPBn4sIB9dnhUt6ZtG6DzGkVlzeK/uvSsOQUQcwmIzHrfE6Op5vU3LG/JASChw2bSPJqQAqmojS1WRTwRIjx8ohxz/JjoTdSfsqfK33plRa0CSucpBo3R9xuCugkhBEB/AJO+DGfB7dx9he68mZApT94rLfo13JpGUFKInOmeFXHKS1RaMg4LNKgzvEDY4Whttyvg6sEYpyzHcVtrX77r+Sg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mBibkdyjZV/1/ppByaipvOqsJDfDzCiJZNCKX7z2dUI=; b=W5cGWHUt8QQMjfEJy8vBHSAE9zGyC/5UhgepceVl2WeKv/N1Wq/nwa2GvBIefK+J6VvWmnSopf24nbj0wJvWVSwqdWHgSIIB3Yaap4keQYOpIuYIgDxrYWct4xSKiduDCyu3bZfWDgPNziegw+JiySy5m7HElCKVNcrxwsB2Iek= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from MW4PR01MB6228.prod.exchangelabs.com (2603:10b6:303:76::7) by PH7PR01MB7871.prod.exchangelabs.com (2603:10b6:510:1de::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.7; Thu, 31 Oct 2024 21:35:24 +0000 Received: from MW4PR01MB6228.prod.exchangelabs.com ([fe80::13ba:df5b:8558:8bba]) by MW4PR01MB6228.prod.exchangelabs.com ([fe80::13ba:df5b:8558:8bba%3]) with mapi id 15.20.8137.008; Thu, 31 Oct 2024 21:35:21 +0000 From: Ilkka Koskinen To: John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , "Liang, Kan" , Graham Woodward Cc: Ilkka Koskinen , linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] perf arm-spe: Add support for SPE Data Source packet on AmpereOne Date: Thu, 31 Oct 2024 21:35:33 +0000 Message-ID: <20241031213533.11148-3-ilkka@os.amperecomputing.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241031213533.11148-1-ilkka@os.amperecomputing.com> References: <20241031213533.11148-1-ilkka@os.amperecomputing.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: CH5P222CA0013.NAMP222.PROD.OUTLOOK.COM (2603:10b6:610:1ee::14) To MW4PR01MB6228.prod.exchangelabs.com (2603:10b6:303:76::7) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW4PR01MB6228:EE_|PH7PR01MB7871:EE_ X-MS-Office365-Filtering-Correlation-Id: efe4b449-e20b-41ec-c074-08dcf9f3ec1a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|52116014|7416014|1800799024|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?jtTDmf6299F/q9xikAip3HnVb8EAKm08OiruNzWoj5U8o/jiwOoh6JfqCrSg?= =?us-ascii?Q?0JPJNgMXwVuWb2BYilmGVwUmAV9Wxmu4TxzCHeuf6Vj89S42pTcoqoBMq7Ki?= =?us-ascii?Q?2lzCTenuaFRYv9LliE9hhIlSlhYPdxVS/qKpbQZ0VYmxQZAFChPoE3sZlHVa?= =?us-ascii?Q?PRAVVW1mh//wNxS/NIWazaC7jVb4Cdp8pBytHEj7QRJuwnW847yMBejgjVT/?= =?us-ascii?Q?drDqO90B3bJVPLpJEGf/Sq0LlLfOFh80UaEmzQVduY3lADlBVk6/QL/MbPG+?= =?us-ascii?Q?2uW3dywa1tADWUoALQbIbPyXzBzbmpyeKXfPPX7FVWuHScwIlZkw588iMacH?= =?us-ascii?Q?lznL6iL22ylmp4nzPOvZmxZLvhSkIbCQbb7qS5+Bsu06Zeuv5O72wC2u1vEG?= =?us-ascii?Q?ZePARe+x8WI2dE5K4N3U4WtIXLy/OZBQ+7i0DCttX5xXl/mf4YHJUQVdfuPH?= =?us-ascii?Q?ZliabKKFoZ4KFPN0W+QEX1ar+rfK1La2IvENfbHlwvBP+lEZKjEMyIgngurU?= =?us-ascii?Q?p7WvdzNfjsJBI1p0TBuA/Va8LP4gzgbhutqsLsHCYSigX0NekZzNYXNV3SS/?= =?us-ascii?Q?NbThRobJaE4bb07+uFaPxOW7rr2SFZ5qIluu2LTv2N8pFQL7jui8KUvZmKUC?= =?us-ascii?Q?0ih1pD6qQK93RJ0cAF4isiAzgti8v7+uczBxNdr5YqD2fwunR8rLxzWtLdsu?= =?us-ascii?Q?inpfJ2AiJJ0YYZCLaTumNvMDalMDGLvHM3vSl/w5kjK5RzXeDQxTmUD0TClR?= =?us-ascii?Q?NXhw8pa/PX2chkUUK/P2c51y1Vs3XaQHuWb60Hpz6dx1YTw9oxD265fRaIxU?= =?us-ascii?Q?98lK9H6HMGlqDcKchNTJCjHsp1IrDX6z6EqolqXMtAXXp0FroPen9j7WRsVs?= =?us-ascii?Q?AjEpD9Z8XBvNZJ/wa/jwYszGQ5uZl5l/H9vXVm8hZXN8orZW3s1YLjYlWVtg?= =?us-ascii?Q?yyo+hTAkyuNqbaARLcRpKTRiK0fUDr4/YSIT2CpfNABu1+npLBEROi3bVvP6?= =?us-ascii?Q?J9sl6ET64gR3Xsx42hNzUTpSIhyhhOQWyMhysgw9c1IOLZ65+6n9TKZAoJ6C?= =?us-ascii?Q?vRy4od8qxZ9fcx9bWEbUBVacyMbVkk4LW9SsNi1bqg11bAviAbMzDrx9ebVe?= =?us-ascii?Q?G2xDuGwoCGFq+Y6yeZcoYBqi8gibfSkTICsIBfNrGfZjrd3cC1eW7ok7qKDN?= =?us-ascii?Q?kTb1pIKpdbPq2yKxCAE2Y/HjClv9MPTs0stnNOuWQQYdUaINIboSEbWiqB+d?= =?us-ascii?Q?myFCVROGocJnjDDO6G566/N4Qhpd7rT6jGsNFcgNfDzNBs0SdxVjbEzl3TF+?= =?us-ascii?Q?nCXZe3YC3kOPDL6MZqgKuKwp1gmlPPoJA99egQgTYAo88USyN+XaPcO0IX1E?= =?us-ascii?Q?bHaBtlyYABKWlZyNQfHHqTO2/pfF?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW4PR01MB6228.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(52116014)(7416014)(1800799024)(921020)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?NSdyNIcHf73k4zoXPwnggE/bd7EsxVpep91U3KNHbQqL+uKo5YsZ/YZqNHK1?= =?us-ascii?Q?0OnnKu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937EDYNIt?= =?us-ascii?Q?HEB2Nv/o7Qs6BOpkKZMEyMgJod8Gh1R9FQcmgY+2Hug1NI40vhY6MX78f2pu?= =?us-ascii?Q?aTQa9BYW/FD7Z52ikxzww5chgTH7ycdf/CCaxkoIVRp0+Hx5yFyvfVbERO8r?= =?us-ascii?Q?tOn+UPTUNUAMgOatD7bV2Dm4JCLNKOI61viXGGXHK2n4qODzji8TGTyNMehs?= =?us-ascii?Q?cOe6iC/R5NQH+dlz4DiOWErlaitCDorwjPaadeqs+Vnn2n/gtwvySf5awpC5?= =?us-ascii?Q?naMpPl0crkoLCHEJWxRP1BKdt+1w8+Aw806HSlC7dMHmKtHfM36VNYGR9Vkq?= =?us-ascii?Q?W11gb5xLM8IDbsIlgnCE9IeChTCZZY0E6EsRYAZeich1VXfWsFfbR8Z96+ha?= =?us-ascii?Q?4fkyIpnX5rUVr39BlZTW1PNriR7XKwOziouhCFN/Hzpbe4vAaagwvZRYq/w+?= =?us-ascii?Q?SZ3HMhn09Rhk3pmWlTdG1DxzrfM+naqgbEJXQhyYI9F2SHMB+wq6lM3xekwR?= =?us-ascii?Q?ZjV6/g6t4NUaqmoDT67hxg+6SLsc8l48ZbVIdSYQulOv1Eiitvcd5IMjc9vO?= =?us-ascii?Q?DMAkFLpuGQbuSrY5A32Xq5V57MToBNQCVhoujbOLPb8IkFPFrmzQYc2+rGR6?= =?us-ascii?Q?0YI8SmUZlN+4AjahZAi8C5+prkXdsJldPGeJzP42CP2KxbgQh4dYDDzIuQ5F?= =?us-ascii?Q?hvOHqDWw0eMHiL3pBip8dQ8=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: efe4b449-e20b-41ec-c074-08dcf9f3ec1a X-MS-Exchange-CrossTenant-AuthSource: MW4PR01MB6228.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2024 21:35:21.4605 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: k3NSLxWXMFLtYsalpVv6y8dFJXOMMJA6R4YgQe3odnM5A2vBMWSC/Ql30d6NYU8BYVdvEUQR0qS1girSWivh1e3GtVdw9lpffPJJm4+So7B3qd2g4ME0PM7Z7oQwN/lq X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR01MB7871 Content-Type: text/plain; charset="utf-8" Decode SPE Data Source packets on AmpereOne. The field is IMPDEF. Signed-off-by: Ilkka Koskinen --- .../util/arm-spe-decoder/arm-spe-decoder.h | 9 +++ tools/perf/util/arm-spe.c | 65 +++++++++++++++++++ 2 files changed, 74 insertions(+) diff --git a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.h b/tools/perf= /util/arm-spe-decoder/arm-spe-decoder.h index 358c611eeddb..4bcd627e859f 100644 --- a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.h +++ b/tools/perf/util/arm-spe-decoder/arm-spe-decoder.h @@ -67,6 +67,15 @@ enum arm_spe_common_data_source { ARM_SPE_COMMON_DS_DRAM =3D 0xe, }; =20 +enum arm_spe_ampereone_data_source { + ARM_SPE_AMPEREONE_LOCAL_CHIP_CACHE_OR_DEVICE =3D 0x0, + ARM_SPE_AMPEREONE_SLC =3D 0x3, + ARM_SPE_AMPEREONE_REMOTE_CHIP_CACHE =3D 0x5, + ARM_SPE_AMPEREONE_DDR =3D 0x7, + ARM_SPE_AMPEREONE_L1D =3D 0x8, + ARM_SPE_AMPEREONE_L2D =3D 0x9, +}; + struct arm_spe_record { enum arm_spe_sample_type type; int err; diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c index 9586416be30a..700d4bc8d8ec 100644 --- a/tools/perf/util/arm-spe.c +++ b/tools/perf/util/arm-spe.c @@ -103,6 +103,30 @@ struct arm_spe_queue { u32 flags; }; =20 +struct arm_spe_source_mapping { + u16 source; + enum arm_spe_common_data_source common_src; +}; + +#define MAP_SOURCE(src, common) \ + { \ + .source =3D ARM_SPE_##src, \ + .common_src =3D ARM_SPE_COMMON_##common, \ + } + +static int arm_spe__map_to_common_source(u16 source, + struct arm_spe_source_mapping *tbl, + int nr_sources) +{ + while (nr_sources--) { + if (tbl->source =3D=3D source) + return tbl->common_src; + tbl++; + } + + return -1; +} + static void arm_spe_dump(struct arm_spe *spe __maybe_unused, unsigned char *buf, size_t len) { @@ -443,6 +467,11 @@ static const struct midr_range common_ds_encoding_cpus= [] =3D { {}, }; =20 +static const struct midr_range ampereone_ds_encoding_cpus[] =3D { + MIDR_ALL_VERSIONS(MIDR_AMPERE1A), + {}, +}; + static void arm_spe__sample_flags(struct arm_spe_queue *speq) { const struct arm_spe_record *record =3D &speq->decoder->record; @@ -532,6 +561,38 @@ static void arm_spe__synth_data_source_common(const st= ruct arm_spe_record *recor } } =20 +static struct arm_spe_source_mapping ampereone_sources[] =3D { + MAP_SOURCE(AMPEREONE_LOCAL_CHIP_CACHE_OR_DEVICE, DS_PEER_CORE), + MAP_SOURCE(AMPEREONE_SLC, DS_SYS_CACHE), + MAP_SOURCE(AMPEREONE_REMOTE_CHIP_CACHE, DS_REMOTE), + MAP_SOURCE(AMPEREONE_DDR, DS_DRAM), + MAP_SOURCE(AMPEREONE_L1D, DS_L1D), + MAP_SOURCE(AMPEREONE_L2D, DS_L2), +}; + +/* + * Source is IMPDEF. Here we convert the source code used on AmpereOne cor= es + * to the common (Neoverse, Cortex) to avoid duplicating the decoding code. + */ +static void arm_spe__synth_data_source_ampereone(const struct arm_spe_reco= rd *record, + union perf_mem_data_src *data_src) +{ + int common_src; + struct arm_spe_record common_record; + + common_src =3D arm_spe__map_to_common_source(record->source, + ampereone_sources, + ARRAY_SIZE(ampereone_sources)); + if (common_src < 0) + /* Assign a bogus value that's not used for common coding */ + common_record.source =3D 0xfff; + else + common_record.source =3D common_src; + + common_record.op =3D record->op; + arm_spe__synth_data_source_common(&common_record, data_src); +} + static void arm_spe__synth_memory_level(const struct arm_spe_record *recor= d, union perf_mem_data_src *data_src) { @@ -606,6 +667,8 @@ static u64 arm_spe__synth_data_source(struct arm_spe_qu= eue *speq, union perf_mem_data_src data_src =3D { .mem_op =3D PERF_MEM_OP_NA }; bool is_common =3D arm_spe__is_ds_encoding_supported(speq, common_ds_encoding_cpus); + bool is_ampereone =3D arm_spe__is_ds_encoding_supported(speq, + ampereone_ds_encoding_cpus); =20 if (record->op & ARM_SPE_OP_LD) data_src.mem_op =3D PERF_MEM_OP_LOAD; @@ -616,6 +679,8 @@ static u64 arm_spe__synth_data_source(struct arm_spe_qu= eue *speq, =20 if (is_common) arm_spe__synth_data_source_common(record, &data_src); + else if (is_ampereone) + arm_spe__synth_data_source_ampereone(record, &data_src); else arm_spe__synth_memory_level(record, &data_src); =20 --=20 2.47.0