aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm
diff options
context:
space:
mode:
authorMarc Zyngier <marc.zyngier@arm.com>2013-06-04 06:36:38 -0400
committerChristoffer Dall <christoffer.dall@linaro.org>2014-07-11 07:57:33 -0400
commitda8dafd1777cdd93091207952297d221a88e6479 (patch)
tree6181cb60c826de307e508801af46bfb29a1012a9 /virt/kvm
parentbeee38b9d0c0ea6cf2a7f35c3108f7d8281d4545 (diff)
KVM: ARM: vgic: introduce vgic_enable
Move the code dealing with enabling the VGIC on to vgic_ops. Acked-by: Catalin Marinas <catalin.marinas@arm.com> Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'virt/kvm')
-rw-r--r--virt/kvm/arm/vgic.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c
index 5c706393956d..70f674bb13a1 100644
--- a/virt/kvm/arm/vgic.c
+++ b/virt/kvm/arm/vgic.c
@@ -1097,6 +1097,19 @@ static void vgic_v2_set_vmcr(struct kvm_vcpu *vcpu, struct vgic_vmcr *vmcrp)
1097 vcpu->arch.vgic_cpu.vgic_v2.vgic_vmcr = vmcr; 1097 vcpu->arch.vgic_cpu.vgic_v2.vgic_vmcr = vmcr;
1098} 1098}
1099 1099
1100static void vgic_v2_enable(struct kvm_vcpu *vcpu)
1101{
1102 /*
1103 * By forcing VMCR to zero, the GIC will restore the binary
1104 * points to their reset values. Anything else resets to zero
1105 * anyway.
1106 */
1107 vcpu->arch.vgic_cpu.vgic_v2.vgic_vmcr = 0;
1108
1109 /* Get the show on the road... */
1110 vcpu->arch.vgic_cpu.vgic_v2.vgic_hcr = GICH_HCR_EN;
1111}
1112
1100static const struct vgic_ops vgic_ops = { 1113static const struct vgic_ops vgic_ops = {
1101 .get_lr = vgic_v2_get_lr, 1114 .get_lr = vgic_v2_get_lr,
1102 .set_lr = vgic_v2_set_lr, 1115 .set_lr = vgic_v2_set_lr,
@@ -1108,6 +1121,7 @@ static const struct vgic_ops vgic_ops = {
1108 .disable_underflow = vgic_v2_disable_underflow, 1121 .disable_underflow = vgic_v2_disable_underflow,
1109 .get_vmcr = vgic_v2_get_vmcr, 1122 .get_vmcr = vgic_v2_get_vmcr,
1110 .set_vmcr = vgic_v2_set_vmcr, 1123 .set_vmcr = vgic_v2_set_vmcr,
1124 .enable = vgic_v2_enable,
1111}; 1125};
1112 1126
1113static struct vgic_lr vgic_get_lr(const struct kvm_vcpu *vcpu, int lr) 1127static struct vgic_lr vgic_get_lr(const struct kvm_vcpu *vcpu, int lr)
@@ -1162,6 +1176,11 @@ static void vgic_set_vmcr(struct kvm_vcpu *vcpu, struct vgic_vmcr *vmcr)
1162 vgic_ops.set_vmcr(vcpu, vmcr); 1176 vgic_ops.set_vmcr(vcpu, vmcr);
1163} 1177}
1164 1178
1179static inline void vgic_enable(struct kvm_vcpu *vcpu)
1180{
1181 vgic_ops.enable(vcpu);
1182}
1183
1165static void vgic_retire_lr(int lr_nr, int irq, struct kvm_vcpu *vcpu) 1184static void vgic_retire_lr(int lr_nr, int irq, struct kvm_vcpu *vcpu)
1166{ 1185{
1167 struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu; 1186 struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
@@ -1624,15 +1643,9 @@ int kvm_vgic_vcpu_init(struct kvm_vcpu *vcpu)
1624 vgic_cpu->vgic_irq_lr_map[i] = LR_EMPTY; 1643 vgic_cpu->vgic_irq_lr_map[i] = LR_EMPTY;
1625 } 1644 }
1626 1645
1627 /*
1628 * By forcing VMCR to zero, the GIC will restore the binary
1629 * points to their reset values. Anything else resets to zero
1630 * anyway.
1631 */
1632 vgic_cpu->vgic_v2.vgic_vmcr = 0;
1633
1634 vgic_cpu->nr_lr = vgic_nr_lr; 1646 vgic_cpu->nr_lr = vgic_nr_lr;
1635 vgic_cpu->vgic_v2.vgic_hcr = GICH_HCR_EN; /* Get the show on the road... */ 1647
1648 vgic_enable(vcpu);
1636 1649
1637 return 0; 1650 return 0;
1638} 1651}