aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/lapic.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/kvm/lapic.c')
-rw-r--r--drivers/kvm/lapic.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/kvm/lapic.c b/drivers/kvm/lapic.c
index df636bf19798..68bbbb38edad 100644
--- a/drivers/kvm/lapic.c
+++ b/drivers/kvm/lapic.c
@@ -170,6 +170,19 @@ static inline int apic_find_highest_irr(struct kvm_lapic *apic)
170 return result; 170 return result;
171} 171}
172 172
173int kvm_lapic_find_highest_irr(struct kvm_vcpu *vcpu)
174{
175 struct kvm_lapic *apic = (struct kvm_lapic *)vcpu->apic;
176 int highest_irr;
177
178 if (!apic)
179 return 0;
180 highest_irr = apic_find_highest_irr(apic);
181
182 return highest_irr;
183}
184EXPORT_SYMBOL_GPL(kvm_lapic_find_highest_irr);
185
173int kvm_apic_set_irq(struct kvm_lapic *apic, u8 vec, u8 trig) 186int kvm_apic_set_irq(struct kvm_lapic *apic, u8 vec, u8 trig)
174{ 187{
175 if (!apic_test_and_set_irr(vec, apic)) { 188 if (!apic_test_and_set_irr(vec, apic)) {
@@ -483,6 +496,7 @@ static u32 __apic_read(struct kvm_lapic *apic, unsigned int offset)
483 break; 496 break;
484 497
485 default: 498 default:
499 apic_update_ppr(apic);
486 val = apic_get_reg(apic, offset); 500 val = apic_get_reg(apic, offset);
487 break; 501 break;
488 } 502 }
@@ -723,6 +737,7 @@ u64 kvm_lapic_get_cr8(struct kvm_vcpu *vcpu)
723 737
724 return (tpr & 0xf0) >> 4; 738 return (tpr & 0xf0) >> 4;
725} 739}
740EXPORT_SYMBOL_GPL(kvm_lapic_get_cr8);
726 741
727void kvm_lapic_set_base(struct kvm_vcpu *vcpu, u64 value) 742void kvm_lapic_set_base(struct kvm_vcpu *vcpu, u64 value)
728{ 743{
@@ -809,6 +824,7 @@ int kvm_lapic_enabled(struct kvm_vcpu *vcpu)
809 824
810 return ret; 825 return ret;
811} 826}
827EXPORT_SYMBOL_GPL(kvm_lapic_enabled);
812 828
813/* 829/*
814 *---------------------------------------------------------------------- 830 *----------------------------------------------------------------------
@@ -911,6 +927,7 @@ int kvm_apic_has_interrupt(struct kvm_vcpu *vcpu)
911 if (!apic || !apic_enabled(apic)) 927 if (!apic || !apic_enabled(apic))
912 return -1; 928 return -1;
913 929
930 apic_update_ppr(apic);
914 highest_irr = apic_find_highest_irr(apic); 931 highest_irr = apic_find_highest_irr(apic);
915 if ((highest_irr == -1) || 932 if ((highest_irr == -1) ||
916 ((highest_irr & 0xF0) <= apic_get_reg(apic, APIC_PROCPRI))) 933 ((highest_irr & 0xF0) <= apic_get_reg(apic, APIC_PROCPRI)))