@@ -1217,6 +1217,7 @@ int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int idt_index,
unsigned long kvm_get_rflags(struct kvm_vcpu *vcpu);
void kvm_set_rflags(struct kvm_vcpu *vcpu, unsigned long rflags);
bool kvm_rdpmc(struct kvm_vcpu *vcpu);
+unsigned int kvm_get_pt_addr_cnt(void);
void kvm_queue_exception(struct kvm_vcpu *vcpu, unsigned nr);
void kvm_queue_exception_e(struct kvm_vcpu *vcpu, unsigned nr, u32 error_code);
@@ -991,6 +991,19 @@ bool kvm_rdpmc(struct kvm_vcpu *vcpu)
}
EXPORT_SYMBOL_GPL(kvm_rdpmc);
+unsigned int kvm_get_pt_addr_cnt(void)
+{
+ unsigned int eax, ebx, ecx, edx;
+ /*
+ * - CPUID function 14H, sub-function 1:
+ * EAX[2:0] enumerates the number of Intel Processor
+ * Trace configurable Address Ranges for filtering.
+ */
+ cpuid_count(0x14, 1, &eax, &ebx, &ecx, &edx);
+ return (eax & 0x7);
+}
+EXPORT_SYMBOL_GPL(kvm_get_pt_addr_cnt);
+
/*
* List of msr numbers which we expose to userspace through KVM_GET_MSRS
* and KVM_SET_MSRS, and KVM_GET_MSR_INDEX_LIST.
CPUID.(EAX=14H,ECX=1H).EAX[2:0] enumerates the number of Intel Processor Trace configurable Address Ranges for filtering. Signed-off-by: Luwei Kang <luwei.kang@intel.com> --- arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/x86.c | 13 +++++++++++++ 2 files changed, 14 insertions(+)