kvm_book3s_asm.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /*
  2. * This program is free software; you can redistribute it and/or modify
  3. * it under the terms of the GNU General Public License, version 2, as
  4. * published by the Free Software Foundation.
  5. *
  6. * This program is distributed in the hope that it will be useful,
  7. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. * GNU General Public License for more details.
  10. *
  11. * You should have received a copy of the GNU General Public License
  12. * along with this program; if not, write to the Free Software
  13. * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  14. *
  15. * Copyright SUSE Linux Products GmbH 2009
  16. *
  17. * Authors: Alexander Graf <agraf@suse.de>
  18. */
  19. #ifndef __ASM_KVM_BOOK3S_ASM_H__
  20. #define __ASM_KVM_BOOK3S_ASM_H__
  21. #ifdef __ASSEMBLY__
  22. #ifdef CONFIG_KVM_BOOK3S_HANDLER
  23. #include <asm/kvm_asm.h>
  24. .macro DO_KVM intno
  25. .if (\intno == BOOK3S_INTERRUPT_SYSTEM_RESET) || \
  26. (\intno == BOOK3S_INTERRUPT_MACHINE_CHECK) || \
  27. (\intno == BOOK3S_INTERRUPT_DATA_STORAGE) || \
  28. (\intno == BOOK3S_INTERRUPT_INST_STORAGE) || \
  29. (\intno == BOOK3S_INTERRUPT_DATA_SEGMENT) || \
  30. (\intno == BOOK3S_INTERRUPT_INST_SEGMENT) || \
  31. (\intno == BOOK3S_INTERRUPT_EXTERNAL) || \
  32. (\intno == BOOK3S_INTERRUPT_EXTERNAL_HV) || \
  33. (\intno == BOOK3S_INTERRUPT_ALIGNMENT) || \
  34. (\intno == BOOK3S_INTERRUPT_PROGRAM) || \
  35. (\intno == BOOK3S_INTERRUPT_FP_UNAVAIL) || \
  36. (\intno == BOOK3S_INTERRUPT_DECREMENTER) || \
  37. (\intno == BOOK3S_INTERRUPT_SYSCALL) || \
  38. (\intno == BOOK3S_INTERRUPT_TRACE) || \
  39. (\intno == BOOK3S_INTERRUPT_PERFMON) || \
  40. (\intno == BOOK3S_INTERRUPT_ALTIVEC) || \
  41. (\intno == BOOK3S_INTERRUPT_VSX)
  42. b kvmppc_trampoline_\intno
  43. kvmppc_resume_\intno:
  44. .endif
  45. .endm
  46. #else
  47. .macro DO_KVM intno
  48. .endm
  49. #endif /* CONFIG_KVM_BOOK3S_HANDLER */
  50. #else /*__ASSEMBLY__ */
  51. /*
  52. * This struct goes in the PACA on 64-bit processors. It is used
  53. * to store host state that needs to be saved when we enter a guest
  54. * and restored when we exit, but isn't specific to any particular
  55. * guest or vcpu. It also has some scratch fields used by the guest
  56. * exit code.
  57. */
  58. struct kvmppc_host_state {
  59. ulong host_r1;
  60. ulong host_r2;
  61. ulong host_msr;
  62. ulong vmhandler;
  63. ulong scratch0;
  64. ulong scratch1;
  65. u8 in_guest;
  66. u8 restore_hid5;
  67. u8 napping;
  68. #ifdef CONFIG_KVM_BOOK3S_64_HV
  69. struct kvm_vcpu *kvm_vcpu;
  70. struct kvmppc_vcore *kvm_vcore;
  71. unsigned long xics_phys;
  72. u64 dabr;
  73. u64 host_mmcr[3];
  74. u32 host_pmc[8];
  75. u64 host_purr;
  76. u64 host_spurr;
  77. u64 host_dscr;
  78. u64 dec_expires;
  79. #endif
  80. };
  81. struct kvmppc_book3s_shadow_vcpu {
  82. ulong gpr[14];
  83. u32 cr;
  84. u32 xer;
  85. u32 fault_dsisr;
  86. u32 last_inst;
  87. ulong ctr;
  88. ulong lr;
  89. ulong pc;
  90. ulong shadow_srr1;
  91. ulong fault_dar;
  92. #ifdef CONFIG_PPC_BOOK3S_32
  93. u32 sr[16]; /* Guest SRs */
  94. struct kvmppc_host_state hstate;
  95. #endif
  96. #ifdef CONFIG_PPC_BOOK3S_64
  97. u8 slb_max; /* highest used guest slb entry */
  98. struct {
  99. u64 esid;
  100. u64 vsid;
  101. } slb[64]; /* guest SLB */
  102. #endif
  103. };
  104. #endif /*__ASSEMBLY__ */
  105. #endif /* __ASM_KVM_BOOK3S_ASM_H__ */