[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2 1/4] x86/vpmu: Move vpmu_do_cpuid() handling into {pv, hvm}_cpuid()
On 12/05/2016 01:24 PM, Andrew Cooper wrote: > @@ -3516,6 +3516,17 @@ void hvm_cpuid(unsigned int input, unsigned int *eax, > unsigned int *ebx, > if ( !(hvm_pae_enabled(v) || hvm_long_mode_enabled(v)) ) > *edx &= ~cpufeat_mask(X86_FEATURE_PSE36); > } > + > + if ( vpmu_enabled(v) && > + vpmu_is_set(vcpu_vpmu(v), VPMU_CPU_HAS_DS) ) > + { > + *edx |= cpufeat_mask(X86_FEATURE_DS); > + if ( cpu_has(¤t_cpu_data, X86_FEATURE_DTES64) ) > + *ecx |= cpufeat_mask(X86_FEATURE_DTES64); > + if ( cpu_has(¤t_cpu_data, X86_FEATURE_DSCPL) ) > + *ecx |= cpufeat_mask(X86_FEATURE_DSCPL); > + } > + > break; > > case 0x7: > @@ -3646,6 +3657,18 @@ void hvm_cpuid(unsigned int input, unsigned int *eax, > unsigned int *ebx, > } > break; > > + case 0x0000000a: /* Architectural Performance Monitor Features (Intel) */ > + if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL || > !vpmu_enabled(v) ) > + { > + *eax = *ebx = *ecx = *edx = 0; > + break; > + } > + > + /* Report at most version 3 since that's all we currently emulate */ > + if ( (*eax & 0xff) > 3 ) > + *eax = (*eax & ~0xff) | 3; > + break; Both this and Debug Store checks are the same for both HVM and PV. Can they be factored out? (and then perhaps version update can gain back PMU_VERSION_MASK macro) -boris > @@ -1192,6 +1192,16 @@ void pv_cpuid(struct cpu_user_regs *regs) > } > } > > + if ( vpmu_enabled(curr) && > + vpmu_is_set(vcpu_vpmu(curr), VPMU_CPU_HAS_DS) ) > + { > + d |= cpufeat_mask(X86_FEATURE_DS); > + if ( cpu_has(¤t_cpu_data, X86_FEATURE_DTES64) ) > + c |= cpufeat_mask(X86_FEATURE_DTES64); > + if ( cpu_has(¤t_cpu_data, X86_FEATURE_DSCPL) ) > + c |= cpufeat_mask(X86_FEATURE_DSCPL); > + } > + > c |= cpufeat_mask(X86_FEATURE_HYPERVISOR); > break; > > @@ -1224,6 +1234,16 @@ void pv_cpuid(struct cpu_user_regs *regs) > a = 0; > break; > > + case 0x0000000a: /* Architectural Performance Monitor Features (Intel) */ > + if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL || > + !vpmu_enabled(curr) ) > + goto unsupported; > + > + /* Report at most version 3 since that's all we currently emulate. */ > + if ( (a & 0xff) > 3 ) > + a = (a & ~0xff) | 3; > + break; > + > _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |