Skip to content

Commit 1caa71a

Browse files
author
Marc Zyngier
committed
KVM: arm64: Restore GICv2-on-GICv3 functionality
When reworking the vgic locking, the vgic distributor registration got simplified, which was a very good cleanup. But just a tad too radical, as we now register the *native* vgic only, ignoring the GICv2-on-GICv3 that allows pre-historic VMs (or so I thought) to run. As it turns out, QEMU still defaults to GICv2 in some cases, and this breaks Nathan's setup! Fix it by propagating the *requested* vgic type rather than the host's version. Fixes: 59112e9 ("KVM: arm64: vgic: Fix a circular locking issue") Reported-by: Nathan Chancellor <[email protected]> Tested-by: Nathan Chancellor <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> link: https://lore.kernel.org/r/[email protected]
1 parent 0c2f9ac commit 1caa71a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

arch/arm64/kvm/vgic/vgic-init.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,7 @@ int vgic_lazy_init(struct kvm *kvm)
446446
int kvm_vgic_map_resources(struct kvm *kvm)
447447
{
448448
struct vgic_dist *dist = &kvm->arch.vgic;
449+
enum vgic_type type;
449450
gpa_t dist_base;
450451
int ret = 0;
451452

@@ -460,10 +461,13 @@ int kvm_vgic_map_resources(struct kvm *kvm)
460461
if (!irqchip_in_kernel(kvm))
461462
goto out;
462463

463-
if (dist->vgic_model == KVM_DEV_TYPE_ARM_VGIC_V2)
464+
if (dist->vgic_model == KVM_DEV_TYPE_ARM_VGIC_V2) {
464465
ret = vgic_v2_map_resources(kvm);
465-
else
466+
type = VGIC_V2;
467+
} else {
466468
ret = vgic_v3_map_resources(kvm);
469+
type = VGIC_V3;
470+
}
467471

468472
if (ret) {
469473
__kvm_vgic_destroy(kvm);
@@ -473,8 +477,7 @@ int kvm_vgic_map_resources(struct kvm *kvm)
473477
dist_base = dist->vgic_dist_base;
474478
mutex_unlock(&kvm->arch.config_lock);
475479

476-
ret = vgic_register_dist_iodev(kvm, dist_base,
477-
kvm_vgic_global_state.type);
480+
ret = vgic_register_dist_iodev(kvm, dist_base, type);
478481
if (ret) {
479482
kvm_err("Unable to register VGIC dist MMIO regions\n");
480483
kvm_vgic_destroy(kvm);

0 commit comments

Comments
 (0)