aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2011-12-12 07:27:39 -0500
committerAvi Kivity <avi@redhat.com>2012-03-05 07:52:35 -0500
commit8936dda4c2ed070ecebd786baf35b08584accf4a (patch)
tree7f75079f3814304050cbf880ecd7ddb9505f63a4 /arch/powerpc/include
parent4e72dbe13528394a413889d73e5025dbdf6cab70 (diff)
KVM: PPC: Keep a record of HV guest view of hashed page table entries
This adds an array that parallels the guest hashed page table (HPT), that is, it has one entry per HPTE, used to store the guest's view of the second doubleword of the corresponding HPTE. The first doubleword in the HPTE is the same as the guest's idea of it, so we don't need to store a copy, but the second doubleword in the HPTE has the real page number rather than the guest's logical page number. This allows us to remove the back_translate() and reverse_xlate() functions. This "reverse mapping" array is vmalloc'd, meaning that to access it in real mode we have to walk the kernel's page tables explicitly. That is done by the new real_vmalloc_addr() function. (In fact this returns an address in the linear mapping, so the result is usable both in real mode and in virtual mode.) There are also some minor cleanups here: moving the definitions of HPT_ORDER etc. to a header file and defining HPT_NPTE for HPT_NPTEG << 3. Signed-off-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/powerpc/include')
-rw-r--r--arch/powerpc/include/asm/kvm_book3s_64.h8
-rw-r--r--arch/powerpc/include/asm/kvm_host.h10
2 files changed, 18 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/kvm_book3s_64.h b/arch/powerpc/include/asm/kvm_book3s_64.h
index 2054e4726ba2..fa3dc79af702 100644
--- a/arch/powerpc/include/asm/kvm_book3s_64.h
+++ b/arch/powerpc/include/asm/kvm_book3s_64.h
@@ -35,6 +35,14 @@ static inline void svcpu_put(struct kvmppc_book3s_shadow_vcpu *svcpu)
35 35
36#define SPAPR_TCE_SHIFT 12 36#define SPAPR_TCE_SHIFT 12
37 37
38#ifdef CONFIG_KVM_BOOK3S_64_HV
39/* For now use fixed-size 16MB page table */
40#define HPT_ORDER 24
41#define HPT_NPTEG (1ul << (HPT_ORDER - 7)) /* 128B per pteg */
42#define HPT_NPTE (HPT_NPTEG << 3) /* 8 PTEs per PTEG */
43#define HPT_HASH_MASK (HPT_NPTEG - 1)
44#endif
45
38static inline unsigned long compute_tlbie_rb(unsigned long v, unsigned long r, 46static inline unsigned long compute_tlbie_rb(unsigned long v, unsigned long r,
39 unsigned long pte_index) 47 unsigned long pte_index)
40{ 48{
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
index 66c75cddaec6..629df2ed22f7 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -166,9 +166,19 @@ struct kvmppc_rma_info {
166 atomic_t use_count; 166 atomic_t use_count;
167}; 167};
168 168
169/*
170 * The reverse mapping array has one entry for each HPTE,
171 * which stores the guest's view of the second word of the HPTE
172 * (including the guest physical address of the mapping).
173 */
174struct revmap_entry {
175 unsigned long guest_rpte;
176};
177
169struct kvm_arch { 178struct kvm_arch {
170#ifdef CONFIG_KVM_BOOK3S_64_HV 179#ifdef CONFIG_KVM_BOOK3S_64_HV
171 unsigned long hpt_virt; 180 unsigned long hpt_virt;
181 struct revmap_entry *revmap;
172 unsigned long ram_npages; 182 unsigned long ram_npages;
173 unsigned long ram_psize; 183 unsigned long ram_psize;
174 unsigned long ram_porder; 184 unsigned long ram_porder;