Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp120023iob; Tue, 17 May 2022 20:53:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqlyN+x/n2+ePuIxzbNsjjk7luc2TIMjrm4KeGvXiuy3YrpVHbXxW7GPHpj2qlTzq6Xxks X-Received: by 2002:a17:903:2310:b0:15e:bc9c:18b9 with SMTP id d16-20020a170903231000b0015ebc9c18b9mr26248107plh.58.1652846000338; Tue, 17 May 2022 20:53:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652846000; cv=none; d=google.com; s=arc-20160816; b=yEbFlujHIgXWvCiZHIkrdoFw3Ur+22nIRV8vOfsgEoDSfO9RCLNEzIuSQRYiEFUP/p uCCGQzrZmIp/NSsyNkKQ4IuAZ6qDSrm9L6bwSSesueh1pk5YNfl7wUxLJJPjLmPRgOYl vdXTXmbjaWqTMZ7fesR1XHkX3AVcm3ICAuNLVL+WuYyXrEymvop7x/+FYItNOXAdEXXQ oTuIlNYgPKxSaQ1ZxpUK7i+AydgvUONiDaaVUymkwmMM6iqbmMzuRXtEu+bo0YQwLkPL jBgvdYO4+vZg16HB+v9zeC1DZPfvX78MWuIkAVpM1sTzcO/A7W7gmZXfdWe2hsp+NgO9 hoIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=RFYfCbFwVsr6/GMZL4uVfueY8+AtiRleuMnlsWYlw/w=; b=btVKozdnpHCuTCP6VKel1Q7aVO//atQ/8h0HtX5c6VJy+09YmtBzq1a1AXftNtgaf7 ITZeyfiKAhWWwJdfPSlTPfh0UN3sRAMTlbqs9tNqyvvmPya/k+aR4WTu8sb83e0drFad e1luyBOCaM2loVVM3qdYoJylZctFuYn5CP2kTJyhV+klR8sp82xpjUBiOWwEtKEju8Ib 3Y9/Qg0EIDFaN02ObAKV8zozAPYotMppAxz4qYDzru8//6cnssDHRMcdNoxRV3fhZbhS 1ec+blK2vRQdy9bEmJO4INk9M9DWIWBhlkAspVSlSOmWUBVLMHofauoMUrvRh6/RcfcI 2ucw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id c11-20020a63350b000000b003aae4f1097asi1087073pga.559.2022.05.17.20.53.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 20:53:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 95EA3939D1; Tue, 17 May 2022 20:34:29 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343517AbiEQKWo (ORCPT + 99 others); Tue, 17 May 2022 06:22:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344829AbiEQKV7 (ORCPT ); Tue, 17 May 2022 06:21:59 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4FFBA4BFEC; Tue, 17 May 2022 03:20:26 -0700 (PDT) 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 178601063; Tue, 17 May 2022 03:20:26 -0700 (PDT) Received: from e121896.warwick.arm.com (e121896.warwick.arm.com [10.32.33.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id A01C93F66F; Tue, 17 May 2022 03:20:23 -0700 (PDT) From: James Clark To: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, broonie@kernel.org, acme@kernel.org Cc: german.gomez@arm.com, leo.yan@linaro.org, mathieu.poirier@linaro.org, john.garry@huawei.com, James Clark , Will Deacon , Mike Leach , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 3/4] perf tools: arm64: Decouple Libunwind register names from Perf Date: Tue, 17 May 2022 11:20:04 +0100 Message-Id: <20220517102005.3022017-4-james.clark@arm.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20220517102005.3022017-1-james.clark@arm.com> References: <20220517102005.3022017-1-james.clark@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dwarf register numbers and real register numbers on aarch64 are equivalent. Remove the references to the register names from Libunwind so that new registers are supported without having to add build time feature checks for each new register. The unwinder won't ask for a register that it doesn't know about and Perf will already report an error for an unknown or unrecorded register in the perf_reg_value() function so extra validation isn't needed. After this change the new VG register can be read by libunwind. Signed-off-by: James Clark --- tools/perf/arch/arm64/util/unwind-libunwind.c | 73 +------------------ 1 file changed, 2 insertions(+), 71 deletions(-) diff --git a/tools/perf/arch/arm64/util/unwind-libunwind.c b/tools/perf/arch/arm64/util/unwind-libunwind.c index 5aecf88e3de6..871af5992298 100644 --- a/tools/perf/arch/arm64/util/unwind-libunwind.c +++ b/tools/perf/arch/arm64/util/unwind-libunwind.c @@ -10,77 +10,8 @@ int LIBUNWIND__ARCH_REG_ID(int regnum) { - switch (regnum) { - case UNW_AARCH64_X0: - return PERF_REG_ARM64_X0; - case UNW_AARCH64_X1: - return PERF_REG_ARM64_X1; - case UNW_AARCH64_X2: - return PERF_REG_ARM64_X2; - case UNW_AARCH64_X3: - return PERF_REG_ARM64_X3; - case UNW_AARCH64_X4: - return PERF_REG_ARM64_X4; - case UNW_AARCH64_X5: - return PERF_REG_ARM64_X5; - case UNW_AARCH64_X6: - return PERF_REG_ARM64_X6; - case UNW_AARCH64_X7: - return PERF_REG_ARM64_X7; - case UNW_AARCH64_X8: - return PERF_REG_ARM64_X8; - case UNW_AARCH64_X9: - return PERF_REG_ARM64_X9; - case UNW_AARCH64_X10: - return PERF_REG_ARM64_X10; - case UNW_AARCH64_X11: - return PERF_REG_ARM64_X11; - case UNW_AARCH64_X12: - return PERF_REG_ARM64_X12; - case UNW_AARCH64_X13: - return PERF_REG_ARM64_X13; - case UNW_AARCH64_X14: - return PERF_REG_ARM64_X14; - case UNW_AARCH64_X15: - return PERF_REG_ARM64_X15; - case UNW_AARCH64_X16: - return PERF_REG_ARM64_X16; - case UNW_AARCH64_X17: - return PERF_REG_ARM64_X17; - case UNW_AARCH64_X18: - return PERF_REG_ARM64_X18; - case UNW_AARCH64_X19: - return PERF_REG_ARM64_X19; - case UNW_AARCH64_X20: - return PERF_REG_ARM64_X20; - case UNW_AARCH64_X21: - return PERF_REG_ARM64_X21; - case UNW_AARCH64_X22: - return PERF_REG_ARM64_X22; - case UNW_AARCH64_X23: - return PERF_REG_ARM64_X23; - case UNW_AARCH64_X24: - return PERF_REG_ARM64_X24; - case UNW_AARCH64_X25: - return PERF_REG_ARM64_X25; - case UNW_AARCH64_X26: - return PERF_REG_ARM64_X26; - case UNW_AARCH64_X27: - return PERF_REG_ARM64_X27; - case UNW_AARCH64_X28: - return PERF_REG_ARM64_X28; - case UNW_AARCH64_X29: - return PERF_REG_ARM64_X29; - case UNW_AARCH64_X30: - return PERF_REG_ARM64_LR; - case UNW_AARCH64_SP: - return PERF_REG_ARM64_SP; - case UNW_AARCH64_PC: - return PERF_REG_ARM64_PC; - default: - pr_err("unwind: invalid reg id %d\n", regnum); + if (regnum < 0 || regnum >= PERF_REG_ARM64_EXTENDED_MAX) return -EINVAL; - } - return -EINVAL; + return regnum; } -- 2.28.0