Add IRQCHIP_GICV5 and create KVM_DEV_TYPE_ARM_VGIC_V5 for it. GICv5 has no distributor or redistributor MMIO frame, so omit those address attributes. Also omit the GICv2 PPI CPU mask from GICv5 interrupt specifiers. Signed-off-by: Sascha Bischoff --- arm64/gic.c | 19 +++++++++++++++---- arm64/include/kvm/gic.h | 1 + 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/arm64/gic.c b/arm64/gic.c index f8371f50..5c8a33b5 100644 --- a/arm64/gic.c +++ b/arm64/gic.c @@ -189,6 +189,9 @@ static int gic__create_device(struct kvm *kvm, enum irqchip_type type) gic_device.type = KVM_DEV_TYPE_ARM_VGIC_V3; dist_attr.attr = KVM_VGIC_V3_ADDR_TYPE_DIST; break; + case IRQCHIP_GICV5: + gic_device.type = KVM_DEV_TYPE_ARM_VGIC_V5; + break; case IRQCHIP_AUTO: return -ENODEV; } @@ -208,15 +211,20 @@ static int gic__create_device(struct kvm *kvm, enum irqchip_type type) case IRQCHIP_GICV3: err = ioctl(gic_fd, KVM_SET_DEVICE_ATTR, &redist_attr); break; + case IRQCHIP_GICV5: + break; case IRQCHIP_AUTO: return -ENODEV; } if (err) goto out_err; - err = ioctl(gic_fd, KVM_SET_DEVICE_ATTR, &dist_attr); - if (err) - goto out_err; + /* Only set the dist_attr for non-GICv5 */ + if (type != IRQCHIP_GICV5) { + err = ioctl(gic_fd, KVM_SET_DEVICE_ATTR, &dist_attr); + if (err) + goto out_err; + } err = gic__create_msi_frame(kvm, type, gic_msi_base); if (err) @@ -290,6 +298,8 @@ int gic__create(struct kvm *kvm, enum irqchip_type type) gic_redists_base = ARM_GIC_DIST_BASE - gic_redists_size; gic_msi_base = gic_redists_base - gic_msi_size; break; + case IRQCHIP_GICV5: + break; default: return -ENODEV; } @@ -440,7 +450,8 @@ u32 gic__get_fdt_irq_cpumask(struct kvm *kvm) { /* Only for GICv2 */ if (kvm->cfg.arch.irqchip == IRQCHIP_GICV3 || - kvm->cfg.arch.irqchip == IRQCHIP_GICV3_ITS) + kvm->cfg.arch.irqchip == IRQCHIP_GICV3_ITS || + kvm->cfg.arch.irqchip == IRQCHIP_GICV5) return 0; if (kvm->nrcpus > 8) diff --git a/arm64/include/kvm/gic.h b/arm64/include/kvm/gic.h index 8490cca6..630f0bbd 100644 --- a/arm64/include/kvm/gic.h +++ b/arm64/include/kvm/gic.h @@ -29,6 +29,7 @@ enum irqchip_type { IRQCHIP_GICV2M, IRQCHIP_GICV3, IRQCHIP_GICV3_ITS, + IRQCHIP_GICV5, }; struct kvm; -- 2.34.1