kvm_host_pmu holds the unadulterated host PMU capabilities, which can be used to compare against guest capabilities to determine whether certain MSRs should be intercepted by KVM. Exposing it directly avoids the need for multiple per-field accessors, which adds boilerplate without hiding any implementation detail worth encapsulating. Opportunistically, fix typo "Unadultered" in the comment. Signed-off-by: Zide Chen --- arch/x86/kvm/pmu.c | 5 +++-- arch/x86/kvm/pmu.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/pmu.c b/arch/x86/kvm/pmu.c index 0b66e7756ecc..3647ce3f0e3f 100644 --- a/arch/x86/kvm/pmu.c +++ b/arch/x86/kvm/pmu.c @@ -27,8 +27,9 @@ /* This is enough to filter the vast majority of currently defined events. */ #define KVM_PMU_EVENT_FILTER_MAX_EVENTS 300 -/* Unadultered PMU capabilities of the host, i.e. of hardware. */ -static struct x86_pmu_capability __read_mostly kvm_host_pmu; +/* Unadulterated PMU capabilities of the host, i.e. of hardware. */ +struct x86_pmu_capability __read_mostly kvm_host_pmu; +EXPORT_SYMBOL_FOR_KVM_INTERNAL(kvm_host_pmu); /* KVM's PMU capabilities, i.e. the intersection of KVM and hardware support. */ struct x86_pmu_capability __read_mostly kvm_pmu_cap; diff --git a/arch/x86/kvm/pmu.h b/arch/x86/kvm/pmu.h index 95dc95a9ae37..95b73aac72db 100644 --- a/arch/x86/kvm/pmu.h +++ b/arch/x86/kvm/pmu.h @@ -254,6 +254,7 @@ static inline bool pmc_is_locally_enabled(struct kvm_pmc *pmc) return !kvm_pmu_call(pmc_is_disabled_in_current_mode)(pmc); } +extern struct x86_pmu_capability kvm_host_pmu; extern struct x86_pmu_capability kvm_pmu_cap; void kvm_init_pmu_capability(struct kvm_pmu_ops *pmu_ops); -- 2.54.0