diff options
author | Alexander Graf <agraf@suse.de> | 2009-10-30 01:47:05 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-11-05 00:49:52 -0500 |
commit | 4e342025e625a7271be0a9e2d20b7caf1ab70e8a (patch) | |
tree | 679ab5c35c4349e692dba2bd3994aeeef839ee72 /arch/powerpc/include | |
parent | ca95150b3a9f3f3146a686296f2156a7ec6e98e9 (diff) |
Add asm/kvm_book3s.h
This adds the book3s specific header file that contains structs that
are only valid on book3s specific code.
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/include')
-rw-r--r-- | arch/powerpc/include/asm/kvm_book3s.h | 136 |
1 files changed, 136 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h new file mode 100644 index 000000000000..c6011336371e --- /dev/null +++ b/arch/powerpc/include/asm/kvm_book3s.h | |||
@@ -0,0 +1,136 @@ | |||
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 | |||
20 | #ifndef __ASM_KVM_BOOK3S_H__ | ||
21 | #define __ASM_KVM_BOOK3S_H__ | ||
22 | |||
23 | #include <linux/types.h> | ||
24 | #include <linux/kvm_host.h> | ||
25 | #include <asm/kvm_ppc.h> | ||
26 | |||
27 | struct kvmppc_slb { | ||
28 | u64 esid; | ||
29 | u64 vsid; | ||
30 | u64 orige; | ||
31 | u64 origv; | ||
32 | bool valid; | ||
33 | bool Ks; | ||
34 | bool Kp; | ||
35 | bool nx; | ||
36 | bool large; | ||
37 | bool class; | ||
38 | }; | ||
39 | |||
40 | struct kvmppc_sr { | ||
41 | u32 raw; | ||
42 | u32 vsid; | ||
43 | bool Ks; | ||
44 | bool Kp; | ||
45 | bool nx; | ||
46 | }; | ||
47 | |||
48 | struct kvmppc_bat { | ||
49 | u32 bepi; | ||
50 | u32 bepi_mask; | ||
51 | bool vs; | ||
52 | bool vp; | ||
53 | u32 brpn; | ||
54 | u8 wimg; | ||
55 | u8 pp; | ||
56 | }; | ||
57 | |||
58 | struct kvmppc_sid_map { | ||
59 | u64 guest_vsid; | ||
60 | u64 guest_esid; | ||
61 | u64 host_vsid; | ||
62 | bool valid; | ||
63 | }; | ||
64 | |||
65 | #define SID_MAP_BITS 9 | ||
66 | #define SID_MAP_NUM (1 << SID_MAP_BITS) | ||
67 | #define SID_MAP_MASK (SID_MAP_NUM - 1) | ||
68 | |||
69 | struct kvmppc_vcpu_book3s { | ||
70 | struct kvm_vcpu vcpu; | ||
71 | struct kvmppc_sid_map sid_map[SID_MAP_NUM]; | ||
72 | struct kvmppc_slb slb[64]; | ||
73 | struct { | ||
74 | u64 esid; | ||
75 | u64 vsid; | ||
76 | } slb_shadow[64]; | ||
77 | u8 slb_shadow_max; | ||
78 | struct kvmppc_sr sr[16]; | ||
79 | struct kvmppc_bat ibat[8]; | ||
80 | struct kvmppc_bat dbat[8]; | ||
81 | u64 hid[6]; | ||
82 | int slb_nr; | ||
83 | u64 sdr1; | ||
84 | u64 dsisr; | ||
85 | u64 hior; | ||
86 | u64 msr_mask; | ||
87 | u64 vsid_first; | ||
88 | u64 vsid_next; | ||
89 | u64 vsid_max; | ||
90 | int context_id; | ||
91 | }; | ||
92 | |||
93 | #define CONTEXT_HOST 0 | ||
94 | #define CONTEXT_GUEST 1 | ||
95 | #define CONTEXT_GUEST_END 2 | ||
96 | |||
97 | #define VSID_REAL 0xfffffffffff00000 | ||
98 | #define VSID_REAL_DR 0xffffffffffe00000 | ||
99 | #define VSID_REAL_IR 0xffffffffffd00000 | ||
100 | #define VSID_BAT 0xffffffffffc00000 | ||
101 | #define VSID_PR 0x8000000000000000 | ||
102 | |||
103 | extern void kvmppc_mmu_pte_flush(struct kvm_vcpu *vcpu, u64 ea, u64 ea_mask); | ||
104 | extern void kvmppc_mmu_pte_vflush(struct kvm_vcpu *vcpu, u64 vp, u64 vp_mask); | ||
105 | extern void kvmppc_mmu_pte_pflush(struct kvm_vcpu *vcpu, u64 pa_start, u64 pa_end); | ||
106 | extern void kvmppc_set_msr(struct kvm_vcpu *vcpu, u64 new_msr); | ||
107 | extern void kvmppc_mmu_book3s_64_init(struct kvm_vcpu *vcpu); | ||
108 | extern void kvmppc_mmu_book3s_32_init(struct kvm_vcpu *vcpu); | ||
109 | extern int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *pte); | ||
110 | extern int kvmppc_mmu_map_segment(struct kvm_vcpu *vcpu, ulong eaddr); | ||
111 | extern void kvmppc_mmu_flush_segments(struct kvm_vcpu *vcpu); | ||
112 | extern struct kvmppc_pte *kvmppc_mmu_find_pte(struct kvm_vcpu *vcpu, u64 ea, bool data); | ||
113 | extern int kvmppc_ld(struct kvm_vcpu *vcpu, ulong eaddr, int size, void *ptr, bool data); | ||
114 | extern int kvmppc_st(struct kvm_vcpu *vcpu, ulong eaddr, int size, void *ptr); | ||
115 | extern void kvmppc_book3s_queue_irqprio(struct kvm_vcpu *vcpu, unsigned int vec); | ||
116 | |||
117 | extern u32 kvmppc_trampoline_lowmem; | ||
118 | extern u32 kvmppc_trampoline_enter; | ||
119 | |||
120 | static inline struct kvmppc_vcpu_book3s *to_book3s(struct kvm_vcpu *vcpu) | ||
121 | { | ||
122 | return container_of(vcpu, struct kvmppc_vcpu_book3s, vcpu); | ||
123 | } | ||
124 | |||
125 | static inline ulong dsisr(void) | ||
126 | { | ||
127 | ulong r; | ||
128 | asm ( "mfdsisr %0 " : "=r" (r) ); | ||
129 | return r; | ||
130 | } | ||
131 | |||
132 | extern void kvm_return_point(void); | ||
133 | |||
134 | #define INS_DCBZ 0x7c0007ec | ||
135 | |||
136 | #endif /* __ASM_KVM_BOOK3S_H__ */ | ||