Release 4.14 arch/x86/kvm/irq.c
/*
* irq.c: API for in kernel interrupt controller
* Copyright (c) 2007, Intel Corporation.
* Copyright 2009 Red Hat, Inc. and/or its affiliates.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 59 Temple
* Place - Suite 330, Boston, MA 02111-1307 USA.
* Authors:
* Yaozu (Eddie) Dong <Eddie.dong@intel.com>
*
*/
#include <linux/export.h>
#include <linux/kvm_host.h>
#include "irq.h"
#include "i8254.h"
#include "x86.h"
/*
* check if there are pending timer events
* to be processed.
*/
int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu)
{
if (lapic_in_kernel(vcpu))
return apic_has_pending_timer(vcpu);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Marcelo Tosatti | 15 | 57.69% | 1 | 33.33% |
Paolo Bonzini | 10 | 38.46% | 1 | 33.33% |
Jason (Hui) Wang | 1 | 3.85% | 1 | 33.33% |
Total | 26 | 100.00% | 3 | 100.00% |
EXPORT_SYMBOL(kvm_cpu_has_pending_timer);
/*
* check if there is a pending userspace external interrupt
*/
static int pending_userspace_extint(struct kvm_vcpu *v)
{
return v->arch.pending_external_vector != -1;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Steve Rutherford | 21 | 100.00% | 1 | 100.00% |
Total | 21 | 100.00% | 1 | 100.00% |
/*
* check if there is pending interrupt from
* non-APIC source without intack.
*/
static int kvm_cpu_has_extint(struct kvm_vcpu *v)
{
u8 accept = kvm_apic_accept_pic_intr(v);
if (accept) {
if (irqchip_split(v->kvm))
return pending_userspace_extint(v);
else
return v->kvm->arch.vpic->output;
} else
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Yang Zhang | 27 | 48.21% | 1 | 25.00% |
Steve Rutherford | 24 | 42.86% | 1 | 25.00% |
David Hildenbrand | 4 | 7.14% | 1 | 25.00% |
Eddie Dong | 1 | 1.79% | 1 | 25.00% |
Total | 56 | 100.00% | 4 | 100.00% |
/*
* check if there is injectable interrupt:
* when virtual interrupt delivery enabled,
* interrupt from apic will handled by hardware,
* we don't need to check it here.
*/
int kvm_cpu_has_injectable_intr(struct kvm_vcpu *v)
{
if (!lapic_in_kernel(v))
return v->arch.interrupt.pending;
if (kvm_cpu_has_extint(v))
return 1;
if (kvm_vcpu_apicv_active(v))
return 0;
return kvm_apic_has_interrupt(v) != -1; /* LAPIC */
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Yang Zhang | 22 | 38.60% | 1 | 11.11% |
Gleb Natapov | 17 | 29.82% | 3 | 33.33% |
Eddie Dong | 12 | 21.05% | 2 | 22.22% |
Qing He | 4 | 7.02% | 1 | 11.11% |
Andrey Smetanin | 1 | 1.75% | 1 | 11.11% |
Paolo Bonzini | 1 | 1.75% | 1 | 11.11% |
Total | 57 | 100.00% | 9 | 100.00% |
/*
* check if there is pending interrupt without
* intack.
*/
int kvm_cpu_has_interrupt(struct kvm_vcpu *v)
{
if (!lapic_in_kernel(v))
return v->arch.interrupt.pending;
if (kvm_cpu_has_extint(v))
return 1;
return kvm_apic_has_interrupt(v) != -1; /* LAPIC */
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Yang Zhang | 30 | 63.83% | 1 | 20.00% |
Eddie Dong | 9 | 19.15% | 2 | 40.00% |
Gleb Natapov | 7 | 14.89% | 1 | 20.00% |
Paolo Bonzini | 1 | 2.13% | 1 | 20.00% |
Total | 47 | 100.00% | 5 | 100.00% |
EXPORT_SYMBOL_GPL(kvm_cpu_has_interrupt);
/*
* Read pending interrupt(from non-APIC source)
* vector and intack.
*/
static int kvm_cpu_get_extint(struct kvm_vcpu *v)
{
if (kvm_cpu_has_extint(v)) {
if (irqchip_split(v->kvm)) {
int vector = v->arch.pending_external_vector;
v->arch.pending_external_vector = -1;
return vector;
} else
return kvm_pic_read_irq(v->kvm); /* PIC */
} else
return -1;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Steve Rutherford | 36 | 53.73% | 1 | 50.00% |
Yang Zhang | 31 | 46.27% | 1 | 50.00% |
Total | 67 | 100.00% | 2 | 100.00% |
/*
* Read pending interrupt vector and intack.
*/
int kvm_cpu_get_interrupt(struct kvm_vcpu *v)
{
int vector;
if (!lapic_in_kernel(v))
return v->arch.interrupt.nr;
vector = kvm_cpu_get_extint(v);
if (vector != -1)
return vector; /* PIC */
return kvm_get_apic_interrupt(v); /* APIC */
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Gleb Natapov | 25 | 45.45% | 3 | 42.86% |
Yang Zhang | 14 | 25.45% | 1 | 14.29% |
Eddie Dong | 12 | 21.82% | 1 | 14.29% |
Qing He | 3 | 5.45% | 1 | 14.29% |
Paolo Bonzini | 1 | 1.82% | 1 | 14.29% |
Total | 55 | 100.00% | 7 | 100.00% |
EXPORT_SYMBOL_GPL(kvm_cpu_get_interrupt);
void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu)
{
if (lapic_in_kernel(vcpu))
kvm_inject_apic_timer_irqs(vcpu);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Eddie Dong | 15 | 68.18% | 1 | 50.00% |
Paolo Bonzini | 7 | 31.82% | 1 | 50.00% |
Total | 22 | 100.00% | 2 | 100.00% |
EXPORT_SYMBOL_GPL(kvm_inject_pending_timer_irqs);
void __kvm_migrate_timers(struct kvm_vcpu *vcpu)
{
__kvm_migrate_apic_timer(vcpu);
__kvm_migrate_pit_timer(vcpu);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Marcelo Tosatti | 20 | 100.00% | 1 | 100.00% |
Total | 20 | 100.00% | 1 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Yang Zhang | 128 | 30.92% | 1 | 4.55% |
Steve Rutherford | 82 | 19.81% | 1 | 4.55% |
Eddie Dong | 65 | 15.70% | 3 | 13.64% |
Gleb Natapov | 52 | 12.56% | 3 | 13.64% |
Marcelo Tosatti | 41 | 9.90% | 2 | 9.09% |
Paolo Bonzini | 20 | 4.83% | 2 | 9.09% |
Qing He | 7 | 1.69% | 1 | 4.55% |
Bandan Das | 5 | 1.21% | 1 | 4.55% |
David Hildenbrand | 4 | 0.97% | 1 | 4.55% |
Sheng Yang | 3 | 0.72% | 1 | 4.55% |
Xiantao Zhang | 2 | 0.48% | 1 | 4.55% |
Avi Kivity | 1 | 0.24% | 1 | 4.55% |
Jason (Hui) Wang | 1 | 0.24% | 1 | 4.55% |
Paul Gortmaker | 1 | 0.24% | 1 | 4.55% |
Andrey Smetanin | 1 | 0.24% | 1 | 4.55% |
Nicolas Kaiser | 1 | 0.24% | 1 | 4.55% |
Total | 414 | 100.00% | 22 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.