diff mbox series

[XEN,v2,10/25] arm: new VGIC: Add vgic_v3_enable

Message ID 60813d95cee1619888864a76cf398b8b41c854b4.1699618395.git.mykyta_poturai@epam.com (mailing list archive)
State New, archived
Headers show
Series arm: Add GICv3 support to the New VGIC | expand

Commit Message

Mykyta Poturai Nov. 10, 2023, 12:56 p.m. UTC
Enable the VGIC operation by properly initialising the registers
in the hypervisor GIC interface.

This is based on Linux commit f7b6985cc3d0f by Eric Auger

Signed-off-by: Mykyta Poturai <mykyta_poturai@epam.com>
---
 xen/arch/arm/vgic/vgic-init.c | 5 +++++
 xen/arch/arm/vgic/vgic-v3.c   | 6 ++++++
 xen/arch/arm/vgic/vgic.h      | 4 ++++
 3 files changed, 15 insertions(+)
diff mbox series

Patch

diff --git a/xen/arch/arm/vgic/vgic-init.c b/xen/arch/arm/vgic/vgic-init.c
index ca13cf385c..96f6669d38 100644
--- a/xen/arch/arm/vgic/vgic-init.c
+++ b/xen/arch/arm/vgic/vgic-init.c
@@ -209,9 +209,14 @@  int vcpu_vgic_init(struct vcpu *v)
     vgic_vcpu_early_init(v);
 
     if ( gic_hw_version() == GIC_V2 )
+    {
         vgic_v2_enable(v);
+    }
     else
+    {
         vgic_register_redist_iodev(v);
+        vgic_v3_enable(v);
+    }
 
     return ret;
 }
diff --git a/xen/arch/arm/vgic/vgic-v3.c b/xen/arch/arm/vgic/vgic-v3.c
index 470bb63147..682d57b476 100644
--- a/xen/arch/arm/vgic/vgic-v3.c
+++ b/xen/arch/arm/vgic/vgic-v3.c
@@ -244,6 +244,12 @@  unsigned int vgic_v3_max_rdist_count(const struct domain *d)
                                      : GUEST_GICV3_RDIST_REGIONS;
 }
 
+void vgic_v3_enable(struct vcpu *vcpu)
+{
+    /* Get the show on the road... */
+    gic_hw_ops->update_hcr_status(GICH_HCR_EN, true);
+}
+
 int vgic_v3_map_resources(struct domain *d)
 {
     int rdist_count, i, ret;
diff --git a/xen/arch/arm/vgic/vgic.h b/xen/arch/arm/vgic/vgic.h
index 7dbadf7501..791c91ebb3 100644
--- a/xen/arch/arm/vgic/vgic.h
+++ b/xen/arch/arm/vgic/vgic.h
@@ -74,6 +74,7 @@  int vgic_register_dist_iodev(struct domain *d, gfn_t dist_base_fn,
 #ifdef CONFIG_GICV3
 void vgic_v3_fold_lr_state(struct vcpu *vcpu);
 void vgic_v3_populate_lr(struct vcpu *vcpu, struct vgic_irq *irq, int lr);
+void vgic_v3_enable(struct vcpu *vcpu);
 int vgic_v3_map_resources(struct domain *d);
 bool vgic_v3_emulate_reg(struct cpu_user_regs *regs, union hsr hsr);
 unsigned int vgic_v3_init_dist_iodev(struct vgic_io_device *dev);
@@ -86,6 +87,9 @@  static inline void vgic_v3_fold_lr_state(struct vcpu *vcpu)
 static inline void vgic_v3_populate_lr(struct vcpu *vcpu, struct vgic_irq *irq, int lr)
 {
 }
+static inline void vgic_v3_enable(struct vcpu *vcpu)
+{
+}
 static inline int vgic_v3_map_resources(struct domain *d)
 {
     return 0;