Skip to content

Commit f8f85dc

Browse files
committed
KVM: arm64: Fix GICv4 init when called from vgic_its_create
Commit 3d1ad64 ("KVM: arm/arm64: Fix GICv4 ITS initialization issues") moved the vgic_supports_direct_msis() check in vgic_v4_init(). However when vgic_v4_init is called from vgic_its_create(), the has_its field is not yet set. Hence vgic_supports_direct_msis returns false and vgic_v4_init does nothing. The gic/its init sequence is a bit messy, so let's be specific about the prerequisite checks in the various call paths instead of relying on a common wrapper. Fixes: 3d1ad64 ("KVM: arm/arm64: Fix GICv4 ITS initialization issues") Reported-by: Eric Auger <[email protected]> Signed-off-by: Christoffer Dall <[email protected]>
1 parent c507bab commit f8f85dc

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

virt/kvm/arm/vgic/vgic-init.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,11 @@ int vgic_init(struct kvm *kvm)
285285
if (ret)
286286
goto out;
287287

288-
ret = vgic_v4_init(kvm);
289-
if (ret)
290-
goto out;
288+
if (vgic_has_its(kvm)) {
289+
ret = vgic_v4_init(kvm);
290+
if (ret)
291+
goto out;
292+
}
291293

292294
kvm_for_each_vcpu(i, vcpu, kvm)
293295
kvm_vgic_vcpu_enable(vcpu);

virt/kvm/arm/vgic/vgic-v4.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ int vgic_v4_init(struct kvm *kvm)
118118
struct kvm_vcpu *vcpu;
119119
int i, nr_vcpus, ret;
120120

121-
if (!vgic_supports_direct_msis(kvm))
121+
if (!kvm_vgic_global_state.has_gicv4)
122122
return 0; /* Nothing to see here... move along. */
123123

124124
if (dist->its_vm.vpes)

0 commit comments

Comments
 (0)