aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm/arm/pmu.c
diff options
context:
space:
mode:
authorChristoffer Dall <cdall@linaro.org>2017-05-04 13:32:53 +0200
committerChristoffer Dall <cdall@linaro.org>2017-06-08 17:00:12 +0200
commitabcb851daa617706e90ee7d39d4d9a74ac05f4b1 (patch)
treea126efb3a85113f4c215568a5072598b24affdce /virt/kvm/arm/pmu.c
parentKVM: arm/arm64: Introduce an allocator for in-kernel irq lines (diff)
downloadlinux-dev-abcb851daa617706e90ee7d39d4d9a74ac05f4b1.tar.xz
linux-dev-abcb851daa617706e90ee7d39d4d9a74ac05f4b1.zip
KVM: arm/arm64: Check if irq lines to the GIC are already used
We check if other in-kernel devices have already been connected to the GIC for a particular interrupt line when possible. For the PMU, we can do this whenever setting the PMU interrupt number from userspace. For the timers, we have to wait until we try to enable the timer, because we have a concept of default IRQ numbers that userspace shouldn't have to work around in the initialization phase. Signed-off-by: Christoffer Dall <cdall@linaro.org> Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'virt/kvm/arm/pmu.c')
-rw-r--r--virt/kvm/arm/pmu.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/virt/kvm/arm/pmu.c b/virt/kvm/arm/pmu.c
index 574feff55a6c..3f0866925b6b 100644
--- a/virt/kvm/arm/pmu.c
+++ b/virt/kvm/arm/pmu.c
@@ -480,6 +480,8 @@ static int kvm_arm_pmu_v3_init(struct kvm_vcpu *vcpu)
return -EBUSY;
if (irqchip_in_kernel(vcpu->kvm)) {
+ int ret;
+
/*
* If using the PMU with an in-kernel virtual GIC
* implementation, we require the GIC to be already
@@ -490,6 +492,11 @@ static int kvm_arm_pmu_v3_init(struct kvm_vcpu *vcpu)
if (!kvm_arm_pmu_irq_initialized(vcpu))
return -ENXIO;
+
+ ret = kvm_vgic_set_owner(vcpu, vcpu->arch.pmu.irq_num,
+ &vcpu->arch.pmu);
+ if (ret)
+ return ret;
}
vcpu->arch.pmu.created = true;