Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

KVM: arm64: vgic-v5: Correctly set dist->ready once initialised

kvm_vgic_map_resources() targetting a v5 model results in vgic->dist_ready
never being set. This doesn't result in anything really bad, only
some more heavy locking as we go and re-init something for no good reason.

Rejig the code to correctly set the ready flag in all non-failing
cases.

Reviewed-by: Sascha Bischoff <sascha.bischoff@arm.com>
Fixes: f4d37c7c35769 ("KVM: arm64: gic-v5: Create and initialise vgic_v5")
Link: https://sashiko.dev/#/patchset/20260319154937.3619520-1-sascha.bischoff%40arm.com
Link: https://patch.msgid.link/20260401103611.357092-11-maz@kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>

+11 -7
+11 -7
arch/arm64/kvm/vgic/vgic-init.c
··· 657 657 needs_dist = false; 658 658 } 659 659 660 - if (ret || !needs_dist) 660 + if (ret) 661 661 goto out; 662 662 663 - dist_base = dist->vgic_dist_base; 664 - mutex_unlock(&kvm->arch.config_lock); 663 + if (needs_dist) { 664 + dist_base = dist->vgic_dist_base; 665 + mutex_unlock(&kvm->arch.config_lock); 665 666 666 - ret = vgic_register_dist_iodev(kvm, dist_base, type); 667 - if (ret) { 668 - kvm_err("Unable to register VGIC dist MMIO regions\n"); 669 - goto out_slots; 667 + ret = vgic_register_dist_iodev(kvm, dist_base, type); 668 + if (ret) { 669 + kvm_err("Unable to register VGIC dist MMIO regions\n"); 670 + goto out_slots; 671 + } 672 + } else { 673 + mutex_unlock(&kvm->arch.config_lock); 670 674 } 671 675 672 676 smp_store_release(&dist->ready, true);