diff options
Diffstat (limited to 'arch/x86/kvm/svm.c')
-rw-r--r-- | arch/x86/kvm/svm.c | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 5b35ebd4ec88..aa528dbad070 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include "irq.h" | 19 | #include "irq.h" |
20 | #include "mmu.h" | 20 | #include "mmu.h" |
21 | #include "kvm_cache_regs.h" | 21 | #include "kvm_cache_regs.h" |
22 | #include "x86.h" | ||
22 | 23 | ||
23 | #include <linux/module.h> | 24 | #include <linux/module.h> |
24 | #include <linux/kernel.h> | 25 | #include <linux/kernel.h> |
@@ -132,24 +133,6 @@ static inline u32 svm_has(u32 feat) | |||
132 | return svm_features & feat; | 133 | return svm_features & feat; |
133 | } | 134 | } |
134 | 135 | ||
135 | static inline u8 pop_irq(struct kvm_vcpu *vcpu) | ||
136 | { | ||
137 | int word_index = __ffs(vcpu->arch.irq_summary); | ||
138 | int bit_index = __ffs(vcpu->arch.irq_pending[word_index]); | ||
139 | int irq = word_index * BITS_PER_LONG + bit_index; | ||
140 | |||
141 | clear_bit(bit_index, &vcpu->arch.irq_pending[word_index]); | ||
142 | if (!vcpu->arch.irq_pending[word_index]) | ||
143 | clear_bit(word_index, &vcpu->arch.irq_summary); | ||
144 | return irq; | ||
145 | } | ||
146 | |||
147 | static inline void push_irq(struct kvm_vcpu *vcpu, u8 irq) | ||
148 | { | ||
149 | set_bit(irq, vcpu->arch.irq_pending); | ||
150 | set_bit(irq / BITS_PER_LONG, &vcpu->arch.irq_summary); | ||
151 | } | ||
152 | |||
153 | static inline void clgi(void) | 136 | static inline void clgi(void) |
154 | { | 137 | { |
155 | asm volatile (__ex(SVM_CLGI)); | 138 | asm volatile (__ex(SVM_CLGI)); |
@@ -1116,7 +1099,7 @@ static int pf_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run) | |||
1116 | if (!irqchip_in_kernel(kvm) && | 1099 | if (!irqchip_in_kernel(kvm) && |
1117 | is_external_interrupt(exit_int_info)) { | 1100 | is_external_interrupt(exit_int_info)) { |
1118 | event_injection = true; | 1101 | event_injection = true; |
1119 | push_irq(&svm->vcpu, exit_int_info & SVM_EVTINJ_VEC_MASK); | 1102 | kvm_push_irq(&svm->vcpu, exit_int_info & SVM_EVTINJ_VEC_MASK); |
1120 | } | 1103 | } |
1121 | 1104 | ||
1122 | fault_address = svm->vmcb->control.exit_info_2; | 1105 | fault_address = svm->vmcb->control.exit_info_2; |
@@ -2336,7 +2319,7 @@ static void kvm_reput_irq(struct vcpu_svm *svm) | |||
2336 | if ((control->int_ctl & V_IRQ_MASK) | 2319 | if ((control->int_ctl & V_IRQ_MASK) |
2337 | && !irqchip_in_kernel(svm->vcpu.kvm)) { | 2320 | && !irqchip_in_kernel(svm->vcpu.kvm)) { |
2338 | control->int_ctl &= ~V_IRQ_MASK; | 2321 | control->int_ctl &= ~V_IRQ_MASK; |
2339 | push_irq(&svm->vcpu, control->int_vector); | 2322 | kvm_push_irq(&svm->vcpu, control->int_vector); |
2340 | } | 2323 | } |
2341 | 2324 | ||
2342 | svm->vcpu.arch.interrupt_window_open = | 2325 | svm->vcpu.arch.interrupt_window_open = |
@@ -2346,7 +2329,7 @@ static void kvm_reput_irq(struct vcpu_svm *svm) | |||
2346 | 2329 | ||
2347 | static void svm_do_inject_vector(struct vcpu_svm *svm) | 2330 | static void svm_do_inject_vector(struct vcpu_svm *svm) |
2348 | { | 2331 | { |
2349 | svm_inject_irq(svm, pop_irq(&svm->vcpu)); | 2332 | svm_inject_irq(svm, kvm_pop_irq(&svm->vcpu)); |
2350 | } | 2333 | } |
2351 | 2334 | ||
2352 | static void do_interrupt_requests(struct kvm_vcpu *vcpu, | 2335 | static void do_interrupt_requests(struct kvm_vcpu *vcpu, |