Re: [PATCH 4/4] KVM: x86/cpuid: Add AMD CPUID ExtPerfMonAndDbg leaf 0x80000022

From: Jim Mattson
Date: Thu Sep 08 2022 - 19:15:13 EST


On Wed, Sep 7, 2022 at 11:00 PM Sandipan Das <sandipan.das@xxxxxxx> wrote:
> This is the suggested method for detecting the number of counters:
>
> If CPUID Fn8000_0022_EAX[PerfMonV2] is set, then use the new interface in
> CPUID Fn8000_0022_EBX to determine the number of counters.
>
> Else if CPUID Fn8000_0001_ECX[PerfCtrExtCore] is set, then six counters
> are available.
>
> Else, four legacy counters are available.
>
> There will be an APM update that will have this information in the
> "Detecting Hardware Support for Performance Counters" section.

Nonetheless, for compatibility with old software, Fn8000_0022_EBX can
never report less than four counters (or six, if
Fn8000_0001_ECX[PerfCtrExtCore] is set).