aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2009-12-21 14:21:23 -0500
committerMarcelo Tosatti <mtosatti@redhat.com>2010-03-01 10:35:41 -0500
commit583617b7866cfcc0b3830a4b7ab20f218d180f67 (patch)
tree9be91415974c7e1aa8e1486b5e20e0b734daddaa
parent980da6ce573b7c40886406674ff8f022a975e65e (diff)
KVM: powerpc: Move vector to irqprio resolving to separate function
We're using a switch table to find the irqprio that belongs to a specific interrupt vector. This table is part of the interrupt inject logic. Since we'll add a new function to stop interrupts, let's move this table out of the injection logic into a separate function. Signed-off-by: Alexander Graf <agraf@suse.de> Acked-by: Acked-by: Hollis Blanchard <hollis@penguinppc.org> Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r--arch/powerpc/kvm/book3s.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
index 3e294bd9b8c6..241795bdf34c 100644
--- a/arch/powerpc/kvm/book3s.c
+++ b/arch/powerpc/kvm/book3s.c
@@ -125,11 +125,10 @@ void kvmppc_inject_interrupt(struct kvm_vcpu *vcpu, int vec, u64 flags)
125 vcpu->arch.mmu.reset_msr(vcpu); 125 vcpu->arch.mmu.reset_msr(vcpu);
126} 126}
127 127
128void kvmppc_book3s_queue_irqprio(struct kvm_vcpu *vcpu, unsigned int vec) 128static int kvmppc_book3s_vec2irqprio(unsigned int vec)
129{ 129{
130 unsigned int prio; 130 unsigned int prio;
131 131
132 vcpu->stat.queue_intr++;
133 switch (vec) { 132 switch (vec) {
134 case 0x100: prio = BOOK3S_IRQPRIO_SYSTEM_RESET; break; 133 case 0x100: prio = BOOK3S_IRQPRIO_SYSTEM_RESET; break;
135 case 0x200: prio = BOOK3S_IRQPRIO_MACHINE_CHECK; break; 134 case 0x200: prio = BOOK3S_IRQPRIO_MACHINE_CHECK; break;
@@ -149,7 +148,15 @@ void kvmppc_book3s_queue_irqprio(struct kvm_vcpu *vcpu, unsigned int vec)
149 default: prio = BOOK3S_IRQPRIO_MAX; break; 148 default: prio = BOOK3S_IRQPRIO_MAX; break;
150 } 149 }
151 150
152 set_bit(prio, &vcpu->arch.pending_exceptions); 151 return prio;
152}
153
154void kvmppc_book3s_queue_irqprio(struct kvm_vcpu *vcpu, unsigned int vec)
155{
156 vcpu->stat.queue_intr++;
157
158 set_bit(kvmppc_book3s_vec2irqprio(vec),
159 &vcpu->arch.pending_exceptions);
153#ifdef EXIT_DEBUG 160#ifdef EXIT_DEBUG
154 printk(KERN_INFO "Queueing interrupt %x\n", vec); 161 printk(KERN_INFO "Queueing interrupt %x\n", vec);
155#endif 162#endif