Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp150634pxb; Tue, 10 Nov 2020 23:23:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJxKNqzS1pVr4GG49YOkLeRajcDphErsvIeetJ5Wn8iESUptnjUQIY9Wes90HYZcYZ9uUXf+ X-Received: by 2002:a17:906:3a49:: with SMTP id a9mr24351356ejf.95.1605079436065; Tue, 10 Nov 2020 23:23:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605079436; cv=none; d=google.com; s=arc-20160816; b=vCosaXElJlFgIWOq/keU3N/fslKr2bkPOv+u0M0/be4BVKmpTD41fqQlrVjLotzSA4 AGRBuHOi2MeaC0GnJhXz6rNWqjMOdLzjiLKEtJhzBA1Vk34npHKAGXmLh8//s/6W1Dzd okIeYb0hV6twh/dzyYdAInwsj8WI+BRZqNP0K2CmIJnzdm1iXvZOZpZXi92WIEHssTk0 2079btZ3ONDCroTQOfnSXsF4JovOD9arD3b1lRtYB9DEEiHlhppQu8PFyeFMmV9ytzQN i/UJfR1Rl06w4LgXk7dWrUfOWmisMoZFB1UQIcpRBbJ+46huqbkz18PJZzz8rX28ib0g y8Og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=rUdWJBpVQKDUuBKsRdoQ/VtGJb0BHoKqXFn1e9x1cfY=; b=t+YKaXDdm/IKGTosrSyb8ODZBTmiQa4DeUIcAGwjeixIjIfQVr7NpL/jzwDX9ddOHA STMOhqWOOcjjaX8OQe3cVg6EvNaojHJaAxq186mLGM/13rhSr0PiPo38EG7JOcdEE5Jx Uk7EUbggH+Ahrfo0jHtJ1HIrptHukSA0GO4JbcREzb9wiQ9z+qFir9Z3bbynGgyNQ81d m+2+lkCHb7AKFouC+jtVJBSFIY39XsQVcxn1dHS7Ys5K+EQnC8xI9gc8M/PJ1N0UjP4p 6FljN2NF+TCMaviBLRKTQ+HRo8m+1s+ImrQm2//nIfISsJUUo0Ne/oLDZpvN4GLgKQW7 csng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=C5mWccxY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bi24si943491edb.452.2020.11.10.23.23.32; Tue, 10 Nov 2020 23:23:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=C5mWccxY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726571AbgKKHVL (ORCPT + 99 others); Wed, 11 Nov 2020 02:21:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726308AbgKKHOJ (ORCPT ); Wed, 11 Nov 2020 02:14:09 -0500 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD93DC061A48 for ; Tue, 10 Nov 2020 23:13:16 -0800 (PST) Received: by mail-pl1-x635.google.com with SMTP id w11so507146pll.8 for ; Tue, 10 Nov 2020 23:13:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rUdWJBpVQKDUuBKsRdoQ/VtGJb0BHoKqXFn1e9x1cfY=; b=C5mWccxYhCK5fJ3TQwrTcbmDom7OuRF51wTOVIkYv4nv6S0duM2IB3MMpqCxffCdKY 9Qeha07SYUGOL/iFG+vwx78r5aIXD5G379ZkhFv55K7Iu1vvILg6S8BTMQ+Ffr+y+6rg eveSnxjEbmuB21cPUznBdvfF0diW2i+2VQeOQyui63q6YHFHx8CDUVCAaL+zXV31xZ0p x/+LNQvgIFHh8CkAw0xcAkC28IqHvQyJjTUpHsR+WaRGb0tPjbMwKyHzIL+iP08iWtK0 QNaz/CcB+5Ro5vM6CkX1aPUhg6L/dotADs1LRJr8I3Ysovpck5VVJcLd+cZAoVQxoLsz CSwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=rUdWJBpVQKDUuBKsRdoQ/VtGJb0BHoKqXFn1e9x1cfY=; b=IF29zeX4EIrzVDqLaMy6fGczv76vkeLBjRJBQrz/6Yelvz2iZmyLthvGqQhFb9bwxU fUMzHRdICV1NtM8OwqtG+0o5IusGV3nMaVuVUCsbghGwTh8QA58W/J30NPQQ6NffjdWe 8pwROm4RgkDUzh4LDjF3bPVvLGgNv+72KWzcPUXHWLKhpKIorm5/EsMWsHX6pEF76qQw sv3qsvQfihmvN5TwEzHsh9Zkf9y5pwvPRZC9R1KRP/9krY0/6S6XxAJynFxXMb05cukw MpyhTkyot+md0rFD6sqyoirvnaOnPJI+CJ3EKpr9NZcrXC4Qi4eUD88y9Rm5WcKePfvL jOww== X-Gm-Message-State: AOAM532duAtxNEFueZ3vBmFn8NS7XX/5cY29rVn11zQQL1SbFzCU6c2Z 0X1knRLNkkzXz70LkDdu3KGdxg== X-Received: by 2002:a17:902:864c:b029:d8:b3b1:b91c with SMTP id y12-20020a170902864cb02900d8b3b1b91cmr3862405plt.79.1605078796252; Tue, 10 Nov 2020 23:13:16 -0800 (PST) Received: from localhost ([45.137.216.7]) by smtp.gmail.com with ESMTPSA id fh22sm1265474pjb.45.2020.11.10.23.13.15 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Nov 2020 23:13:15 -0800 (PST) From: Leo Yan To: Arnaldo Carvalho de Melo , Andre Przywara , Dave Martin , James Clark , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Al Grant , Wei Li , John Garry , Will Deacon , Mathieu Poirier , linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [PATCH v8 15/22] perf arm-spe: Add new function arm_spe_pkt_desc_event() Date: Wed, 11 Nov 2020 15:11:42 +0800 Message-Id: <20201111071149.815-16-leo.yan@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201111071149.815-1-leo.yan@linaro.org> References: <20201111071149.815-1-leo.yan@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch moves out the event packet parsing from arm_spe_pkt_desc() to the new function arm_spe_pkt_desc_event(). Signed-off-by: Leo Yan Reviewed-by: Andre Przywara --- .../arm-spe-decoder/arm-spe-pkt-decoder.c | 63 +++++++++++-------- 1 file changed, 37 insertions(+), 26 deletions(-) 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 5178bbe64422..af87d3c8cb50 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 @@ -287,6 +287,42 @@ static int arm_spe_pkt_snprintf(int *err, char **buf_p, size_t *blen, return ret; } +static int arm_spe_pkt_desc_event(const struct arm_spe_pkt *packet, + char *buf, size_t buf_len) +{ + u64 payload = packet->payload; + int err = 0; + + arm_spe_pkt_snprintf(&err, &buf, &buf_len, "EV"); + + if (payload & 0x1) + arm_spe_pkt_snprintf(&err, &buf, &buf_len, " EXCEPTION-GEN"); + if (payload & 0x2) + arm_spe_pkt_snprintf(&err, &buf, &buf_len, " RETIRED"); + if (payload & 0x4) + arm_spe_pkt_snprintf(&err, &buf, &buf_len, " L1D-ACCESS"); + if (payload & 0x8) + arm_spe_pkt_snprintf(&err, &buf, &buf_len, " L1D-REFILL"); + if (payload & 0x10) + arm_spe_pkt_snprintf(&err, &buf, &buf_len, " TLB-ACCESS"); + if (payload & 0x20) + arm_spe_pkt_snprintf(&err, &buf, &buf_len, " TLB-REFILL"); + if (payload & 0x40) + arm_spe_pkt_snprintf(&err, &buf, &buf_len, " NOT-TAKEN"); + if (payload & 0x80) + arm_spe_pkt_snprintf(&err, &buf, &buf_len, " MISPRED"); + if (packet->index > 1) { + if (payload & 0x100) + arm_spe_pkt_snprintf(&err, &buf, &buf_len, " LLC-ACCESS"); + if (payload & 0x200) + arm_spe_pkt_snprintf(&err, &buf, &buf_len, " LLC-REFILL"); + if (payload & 0x400) + arm_spe_pkt_snprintf(&err, &buf, &buf_len, " REMOTE-ACCESS"); + } + + return err; +} + static int arm_spe_pkt_desc_addr(const struct arm_spe_pkt *packet, char *buf, size_t buf_len) { @@ -367,32 +403,7 @@ int arm_spe_pkt_desc(const struct arm_spe_pkt *packet, char *buf, arm_spe_pkt_snprintf(&err, &buf, &blen, "%s", name); break; case ARM_SPE_EVENTS: - arm_spe_pkt_snprintf(&err, &buf, &blen, "EV"); - - if (payload & 0x1) - arm_spe_pkt_snprintf(&err, &buf, &blen, " EXCEPTION-GEN"); - if (payload & 0x2) - arm_spe_pkt_snprintf(&err, &buf, &blen, " RETIRED"); - if (payload & 0x4) - arm_spe_pkt_snprintf(&err, &buf, &blen, " L1D-ACCESS"); - if (payload & 0x8) - arm_spe_pkt_snprintf(&err, &buf, &blen, " L1D-REFILL"); - if (payload & 0x10) - arm_spe_pkt_snprintf(&err, &buf, &blen, " TLB-ACCESS"); - if (payload & 0x20) - arm_spe_pkt_snprintf(&err, &buf, &blen, " TLB-REFILL"); - if (payload & 0x40) - arm_spe_pkt_snprintf(&err, &buf, &blen, " NOT-TAKEN"); - if (payload & 0x80) - arm_spe_pkt_snprintf(&err, &buf, &blen, " MISPRED"); - if (idx > 1) { - if (payload & 0x100) - arm_spe_pkt_snprintf(&err, &buf, &blen, " LLC-ACCESS"); - if (payload & 0x200) - arm_spe_pkt_snprintf(&err, &buf, &blen, " LLC-REFILL"); - if (payload & 0x400) - arm_spe_pkt_snprintf(&err, &buf, &blen, " REMOTE-ACCESS"); - } + err = arm_spe_pkt_desc_event(packet, buf, buf_len); break; case ARM_SPE_OP_TYPE: switch (idx) { -- 2.17.1