| 1 |
/* |
| 2 |
* This file is subject to the terms and conditions of the GNU General Public |
| 3 |
* License. See the file "COPYING" in the main directory of this archive |
| 4 |
* for more details. |
| 5 |
* |
| 6 |
* KVM/MIPS: Interrupt delivery |
| 7 |
* |
| 8 |
* Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved. |
| 9 |
* Authors: Sanjay Lal <[email protected]> |
| 10 |
*/ |
| 11 |
|
| 12 |
#include <linux/errno.h> |
| 13 |
#include <linux/err.h> |
| 14 |
#include <linux/vmalloc.h> |
| 15 |
#include <linux/fs.h> |
| 16 |
#include <linux/memblock.h> |
| 17 |
#include <asm/page.h> |
| 18 |
#include <asm/cacheflush.h> |
| 19 |
|
| 20 |
#include <linux/kvm_host.h> |
| 21 |
|
| 22 |
#include "interrupt.h" |
| 23 |
|
| 24 |
void kvm_mips_deliver_interrupts(struct kvm_vcpu *vcpu, u32 cause) |
| 25 |
{ |
| 26 |
unsigned long *pending = &vcpu->arch.pending_exceptions; |
| 27 |
unsigned long *pending_clr = &vcpu->arch.pending_exceptions_clr; |
| 28 |
unsigned int priority; |
| 29 |
|
| 30 |
for_each_set_bit(priority, pending_clr, MIPS_EXC_MAX + 1) |
| 31 |
kvm_mips_callbacks->irq_clear(vcpu, priority, cause); |
| 32 |
|
| 33 |
for_each_set_bit(priority, pending, MIPS_EXC_MAX + 1) |
| 34 |
kvm_mips_callbacks->irq_deliver(vcpu, priority, cause); |
| 35 |
} |
| 36 |
|
| 37 |
int kvm_mips_pending_timer(struct kvm_vcpu *vcpu) |
| 38 |
{ |
| 39 |
return test_bit(MIPS_EXC_INT_TIMER, &vcpu->arch.pending_exceptions); |
| 40 |
} |