From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F39CBC63697 for ; Thu, 19 Nov 2020 15:29:28 +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 77D0424695 for ; Thu, 19 Nov 2020 15:29:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="3bCWCbhu"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="fEp1h3ga" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 77D0424695 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.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=xeHVGTHGzko/mV/MmDA+aGbBFA3TLpGGY0KkaQVCtRE=; b=3bCWCbhuc8Ee847aQgP5bYPr9X bynM4K4oTlStdJM4ty+UScrpbvs/5FLe6HPvB++deWogrAtVNM9UKNPAscsMPmJ2WgCOVXRoqbreg 9G+UEQvSnycVN0ojuf/ioPdFPPTI+XkDPScrq/zl0cjkaLVfg0aaiiebGnWnAdjVqQ+AY1Qmlf035 VGDJmEJcyi/ovN8bck+xA6/Cjpd5CxMN1/Iczf2lDoRWszGd8J0SLYKYc7gypzdZhuALQgS1DFq97 PPQ4XJUxmh2O7+r1lLkG0ztXX2fJ5iI9zdLtZTNB4XzhudH+Pa6KIV9NxfPca0D5+ijXzAgkRsFpb 4tk4oC+A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kflqc-00052U-Ed; Thu, 19 Nov 2020 15:27:46 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kfloD-0004CI-MD for linux-arm-kernel@lists.infradead.org; Thu, 19 Nov 2020 15:25:25 +0000 Received: by mail-pf1-x442.google.com with SMTP id 131so4799648pfb.9 for ; Thu, 19 Nov 2020 07:25:14 -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=MKtpSb7ggyuP00IKgz0kuA1rF3BXU0c9G0aSMbhomVk=; b=fEp1h3gaPJR7nar5j3PpHMBX1/sb/5qDsYvwvh+fnmsEHgN+7jQfX/8/sBrYEIefTr Ti9Muj+F3fo24KF38/JAKMHclZg0rEDjnrj9NfXDqXI0GY9fo9lhr/q2mtTAnZn0kb9Z JPUvdun8B4z/h6mRPPuEZtShmzlZQjF1yYpr541waGHTxNcraNvdnlX4T6N6p2+32zuR paajmVvAFrMl2RA2cC7UMhGc82AaA1LUtSqGfwn+84s7qwCji6xS8e6qbV/ESVV3Jmie 8kzmyvNTD/8tcLiYE/R4h9eV9wUqdyutzXjBmb4ypgYe8rPDNxxXoMfLPUWjT5yG5LV2 OEZg== 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=MKtpSb7ggyuP00IKgz0kuA1rF3BXU0c9G0aSMbhomVk=; b=hdCQvTmsdcBxZm4NNNA1AS+2lhlvDl5nmFhOAiS/kk1o2K8/qXEpfTjw/hLWmlLVQi mz1mLwoyXq7N+R0vlWyjHFDfhpmbJOEG0/DdpsmPIimbWKTGHTBsR9hhqIQZOs8F+Oli LMeLQWV8+jBCYEBsZ8PVtGZeZhvncaJhuzLAXMVEUMJP/FxMif7vRYX5Zu+Zar3DHury bdVSUUtoQOZRE6SJmTOp942NY6vVznOqeOD2/fTTHeHzJPDWCcbckG0VfHFyblsLtpMk 4cYPh9tStxcEwVE73glwcyEZTtSl/V+1HmIQ6wd6Bmf/kjb7fOXPWP3IR3EfL24rkM1c yNZA== X-Gm-Message-State: AOAM531mBqfU6gjbdA5GkyNRY0Em0BFTyymlr+dG7KXi9wnPp6E8GYGR IrttqPh82UgqW3itj7Qxy7p12g== X-Google-Smtp-Source: ABdhPJwXpJHgQD4X1NWIfilkx+2/X6lgps059GVgTh+xrVOrzcvIUOpOdb5V+AGgzKGpFntsxVBkdg== X-Received: by 2002:a17:90a:e2cd:: with SMTP id fr13mr4961633pjb.97.1605799512958; Thu, 19 Nov 2020 07:25:12 -0800 (PST) Received: from localhost ([45.137.216.7]) by smtp.gmail.com with ESMTPSA id d188sm122830pfd.86.2020.11.19.07.25.12 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Nov 2020 07:25:12 -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, linux-arm-kernel@lists.infradead.org Subject: [PATCH v9 05/16] perf arm_spe: Fixup top byte for data virtual address Date: Thu, 19 Nov 2020 23:24:30 +0800 Message-Id: <20201119152441.6972-6-leo.yan@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201119152441.6972-1-leo.yan@linaro.org> References: <20201119152441.6972-1-leo.yan@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201119_102517_808490_6E04C844 X-CRM114-Status: GOOD ( 19.07 ) 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: Leo Yan MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org To establish a valid address from the address packet payload and finally the address value can be used for parsing data symbol in DSO, current code uses 0xff to replace the tag in the top byte of data virtual address. So far the code only fixups top byte for the memory layouts with 4KB pages, it misses to support memory layouts with 64KB pages. This patch adds the conditions for checking bits [55:52] are 0xf, if detects the pattern it will fill 0xff into the top byte of the address, also adds comment to explain the fixing up. Signed-off-by: Leo Yan Reviewed-by: Andre Przywara --- .../util/arm-spe-decoder/arm-spe-decoder.c | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c b/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c index 776b3e6628bb..cac2ef79c025 100644 --- a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c +++ b/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c @@ -24,7 +24,7 @@ static u64 arm_spe_calc_ip(int index, u64 payload) { - u64 ns, el; + u64 ns, el, val; /* Instruction virtual address or Branch target address */ if (index == SPE_ADDR_PKT_HDR_INDEX_INS || @@ -45,8 +45,22 @@ static u64 arm_spe_calc_ip(int index, u64 payload) /* Clean tags */ payload = SPE_ADDR_PKT_ADDR_GET_BYTES_0_6(payload); - /* Fill highest byte if bits [48..55] is 0xff */ - if (SPE_ADDR_PKT_ADDR_GET_BYTE_6(payload) == 0xffULL) + /* + * Armv8 ARM (ARM DDI 0487F.c), chapter "D10.2.1 Address packet" + * defines the data virtual address payload format, the top byte + * (bits [63:56]) is assigned as top-byte tag; so we only can + * retrieve address value from bits [55:0]. + * + * According to Documentation/arm64/memory.rst, if detects the + * specific pattern in bits [55:52] of payload which falls in + * the kernel space, should fixup the top byte and this allows + * perf tool to parse DSO symbol for data address correctly. + * + * For this reason, if detects the bits [55:52] is 0xf, will + * fill 0xff into the top byte. + */ + val = SPE_ADDR_PKT_ADDR_GET_BYTE_6(payload); + if ((val & 0xf0ULL) == 0xf0ULL) payload |= 0xffULL << SPE_ADDR_PKT_ADDR_BYTE7_SHIFT; /* Data access physical address */ -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel