We need to loop through the SLB several times when switching from guest to host or vice versa. We only really know the SLB size of the system we're running on on bootup. Linux patches its own assembly code on bootup to know how big its SLB is. Let's just take that code and patch our own assembly as well, so we can loop through the SLB easily. Signed-off-by: Alexander Graf <agraf@xxxxxxx> --- arch/powerpc/mm/slb.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c index 3b52c80..3be40a4 100644 --- a/arch/powerpc/mm/slb.c +++ b/arch/powerpc/mm/slb.c @@ -267,6 +267,12 @@ void slb_initialize(void) extern unsigned int *slb_miss_kernel_load_vmemmap; unsigned long vmemmap_llp; #endif +#ifdef CONFIG_KVM_BOOK3S_64_HANDLER + extern unsigned int *kvmppc_patch_slb_1; + extern unsigned int *kvmppc_patch_slb_2; + extern unsigned int *kvmppc_patch_slb_3; + extern unsigned int *kvmppc_patch_slb_4; +#endif /* Prepare our SLB miss handler based on our page size */ linear_llp = mmu_psize_defs[mmu_linear_psize].sllp; @@ -293,6 +299,13 @@ void slb_initialize(void) SLB_VSID_KERNEL | vmemmap_llp); DBG("SLB: vmemmap LLP = %04lx\n", vmemmap_llp); #endif + +#ifdef CONFIG_KVM_BOOK3S_64_HANDLER + patch_slb_encoding(kvmppc_patch_slb_1, mmu_slb_size); + patch_slb_encoding(kvmppc_patch_slb_2, mmu_slb_size); + patch_slb_encoding(kvmppc_patch_slb_3, mmu_slb_size); + patch_slb_encoding(kvmppc_patch_slb_4, mmu_slb_size); +#endif } get_paca()->stab_rr = SLB_NUM_BOLTED; -- 1.6.0.2 -- To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html