Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp1067709rdg; Fri, 11 Aug 2023 08:43:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFdEiKngqmaTdI9XvvPOj3av90Pop0VtJhRfDra8rLLQdrr1eZ5JN9FNE4OV0q5a3aCZBjS X-Received: by 2002:aa7:c382:0:b0:522:2f8c:8953 with SMTP id k2-20020aa7c382000000b005222f8c8953mr2373676edq.39.1691768634993; Fri, 11 Aug 2023 08:43:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691768634; cv=none; d=google.com; s=arc-20160816; b=E0DukcltkUHndKt9RCgVY5fZEkO+pM9usMymXrfi3eDmk4IFTHG8JFiTVKmFSUvifJ uInfz12ojtjsT4RMQPRmovesg2U7guozPBx2nkjgCzr/bAjfaOlK+k8L7YBzgoE7PLER YqUrFkelkOigFSSTXs/uIfmgWQtSMJ1GY3iSxOPkr0RxnF3gAoKbwcjpuRneLiMHEr92 tdK86u4bkc0P9MzTX7q8yFwzA4VFrTjcKn0kx7STRUmXmnBPFr7fs8kLEaeRZ4KaKiim 0kEDsTThgsOcbGpr0w/Z8a0Agdcf5m/S3GiyTKGOTNJ3qWNKZcCbOk79Q8sjygs36qeQ XT2g== 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=TP+9bRqC8qR7elXDpzrp1ZKI8X95ImnaOT+dOwXx/m4=; fh=5JoC92bka4oAOTaXPZp1L2d6vecu0EsEnBOuOGSGC8g=; b=n7uFvKCikJcWPkFqhY7vd5gSNH5H9KTga9IeAZuVeKOJBzuLagy2e3UEh0zE6Az0vP X6mIcqOhHG7a1AXVpgumG023VxKnVPgZz7HGrPW+6X6VnU0+5qi2X/zaejtxAqTcRT4F rQsUwjmvnKxWV3W1eDuc9csGgCvrjXdxnNGzNpuD3KKHfhqmYFMvP3kzwJjPuY3TQaRn r83/YShWffVVyFwhnJVGXQ/Eg/nFS052BKjeTPwjT0kUyEJs2CXDX/T2DCCkBqBYzVqE FFSU/LayezO9rlCDqiBS7PLUjLY/CrGjdTIRmpSZhXyV7pRtr0UZHVppiOwmfdobpdDb 82/w== 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:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b21-20020aa7c6d5000000b00523ae80dc04si2879567eds.657.2023.08.11.08.43.30; Fri, 11 Aug 2023 08:43:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235533AbjHKOnb (ORCPT + 99 others); Fri, 11 Aug 2023 10:43:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234314AbjHKOna (ORCPT ); Fri, 11 Aug 2023 10:43:30 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C558BE4C; Fri, 11 Aug 2023 07:43:29 -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 CADE0113E; Fri, 11 Aug 2023 07:44:11 -0700 (PDT) Received: from e127643.broadband (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 3C3823F64C; Fri, 11 Aug 2023 07:43:26 -0700 (PDT) From: James Clark To: linux-perf-users@vger.kernel.org, irogers@google.com, john.g.garry@oracle.com, renyu.zj@linux.alibaba.com Cc: James Clark , Will Deacon , Mike Leach , Leo Yan , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Adrian Hunter , Suzuki K Poulose , Kajol Jain , Nick Forrington , Kan Liang , Eduard Zingerman , Sohom Datta , Rob Herring , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org Subject: [PATCH v5 3/6] perf test: Add a test for the new Arm CPU ID comparison behavior Date: Fri, 11 Aug 2023 15:39:20 +0100 Message-Id: <20230811144017.491628-4-james.clark@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230811144017.491628-1-james.clark@arm.com> References: <20230811144017.491628-1-james.clark@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham 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 Now that variant and revision fields are taken into account the behavior is slightly more complicated so add a test to ensure that this behaves as expected. Signed-off-by: James Clark --- tools/perf/arch/arm64/include/arch-tests.h | 3 ++ tools/perf/arch/arm64/tests/Build | 1 + tools/perf/arch/arm64/tests/arch-tests.c | 4 +++ tools/perf/arch/arm64/tests/cpuid-match.c | 38 ++++++++++++++++++++++ 4 files changed, 46 insertions(+) create mode 100644 tools/perf/arch/arm64/tests/cpuid-match.c diff --git a/tools/perf/arch/arm64/include/arch-tests.h b/tools/perf/arch/arm64/include/arch-tests.h index 452b3d904521..474d7cf5afbd 100644 --- a/tools/perf/arch/arm64/include/arch-tests.h +++ b/tools/perf/arch/arm64/include/arch-tests.h @@ -2,6 +2,9 @@ #ifndef ARCH_TESTS_H #define ARCH_TESTS_H +struct test_suite; + +int test__cpuid_match(struct test_suite *test, int subtest); extern struct test_suite *arch_tests[]; #endif diff --git a/tools/perf/arch/arm64/tests/Build b/tools/perf/arch/arm64/tests/Build index a61c06bdb757..e337c09e7f56 100644 --- a/tools/perf/arch/arm64/tests/Build +++ b/tools/perf/arch/arm64/tests/Build @@ -2,3 +2,4 @@ perf-y += regs_load.o perf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o perf-y += arch-tests.o +perf-y += cpuid-match.o diff --git a/tools/perf/arch/arm64/tests/arch-tests.c b/tools/perf/arch/arm64/tests/arch-tests.c index ad16b4f8f63e..74932e72c727 100644 --- a/tools/perf/arch/arm64/tests/arch-tests.c +++ b/tools/perf/arch/arm64/tests/arch-tests.c @@ -3,9 +3,13 @@ #include "tests/tests.h" #include "arch-tests.h" + +DEFINE_SUITE("arm64 CPUID matching", cpuid_match); + struct test_suite *arch_tests[] = { #ifdef HAVE_DWARF_UNWIND_SUPPORT &suite__dwarf_unwind, #endif + &suite__cpuid_match, NULL, }; diff --git a/tools/perf/arch/arm64/tests/cpuid-match.c b/tools/perf/arch/arm64/tests/cpuid-match.c new file mode 100644 index 000000000000..af0871b54ae7 --- /dev/null +++ b/tools/perf/arch/arm64/tests/cpuid-match.c @@ -0,0 +1,38 @@ +// SPDX-License-Identifier: GPL-2.0 +#include + +#include "arch-tests.h" +#include "tests/tests.h" +#include "util/header.h" + +int test__cpuid_match(struct test_suite *test __maybe_unused, + int subtest __maybe_unused) +{ + /* midr with no leading zeros matches */ + if (strcmp_cpuid_str("0x410fd0c0", "0x00000000410fd0c0")) + return -1; + /* Upper case matches */ + if (strcmp_cpuid_str("0x410fd0c0", "0x00000000410FD0C0")) + return -1; + /* r0p0 = r0p0 matches */ + if (strcmp_cpuid_str("0x00000000410fd480", "0x00000000410fd480")) + return -1; + /* r0p1 > r0p0 matches */ + if (strcmp_cpuid_str("0x00000000410fd480", "0x00000000410fd481")) + return -1; + /* r1p0 > r0p0 matches*/ + if (strcmp_cpuid_str("0x00000000410fd480", "0x00000000411fd480")) + return -1; + /* r0p0 < r0p1 doesn't match */ + if (!strcmp_cpuid_str("0x00000000410fd481", "0x00000000410fd480")) + return -1; + /* r0p0 < r1p0 doesn't match */ + if (!strcmp_cpuid_str("0x00000000411fd480", "0x00000000410fd480")) + return -1; + /* Different CPU doesn't match */ + if (!strcmp_cpuid_str("0x00000000410fd4c0", "0x00000000430f0af0")) + return -1; + + return 0; +} + -- 2.34.1