From: Michael Ellerman Date: Wed, 29 Mar 2017 11:00:46 +0000 (+1100) Subject: powerpc/mm/hash: Abstract context id allocation for KVM X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a336f2f5b05c3c02876a365b8f17b3d10920dbd5;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git powerpc/mm/hash: Abstract context id allocation for KVM KVM wants to be able to allocate an MMU context id, which it does currently by calling __init_new_context(). We're about to rework that code, so provide a wrapper for KVM so it can not worry about the details. Signed-off-by: Michael Ellerman --- diff --git a/arch/powerpc/include/asm/mmu_context.h b/arch/powerpc/include/asm/mmu_context.h index b9e3f0aca261..7d721101ec78 100644 --- a/arch/powerpc/include/asm/mmu_context.h +++ b/arch/powerpc/include/asm/mmu_context.h @@ -51,7 +51,7 @@ static inline void switch_mmu_context(struct mm_struct *prev, return switch_slb(tsk, next); } -extern int __init_new_context(void); +extern int hash__alloc_context_id(void); extern void __destroy_context(int context_id); static inline void mmu_context_init(void) { } #else diff --git a/arch/powerpc/kvm/book3s_64_mmu_host.c b/arch/powerpc/kvm/book3s_64_mmu_host.c index a587e8f4fd26..b35f44c98d1f 100644 --- a/arch/powerpc/kvm/book3s_64_mmu_host.c +++ b/arch/powerpc/kvm/book3s_64_mmu_host.c @@ -390,7 +390,7 @@ int kvmppc_mmu_init(struct kvm_vcpu *vcpu) struct kvmppc_vcpu_book3s *vcpu3s = to_book3s(vcpu); int err; - err = __init_new_context(); + err = hash__alloc_context_id(); if (err < 0) return -1; vcpu3s->context_id[0] = err; diff --git a/arch/powerpc/mm/mmu_context_book3s64.c b/arch/powerpc/mm/mmu_context_book3s64.c index 73bf6e14c3aa..650a498b1de9 100644 --- a/arch/powerpc/mm/mmu_context_book3s64.c +++ b/arch/powerpc/mm/mmu_context_book3s64.c @@ -30,7 +30,7 @@ static DEFINE_SPINLOCK(mmu_context_lock); static DEFINE_IDA(mmu_context_ida); -int __init_new_context(void) +static int __init_new_context(void) { int index; int err; @@ -57,7 +57,13 @@ again: return index; } -EXPORT_SYMBOL_GPL(__init_new_context); + +int hash__alloc_context_id(void) +{ + return __init_new_context(); +} +EXPORT_SYMBOL_GPL(hash__alloc_context_id); + static int radix__init_new_context(struct mm_struct *mm, int index) { unsigned long rts_field;