1 /*
2  * Copyright (C) 2008 Freescale Semiconductor, Inc. All rights reserved.
3  *
4  * Author: Yu Liu, <yu.liu@freescale.com>
5  *
6  * Description:
7  * This file is derived from arch/powerpc/include/asm/kvm_44x.h,
8  * by Hollis Blanchard <hollisb@us.ibm.com>.
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License, version 2, as
12  * published by the Free Software Foundation.
13  */
14 
15 #ifndef __ASM_KVM_E500_H__
16 #define __ASM_KVM_E500_H__
17 
18 #include <linux/kvm_host.h>
19 
20 #define BOOKE_INTERRUPT_SIZE 36
21 
22 #define E500_PID_NUM   3
23 #define E500_TLB_NUM   2
24 
25 struct tlbe{
26 	u32 mas1;
27 	u32 mas2;
28 	u32 mas3;
29 	u32 mas7;
30 };
31 
32 struct kvmppc_vcpu_e500 {
33 	/* Unmodified copy of the guest's TLB. */
34 	struct tlbe *guest_tlb[E500_TLB_NUM];
35 	/* TLB that's actually used when the guest is running. */
36 	struct tlbe *shadow_tlb[E500_TLB_NUM];
37 	/* Pages which are referenced in the shadow TLB. */
38 	struct page **shadow_pages[E500_TLB_NUM];
39 
40 	unsigned int guest_tlb_size[E500_TLB_NUM];
41 	unsigned int shadow_tlb_size[E500_TLB_NUM];
42 	unsigned int guest_tlb_nv[E500_TLB_NUM];
43 
44 	u32 host_pid[E500_PID_NUM];
45 	u32 pid[E500_PID_NUM];
46 
47 	u32 mas0;
48 	u32 mas1;
49 	u32 mas2;
50 	u32 mas3;
51 	u32 mas4;
52 	u32 mas5;
53 	u32 mas6;
54 	u32 mas7;
55 	u32 l1csr0;
56 	u32 l1csr1;
57 	u32 hid0;
58 	u32 hid1;
59 	u32 tlb0cfg;
60 	u32 tlb1cfg;
61 
62 	struct kvm_vcpu vcpu;
63 };
64 
to_e500(struct kvm_vcpu * vcpu)65 static inline struct kvmppc_vcpu_e500 *to_e500(struct kvm_vcpu *vcpu)
66 {
67 	return container_of(vcpu, struct kvmppc_vcpu_e500, vcpu);
68 }
69 
70 #endif /* __ASM_KVM_E500_H__ */
71