kvm_asm.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Copyright (C) 2012 - Virtual Open Systems and Columbia University
  3. * Author: Christoffer Dall <c.dall@virtualopensystems.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License, version 2, as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  17. */
  18. #ifndef __ARM_KVM_ASM_H__
  19. #define __ARM_KVM_ASM_H__
  20. #include <asm/virt.h>
  21. #define ARM_EXCEPTION_RESET 0
  22. #define ARM_EXCEPTION_UNDEFINED 1
  23. #define ARM_EXCEPTION_SOFTWARE 2
  24. #define ARM_EXCEPTION_PREF_ABORT 3
  25. #define ARM_EXCEPTION_DATA_ABORT 4
  26. #define ARM_EXCEPTION_IRQ 5
  27. #define ARM_EXCEPTION_FIQ 6
  28. #define ARM_EXCEPTION_HVC 7
  29. /*
  30. * The rr_lo_hi macro swaps a pair of registers depending on
  31. * current endianness. It is used in conjunction with ldrd and strd
  32. * instructions that load/store a 64-bit value from/to memory to/from
  33. * a pair of registers which are used with the mrrc and mcrr instructions.
  34. * If used with the ldrd/strd instructions, the a1 parameter is the first
  35. * source/destination register and the a2 parameter is the second
  36. * source/destination register. Note that the ldrd/strd instructions
  37. * already swap the bytes within the words correctly according to the
  38. * endianness setting, but the order of the registers need to be effectively
  39. * swapped when used with the mrrc/mcrr instructions.
  40. */
  41. #ifdef CONFIG_CPU_ENDIAN_BE8
  42. #define rr_lo_hi(a1, a2) a2, a1
  43. #else
  44. #define rr_lo_hi(a1, a2) a1, a2
  45. #endif
  46. #define kvm_ksym_ref(kva) (kva)
  47. #ifndef __ASSEMBLY__
  48. struct kvm;
  49. struct kvm_vcpu;
  50. extern char __kvm_hyp_init[];
  51. extern char __kvm_hyp_init_end[];
  52. extern char __kvm_hyp_vector[];
  53. extern void __kvm_flush_vm_context(void);
  54. extern void __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa);
  55. extern void __kvm_tlb_flush_vmid(struct kvm *kvm);
  56. extern int __kvm_vcpu_run(struct kvm_vcpu *vcpu);
  57. extern void __init_stage2_translation(void);
  58. extern void __kvm_hyp_reset(unsigned long);
  59. #endif
  60. #endif /* __ARM_KVM_ASM_H__ */