From: Jinke F. <fan...@ye...> - 2019-05-09 09:55:47
|
Background: Chengdu Haiguang IC Design Co., Ltd (Hygon) is a Joint Venture between AMD and Haiguang Information Technology Co.,Ltd., aims at providing high performance x86 processor for China server market. Its first generation processor codename is Dhyana, which originates from AMD technology and shares most of the architecture with AMD's family 17h, but with different CPU Vendor ID("HygonGenuine")/Family series number(Family 18h). Related Hygon kernel patch can be found on http://lkml.kernel.org/r/5ce...@hy... Signed-off-by: fanjinke <fan...@ye...> --- libop/op_cpu_type.c | 3 ++- libpe_utils/op_pe_utils.cpp | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/libop/op_cpu_type.c b/libop/op_cpu_type.c index 1d601c6..3aab4a2 100644 --- a/libop/op_cpu_type.c +++ b/libop/op_cpu_type.c @@ -599,7 +599,8 @@ static op_cpu _get_x86_64_cpu_type(void) if (cpuid_vendor("GenuineIntel")) { ret = _get_intel_cpu_type(); - } else if (cpuid_vendor("AuthenticAMD")) { + } else if (cpuid_vendor("AuthenticAMD") || + cpuid_vendor("HygonGenuine")) { ret = _get_amd_cpu_type(); } diff --git a/libpe_utils/op_pe_utils.cpp b/libpe_utils/op_pe_utils.cpp index d545cee..1ca4ce3 100644 --- a/libpe_utils/op_pe_utils.cpp +++ b/libpe_utils/op_pe_utils.cpp @@ -415,7 +415,9 @@ static void _get_event_code(operf_event_t * event, op_cpu cpu_type) #if defined(__i386__) || defined(__x86_64__) // Setup EventSelct[11:8] field for AMD const char * vendor_AMD = "AuthenticAMD"; - if (op_is_cpu_vendor((char *)vendor_AMD)) { + const char * vendor_Hygon = "HygonGenuine"; + if (op_is_cpu_vendor((char *)vendor_AMD) || + op_is_cpu_vendor((char *)vendor_Hygon)) { config = base_code & 0xF00ULL; config = config << 32; } -- 2.17.1 |