summaryrefslogtreecommitdiff
path: root/virt
diff options
context:
space:
mode:
authorShannon Zhao <shannon.zhao@linaro.org>2016-01-11 22:46:15 +0800
committerMarc Zyngier <marc.zyngier@arm.com>2016-02-29 18:34:21 +0000
commit808e738142e7086ef793ebf9797099c392894e65 (patch)
tree38c6f338451aca94c326fe5991fbf7fa13aeccc7 /virt
parent5f0a714a2b63c25ffba5d832773f3ca4f0d02e21 (diff)
downloadlinux-rpi3-808e738142e7086ef793ebf9797099c392894e65.tar.gz
linux-rpi3-808e738142e7086ef793ebf9797099c392894e65.tar.bz2
linux-rpi3-808e738142e7086ef793ebf9797099c392894e65.zip
arm64: KVM: Add a new feature bit for PMUv3
To support guest PMUv3, use one bit of the VCPU INIT feature array. Initialize the PMU when initialzing the vcpu with that bit and PMU overflow interrupt set. Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> Acked-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Andrew Jones <drjones@redhat.com> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/arm/pmu.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/virt/kvm/arm/pmu.c b/virt/kvm/arm/pmu.c
index 9b83857da195..6e28f4f86cc6 100644
--- a/virt/kvm/arm/pmu.c
+++ b/virt/kvm/arm/pmu.c
@@ -405,3 +405,13 @@ void kvm_pmu_set_counter_event_type(struct kvm_vcpu *vcpu, u64 data,
pmc->perf_event = event;
}
+
+bool kvm_arm_support_pmu_v3(void)
+{
+ /*
+ * Check if HW_PERF_EVENTS are supported by checking the number of
+ * hardware performance counters. This could ensure the presence of
+ * a physical PMU and CONFIG_PERF_EVENT is selected.
+ */
+ return (perf_num_counters() > 0);
+}