F(NULL_SEL_CLR_BASE) | F(AUTOIBRS) | 0 /* PrefetchCtlMsr */
        );
 
+       kvm_cpu_cap_init_kvm_defined(CPUID_8000_0022_EAX,
+               F(PERFMON_V2)
+       );
+
        /*
         * Synthesize "LFENCE is serializing" into the AMD-defined entry in
         * KVM's supported CPUID if the feature is reported as supported by the
                entry->edx = 0;
                break;
        case 0x80000000:
-               entry->eax = min(entry->eax, 0x80000021);
+               entry->eax = min(entry->eax, 0x80000022);
                /*
                 * Serializing LFENCE is reported in a multitude of ways, and
                 * NullSegClearsBase is not reported in CPUID on Zen2; help
                entry->ebx = entry->ecx = entry->edx = 0;
                cpuid_entry_override(entry, CPUID_8000_0021_EAX);
                break;
+       /* AMD Extended Performance Monitoring and Debug */
+       case 0x80000022: {
+               union cpuid_0x80000022_ebx ebx;
+
+               entry->ecx = entry->edx = 0;
+               if (!enable_pmu || !kvm_cpu_cap_has(X86_FEATURE_PERFMON_V2)) {
+                       entry->eax = entry->ebx;
+                       break;
+               }
+
+               cpuid_entry_override(entry, CPUID_8000_0022_EAX);
+
+               if (kvm_cpu_cap_has(X86_FEATURE_PERFMON_V2))
+                       ebx.split.num_core_pmc = kvm_pmu_cap.num_counters_gp;
+               else if (kvm_cpu_cap_has(X86_FEATURE_PERFCTR_CORE))
+                       ebx.split.num_core_pmc = AMD64_NUM_COUNTERS_CORE;
+               else
+                       ebx.split.num_core_pmc = AMD64_NUM_COUNTERS;
+
+               entry->ebx = ebx.full;
+               break;
+       }
        /*Add support for Centaur's CPUID instruction*/
        case 0xC0000000:
                /*Just support up to 0xC0000004 now*/
 
                                                          kvm_pmu_cap.num_counters_gp);
                else
                        kvm_cpu_cap_check_and_set(X86_FEATURE_PERFCTR_CORE);
+
+               if (kvm_pmu_cap.version != 2 ||
+                   !kvm_cpu_cap_has(X86_FEATURE_PERFCTR_CORE))
+                       kvm_cpu_cap_clear(X86_FEATURE_PERFMON_V2);
        }
 
        /* CPUID 0x8000001F (SME/SEV features) */