diff options
author | Hollis Blanchard <hollisb@us.ibm.com> | 2008-11-05 10:36:18 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2008-12-31 09:52:22 -0500 |
commit | db93f5745d836f81cef0b4101a7c2685eeb55efb (patch) | |
tree | 970b0dfc93dbbe25eb988b008bbbeffd866f3f23 /arch/powerpc/include/asm/kvm_44x.h | |
parent | 5cbb5106f50b4515815cd32cf944958c0d4da83f (diff) |
KVM: ppc: create struct kvm_vcpu_44x and introduce container_of() accessor
This patch doesn't yet move all 44x-specific data into the new structure, but
is the first step down that path. In the future we may also want to create a
struct kvm_vcpu_booke.
Based on patch from Liu Yu <yu.liu@freescale.com>.
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/powerpc/include/asm/kvm_44x.h')
-rw-r--r-- | arch/powerpc/include/asm/kvm_44x.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/kvm_44x.h b/arch/powerpc/include/asm/kvm_44x.h new file mode 100644 index 000000000000..dece09350712 --- /dev/null +++ b/arch/powerpc/include/asm/kvm_44x.h | |||
@@ -0,0 +1,47 @@ | |||
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. 2008 | ||
16 | * | ||
17 | * Authors: Hollis Blanchard <hollisb@us.ibm.com> | ||
18 | */ | ||
19 | |||
20 | #ifndef __ASM_44X_H__ | ||
21 | #define __ASM_44X_H__ | ||
22 | |||
23 | #include <linux/kvm_host.h> | ||
24 | |||
25 | /* XXX Can't include mmu-44x.h because it redefines struct mm_context. */ | ||
26 | #define PPC44x_TLB_SIZE 64 | ||
27 | |||
28 | struct kvmppc_vcpu_44x { | ||
29 | /* Unmodified copy of the guest's TLB. */ | ||
30 | struct kvmppc_44x_tlbe guest_tlb[PPC44x_TLB_SIZE]; | ||
31 | /* TLB that's actually used when the guest is running. */ | ||
32 | struct kvmppc_44x_tlbe shadow_tlb[PPC44x_TLB_SIZE]; | ||
33 | /* Pages which are referenced in the shadow TLB. */ | ||
34 | struct page *shadow_pages[PPC44x_TLB_SIZE]; | ||
35 | |||
36 | /* Track which TLB entries we've modified in the current exit. */ | ||
37 | u8 shadow_tlb_mod[PPC44x_TLB_SIZE]; | ||
38 | |||
39 | struct kvm_vcpu vcpu; | ||
40 | }; | ||
41 | |||
42 | static inline struct kvmppc_vcpu_44x *to_44x(struct kvm_vcpu *vcpu) | ||
43 | { | ||
44 | return container_of(vcpu, struct kvmppc_vcpu_44x, vcpu); | ||
45 | } | ||
46 | |||
47 | #endif /* __ASM_44X_H__ */ | ||