From patchwork Tue Sep 22 10:12:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 11792045 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1375B618 for ; Tue, 22 Sep 2020 10:13:23 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ADC02238D6 for ; Tue, 22 Sep 2020 10:13:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="AlF23vhG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ADC02238D6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=5SUlXHcUZ/gBRJ4hUvMeFz5jCnczAezU8P6nm2sNfxM=; b=AlF23vhGSRGmZvoNZeEagB6M4T YTdDkXp1iYP8WAXMsvB2PaB2K50tRmUYRCkf3XXrk6ZhsW/vHF7f/om33M3pobazmdJxTCyZAP45/ jGY3WuV74XMUeA/6Uy1w3LtJ5pXfftphr/Yv4sl2QSESpCsAH97/e1gOqeRndatGT5nPIBUoq2X31 2T3Og3riTY6ZDoLDaVlK31L8pDv/hmzwSGZ+4q6afagYbxRB/6hPjmoZ0x5qbe3uY7zCxeMIYbLXU FnbW3fKmnBHtOSAd96eRKj+FQh19grKpQeSZni7ihKpMmKH2mAWzMuChAaDc4HAWDORtsm/Cwu0HW 9Ss16UjQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKfIF-0006Yr-F9; Tue, 22 Sep 2020 10:13:06 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKfHt-0006TT-6Q for linux-arm-kernel@lists.infradead.org; Tue, 22 Sep 2020 10:12:44 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BD700147A; Tue, 22 Sep 2020 03:12:40 -0700 (PDT) Received: from donnerap.arm.com (donnerap.cambridge.arm.com [10.1.195.35]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B88803F718; Tue, 22 Sep 2020 03:12:38 -0700 (PDT) From: Andre Przywara To: Will Deacon , Catalin Marinas , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo Subject: [PATCH 4/5] perf: arm_spe: Decode memory tagging properties Date: Tue, 22 Sep 2020 11:12:24 +0100 Message-Id: <20200922101225.183554-5-andre.przywara@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200922101225.183554-1-andre.przywara@arm.com> References: <20200922101225.183554-1-andre.przywara@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200922_061241_375847_EBEF5D95 X-CRM114-Status: GOOD ( 13.12 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [217.140.110.172 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Suzuki K Poulose , Alexander Shishkin , linux-kernel@vger.kernel.org, James Clark , Leo Yan , Namhyung Kim , Jiri Olsa , Tan Xiaojun , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org When SPE records a physical address, it can additionally tag the event with information from the Memory Tagging architecture extension. Decode the two additional fields in the SPE event payload. Signed-off-by: Andre Przywara Reviewed-by: Leo Yan --- .../util/arm-spe-decoder/arm-spe-pkt-decoder.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 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 943e4155b246..a033f34846a6 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 @@ -8,13 +8,14 @@ #include #include #include +#include #include "arm-spe-pkt-decoder.h" -#define BIT(n) (1ULL << (n)) - #define NS_FLAG BIT(63) #define EL_FLAG (BIT(62) | BIT(61)) +#define CH_FLAG BIT(62) +#define PAT_FLAG GENMASK_ULL(59, 56) #define SPE_HEADER0_PAD 0x0 #define SPE_HEADER0_END 0x1 @@ -447,10 +448,16 @@ int arm_spe_pkt_desc(const struct arm_spe_pkt *packet, char *buf, return snprintf(buf, buf_len, "%s 0x%llx el%d ns=%d", (idx == 1) ? "TGT" : "PC", payload, el, ns); case 2: return snprintf(buf, buf_len, "VA 0x%llx", payload); - case 3: ns = !!(packet->payload & NS_FLAG); + case 3: { + int ch = !!(packet->payload & CH_FLAG); + int pat = (packet->payload & PAT_FLAG) >> 56; + + ns = !!(packet->payload & NS_FLAG); payload &= ~(0xffULL << 56); - return snprintf(buf, buf_len, "PA 0x%llx ns=%d", - payload, ns); + return snprintf(buf, buf_len, + "PA 0x%llx ns=%d ch=%d, pat=%x", + payload, ns, ch, pat); + } default: return 0; } case ARM_SPE_CONTEXT: