Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1376285

Re: [PART1 RFC v4 07/11] svm: Add interrupt injection via AVIC

From Radim Krčmář <rkrcmar@redhat.com>
Newsgroups linux.kernel
Subject Re: [PART1 RFC v4 07/11] svm: Add interrupt injection via AVIC
Date 2016-04-11 23:00 +0200
Message-ID <rmR6a-3xa-9@gated-at.bofh.it> (permalink)
References <rldu9-10J-3@gated-at.bofh.it> <rldua-10J-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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@amd.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. ;])

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PART1 RFC v4 07/11] svm: Add interrupt injection via AVIC Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> - 2016-04-07 10:30 +0200
  Re: [PART1 RFC v4 07/11] svm: Add interrupt injection via AVIC Radim Krčmář <rkrcmar@redhat.com> - 2016-04-11 23:00 +0200

csiph-web