[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160411205204.GA9442@potion.brq.redhat.com>
Date: Mon, 11 Apr 2016 22:52:04 +0200
From: Radim Krčmář <rkrcmar@...hat.com>
To: Suravee Suthikulpanit <Suravee.Suthikulpanit@....com>
Cc: pbonzini@...hat.com, joro@...tes.org, bp@...en8.de,
gleb@...nel.org, alex.williamson@...hat.com, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, wei@...hat.com,
sherry.hurwitz@....com
Subject: Re: [PART1 RFC v4 07/11] svm: Add interrupt injection via AVIC
2016-04-07 03:20-0500, Suravee Suthikulpanit:
> This patch introduces a new mechanism to inject interrupt using AVIC.
> Since VINTR is not supported when enable AVIC, we need to inject
> interrupt via APIC backing page instead.
>
> This patch also adds support for AVIC doorbell, which is used by
> KVM to signal a running vcpu to check IRR for injected interrupts.
>
> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@....com>
> ---
> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> @@ -216,6 +218,8 @@ static bool npt_enabled = true;
> +static struct kvm_x86_ops svm_x86_ops;
> @@ -963,6 +979,8 @@ static __init int svm_hardware_setup(void)
>
> if (avic) {
> printk(KERN_INFO "kvm: AVIC enabled\n");
> + } else {
> + svm_x86_ops.deliver_posted_interrupt = NULL;
(No need to NULL this. deliver_posted_interrupt cannot be used to
determine whether avic is should be used, so we can keep it !NULL.
Declaration of svm_x86_ops can be omitted then.)
> @@ -2883,8 +2901,10 @@ static int clgi_interception(struct vcpu_svm *svm)
> disable_gif(svm);
>
> /* After a CLGI no interrupts should come */
> - svm_clear_vintr(svm);
> - svm->vmcb->control.int_ctl &= ~V_IRQ_MASK;
> + if (!svm_vcpu_avic_enabled(svm)) {
> + svm_clear_vintr(svm);
> + svm->vmcb->control.int_ctl &= ~V_IRQ_MASK;
> + }
>
> mark_dirty(svm->vmcb, VMCB_INTR);
mark_dirty also belongs to the if, because avic doesn't touch vmcb.
> @@ -3854,6 +3875,20 @@ static void svm_sync_pir_to_irr(struct kvm_vcpu *vcpu)
> +static void svm_deliver_avic_intr(struct kvm_vcpu *vcpu, int vec)
> +{
> + struct vcpu_svm *svm = to_svm(vcpu);
> +
> + kvm_lapic_set_irr(vec, svm->vcpu.arch.apic);
(vcpu->arch.apic would work too. ;])
Powered by blists - more mailing lists