Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 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 IBM Corp. 2007 |
| 16 | * |
| 17 | * Authors: Hollis Blanchard <hollisb@us.ibm.com> |
| 18 | */ |
| 19 | |
| 20 | #ifndef __POWERPC_KVM_HOST_H__ |
| 21 | #define __POWERPC_KVM_HOST_H__ |
| 22 | |
| 23 | #include <linux/mutex.h> |
| 24 | #include <linux/timer.h> |
| 25 | #include <linux/types.h> |
| 26 | #include <linux/kvm_types.h> |
| 27 | #include <asm/kvm_asm.h> |
| 28 | |
| 29 | #define KVM_MAX_VCPUS 1 |
| 30 | #define KVM_MEMORY_SLOTS 32 |
| 31 | /* memory slots that does not exposed to userspace */ |
| 32 | #define KVM_PRIVATE_MEM_SLOTS 4 |
| 33 | |
Laurent Vivier | 588968b | 2008-05-30 16:05:56 +0200 | [diff] [blame] | 34 | #define KVM_COALESCED_MMIO_PAGE_OFFSET 1 |
| 35 | |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 36 | /* We don't currently support large pages. */ |
| 37 | #define KVM_PAGES_PER_HPAGE (1<<31) |
| 38 | |
| 39 | struct kvm; |
| 40 | struct kvm_run; |
| 41 | struct kvm_vcpu; |
| 42 | |
| 43 | struct kvm_vm_stat { |
| 44 | u32 remote_tlb_flush; |
| 45 | }; |
| 46 | |
| 47 | struct kvm_vcpu_stat { |
| 48 | u32 sum_exits; |
| 49 | u32 mmio_exits; |
| 50 | u32 dcr_exits; |
| 51 | u32 signal_exits; |
| 52 | u32 light_exits; |
| 53 | /* Account for special types of light exits: */ |
| 54 | u32 itlb_real_miss_exits; |
| 55 | u32 itlb_virt_miss_exits; |
| 56 | u32 dtlb_real_miss_exits; |
| 57 | u32 dtlb_virt_miss_exits; |
| 58 | u32 syscall_exits; |
| 59 | u32 isi_exits; |
| 60 | u32 dsi_exits; |
| 61 | u32 emulated_inst_exits; |
| 62 | u32 dec_exits; |
| 63 | u32 ext_intr_exits; |
Hollis Blanchard | 45c5eb6 | 2008-04-25 17:55:49 -0500 | [diff] [blame] | 64 | u32 halt_wakeup; |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 65 | }; |
| 66 | |
| 67 | struct tlbe { |
| 68 | u32 tid; /* Only the low 8 bits are used. */ |
| 69 | u32 word0; |
| 70 | u32 word1; |
| 71 | u32 word2; |
| 72 | }; |
| 73 | |
| 74 | struct kvm_arch { |
| 75 | }; |
| 76 | |
| 77 | struct kvm_vcpu_arch { |
| 78 | /* Unmodified copy of the guest's TLB. */ |
| 79 | struct tlbe guest_tlb[PPC44x_TLB_SIZE]; |
| 80 | /* TLB that's actually used when the guest is running. */ |
| 81 | struct tlbe shadow_tlb[PPC44x_TLB_SIZE]; |
| 82 | /* Pages which are referenced in the shadow TLB. */ |
| 83 | struct page *shadow_pages[PPC44x_TLB_SIZE]; |
| 84 | /* Copy of the host's TLB. */ |
| 85 | struct tlbe host_tlb[PPC44x_TLB_SIZE]; |
| 86 | |
| 87 | u32 host_stack; |
| 88 | u32 host_pid; |
Hollis Blanchard | 6a0ab73 | 2008-07-25 13:54:49 -0500 | [diff] [blame^] | 89 | u32 host_dbcr0; |
| 90 | u32 host_dbcr1; |
| 91 | u32 host_dbcr2; |
| 92 | u32 host_iac[4]; |
| 93 | u32 host_msr; |
Hollis Blanchard | bbf45ba | 2008-04-16 23:28:09 -0500 | [diff] [blame] | 94 | |
| 95 | u64 fpr[32]; |
| 96 | u32 gpr[32]; |
| 97 | |
| 98 | u32 pc; |
| 99 | u32 cr; |
| 100 | u32 ctr; |
| 101 | u32 lr; |
| 102 | u32 xer; |
| 103 | |
| 104 | u32 msr; |
| 105 | u32 mmucr; |
| 106 | u32 sprg0; |
| 107 | u32 sprg1; |
| 108 | u32 sprg2; |
| 109 | u32 sprg3; |
| 110 | u32 sprg4; |
| 111 | u32 sprg5; |
| 112 | u32 sprg6; |
| 113 | u32 sprg7; |
| 114 | u32 srr0; |
| 115 | u32 srr1; |
| 116 | u32 csrr0; |
| 117 | u32 csrr1; |
| 118 | u32 dsrr0; |
| 119 | u32 dsrr1; |
| 120 | u32 dear; |
| 121 | u32 esr; |
| 122 | u32 dec; |
| 123 | u32 decar; |
| 124 | u32 tbl; |
| 125 | u32 tbu; |
| 126 | u32 tcr; |
| 127 | u32 tsr; |
| 128 | u32 ivor[16]; |
| 129 | u32 ivpr; |
| 130 | u32 pir; |
| 131 | u32 pid; |
| 132 | u32 pvr; |
| 133 | u32 ccr0; |
| 134 | u32 ccr1; |
| 135 | u32 dbcr0; |
| 136 | u32 dbcr1; |
| 137 | |
| 138 | u32 last_inst; |
| 139 | u32 fault_dear; |
| 140 | u32 fault_esr; |
| 141 | gpa_t paddr_accessed; |
| 142 | |
| 143 | u8 io_gpr; /* GPR used as IO source/target */ |
| 144 | u8 mmio_is_bigendian; |
| 145 | u8 dcr_needed; |
| 146 | u8 dcr_is_write; |
| 147 | |
| 148 | u32 cpr0_cfgaddr; /* holds the last set cpr0_cfgaddr */ |
| 149 | |
| 150 | struct timer_list dec_timer; |
| 151 | unsigned long pending_exceptions; |
| 152 | }; |
| 153 | |
| 154 | struct kvm_guest_debug { |
| 155 | int enabled; |
| 156 | unsigned long bp[4]; |
| 157 | int singlestep; |
| 158 | }; |
| 159 | |
| 160 | #endif /* __POWERPC_KVM_HOST_H__ */ |