From 1d152fc5975f095a22ad4b15f66fc31b3c0fad40 Mon Sep 17 00:00:00 2001 From: William Cohen Date: Mon, 12 Jun 2023 15:49:31 -0400 Subject: [PATCH] AMD Zen4 Bergamo CPU support in libpfm Related: #2111973 --- libpfm-zen4.patch | 29 +++++++++++++++++++++++++++++ libpfm.spec | 7 ++++++- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 libpfm-zen4.patch diff --git a/libpfm-zen4.patch b/libpfm-zen4.patch new file mode 100644 index 0000000..e319e32 --- /dev/null +++ b/libpfm-zen4.patch @@ -0,0 +1,29 @@ +commit 1befa3d200cc17d5a278fcb2f597c4876c58f949 +Author: Stephane Eranian +Date: Tue Apr 25 00:35:41 2023 -0700 + + fix AMD Zen3/Zen4 detection + + To cover more models of Zen4. + + Signed-off-by: Stephane Eranian + +diff --git a/lib/pfmlib_amd64.c b/lib/pfmlib_amd64.c +index e51a43d..0c6702d 100644 +--- a/lib/pfmlib_amd64.c ++++ b/lib/pfmlib_amd64.c +@@ -181,10 +181,10 @@ amd64_get_revision(pfm_amd64_config_t *cfg) + } else if (cfg->family == 22) { /* family 16h */ + rev = PFM_PMU_AMD64_FAM16H; + } else if (cfg->family == 25) { /* family 19h */ +- if (cfg->model <= 0x0f || (cfg->model >= 0x20 && cfg->model <= 0x5f)) { +- rev = PFM_PMU_AMD64_FAM19H_ZEN3; +- } else if (cfg->model == 17) { +- rev = PFM_PMU_AMD64_FAM19H_ZEN4; ++ if (cfg->model >= 0x60 || (cfg->model >= 0x10 && cfg->model <= 0x1f)) { ++ rev = PFM_PMU_AMD64_FAM19H_ZEN4; ++ } else { ++ rev = PFM_PMU_AMD64_FAM19H_ZEN3; + } + } + diff --git a/libpfm.spec b/libpfm.spec index 4fb8696..6a9b4a6 100644 --- a/libpfm.spec +++ b/libpfm.spec @@ -10,7 +10,7 @@ Name: libpfm Version: 4.13.0 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Library to encode performance events for use by perf tool @@ -20,6 +20,7 @@ URL: http://perfmon2.sourceforge.net/ Source0: http://sourceforge.net/projects/perfmon2/files/libpfm4/%{name}-%{version}.tar.gz Patch2: libpfm-python3-setup.patch Patch3: libpfm-initp.patch +Patch4: libpfm-zen4.patch %if %{with python} BuildRequires: python3 @@ -71,6 +72,7 @@ Python bindings for libpfm4 and perf_event_open system call. %setup -q %patch2 -p1 -b .python3 %patch3 -p1 -b .test +%patch4 -p1 -b .zen4 %build %if %{with python} @@ -119,6 +121,9 @@ make \ %endif %changelog +* Mon Jun 12 2023 William cohen - 4.13.0-4 +- Identify AMD Bergamo processors. + * Wed May 3 2023 William cohen - 4.13.0-3 - Rebuild for rhbz #2161146.