]> git.ipfire.org Git - thirdparty/qemu.git/commit
target/i386/kvm: set KVM_PMU_CAP_DISABLE if "-pmu" is configured
authorDongli Zhang <dongli.zhang@oracle.com>
Fri, 9 Jan 2026 07:53:56 +0000 (23:53 -0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 13 Feb 2026 10:16:52 +0000 (11:16 +0100)
commit383374465155c682ddd6bb4002cdcd09995c9b7f
treed3fe12b0de65411cf72976eac21b350e057386cf
parent4f0dd09e61b080c27589fe35b575503783c5a256
target/i386/kvm: set KVM_PMU_CAP_DISABLE if "-pmu" is configured

Although AMD PERFCORE and PerfMonV2 are removed when "-pmu" is configured,
there is no way to fully disable KVM AMD PMU virtualization. Neither
"-cpu host,-pmu" nor "-cpu EPYC" achieves this.

As a result, the following message still appears in the VM dmesg:

[    0.263615] Performance Events: AMD PMU driver.

However, the expected output should be:

[    0.596381] Performance Events: PMU not available due to virtualization, using software events only.
[    0.600972] NMI watchdog: Perf NMI watchdog permanently disabled

This occurs because AMD does not use any CPUID bit to indicate PMU
availability.

To address this, KVM_CAP_PMU_CAPABILITY is used to set KVM_PMU_CAP_DISABLE
when "-pmu" is configured.

Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
Reviewed-by: Zide Chen <zide.chen@intel.com>
Link: https://lore.kernel.org/r/20260109075508.113097-2-dongli.zhang@oracle.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
target/i386/kvm/kvm.c