x86/cpu/vpmu: Add Hygon Dhyana and AMD Zen support for vPMU
authorPu Wen <puwen@hygon.cn>
Thu, 4 Apr 2019 13:46:11 +0000 (21:46 +0800)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 6 Jun 2019 14:28:21 +0000 (15:28 +0100)
commit4d94642626048e47f29a9505f892b4004002dcbe
tree597b803d8dae445e6c819125338d1e6795c58543
parent1c07b0135a715021142c549eae6ad5c52acd9eb6
x86/cpu/vpmu: Add Hygon Dhyana and AMD Zen support for vPMU

As Hygon Dhyana CPU share similar PMU architecture with AMD family
17h one, so add Hygon Dhyana support in vpmu_arch_initialise() and
vpmu_init() by sharing AMD code path.

Split the common part in amd_vpmu_init() to a static function
_vpmu_init(), making AMD and Hygon to call the shared function to
initialize vPMU.

As current vPMU still not support AMD Zen(family 17h), add 0x17 support
to amd_vpmu_init().

Also create a function hygon_vpmu_init() for Hygon vPMU initialization.

Both of AMD 17h and Hygon 18h have the same performance event select
and counter MSRs as AMD 15h has, so reuse the 15h definitions for them.

Signed-off-by: Pu Wen <puwen@hygon.cn>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/cpu/vpmu.c
xen/arch/x86/cpu/vpmu_amd.c
xen/include/asm-x86/vpmu.h