diff options
author | Paul Mackerras <paulus@samba.org> | 2011-12-12 07:31:41 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2012-03-05 07:52:37 -0500 |
commit | da9d1d7f2875cc8c1ffbce8f3501d0b33f4e7a4d (patch) | |
tree | a811ee19778715766e720646506311c8fc7d7bd0 /arch/powerpc/include/asm/kvm_book3s_64.h | |
parent | c77162dee7aff6ab5f075da9b60f649cbbeb86cc (diff) |
KVM: PPC: Allow use of small pages to back Book3S HV guests
This relaxes the requirement that the guest memory be provided as
16MB huge pages, allowing it to be provided as normal memory, i.e.
in pages of PAGE_SIZE bytes (4k or 64k). To allow this, we index
the kvm->arch.slot_phys[] arrays with a small page index, even if
huge pages are being used, and use the low-order 5 bits of each
entry to store the order of the enclosing page with respect to
normal pages, i.e. log_2(enclosing_page_size / PAGE_SIZE).
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/asm/kvm_book3s_64.h')
-rw-r--r-- | arch/powerpc/include/asm/kvm_book3s_64.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/kvm_book3s_64.h b/arch/powerpc/include/asm/kvm_book3s_64.h index 7e6f2ede44ac..10920f7a2b8d 100644 --- a/arch/powerpc/include/asm/kvm_book3s_64.h +++ b/arch/powerpc/include/asm/kvm_book3s_64.h | |||
@@ -113,4 +113,14 @@ static inline unsigned long hpte_page_size(unsigned long h, unsigned long l) | |||
113 | return 0; /* error */ | 113 | return 0; /* error */ |
114 | } | 114 | } |
115 | 115 | ||
116 | static inline bool slot_is_aligned(struct kvm_memory_slot *memslot, | ||
117 | unsigned long pagesize) | ||
118 | { | ||
119 | unsigned long mask = (pagesize >> PAGE_SHIFT) - 1; | ||
120 | |||
121 | if (pagesize <= PAGE_SIZE) | ||
122 | return 1; | ||
123 | return !(memslot->base_gfn & mask) && !(memslot->npages & mask); | ||
124 | } | ||
125 | |||
116 | #endif /* __ASM_KVM_BOOK3S_64_H__ */ | 126 | #endif /* __ASM_KVM_BOOK3S_64_H__ */ |