Re: [PATCH 0/2] hwpmc_amd: fix MSR offset calculation and DF counter sharing

From: Paulo Fragoso <paulo_at_nlink.com.br>
Date: Sun, 01 Mar 2026 18:49:25 UTC
I have also submitted these patches to Phabricator at https://reviews.freebsd.org/D55607 for formal review.

Em 01/03/2026 10:50, Paulo Fragoso escreveu:
> Hello!
> 
> These two patches fix regressions in the hwpmc AMD driver introduced
> by the Netflix commit 37bba2ad92d8 (2026-02-01), which refactored the
> driver from a static counter table to dynamic CPUID-based detection.
> 
> Patch 1 fixes amd_get_msr() MSR offset calculation for newer AMD
> counter bases (Core, L3, Data Fabric), verified on AMD Ryzen 5600X.
> 
> Patch 2 fixes Data Fabric counter MSR sharing in amd_pcpu_init(),
> honoring the per-package sharing requirement documented in AMD PPR
> 57930-A0 section 2.1.9 [Register Sharing].
> 
> Both patches tested on AMD Ryzen 5600X (Family 19h, Zen 3),
> FreeBSD 16.0-CURRENT.
> 
> Paulo Fragoso (2):
>    hwpmc_amd: fix amd_get_msr() MSR offset for newer counter bases
>    hwpmc_amd: fix DF counter MSR sharing in amd_pcpu_init()
> 
>   sys/dev/hwpmc/hwpmc_amd.c | 38 +++++++++++++++++++++++++++++++++++---
>   1 file changed, 35 insertions(+), 3 deletions(-)
> 
> -- 
> 2.53.0
>