Commit 583617b7 authored by Alexander Graf's avatar Alexander Graf Committed by Marcelo Tosatti

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: default avatarAlexander Graf <agraf@suse.de>
Acked-by: default avatarAcked-by: Hollis Blanchard <hollis@penguinppc.org>
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
parent 980da6ce
...@@ -125,11 +125,10 @@ void kvmppc_inject_interrupt(struct kvm_vcpu *vcpu, int vec, u64 flags) ...@@ -125,11 +125,10 @@ void kvmppc_inject_interrupt(struct kvm_vcpu *vcpu, int vec, u64 flags)
vcpu->arch.mmu.reset_msr(vcpu); vcpu->arch.mmu.reset_msr(vcpu);
} }
void kvmppc_book3s_queue_irqprio(struct kvm_vcpu *vcpu, unsigned int vec) static int kvmppc_book3s_vec2irqprio(unsigned int vec)
{ {
unsigned int prio; unsigned int prio;
vcpu->stat.queue_intr++;
switch (vec) { switch (vec) {
case 0x100: prio = BOOK3S_IRQPRIO_SYSTEM_RESET; break; case 0x100: prio = BOOK3S_IRQPRIO_SYSTEM_RESET; break;
case 0x200: prio = BOOK3S_IRQPRIO_MACHINE_CHECK; break; 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,7 +148,15 @@ void kvmppc_book3s_queue_irqprio(struct kvm_vcpu *vcpu, unsigned int vec)
default: prio = BOOK3S_IRQPRIO_MAX; break; default: prio = BOOK3S_IRQPRIO_MAX; break;
} }
set_bit(prio, &vcpu->arch.pending_exceptions); return prio;
}
void kvmppc_book3s_queue_irqprio(struct kvm_vcpu *vcpu, unsigned int vec)
{
vcpu->stat.queue_intr++;
set_bit(kvmppc_book3s_vec2irqprio(vec),
&vcpu->arch.pending_exceptions);
#ifdef EXIT_DEBUG #ifdef EXIT_DEBUG
printk(KERN_INFO "Queueing interrupt %x\n", vec); printk(KERN_INFO "Queueing interrupt %x\n", vec);
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment