aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Zyngier <marc.zyngier@arm.com>2012-10-05 08:42:45 -0400
committerChristoffer Dall <cdall@cs.columbia.edu>2013-03-06 18:48:45 -0500
commit6190920a35068a621570cca7f07f3c4477615176 (patch)
treefb16f02b272f5b2e554c4ee9c6d965a5e790ff84
parent48762767e1c150d58c250650f8202b7d4ad65ec4 (diff)
ARM: KVM: move kvm_handle_wfi to handle_exit.c
It has little to do in emulate.c these days... Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
-rw-r--r--arch/arm/include/asm/kvm_emulate.h1
-rw-r--r--arch/arm/kvm/emulate.c16
-rw-r--r--arch/arm/kvm/handle_exit.c19
3 files changed, 19 insertions, 17 deletions
diff --git a/arch/arm/include/asm/kvm_emulate.h b/arch/arm/include/asm/kvm_emulate.h
index 9cb2fe17cf3a..82b4babead2c 100644
--- a/arch/arm/include/asm/kvm_emulate.h
+++ b/arch/arm/include/asm/kvm_emulate.h
@@ -27,7 +27,6 @@
27unsigned long *vcpu_reg(struct kvm_vcpu *vcpu, u8 reg_num); 27unsigned long *vcpu_reg(struct kvm_vcpu *vcpu, u8 reg_num);
28unsigned long *vcpu_spsr(struct kvm_vcpu *vcpu); 28unsigned long *vcpu_spsr(struct kvm_vcpu *vcpu);
29 29
30int kvm_handle_wfi(struct kvm_vcpu *vcpu, struct kvm_run *run);
31bool kvm_condition_valid(struct kvm_vcpu *vcpu); 30bool kvm_condition_valid(struct kvm_vcpu *vcpu);
32void kvm_skip_instr(struct kvm_vcpu *vcpu, bool is_wide_instr); 31void kvm_skip_instr(struct kvm_vcpu *vcpu, bool is_wide_instr);
33void kvm_inject_undefined(struct kvm_vcpu *vcpu); 32void kvm_inject_undefined(struct kvm_vcpu *vcpu);
diff --git a/arch/arm/kvm/emulate.c b/arch/arm/kvm/emulate.c
index 04dbac6bdf4d..bdede9e7da51 100644
--- a/arch/arm/kvm/emulate.c
+++ b/arch/arm/kvm/emulate.c
@@ -161,22 +161,6 @@ unsigned long *vcpu_spsr(struct kvm_vcpu *vcpu)
161 } 161 }
162} 162}
163 163
164/**
165 * kvm_handle_wfi - handle a wait-for-interrupts instruction executed by a guest
166 * @vcpu: the vcpu pointer
167 * @run: the kvm_run structure pointer
168 *
169 * Simply sets the wait_for_interrupts flag on the vcpu structure, which will
170 * halt execution of world-switches and schedule other host processes until
171 * there is an incoming IRQ or FIQ to the VM.
172 */
173int kvm_handle_wfi(struct kvm_vcpu *vcpu, struct kvm_run *run)
174{
175 trace_kvm_wfi(*vcpu_pc(vcpu));
176 kvm_vcpu_block(vcpu);
177 return 1;
178}
179
180/* 164/*
181 * A conditional instruction is allowed to trap, even though it 165 * A conditional instruction is allowed to trap, even though it
182 * wouldn't be executed. So let's re-implement the hardware, in 166 * wouldn't be executed. So let's re-implement the hardware, in
diff --git a/arch/arm/kvm/handle_exit.c b/arch/arm/kvm/handle_exit.c
index 301301808c4e..26ad17310a1e 100644
--- a/arch/arm/kvm/handle_exit.c
+++ b/arch/arm/kvm/handle_exit.c
@@ -22,6 +22,9 @@
22#include <asm/kvm_coproc.h> 22#include <asm/kvm_coproc.h>
23#include <asm/kvm_mmu.h> 23#include <asm/kvm_mmu.h>
24#include <asm/kvm_psci.h> 24#include <asm/kvm_psci.h>
25#include <trace/events/kvm.h>
26
27#include "trace.h"
25 28
26#include "trace.h" 29#include "trace.h"
27 30
@@ -72,6 +75,22 @@ static int handle_dabt_hyp(struct kvm_vcpu *vcpu, struct kvm_run *run)
72 return -EFAULT; 75 return -EFAULT;
73} 76}
74 77
78/**
79 * kvm_handle_wfi - handle a wait-for-interrupts instruction executed by a guest
80 * @vcpu: the vcpu pointer
81 * @run: the kvm_run structure pointer
82 *
83 * Simply sets the wait_for_interrupts flag on the vcpu structure, which will
84 * halt execution of world-switches and schedule other host processes until
85 * there is an incoming IRQ or FIQ to the VM.
86 */
87static int kvm_handle_wfi(struct kvm_vcpu *vcpu, struct kvm_run *run)
88{
89 trace_kvm_wfi(*vcpu_pc(vcpu));
90 kvm_vcpu_block(vcpu);
91 return 1;
92}
93
75static exit_handle_fn arm_exit_handlers[] = { 94static exit_handle_fn arm_exit_handlers[] = {
76 [HSR_EC_WFI] = kvm_handle_wfi, 95 [HSR_EC_WFI] = kvm_handle_wfi,
77 [HSR_EC_CP15_32] = kvm_handle_cp15_32, 96 [HSR_EC_CP15_32] = kvm_handle_cp15_32,