Skip to content

Commit

Permalink
KVM: SVM: allocate AVIC data structures based on kvm_amd module param…
Browse files Browse the repository at this point in the history
…eter

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: rmuncrief@humanavance.com
Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=206579
Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
Paolo Bonzini committed Feb 28, 2020
1 parent a93236f commit 7943f4a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion arch/x86/kvm/svm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2194,8 +2194,9 @@ static void svm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event)
static int avic_init_vcpu(struct vcpu_svm *svm)
{
int ret;
struct kvm_vcpu *vcpu = &svm->vcpu;

if (!kvm_vcpu_apicv_active(&svm->vcpu))
if (!avic || !irqchip_in_kernel(vcpu->kvm))
return 0;

ret = avic_init_backing_page(&svm->vcpu);
Expand Down

0 comments on commit 7943f4a

Please sign in to comment.