KVM: ppc: save and restore guest mappings on context switch
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / powerpc / include / asm / kvm_44x.h
blobf49031b632ca34bb82536bb1f3a0913a6a59b571
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.
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.
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.
15 * Copyright IBM Corp. 2008
17 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
20 #ifndef __ASM_44X_H__
21 #define __ASM_44X_H__
23 #include <linux/kvm_host.h>
25 #define PPC44x_TLB_SIZE 64
27 /* If the guest is expecting it, this can be as large as we like; we'd just
28 * need to find some way of advertising it. */
29 #define KVM44x_GUEST_TLB_SIZE 64
31 struct kvmppc_44x_shadow_ref {
32 struct page *page;
33 u16 gtlb_index;
34 u8 writeable;
35 u8 tid;
38 struct kvmppc_vcpu_44x {
39 /* Unmodified copy of the guest's TLB. */
40 struct kvmppc_44x_tlbe guest_tlb[KVM44x_GUEST_TLB_SIZE];
42 /* References to guest pages in the hardware TLB. */
43 struct kvmppc_44x_shadow_ref shadow_refs[PPC44x_TLB_SIZE];
45 /* State of the shadow TLB at guest context switch time. */
46 struct kvmppc_44x_tlbe shadow_tlb[PPC44x_TLB_SIZE];
47 u8 shadow_tlb_mod[PPC44x_TLB_SIZE];
49 struct kvm_vcpu vcpu;
52 static inline struct kvmppc_vcpu_44x *to_44x(struct kvm_vcpu *vcpu)
54 return container_of(vcpu, struct kvmppc_vcpu_44x, vcpu);
57 void kvmppc_set_pid(struct kvm_vcpu *vcpu, u32 new_pid);
58 void kvmppc_44x_tlb_put(struct kvm_vcpu *vcpu);
59 void kvmppc_44x_tlb_load(struct kvm_vcpu *vcpu);
61 #endif /* __ASM_44X_H__ */