Re: [oprof-cvs] [PATCH] Add support for Hygon Dhyana CPU

William Cohen <[email protected]> Thu, 9 May 2019 09:41:45 -0400
Newsgroups gmane.linux.oprofile
Message-ID <[email protected]>
On 5/9/19 5:52 AM, Jinke Fan wrote:
> 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/5ce86123a7b9dad925ac583d88d2f921040e859b.1538583282.git.puwen@hygon.cn
> 
> Signed-off-by: fanjinke <[email protected]>
> ---

Hi,

The patch looks reasonable and it has been merged into the upstream git repository.  Could make a patch for https://sourceforge.net/p/oprofile/oprofile-tests/ci/master/tree/ so the testsuite works for this processor?

Thanks again for the patch.

-Will Cohen

>  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;
>      }



_______________________________________________
oprofile-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oprofile-list