Skip to contentSkip to conversation

hw/intc/arm_gic: Initialize the vgic in the realize function

PATCH Applied Eric Auger 2 participants 2 messages Mar 11, 2015 – Mar 12, 2015 KVM arm64

lore
Share & tools
lore

Eric Auger

author
#0 lore raw

PATCH v5 1/1 hw/intc/arm_gic: Initialize the vgic in the realize function

This patch forces vgic initialization in the vgic realize function. It uses a new group/attribute that allows such operation:
KVM_DEV_ARM_VGIC_GRP_CTRL/KVM_DEV_ARM_VGIC_CTRL_INIT

This earlier initialization allows, for example, to setup VFIO signaling and irqfd after vgic initialization, on a reset notifier.

---

v4 -> v5:
- add a comment to clarify what the new gic accesses aim at
- header sync removed. The series becomes a singleton.

v1 -> v2:
- The init is not mandated to be done in a machine init done notifier anymore since only the number of vcpus and number of IRQs must be known at init time.

---
 hw/intc/arm_gic_kvm.c | 7 +++++++
 1 file changed, 7 insertions(+)
hw/intc/arm_gic_kvm.c +7 -0
index 1ad3eb0..0d20750 100644
@@ -573,6 +573,13 @@ static void kvm_arm_gic_realize(DeviceState *dev, Error **errp)
         kvm_gic_access(s, KVM_DEV_ARM_VGIC_GRP_NR_IRQS, 0, 0, &numirqs, 1);
     }
 
+    /* Tell the kernel to complete VGIC initialization now */
+    if (kvm_gic_supports_attr(s, KVM_DEV_ARM_VGIC_GRP_CTRL,
+                              KVM_DEV_ARM_VGIC_CTRL_INIT)) {
+        kvm_gic_access(s, KVM_DEV_ARM_VGIC_GRP_CTRL,
+                          KVM_DEV_ARM_VGIC_CTRL_INIT, 0, 0, 1);
+    }
+
     /* Distributor */
     memory_region_init_reservation(&s->iomem, OBJECT(s),
                                    "kvm-gic_dist", 0x1000);
Signature · 1 line
1.8.3.2
#1 lore raw
Quoted 8 lines · Eric Auger

This patch forces vgic initialization in the vgic realize function. It uses a new group/attribute that allows such operation:
KVM_DEV_ARM_VGIC_GRP_CTRL/KVM_DEV_ARM_VGIC_CTRL_INIT

This earlier initialization allows, for example, to setup VFIO signaling and irqfd after vgic initialization, on a reset notifier.

Applied to target-arm.next, thanks.

-- PMM