Skip to content

Commit 7943f4a

Browse files
committed
KVM: SVM: allocate AVIC data structures based on kvm_amd module parameter
Even if APICv is disabled at startup, the backing page and ir_list need to be initialized in case they are needed later. The only case in which this can be skipped is for userspace irqchip, and that must be done because avic_init_backing_page dereferences vcpu->arch.apic (which is NULL for userspace irqchip). Tested-by: [email protected] Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=206579 Reviewed-by: Miaohe Lin <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent a93236f commit 7943f4a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/x86/kvm/svm.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2194,8 +2194,9 @@ static void svm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event)
21942194
static int avic_init_vcpu(struct vcpu_svm *svm)
21952195
{
21962196
int ret;
2197+
struct kvm_vcpu *vcpu = &svm->vcpu;
21972198

2198-
if (!kvm_vcpu_apicv_active(&svm->vcpu))
2199+
if (!avic || !irqchip_in_kernel(vcpu->kvm))
21992200
return 0;
22002201

22012202
ret = avic_init_backing_page(&svm->vcpu);

0 commit comments

Comments
 (0)