Date: Fri, 7 Feb 2020 22:28:04 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r357670 - in head: lib/libpmc lib/libpmc/pmu-events/arch/x86 sys/dev/hwpmc Message-ID: <202002072228.017MS4wX025938@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Fri Feb 7 22:28:04 2020 New Revision: 357670 URL: https://svnweb.freebsd.org/changeset/base/357670 Log: pmc: Add Hygon Dhyana support. To make the PMC tool pmcstat working properly on Hygon platform, add support for Hygon Dhyana family 18h by using the PMC initialization code path of AMD family 17h. Submitted by: Pu Wen <puwen@hygon.cn> MFC after: 1 week Differential revision: https://reviews.freebsd.org/D23562 Modified: head/lib/libpmc/libpmc_pmu_util.c head/lib/libpmc/pmu-events/arch/x86/mapfile.csv head/sys/dev/hwpmc/hwpmc_amd.c head/sys/dev/hwpmc/hwpmc_x86.c Modified: head/lib/libpmc/libpmc_pmu_util.c ============================================================================== --- head/lib/libpmc/libpmc_pmu_util.c Fri Feb 7 22:26:11 2020 (r357669) +++ head/lib/libpmc/libpmc_pmu_util.c Fri Feb 7 22:28:04 2020 (r357670) @@ -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: head/lib/libpmc/pmu-events/arch/x86/mapfile.csv ============================================================================== --- head/lib/libpmc/pmu-events/arch/x86/mapfile.csv Fri Feb 7 22:26:11 2020 (r357669) +++ head/lib/libpmc/pmu-events/arch/x86/mapfile.csv Fri Feb 7 22:28:04 2020 (r357670) @@ -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: head/sys/dev/hwpmc/hwpmc_amd.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_amd.c Fri Feb 7 22:26:11 2020 (r357669) +++ head/sys/dev/hwpmc/hwpmc_amd.c Fri Feb 7 22:28:04 2020 (r357670) @@ -1089,6 +1089,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: head/sys/dev/hwpmc/hwpmc_x86.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_x86.c Fri Feb 7 22:26:11 2020 (r357669) +++ head/sys/dev/hwpmc/hwpmc_x86.c Fri Feb 7 22:28:04 2020 (r357670) @@ -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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202002072228.017MS4wX025938>