Skip to content

Commit 616c59b

Browse files
Sean Christophersonsuryasaimadhu
authored andcommitted
perf/x86: Provide stubs of KVM helpers for non-Intel CPUs
Provide stubs for perf_guest_get_msrs() and intel_pt_handle_vmx() when building without support for Intel CPUs, i.e. CPU_SUP_INTEL=n. Lack of stubs is not currently a problem as the only user, KVM_INTEL, takes a dependency on CPU_SUP_INTEL=y. Provide the stubs for all CPUs so that KVM_INTEL can be built for any CPU with compatible hardware support, e.g. Centuar and Zhaoxin CPUs. Note, the existing stub for perf_guest_get_msrs() is essentially dead code as KVM selects CONFIG_PERF_EVENTS, i.e. the only user guarantees the full implementation is built. Signed-off-by: Sean Christopherson <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent b39033f commit 616c59b

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

arch/x86/include/asm/perf_event.h

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -322,17 +322,10 @@ struct perf_guest_switch_msr {
322322
u64 host, guest;
323323
};
324324

325-
extern struct perf_guest_switch_msr *perf_guest_get_msrs(int *nr);
326325
extern void perf_get_x86_pmu_capability(struct x86_pmu_capability *cap);
327326
extern void perf_check_microcode(void);
328327
extern int x86_perf_rdpmc_index(struct perf_event *event);
329328
#else
330-
static inline struct perf_guest_switch_msr *perf_guest_get_msrs(int *nr)
331-
{
332-
*nr = 0;
333-
return NULL;
334-
}
335-
336329
static inline void perf_get_x86_pmu_capability(struct x86_pmu_capability *cap)
337330
{
338331
memset(cap, 0, sizeof(*cap));
@@ -342,8 +335,23 @@ static inline void perf_events_lapic_init(void) { }
342335
static inline void perf_check_microcode(void) { }
343336
#endif
344337

338+
#if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_INTEL)
339+
extern struct perf_guest_switch_msr *perf_guest_get_msrs(int *nr);
340+
#else
341+
static inline struct perf_guest_switch_msr *perf_guest_get_msrs(int *nr)
342+
{
343+
*nr = 0;
344+
return NULL;
345+
}
346+
#endif
347+
345348
#ifdef CONFIG_CPU_SUP_INTEL
346349
extern void intel_pt_handle_vmx(int on);
350+
#else
351+
static inline void intel_pt_handle_vmx(int on)
352+
{
353+
354+
}
347355
#endif
348356

349357
#if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_AMD)

0 commit comments

Comments
 (0)