From: Wei Huang Subject: [PATCH V2 0/5] KVM vPMU support for AMD Date: Wed, 8 Apr 2015 12:18:20 -0400 Message-ID: <1428509905-32352-1-git-send-email-wei@redhat.com> Cc: pbonzini@redhat.com, rkrcmar@redhat.com, gleb@kernel.org, wei@redhat.com To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:58380 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754033AbbDHQS2 (ORCPT ); Wed, 8 Apr 2015 12:18:28 -0400 Sender: kvm-owner@vger.kernel.org List-ID: Currently KVM only supports vPMU for Intel platforms. This patch set enable vPMU support for AMD platform by creating a common PMU interface for x86. The PMU calls from guest VMs are dispatched to corresponding functions defined in arch specific files. V2: * Create a generic pmu.c file which is shared by Intel and AMD CPUs; * pmu.c code becomes part of kvm.ko module. Similarly pmu_intel.c and pmu_amd.c are linked to kvm-intel.ko and kvm-amd.ko respectively; * Re-define kvm_pmu_ops function pointers. Per Radim Krcmar's comments, a large portion of Intel vPMU code are now consolidated and moved to pmu.c; * Polish pmu_amd.c code to comply with new definition of kvm_pmu_ops; V1: * Adopt the file layout suggested by Radim Krcmar * Link arch module with its specific PMU file RFC: * Initial version for RFC Wei Huang (5): KVM: x86/vPMU: Define kvm_pmu_ops to support vPMU function dispatch KVM: x86/vPMU: Rename pmu.c file to pmu_intel.c KVM: x86/vPMU: Create vPMU interface for VMX and SVM KVM: x86/vPMU: Implement vPMU code AMD CPUs KVM: x86/vPMU: Enable PMU handling for AMD PERFCTRn and EVNTSELn MSRs arch/x86/include/asm/kvm_host.h | 38 ++- arch/x86/kvm/Makefile | 4 +- arch/x86/kvm/cpuid.c | 3 +- arch/x86/kvm/pmu.c | 563 +++++++++++----------------------------- arch/x86/kvm/pmu.h | 98 +++++++ arch/x86/kvm/pmu_amd.c | 198 ++++++++++++++ arch/x86/kvm/pmu_intel.c | 360 +++++++++++++++++++++++++ arch/x86/kvm/svm.c | 8 + arch/x86/kvm/vmx.c | 8 + arch/x86/kvm/x86.c | 57 ++-- 10 files changed, 896 insertions(+), 441 deletions(-) create mode 100644 arch/x86/kvm/pmu.h create mode 100644 arch/x86/kvm/pmu_amd.c create mode 100644 arch/x86/kvm/pmu_intel.c -- 1.8.3.1