diff mbox series

[Xen-devel,RFC,47/49] ARM: new VGIC: Add vgic_v2_enable

Message ID 20180209143937.28866-48-andre.przywara@linaro.org
State New
Headers show
Series New VGIC(-v2) implementation | expand

Commit Message

Andre Przywara Feb. 9, 2018, 2:39 p.m. UTC
Enable the VGIC operation by properly initialising the registers
in the hypervisor GIC interface.

This is based on Linux commit f7b6985cc3d0, written by Eric Auger.

Signed-off-by: Andre Przywara <andre.przywara@linaro.org>
---
 xen/arch/arm/vgic/vgic-v2.c | 13 +++++++++++++
 xen/arch/arm/vgic/vgic.h    |  1 +
 2 files changed, 14 insertions(+)
diff mbox series

Patch

diff --git a/xen/arch/arm/vgic/vgic-v2.c b/xen/arch/arm/vgic/vgic-v2.c
index b5026bb050..16e9c8dbf0 100644
--- a/xen/arch/arm/vgic/vgic-v2.c
+++ b/xen/arch/arm/vgic/vgic-v2.c
@@ -202,6 +202,19 @@  void vgic_v2_clear_lr(struct vcpu *vcpu, int lr)
     vcpu->arch.vgic_cpu.vgic_v2.vgic_lr[lr] = 0;
 }
 
+void vgic_v2_enable(struct vcpu *vcpu)
+{
+    /*
+     * By forcing VMCR to zero, the GIC will restore the binary
+     * points to their reset values. Anything else resets to zero
+     * anyway.
+     */
+    vcpu->arch.vgic_cpu.vgic_v2.vgic_vmcr = 0;
+
+    /* Get the show on the road... */
+    vcpu->arch.vgic_cpu.vgic_v2.vgic_hcr = GICH_HCR_EN;
+}
+
 int vgic_v2_map_resources(struct domain *d)
 {
     struct vgic_dist *dist = &d->arch.vgic;
diff --git a/xen/arch/arm/vgic/vgic.h b/xen/arch/arm/vgic/vgic.h
index adb04f2f52..e28c002a9e 100644
--- a/xen/arch/arm/vgic/vgic.h
+++ b/xen/arch/arm/vgic/vgic.h
@@ -58,6 +58,7 @@  void vgic_v2_fold_lr_state(struct vcpu *vcpu);
 void vgic_v2_populate_lr(struct vcpu *vcpu, struct vgic_irq *irq, int lr);
 void vgic_v2_clear_lr(struct vcpu *vcpu, int lr);
 void vgic_v2_set_underflow(struct vcpu *vcpu);
+void vgic_v2_enable(struct vcpu *vcpu);
 int vgic_v2_map_resources(struct domain *d);
 int vgic_register_dist_iodev(struct domain *d, paddr_t dist_base_address,
                  enum vgic_type);