Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp149220pxb; Tue, 10 Nov 2020 23:20:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJy3zyC0RXzHyo1PYUFti7+hRE0vQ4vqV8S56Ghxa5MktzwE/OLHH5vTTF8zZzwadygVb4Vb X-Received: by 2002:aa7:c30e:: with SMTP id l14mr1166672edq.315.1605079248979; Tue, 10 Nov 2020 23:20:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605079248; cv=none; d=google.com; s=arc-20160816; b=Uu9IDUqfgCkAkMU+5AznNHn5+qXpHoAQ6UPZoB/H7qa8EL+/O36MSE6dIk3U5nmMoq Z1LiJ4sXCJATHD6mvTXBWsEo4LT7ZGc3a0ho4GpUrJ6voF5Du4oA2EgwHvzyleKOwVI/ RYPGmRwl+35CqmMBHUR4UTScbspOW1jY4DEMQzZKJoM4s5hq5PDJeGSBV5SdwtQC2YI4 5G7+iRx1wIXxYnmwJPwYUSDXM2mlz658eJcQURIKAbanDZwv4DQfyGTkUBjIgGFOntza D9W/C6Hcs9/VYHly84OwBxBKkiMi1HaiWtBnZ0ghO5hKcTwvs7sUv3e+mAGHwiCrRa5u D+yQ== 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=tLdPHb7wur2peZls2EEptjsAU4VSJb+8v+Xv8vCbleY=; b=pif/aFzoTU0BEiqQ3nl87Mo0zASrR/u/4Grsz555Ws19PF/8CeWZZAN80gi6jg/Fvn Ods6XAhE6WINXtvdCARb3WID3thB8lmEmcUv23aINi8ZMSKoR9MpP/Cfif+szlrBqLKo zto6NupxBNqNAgkZ4u+z02x9Pf/psmmhKKs3YweApxccDBrMCbeUkvvloRpjtFMe9a5a /STCHUqko5AJbYUDB75MXq+PNfoH5duBknOspSUbiZzmNTvBPILQXlO7NVZV+yctUpWs QGbIcd3QZnKfrQ+BDGvNlCdaFUi/NPlSrMRhapbr8XZRVsdOpg8h90qIgfQqZ3zvfTyA 3q5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rg9jVqxi; 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 dc8si784361ejb.647.2020.11.10.23.20.25; Tue, 10 Nov 2020 23:20:48 -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=rg9jVqxi; 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 S1726365AbgKKHRk (ORCPT + 99 others); Wed, 11 Nov 2020 02:17:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725929AbgKKHPK (ORCPT ); Wed, 11 Nov 2020 02:15:10 -0500 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2BFAC061A4F for ; Tue, 10 Nov 2020 23:13:42 -0800 (PST) Received: by mail-pj1-x1033.google.com with SMTP id ei22so262084pjb.2 for ; Tue, 10 Nov 2020 23:13:42 -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=tLdPHb7wur2peZls2EEptjsAU4VSJb+8v+Xv8vCbleY=; b=rg9jVqxiNP9WLYstdMjM+YzDE3Z8f+mSBhEU312oBdbbJDE09/vaURNvJ+iUUqbQU9 j/8kxWX1wPLfF4ELyinENvlD6H7ZSW1Dd4JvYK/eJ1N5erGTkQkmjp1XcLC+6OtNwwLr +8p0f0cIbXlRCDsVFgWBr+/tsVhrjc6So87NJK65UlEWCp6Wb0IqcJEtWAc/e8Q8szO+ uSG3BOxBoEQl6p0kBsHTHMJQFjNLEovy0Febymiq29siThD7ZD0djJuPNJ6iZK6/am+u ZHQLYisMoC4Y5e7jQg1XWIy3Ofb8PdMEfE7QASHZ5Z7OdY2Xw9FJyM1W/tZKM8KWZ+7W PKEQ== 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=tLdPHb7wur2peZls2EEptjsAU4VSJb+8v+Xv8vCbleY=; b=oTyKXipjkXugsP58M9etRc9YngA/GrxxuL+NJHiIJURk0FRv2fzbdPx2gzJqzpxmuc O5jJSIXB3YDeNvYmhiwETDCR2Pt1c05SiY+SLyTGAtBYOLx76TvEnojiYNcUkwtk1pXQ ULRaZ2xy8d01AtmZDlFfjUmNPEXoQ9J19MHL5vNlxs7uAle8viIKiRjdaxfXm6fpRWQ4 Ku+eGLazDpSBG5Ikhc7KBGQNQdWum8I6XQNbar/JWgykcNmFBLST2x10yrRspVhJmC0I vK7d6BpUHGKJj+Tr8/6UIRj1sFybT9ZOWxUejZEL9mNhsZww/YUuDRPHRdHSZHXyEsEF thjg== X-Gm-Message-State: AOAM533cme21qnRDHw/fb4GZvmqqR4Z4Pp7g2h1fVMUlCLnvuhU2OlNH AwalSCs427/PTNl86WNldtufLw== X-Received: by 2002:a17:902:6b08:b029:d6:c471:8b5b with SMTP id o8-20020a1709026b08b02900d6c4718b5bmr20683231plk.78.1605078821981; Tue, 10 Nov 2020 23:13:41 -0800 (PST) Received: from localhost ([45.137.216.7]) by smtp.gmail.com with ESMTPSA id b142sm1306784pfb.186.2020.11.10.23.13.41 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Nov 2020 23:13:41 -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 22/22] perf arm-spe: Add support for ARMv8.3-SPE Date: Wed, 11 Nov 2020 15:11:49 +0800 Message-Id: <20201111071149.815-23-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 From: Wei Li This patch is to support Armv8.3 extension for SPE, it adds alignment field in the Events packet and it supports the Scalable Vector Extension (SVE) for Operation packet and Events packet with two additions: - The vector length for SVE operations in the Operation Type packet; - The incomplete predicate and empty predicate fields in the Events packet. Signed-off-by: Wei Li Signed-off-by: Leo Yan Reviewed-by: Andre Przywara --- .../arm-spe-decoder/arm-spe-pkt-decoder.c | 36 +++++++++++++++++-- .../arm-spe-decoder/arm-spe-pkt-decoder.h | 16 +++++++++ 2 files changed, 50 insertions(+), 2 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 cbbbbefdc52b..afb6d9fe9eae 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 @@ -317,6 +317,12 @@ static int arm_spe_pkt_desc_event(const struct arm_spe_pkt *packet, arm_spe_pkt_snprintf(&err, &buf, &buf_len, " LLC-REFILL"); if (payload & BIT(EV_REMOTE_ACCESS)) arm_spe_pkt_snprintf(&err, &buf, &buf_len, " REMOTE-ACCESS"); + if (payload & BIT(EV_ALIGNMENT)) + arm_spe_pkt_snprintf(&err, &buf, &buf_len, " ALIGNMENT"); + if (payload & BIT(EV_PARTIAL_PREDICATE)) + arm_spe_pkt_snprintf(&err, &buf, &buf_len, " SVE-PARTIAL-PRED"); + if (payload & BIT(EV_EMPTY_PREDICATE)) + arm_spe_pkt_snprintf(&err, &buf, &buf_len, " SVE-EMPTY-PRED"); return err; } @@ -329,8 +335,23 @@ static int arm_spe_pkt_desc_op_type(const struct arm_spe_pkt *packet, switch (packet->index) { case SPE_OP_PKT_HDR_CLASS_OTHER: - arm_spe_pkt_snprintf(&err, &buf, &buf_len, - payload & SPE_OP_PKT_COND ? "COND-SELECT" : "INSN-OTHER"); + if (SPE_OP_PKT_IS_OTHER_SVE_OP(payload)) { + arm_spe_pkt_snprintf(&err, &buf, &buf_len, "SVE-OTHER"); + + /* SVE effective vector length */ + arm_spe_pkt_snprintf(&err, &buf, &buf_len, " EVLEN %d", + SPE_OP_PKG_SVE_EVL(payload)); + + if (payload & SPE_OP_PKT_SVE_FP) + arm_spe_pkt_snprintf(&err, &buf, &buf_len, " FP"); + if (payload & SPE_OP_PKT_SVE_PRED) + arm_spe_pkt_snprintf(&err, &buf, &buf_len, " PRED"); + } else { + arm_spe_pkt_snprintf(&err, &buf, &buf_len, "OTHER"); + arm_spe_pkt_snprintf(&err, &buf, &buf_len, " %s", + payload & SPE_OP_PKT_COND ? + "COND-SELECT" : "INSN-OTHER"); + } break; case SPE_OP_PKT_HDR_CLASS_LD_ST_ATOMIC: arm_spe_pkt_snprintf(&err, &buf, &buf_len, @@ -361,6 +382,17 @@ static int arm_spe_pkt_desc_op_type(const struct arm_spe_pkt *packet, default: break; } + + if (SPE_OP_PKT_IS_LDST_SVE(payload)) { + /* SVE effective vector length */ + arm_spe_pkt_snprintf(&err, &buf, &buf_len, " EVLEN %d", + SPE_OP_PKG_SVE_EVL(payload)); + + if (payload & SPE_OP_PKT_SVE_PRED) + arm_spe_pkt_snprintf(&err, &buf, &buf_len, " PRED"); + if (payload & SPE_OP_PKT_SVE_SG) + arm_spe_pkt_snprintf(&err, &buf, &buf_len, " SG"); + } break; case SPE_OP_PKT_HDR_CLASS_BR_ERET: arm_spe_pkt_snprintf(&err, &buf, &buf_len, "B"); 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 1ad14885c2a1..9b970e7bf1e2 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 @@ -113,6 +113,8 @@ enum arm_spe_events { #define SPE_OP_PKT_HDR_CLASS_LD_ST_ATOMIC 0x1 #define SPE_OP_PKT_HDR_CLASS_BR_ERET 0x2 +#define SPE_OP_PKT_IS_OTHER_SVE_OP(v) (((v) & (BIT(7) | BIT(3) | BIT(0))) == 0x8) + #define SPE_OP_PKT_COND BIT(0) #define SPE_OP_PKT_LDST_SUBCLASS_GET(v) ((v) & GENMASK_ULL(7, 1)) @@ -128,6 +130,20 @@ enum arm_spe_events { #define SPE_OP_PKT_AT BIT(2) #define SPE_OP_PKT_ST BIT(0) +#define SPE_OP_PKT_IS_LDST_SVE(v) (((v) & (BIT(3) | BIT(1))) == 0x8) + +#define SPE_OP_PKT_SVE_SG BIT(7) +/* + * SVE effective vector length (EVL) is stored in byte 0 bits [6:4]; + * the length is rounded up to a power of two and use 32 as one step, + * so EVL calculation is: + * + * 32 * (2 ^ bits [6:4]) = 32 << (bits [6:4]) + */ +#define SPE_OP_PKG_SVE_EVL(v) (32 << (((v) & GENMASK_ULL(6, 4)) >> 4)) +#define SPE_OP_PKT_SVE_PRED BIT(2) +#define SPE_OP_PKT_SVE_FP BIT(1) + #define SPE_OP_PKT_IS_INDIRECT_BRANCH(v) (((v) & GENMASK_ULL(7, 1)) == 0x2) const char *arm_spe_pkt_name(enum arm_spe_pkt_type); -- 2.17.1