1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/compiler.h>
3 
4 #include "arch-tests.h"
5 #include "tests/tests.h"
6 #include "util/header.h"
7 
8 int test__cpuid_match(struct test_suite *test __maybe_unused,
9 			     int subtest __maybe_unused)
10 {
11 	/* midr with no leading zeros matches */
12 	if (strcmp_cpuid_str("0x410fd0c0", "0x00000000410fd0c0"))
13 		return -1;
14 	/* Upper case matches */
15 	if (strcmp_cpuid_str("0x410fd0c0", "0x00000000410FD0C0"))
16 		return -1;
17 	/* r0p0 = r0p0 matches */
18 	if (strcmp_cpuid_str("0x00000000410fd480", "0x00000000410fd480"))
19 		return -1;
20 	/* r0p1 > r0p0 matches */
21 	if (strcmp_cpuid_str("0x00000000410fd480", "0x00000000410fd481"))
22 		return -1;
23 	/* r1p0 > r0p0 matches*/
24 	if (strcmp_cpuid_str("0x00000000410fd480", "0x00000000411fd480"))
25 		return -1;
26 	/* r0p0 < r0p1 doesn't match */
27 	if (!strcmp_cpuid_str("0x00000000410fd481", "0x00000000410fd480"))
28 		return -1;
29 	/* r0p0 < r1p0 doesn't match */
30 	if (!strcmp_cpuid_str("0x00000000411fd480", "0x00000000410fd480"))
31 		return -1;
32 	/* Different CPU doesn't match */
33 	if (!strcmp_cpuid_str("0x00000000410fd4c0", "0x00000000430f0af0"))
34 		return -1;
35 
36 	return 0;
37 }
38