lkml.org 
[lkml]   [2024]   [Apr]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 2/4] perf/x86/ibs: Use CPUID region helper
From
Date

From: Dave Hansen <dave.hansen@linux.intel.com>

IBS details are enumerated in an extended CPUID leaf. But
the support has an open-coded CPUID region check. Use the
new helper to trim down the code.

Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
--

Note: this cleanup could take another form:

if (boot_cpu_data->extended_cpuid_level >= IBS_CPUID_FEATURES)
caps = cpuid_eax(IBS_CPUID_FEATURES);

that would be one fewer CPUID invocations, but one more
line of code.
---

b/arch/x86/events/amd/ibs.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)

diff -puN arch/x86/events/amd/ibs.c~ibs-region-helpers arch/x86/events/amd/ibs.c
--- a/arch/x86/events/amd/ibs.c~ibs-region-helpers 2024-04-02 15:22:59.262912595 -0700
+++ b/arch/x86/events/amd/ibs.c 2024-04-02 15:22:59.262912595 -0700
@@ -1278,18 +1278,13 @@ static __init int perf_event_ibs_init(vo

static __init u32 __get_ibs_caps(void)
{
- u32 caps;
- unsigned int max_level;
+ u32 caps = 0;

if (!boot_cpu_has(X86_FEATURE_IBS))
return 0;

- /* check IBS cpuid feature flags */
- max_level = cpuid_eax(0x80000000);
- if (max_level < IBS_CPUID_FEATURES)
- return IBS_CAPS_DEFAULT;
+ get_cpuid_region_leaf(IBS_CPUID_FEATURES, CPUID_EAX, &caps);

- caps = cpuid_eax(IBS_CPUID_FEATURES);
if (!(caps & IBS_CAPS_AVAIL))
/* cpuid flags not valid */
return IBS_CAPS_DEFAULT;
_
\
 
 \ /
  Last update: 2024-05-27 16:22    [W:0.576 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site