Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf intel-pt: Use the perf provided "cpuid.h"

Rather than having a feature test and include of <cpuid.h> for the
__get_cpuid function, use the cpuid function provided by
tools/perf/arch/x86/util/cpuid.h.

Signed-off-by: Ian Rogers <irogers@google.com>
Reviewed-by: James Clark <james.clark@linaro.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>

authored by

Ian Rogers and committed by
Namhyung Kim
8933c624 fc9c17b2

+5 -5
+3 -3
tools/perf/arch/x86/tests/intel-pt-test.c
··· 3 3 #include <linux/compiler.h> 4 4 #include <linux/bits.h> 5 5 #include <string.h> 6 - #include <cpuid.h> 7 6 #include <sched.h> 8 7 9 8 #include "intel-pt-decoder/intel-pt-pkt-decoder.h" ··· 10 11 #include "debug.h" 11 12 #include "tests/tests.h" 12 13 #include "arch-tests.h" 14 + #include "../util/cpuid.h" 13 15 #include "cpumap.h" 14 16 15 17 /** ··· 363 363 memset(caps, 0, sizeof(*caps)); 364 364 365 365 for (i = 0; i < INTEL_PT_SUBLEAF_CNT; i++) { 366 - __get_cpuid_count(20, i, &r.eax, &r.ebx, &r.ecx, &r.edx); 366 + cpuid(20, i, &r.eax, &r.ebx, &r.ecx, &r.edx); 367 367 pr_debug("CPU %d CPUID leaf 20 subleaf %d\n", cpu, i); 368 368 pr_debug("eax = 0x%08x\n", r.eax); 369 369 pr_debug("ebx = 0x%08x\n", r.ebx); ··· 380 380 unsigned int eax, ebx, ecx, edx = 0; 381 381 bool result; 382 382 383 - __get_cpuid_count(7, 0, &eax, &ebx, &ecx, &edx); 383 + cpuid(7, 0, &eax, &ebx, &ecx, &edx); 384 384 result = edx & BIT(15); 385 385 pr_debug("Is %shybrid : CPUID leaf 7 subleaf 0 edx %#x (bit-15 indicates hybrid)\n", 386 386 result ? "" : "not ", edx);
+2 -2
tools/perf/arch/x86/util/intel-pt.c
··· 12 12 #include <linux/log2.h> 13 13 #include <linux/zalloc.h> 14 14 #include <linux/err.h> 15 - #include <cpuid.h> 16 15 17 16 #include "../../../util/session.h" 18 17 #include "../../../util/event.h" ··· 33 34 #include <internal/lib.h> // page_size 34 35 #include "../../../util/intel-pt.h" 35 36 #include <api/fs/fs.h> 37 + #include "cpuid.h" 36 38 37 39 #define KiB(x) ((x) * 1024) 38 40 #define MiB(x) ((x) * 1024 * 1024) ··· 311 311 { 312 312 unsigned int eax = 0, ebx = 0, ecx = 0, edx = 0; 313 313 314 - __get_cpuid(0x15, &eax, &ebx, &ecx, &edx); 314 + cpuid(0x15, 0, &eax, &ebx, &ecx, &edx); 315 315 *n = ebx; 316 316 *d = eax; 317 317 }