interrupt.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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 <sanjayl@kymasys.com>
  10. */
  11. #include <linux/errno.h>
  12. #include <linux/err.h>
  13. #include <linux/vmalloc.h>
  14. #include <linux/fs.h>
  15. #include <linux/memblock.h>
  16. #include <asm/page.h>
  17. #include <asm/cacheflush.h>
  18. #include <linux/kvm_host.h>
  19. #include "interrupt.h"
  20. void kvm_mips_deliver_interrupts(struct kvm_vcpu *vcpu, u32 cause)
  21. {
  22. unsigned long *pending = &vcpu->arch.pending_exceptions;
  23. unsigned long *pending_clr = &vcpu->arch.pending_exceptions_clr;
  24. unsigned int priority;
  25. for_each_set_bit(priority, pending_clr, MIPS_EXC_MAX + 1)
  26. kvm_mips_callbacks->irq_clear(vcpu, priority, cause);
  27. for_each_set_bit(priority, pending, MIPS_EXC_MAX + 1)
  28. kvm_mips_callbacks->irq_deliver(vcpu, priority, cause);
  29. }
  30. int kvm_mips_pending_timer(struct kvm_vcpu *vcpu)
  31. {
  32. return test_bit(MIPS_EXC_INT_TIMER, &vcpu->arch.pending_exceptions);
  33. }