@@ -663,6 +663,11 @@ static void create_gic(VirtMachineState *vms)
qdev_prop_set_uint32(vms->gic, "redist-region-count[1]",
MIN(smp_cpus - redist0_count, redist1_capacity));
}
+
+ if (kvm_irqchip_in_kernel()) {
+ bool el2 = object_property_get_bool(OBJECT(first_cpu), "el2", NULL);
+ qdev_prop_set_bit(vms->gic, "has-virtualization-extensions", el2);
+ }
} else {
if (!kvm_irqchip_in_kernel()) {
qdev_prop_set_bit(vms->gic, "has-virtualization-extensions",
@@ -495,6 +495,7 @@ static Property arm_gicv3_common_properties[] = {
DEFINE_PROP_UINT32("num-irq", GICv3State, num_irq, 32),
DEFINE_PROP_UINT32("revision", GICv3State, revision, 3),
DEFINE_PROP_BOOL("has-security-extensions", GICv3State, security_extn, 0),
+ DEFINE_PROP_BOOL("has-virtualization-extensions", GICv3State, virt_extn, 0),
DEFINE_PROP_ARRAY("redist-region-count", GICv3State, nb_redist_regions,
redist_region_count, qdev_prop_uint32, uint32_t),
DEFINE_PROP_END_OF_LIST(),
@@ -826,6 +826,22 @@ static void kvm_arm_gicv3_realize(DeviceState *dev, Error **errp)
kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_CTRL,
KVM_DEV_ARM_VGIC_CTRL_INIT, NULL, true, &error_abort);
+ if (s->virt_extn) {
+ bool maint_irq_allowed;
+ uint32_t maint_irq = 25;
+
+ maint_irq_allowed =
+ kvm_device_check_attr(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_MAINT_IRQ, 0);
+ if (!maint_irq_allowed) {
+ error_setg(errp, "VGICv3 setting maintenance IRQ are not "
+ "supported by this host kernel");
+ return;
+ }
+
+ kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_MAINT_IRQ,
+ 0, &maint_irq, true, &error_abort);
+ }
+
kvm_arm_register_device(&s->iomem_dist, -1, KVM_DEV_ARM_VGIC_GRP_ADDR,
KVM_VGIC_V3_ADDR_TYPE_DIST, s->dev_fd, 0);
@@ -220,6 +220,7 @@ struct GICv3State {
uint32_t num_irq;
uint32_t revision;
bool security_extn;
+ bool virt_extn;
bool irq_reset_nonsecure;
bool gicd_no_migration_shift_bug;
Using the new VGIC KVM device attribute to set the maintenance IRQ. This is fixed to use IRQ 25(PPI 9), as a platform decision matching the arm64 SBSA recommendation. Signed-off-by: Haibo Xu <haibo.xu@linaro.org> --- hw/arm/virt.c | 5 +++++ hw/intc/arm_gicv3_common.c | 1 + hw/intc/arm_gicv3_kvm.c | 16 ++++++++++++++++ include/hw/intc/arm_gicv3_common.h | 1 + 4 files changed, 23 insertions(+)