From patchwork Fri Nov 8 23:45:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13869135 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B471ED6409C for ; Sat, 9 Nov 2024 01:17:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:From:Subject:References:Mime-Version :Message-Id:In-Reply-To:Date:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cS5G5VCZ3sXNgWaNuZOlHfdddPs4YGFaSOkPcgDDIso=; b=Fds4fNGUyam8ne k7lLGqkOUK75HtF8tdKvA5BmEDwJIytU7WvoLpxlsHrO9w1eKgYxJRfdL31gCgh+CCkqvgsMUecZX NBoXQ0U2912K0OmU6JYOl8zdlnDWfJGHF6Ogi8EWj+zRFpnRzM+LJOU36qhnc2Hn0Oof9HPfcn9SP NIKcR8SwbNYiojHi4zCfhShR4/xVs1xAFKFAGZYPyHeNHW5AtHOwsWD0n5rl3hkTTIBDbflyoY2C/ y+1J1E96AmtLeyuDWF0hZZ1HGGiOC9Bu4fyJKtKDR8lBhK1I4PL1c9ISXpjHP659816NXACGQDyr0 2WG2EY2nkkHROroIcWOw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t9a60-0000000CQ78-10Ny; Sat, 09 Nov 2024 01:17:00 +0000 Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t9YgS-0000000CF76-0z1X for linux-riscv@lists.infradead.org; Fri, 08 Nov 2024 23:46:35 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-6e38fabff35so572477b3.0 for ; Fri, 08 Nov 2024 15:46:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1731109591; x=1731714391; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=RQmCsVPRhYPEq2sxlk0awzxNmB9PlXvoAxqxELAu7Vo=; b=V5bbe7aTKsp2RSumq4+IJzjCjahvkpj90iTpjEkkhhktxGepoC8Cv3FsLKK9v8spUJ cjdsj9inlwknYSTKiTEvUclLgZhNyVPrRCBGufPufvewdMfbS+xsWsJ63kL+tvk5CFwa D9LYiF0Ru+p8STZlaA+c278BG2Ke9td72Dd1x68qqoItrAKIH5ibVzEjiRNAqHu8YnSS oJHhsxpCiQFh4IEUfsO0EMM/hQnyGt3IjY7irnP/e8jNNTGmH7QO/Gu5q+WYW1/a0Cb8 l10+bD0fc5HJKGb/cq6cHehDVf81HvDQuJDOvNl/4whTcmMOBggLYRQ4mw8EOWJZYve2 LDOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731109591; x=1731714391; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=RQmCsVPRhYPEq2sxlk0awzxNmB9PlXvoAxqxELAu7Vo=; b=hncSsRf8FmlR9ULk9aNLaybIkTxSTIyxSQRGh9eEG3sM3Jb1OAoVysMdVoyzy+wqIN SEXSW8PE4B/XkX0edgmJqWn0SbwEDJckwj7mkoWl5WZZN5K4hWiG7hkCBxz9gxGpvgiV cNcqje9tbSnET5Mn1EqyFxgNsxbya4Q5h3wq5LgFW3swfK+T5LF621pmS3ikOENkDfJp NCVEyOLPu8MnmlRhiLmLuMNKFfAlYBDpU8fGJzFpu7ziekktJUe110pjzmKA6dpFmJEM LBgYVQc7R3wTr3nm2jZDyrFgAv26K9YKI527M1RBTSPr7Lr0bk4NoZjDN2owdzug1ohq m5cA== X-Forwarded-Encrypted: i=1; AJvYcCWTZetzmg9rpLk/rSeToaXjDTMvJH8mYo6FkP4qaJk0EiRyHA4FF3Yheuaezy01Mjlu/6Js2XHDuGicLw==@lists.infradead.org X-Gm-Message-State: AOJu0Ywrt9v8OeGHOG8wgxD0BcCtXVPEhztPwIbQ83nPGaGRY08g3eFw /6n1XYLUjgpY8Lme7sCi7XLO5T2bKV+4DPjUEo1OMlV+J7rNuUW1IAb0vErnv8Ldoq3sChhm21x xYsuAaw== X-Google-Smtp-Source: AGHT+IFFASGHSVp8Ef02ZpRY4Z1jZ9cv/KNzpyrMsIaYpIQgk4O1dsJu+hlPKBzodupKX2SzhhfpeBrIwd7c X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:6fd2:1e36:6d8c:7c49]) (user=irogers job=sendgmr) by 2002:a0d:fd01:0:b0:6e3:6414:80c5 with SMTP id 00721157ae682-6eadda22e76mr315447b3.0.1731109591007; Fri, 08 Nov 2024 15:46:31 -0800 (PST) Date: Fri, 8 Nov 2024 15:45:54 -0800 In-Reply-To: <20241108234606.429459-1-irogers@google.com> Message-Id: <20241108234606.429459-10-irogers@google.com> Mime-Version: 1.0 References: <20241108234606.429459-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.277.g8800431eea-goog Subject: [PATCH v4 09/20] perf arm: Remove dwarf-regs.c From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241108_154632_308281_D39F651B X-CRM114-Status: GOOD ( 19.47 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org The file just provides the function get_arch_regstr, however, if in the only caller get_dwarf_regstr EM_HOST is used for the EM_NONE case the function can never be called. So remove as dead code. Tidy up the EM_NONE cases for arm in dwarf-regs.c. Reviewed-by: Masami Hiramatsu (Google) Signed-off-by: Ian Rogers --- tools/perf/arch/arm/util/Build | 2 - tools/perf/arch/arm/util/dwarf-regs.c | 61 --------------------------- tools/perf/util/dwarf-regs.c | 4 +- tools/perf/util/include/dwarf-regs.h | 2 +- 4 files changed, 3 insertions(+), 66 deletions(-) delete mode 100644 tools/perf/arch/arm/util/dwarf-regs.c diff --git a/tools/perf/arch/arm/util/Build b/tools/perf/arch/arm/util/Build index e06fea1ea8ff..f7a8b37d1c68 100644 --- a/tools/perf/arch/arm/util/Build +++ b/tools/perf/arch/arm/util/Build @@ -1,7 +1,5 @@ perf-util-y += perf_regs.o -perf-util-$(CONFIG_LIBDW) += dwarf-regs.o - perf-util-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind.o perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o diff --git a/tools/perf/arch/arm/util/dwarf-regs.c b/tools/perf/arch/arm/util/dwarf-regs.c deleted file mode 100644 index fc5f71c91802..000000000000 --- a/tools/perf/arch/arm/util/dwarf-regs.c +++ /dev/null @@ -1,61 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Mapping of DWARF debug register numbers into register names. - * - * Copyright (C) 2010 Will Deacon, ARM Ltd. - */ - -#include -#include -#include - -struct pt_regs_dwarfnum { - const char *name; - unsigned int dwarfnum; -}; - -#define REG_DWARFNUM_NAME(r, num) {.name = r, .dwarfnum = num} -#define GPR_DWARFNUM_NAME(num) \ - {.name = __stringify(%r##num), .dwarfnum = num} -#define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0} - -/* - * Reference: - * http://infocenter.arm.com/help/topic/com.arm.doc.ihi0040a/IHI0040A_aadwarf.pdf - */ -static const struct pt_regs_dwarfnum regdwarfnum_table[] = { - GPR_DWARFNUM_NAME(0), - GPR_DWARFNUM_NAME(1), - GPR_DWARFNUM_NAME(2), - GPR_DWARFNUM_NAME(3), - GPR_DWARFNUM_NAME(4), - GPR_DWARFNUM_NAME(5), - GPR_DWARFNUM_NAME(6), - GPR_DWARFNUM_NAME(7), - GPR_DWARFNUM_NAME(8), - GPR_DWARFNUM_NAME(9), - GPR_DWARFNUM_NAME(10), - REG_DWARFNUM_NAME("%fp", 11), - REG_DWARFNUM_NAME("%ip", 12), - REG_DWARFNUM_NAME("%sp", 13), - REG_DWARFNUM_NAME("%lr", 14), - REG_DWARFNUM_NAME("%pc", 15), - REG_DWARFNUM_END, -}; - -/** - * get_arch_regstr() - lookup register name from it's DWARF register number - * @n: the DWARF register number - * - * get_arch_regstr() returns the name of the register in struct - * regdwarfnum_table from it's DWARF register number. If the register is not - * found in the table, this returns NULL; - */ -const char *get_arch_regstr(unsigned int n) -{ - const struct pt_regs_dwarfnum *roff; - for (roff = regdwarfnum_table; roff->name != NULL; roff++) - if (roff->dwarfnum == n) - return roff->name; - return NULL; -} diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c index 18e916c8e993..fd21f9e90e40 100644 --- a/tools/perf/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs.c @@ -32,14 +32,14 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigned int flags __maybe_unused) { -#if EM_HOST == EM_X86_64 || EM_HOST == EM_386 || EM_HOST == EM_AARCH64 +#if EM_HOST == EM_X86_64 || EM_HOST == EM_386 || EM_HOST == EM_AARCH64 || EM_HOST == EM_ARM if (machine == EM_NONE) { /* Generic arch - use host arch */ machine = EM_HOST; } #endif switch (machine) { -#if EM_HOST != EM_X86_64 && EM_HOST != EM_386 && EM_HOST != EM_AARCH64 +#if EM_HOST != EM_X86_64 && EM_HOST != EM_386 && EM_HOST != EM_AARCH64 && EM_HOST != EM_ARM case EM_NONE: /* Generic arch - use host arch */ return get_arch_regstr(n); #endif diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include/dwarf-regs.h index f976528fdfd6..3652f9d98fe4 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -89,7 +89,7 @@ #define DWARF_REG_FB 0xd3affb /* random number */ #ifdef HAVE_LIBDW_SUPPORT -#if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) +#if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) && !defined(__arm__) const char *get_arch_regstr(unsigned int n); #endif