Author: kib
Date: Fri Feb 14 13:26:45 2020
New Revision: 357917
URL: https://svnweb.freebsd.org/changeset/base/357917

Log:
  MFC r357670:
  pmc: Add Hygon Dhyana support.

Modified:
  stable/12/lib/libpmc/libpmc_pmu_util.c
  stable/12/lib/libpmc/pmu-events/arch/x86/mapfile.csv
  stable/12/sys/dev/hwpmc/hwpmc_amd.c
  stable/12/sys/dev/hwpmc/hwpmc_x86.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libpmc/libpmc_pmu_util.c
==============================================================================
--- stable/12/lib/libpmc/libpmc_pmu_util.c      Fri Feb 14 13:25:37 2020        
(r357916)
+++ stable/12/lib/libpmc/libpmc_pmu_util.c      Fri Feb 14 13:26:45 2020        
(r357917)
@@ -103,7 +103,8 @@ pmu_events_mfr(void)
                free(buf);
                return (PMU_INVALID);
        }
-       if (strcasestr(buf, "AuthenticAMD") != NULL)
+       if (strcasestr(buf, "AuthenticAMD") != NULL ||
+           strcasestr(buf, "HygonGenuine") != NULL)
                mfr = PMU_AMD;
        else if (strcasestr(buf, "GenuineIntel") != NULL)
                mfr = PMU_INTEL;

Modified: stable/12/lib/libpmc/pmu-events/arch/x86/mapfile.csv
==============================================================================
--- stable/12/lib/libpmc/pmu-events/arch/x86/mapfile.csv        Fri Feb 14 
13:25:37 2020        (r357916)
+++ stable/12/lib/libpmc/pmu-events/arch/x86/mapfile.csv        Fri Feb 14 
13:26:45 2020        (r357917)
@@ -41,3 +41,4 @@ AuthenticAMD-23-02,v1,amdfam17h,core
 AuthenticAMD-23-03,v1,amdfam17h,core
 AuthenticAMD-23-04,v1,amdfam17h,core
 AuthenticAMD-23-05,v1,amdfam17h,core
+HygonGenuine-24-00,v1,amdfam17h,core

Modified: stable/12/sys/dev/hwpmc/hwpmc_amd.c
==============================================================================
--- stable/12/sys/dev/hwpmc/hwpmc_amd.c Fri Feb 14 13:25:37 2020        
(r357916)
+++ stable/12/sys/dev/hwpmc/hwpmc_amd.c Fri Feb 14 13:26:45 2020        
(r357917)
@@ -1045,6 +1045,9 @@ pmc_amd_initialize(void)
        if (CPUID_TO_FAMILY(cpu_id) == 0x17)
                snprintf(pmc_cpuid, sizeof(pmc_cpuid), "AuthenticAMD-%d-%02X",
                                 CPUID_TO_FAMILY(cpu_id), model);
+       if (CPUID_TO_FAMILY(cpu_id) == 0x18)
+               snprintf(pmc_cpuid, sizeof(pmc_cpuid), "HygonGenuine-%d-%02X",
+                                CPUID_TO_FAMILY(cpu_id), model);
 
        switch (cpu_id & 0xF00) {
 #if    defined(__i386__)

Modified: stable/12/sys/dev/hwpmc/hwpmc_x86.c
==============================================================================
--- stable/12/sys/dev/hwpmc/hwpmc_x86.c Fri Feb 14 13:25:37 2020        
(r357916)
+++ stable/12/sys/dev/hwpmc/hwpmc_x86.c Fri Feb 14 13:26:45 2020        
(r357917)
@@ -248,7 +248,8 @@ pmc_md_initialize()
        struct pmc_mdep *md;
 
        /* determine the CPU kind */
-       if (cpu_vendor_id == CPU_VENDOR_AMD)
+       if (cpu_vendor_id == CPU_VENDOR_AMD ||
+           cpu_vendor_id == CPU_VENDOR_HYGON)
                md = pmc_amd_initialize();
        else if (cpu_vendor_id == CPU_VENDOR_INTEL)
                md = pmc_intel_initialize();
@@ -271,7 +272,8 @@ pmc_md_finalize(struct pmc_mdep *md)
 {
 
        lapic_disable_pmc();
-       if (cpu_vendor_id == CPU_VENDOR_AMD)
+       if (cpu_vendor_id == CPU_VENDOR_AMD ||
+           cpu_vendor_id == CPU_VENDOR_HYGON)
                pmc_amd_finalize(md);
        else if (cpu_vendor_id == CPU_VENDOR_INTEL)
                pmc_intel_finalize(md);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to