From patchwork Fri Jan 27 20:59:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 49689 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1047742wrn; Fri, 27 Jan 2023 13:16:24 -0800 (PST) X-Google-Smtp-Source: AMrXdXuEqYvN380WRRRFhIfeUsVRZ9PgUmU41efpjCfInHR7rcWCasOzfarttjgbanTeUgXXMXAL X-Received: by 2002:a05:6a20:7a89:b0:a2:c45f:f0fc with SMTP id u9-20020a056a207a8900b000a2c45ff0fcmr43851378pzh.27.1674854183835; Fri, 27 Jan 2023 13:16:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674854183; cv=none; d=google.com; s=arc-20160816; b=YfpqdxBWgIbbYuNd/FSVsUplBHWA3qZlN1SH681wJjVzvgvPTf0Rmlgo9R5/5EN5BX nXhPPz1QD0vyy1sIY2l2sjZX/ntgEGFGFVcoH2cQtE3SPmdWrFK8BMRjbzOZ95fu3qNW SIlKtdO1zPjFy/RfPjdInUOX+9WfJbbhscTzm4jrsRT8o0+JXFFvL8a5m+nHCyhqr5ZD +1YEcxOBmLfq6V5GHigIPnzAdOgeHe+hWU8jTf+PGDKoTuqHNXTa+oHx50ZghBifciuW qUGL2Q8o3tb0w87E09mnz1iWTkd5Hdx8FXY8IfTC/f08ZmRIOooPFQqjt0AKFoIEzDqQ 18tQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=UgCIzyZ1uXoig+M3du7hOj+YSCBLDMUCra02vD8O8os=; b=pGkholUbOABEEzVuDhNHRzbY9iQ+gClZ7aSXRTaHrBBkwSdj3eFIHvAboD3P/8RSdm gBbQtFO1yCresbH3/QSXNzeaXpB4L/hIp8CeE/cPqr6OUIdMHMykL4dq4v14d/E7hDSg 5MKetnMd30nPmR9flqLqLL4cOiN0GrVYusl5HbR3/ms3ZgHxVe1viLnhXYK41zBTo4VN Ens6T61sGeuc6Q3MRuF0nZ35yDGmLeb2vBXi1lVISv8PW6slUA3GmUbIrJDIcrJsZldX zFTNNf1ew+yFv8GkQNudK9x2hNrdxJHB5cHNGnhTHpHiSkIJvJNOVbnvWUVnlvQtw3d1 x4fQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j2-20020a056a00130200b0058b3a0a8308si5456318pfu.60.2023.01.27.13.16.11; Fri, 27 Jan 2023 13:16:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231809AbjA0VAA (ORCPT + 99 others); Fri, 27 Jan 2023 16:00:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229933AbjA0U77 (ORCPT ); Fri, 27 Jan 2023 15:59:59 -0500 Received: from mail-oa1-f47.google.com (mail-oa1-f47.google.com [209.85.160.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1212078AC7; Fri, 27 Jan 2023 12:59:58 -0800 (PST) Received: by mail-oa1-f47.google.com with SMTP id 586e51a60fabf-15085b8a2f7so8143232fac.2; Fri, 27 Jan 2023 12:59:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=UgCIzyZ1uXoig+M3du7hOj+YSCBLDMUCra02vD8O8os=; b=BHtDZ/DddZTTKlp2i3zDeFyrJXEfigDbsrSLvL+cEwjBBBEfjwNag256Mkl8l0MO/4 4OPiAUP3g1guKWzQmnCYFQzQM6kzl89NZJ3+QtfI0tR+QPjXz09v88tICLOeYmTUFhgp Zce2XkDjHRWAnCTbL3j4Uwv6LWkQHrOqgWnZwLDwJ5BaVVcld9B09FPDqDtAdE9w/wFR 2VE6GoM6ibZcGZJNl5/0S9rkoMmhrSB3AvrXpETkKDkm34U2RILUpk341XzwsLubXPc5 S1RNre2wibQvt+tFprqhv3HIxFVEGnAqLyUsjv4245Wbx4q/8cbh8b62qTcbTIC8cUY4 DypQ== X-Gm-Message-State: AO0yUKVjC6xMihqLYxJr444qRHPn1VPGzJOu9qDUHAj3x3jDhb6BJ0h9 8V0rOkYdYixfHghPt2rqSg== X-Received: by 2002:a05:6870:3312:b0:163:4aa1:a92a with SMTP id x18-20020a056870331200b001634aa1a92amr4569506oae.10.1674853197128; Fri, 27 Jan 2023 12:59:57 -0800 (PST) Received: from robh_at_kernel.org (66-90-144-107.dyn.grandenetworks.net. [66.90.144.107]) by smtp.gmail.com with ESMTPSA id p1-20020a4aa241000000b004fde329b944sm2082031ool.28.2023.01.27.12.59.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Jan 2023 12:59:56 -0800 (PST) Received: (nullmailer pid 673390 invoked by uid 1000); Fri, 27 Jan 2023 20:59:56 -0000 From: Rob Herring To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim Cc: James Clark , Will Deacon , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] perf arm-spe: Add raw decoding for SPEv1.2 previous branch address Date: Fri, 27 Jan 2023 14:59:51 -0600 Message-Id: <20230127205951.673253-1-robh@kernel.org> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756211900606593774?= X-GMAIL-MSGID: =?utf-8?q?1756211900606593774?= Arm SPEv1.2 adds a new optional address packet type: previous branch target. The recorded address is the target virtual address of the most recently taken branch in program order. Add support for decoding the address packet in raw dumps. Signed-off-by: Rob Herring Reviewed-by: Leo Yan --- tools/perf/util/arm-spe-decoder/arm-spe-pkt-decoder.c | 4 +++- tools/perf/util/arm-spe-decoder/arm-spe-pkt-decoder.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/arm-spe-decoder/arm-spe-pkt-decoder.c b/tools/perf/util/arm-spe-decoder/arm-spe-pkt-decoder.c index 2f311189c6e8..e92e1a7c8a8e 100644 --- a/tools/perf/util/arm-spe-decoder/arm-spe-pkt-decoder.c +++ b/tools/perf/util/arm-spe-decoder/arm-spe-pkt-decoder.c @@ -422,16 +422,18 @@ static int arm_spe_pkt_desc_addr(const struct arm_spe_pkt *packet, int ch, pat; u64 payload = packet->payload; int err = 0; + static const char *idx_name[] = {"PC", "TGT", "VA", "PA", "LBR" }; switch (idx) { case SPE_ADDR_PKT_HDR_INDEX_INS: case SPE_ADDR_PKT_HDR_INDEX_BRANCH: + case SPE_ADDR_PKT_HDR_INDEX_PREV_BRANCH: ns = !!SPE_ADDR_PKT_GET_NS(payload); el = SPE_ADDR_PKT_GET_EL(payload); payload = SPE_ADDR_PKT_ADDR_GET_BYTES_0_6(payload); arm_spe_pkt_out_string(&err, &buf, &buf_len, "%s 0x%llx el%d ns=%d", - (idx == 1) ? "TGT" : "PC", payload, el, ns); + idx_name[idx], payload, el, ns); break; case SPE_ADDR_PKT_HDR_INDEX_DATA_VIRT: arm_spe_pkt_out_string(&err, &buf, &buf_len, diff --git a/tools/perf/util/arm-spe-decoder/arm-spe-pkt-decoder.h b/tools/perf/util/arm-spe-decoder/arm-spe-pkt-decoder.h index 9b970e7bf1e2..f75ed3a8a050 100644 --- a/tools/perf/util/arm-spe-decoder/arm-spe-pkt-decoder.h +++ b/tools/perf/util/arm-spe-decoder/arm-spe-pkt-decoder.h @@ -65,6 +65,7 @@ struct arm_spe_pkt { #define SPE_ADDR_PKT_HDR_INDEX_BRANCH 0x1 #define SPE_ADDR_PKT_HDR_INDEX_DATA_VIRT 0x2 #define SPE_ADDR_PKT_HDR_INDEX_DATA_PHYS 0x3 +#define SPE_ADDR_PKT_HDR_INDEX_PREV_BRANCH 0x4 /* Address packet payload */ #define SPE_ADDR_PKT_ADDR_BYTE7_SHIFT 56