kvm_asm.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. /* 0 is reserved as an invalid value. */
  21. #define c0_MPIDR 1 /* MultiProcessor ID Register */
  22. #define c0_CSSELR 2 /* Cache Size Selection Register */
  23. #define c1_SCTLR 3 /* System Control Register */
  24. #define c1_ACTLR 4 /* Auxiliary Control Register */
  25. #define c1_CPACR 5 /* Coprocessor Access Control */
  26. #define c2_TTBR0 6 /* Translation Table Base Register 0 */
  27. #define c2_TTBR0_high 7 /* TTBR0 top 32 bits */
  28. #define c2_TTBR1 8 /* Translation Table Base Register 1 */
  29. #define c2_TTBR1_high 9 /* TTBR1 top 32 bits */
  30. #define c2_TTBCR 10 /* Translation Table Base Control R. */
  31. #define c3_DACR 11 /* Domain Access Control Register */
  32. #define c5_DFSR 12 /* Data Fault Status Register */
  33. #define c5_IFSR 13 /* Instruction Fault Status Register */
  34. #define c5_ADFSR 14 /* Auxilary Data Fault Status R */
  35. #define c5_AIFSR 15 /* Auxilary Instrunction Fault Status R */
  36. #define c6_DFAR 16 /* Data Fault Address Register */
  37. #define c6_IFAR 17 /* Instruction Fault Address Register */
  38. #define c7_PAR 18 /* Physical Address Register */
  39. #define c7_PAR_high 19 /* PAR top 32 bits */
  40. #define c9_L2CTLR 20 /* Cortex A15/A7 L2 Control Register */
  41. #define c10_PRRR 21 /* Primary Region Remap Register */
  42. #define c10_NMRR 22 /* Normal Memory Remap Register */
  43. #define c12_VBAR 23 /* Vector Base Address Register */
  44. #define c13_CID 24 /* Context ID Register */
  45. #define c13_TID_URW 25 /* Thread ID, User R/W */
  46. #define c13_TID_URO 26 /* Thread ID, User R/O */
  47. #define c13_TID_PRIV 27 /* Thread ID, Privileged */
  48. #define c14_CNTKCTL 28 /* Timer Control Register (PL1) */
  49. #define c10_AMAIR0 29 /* Auxilary Memory Attribute Indirection Reg0 */
  50. #define c10_AMAIR1 30 /* Auxilary Memory Attribute Indirection Reg1 */
  51. #define NR_CP15_REGS 31 /* Number of regs (incl. invalid) */
  52. #define ARM_EXCEPTION_RESET 0
  53. #define ARM_EXCEPTION_UNDEFINED 1
  54. #define ARM_EXCEPTION_SOFTWARE 2
  55. #define ARM_EXCEPTION_PREF_ABORT 3
  56. #define ARM_EXCEPTION_DATA_ABORT 4
  57. #define ARM_EXCEPTION_IRQ 5
  58. #define ARM_EXCEPTION_FIQ 6
  59. #define ARM_EXCEPTION_HVC 7
  60. /*
  61. * The rr_lo_hi macro swaps a pair of registers depending on
  62. * current endianness. It is used in conjunction with ldrd and strd
  63. * instructions that load/store a 64-bit value from/to memory to/from
  64. * a pair of registers which are used with the mrrc and mcrr instructions.
  65. * If used with the ldrd/strd instructions, the a1 parameter is the first
  66. * source/destination register and the a2 parameter is the second
  67. * source/destination register. Note that the ldrd/strd instructions
  68. * already swap the bytes within the words correctly according to the
  69. * endianness setting, but the order of the registers need to be effectively
  70. * swapped when used with the mrrc/mcrr instructions.
  71. */
  72. #ifdef CONFIG_CPU_ENDIAN_BE8
  73. #define rr_lo_hi(a1, a2) a2, a1
  74. #else
  75. #define rr_lo_hi(a1, a2) a1, a2
  76. #endif
  77. #ifndef __ASSEMBLY__
  78. struct kvm;
  79. struct kvm_vcpu;
  80. extern char __kvm_hyp_init[];
  81. extern char __kvm_hyp_init_end[];
  82. extern char __kvm_hyp_exit[];
  83. extern char __kvm_hyp_exit_end[];
  84. extern char __kvm_hyp_vector[];
  85. extern char __kvm_hyp_code_start[];
  86. extern char __kvm_hyp_code_end[];
  87. extern void __kvm_flush_vm_context(void);
  88. extern void __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa);
  89. extern void __kvm_tlb_flush_vmid(struct kvm *kvm);
  90. extern int __kvm_vcpu_run(struct kvm_vcpu *vcpu);
  91. #endif
  92. #endif /* __ARM_KVM_ASM_H__ */