Commit 1408fca0 authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman

powerpc/mm: Make slice specific to book3s/64

Since commit 555904d0 ("powerpc/8xx: MM_SLICE is not needed
anymore") only book3s/64 selects CONFIG_PPC_MM_SLICES.

Move slice.c into mm/book3s64/

Move necessary stuff in asm/book3s/64/slice.h and
remove asm/slice.h
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Reviewed-by: default avatarNicholas Piggin <npiggin@gmail.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/4a0d74ef1966a5902b5fd4ac4b513a760a6d675a.1649523076.git.christophe.leroy@csgroup.eu
parent 93ea9102
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
* complete pgtable.h but only a portion of it. * complete pgtable.h but only a portion of it.
*/ */
#include <asm/book3s/64/pgtable.h> #include <asm/book3s/64/pgtable.h>
#include <asm/book3s/64/slice.h>
#include <asm/task_size_64.h> #include <asm/task_size_64.h>
#include <asm/cpu_has_feature.h> #include <asm/cpu_has_feature.h>
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
#ifndef _ASM_POWERPC_BOOK3S_64_SLICE_H #ifndef _ASM_POWERPC_BOOK3S_64_SLICE_H
#define _ASM_POWERPC_BOOK3S_64_SLICE_H #define _ASM_POWERPC_BOOK3S_64_SLICE_H
#ifndef __ASSEMBLY__
#define SLICE_LOW_SHIFT 28 #define SLICE_LOW_SHIFT 28
#define SLICE_LOW_TOP (0x100000000ul) #define SLICE_LOW_TOP (0x100000000ul)
#define SLICE_NUM_LOW (SLICE_LOW_TOP >> SLICE_LOW_SHIFT) #define SLICE_NUM_LOW (SLICE_LOW_TOP >> SLICE_LOW_SHIFT)
...@@ -13,4 +15,20 @@ ...@@ -13,4 +15,20 @@
#define SLB_ADDR_LIMIT_DEFAULT DEFAULT_MAP_WINDOW_USER64 #define SLB_ADDR_LIMIT_DEFAULT DEFAULT_MAP_WINDOW_USER64
struct mm_struct;
unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
unsigned long flags, unsigned int psize,
int topdown);
unsigned int get_slice_psize(struct mm_struct *mm, unsigned long addr);
void slice_set_range_psize(struct mm_struct *mm, unsigned long start,
unsigned long len, unsigned int psize);
void slice_init_new_context_exec(struct mm_struct *mm);
void slice_setup_new_exec(void);
#endif /* __ASSEMBLY__ */
#endif /* _ASM_POWERPC_BOOK3S_64_SLICE_H */ #endif /* _ASM_POWERPC_BOOK3S_64_SLICE_H */
...@@ -333,6 +333,5 @@ static inline unsigned long kaslr_offset(void) ...@@ -333,6 +333,5 @@ static inline unsigned long kaslr_offset(void)
#include <asm-generic/memory_model.h> #include <asm-generic/memory_model.h>
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */
#include <asm/slice.h>
#endif /* _ASM_POWERPC_PAGE_H */ #endif /* _ASM_POWERPC_PAGE_H */
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ASM_POWERPC_SLICE_H
#define _ASM_POWERPC_SLICE_H
#ifdef CONFIG_PPC_BOOK3S_64
#include <asm/book3s/64/slice.h>
#endif
#ifndef __ASSEMBLY__
struct mm_struct;
#ifdef CONFIG_PPC_MM_SLICES
#ifdef CONFIG_HUGETLB_PAGE
#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
#endif
#define HAVE_ARCH_UNMAPPED_AREA
#define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN
unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
unsigned long flags, unsigned int psize,
int topdown);
unsigned int get_slice_psize(struct mm_struct *mm, unsigned long addr);
void slice_set_range_psize(struct mm_struct *mm, unsigned long start,
unsigned long len, unsigned int psize);
void slice_init_new_context_exec(struct mm_struct *mm);
void slice_setup_new_exec(void);
#else /* CONFIG_PPC_MM_SLICES */
static inline void slice_init_new_context_exec(struct mm_struct *mm) {}
static inline unsigned int get_slice_psize(struct mm_struct *mm, unsigned long addr)
{
return 0;
}
#endif /* CONFIG_PPC_MM_SLICES */
#endif /* __ASSEMBLY__ */
#endif /* _ASM_POWERPC_SLICE_H */
...@@ -14,7 +14,6 @@ obj-$(CONFIG_PPC_MMU_NOHASH) += nohash/ ...@@ -14,7 +14,6 @@ obj-$(CONFIG_PPC_MMU_NOHASH) += nohash/
obj-$(CONFIG_PPC_BOOK3S_32) += book3s32/ obj-$(CONFIG_PPC_BOOK3S_32) += book3s32/
obj-$(CONFIG_PPC_BOOK3S_64) += book3s64/ obj-$(CONFIG_PPC_BOOK3S_64) += book3s64/
obj-$(CONFIG_NUMA) += numa.o obj-$(CONFIG_NUMA) += numa.o
obj-$(CONFIG_PPC_MM_SLICES) += slice.o
obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
obj-$(CONFIG_NOT_COHERENT_CACHE) += dma-noncoherent.o obj-$(CONFIG_NOT_COHERENT_CACHE) += dma-noncoherent.o
obj-$(CONFIG_PPC_COPRO_BASE) += copro_fault.o obj-$(CONFIG_PPC_COPRO_BASE) += copro_fault.o
......
...@@ -21,6 +21,7 @@ obj-$(CONFIG_PPC_RADIX_MMU) += radix_hugetlbpage.o ...@@ -21,6 +21,7 @@ obj-$(CONFIG_PPC_RADIX_MMU) += radix_hugetlbpage.o
endif endif
obj-$(CONFIG_SPAPR_TCE_IOMMU) += iommu_api.o obj-$(CONFIG_SPAPR_TCE_IOMMU) += iommu_api.o
obj-$(CONFIG_PPC_PKEY) += pkeys.o obj-$(CONFIG_PPC_PKEY) += pkeys.o
obj-$(CONFIG_PPC_MM_SLICES) += slice.o
# Instrumenting the SLB fault path can lead to duplicate SLB entries # Instrumenting the SLB fault path can lead to duplicate SLB entries
KCOV_INSTRUMENT_slb.o := n KCOV_INSTRUMENT_slb.o := n
...@@ -692,7 +692,6 @@ void slice_init_new_context_exec(struct mm_struct *mm) ...@@ -692,7 +692,6 @@ void slice_init_new_context_exec(struct mm_struct *mm)
bitmap_fill(mask->high_slices, SLICE_NUM_HIGH); bitmap_fill(mask->high_slices, SLICE_NUM_HIGH);
} }
#ifdef CONFIG_PPC_BOOK3S_64
void slice_setup_new_exec(void) void slice_setup_new_exec(void)
{ {
struct mm_struct *mm = current->mm; struct mm_struct *mm = current->mm;
...@@ -704,7 +703,6 @@ void slice_setup_new_exec(void) ...@@ -704,7 +703,6 @@ void slice_setup_new_exec(void)
mm_ctx_set_slb_addr_limit(&mm->context, DEFAULT_MAP_WINDOW); mm_ctx_set_slb_addr_limit(&mm->context, DEFAULT_MAP_WINDOW);
} }
#endif
void slice_set_range_psize(struct mm_struct *mm, unsigned long start, void slice_set_range_psize(struct mm_struct *mm, unsigned long start,
unsigned long len, unsigned int psize) unsigned long len, unsigned int psize)
......
...@@ -317,15 +317,6 @@ void switch_mmu_context(struct mm_struct *prev, struct mm_struct *next, ...@@ -317,15 +317,6 @@ void switch_mmu_context(struct mm_struct *prev, struct mm_struct *next,
*/ */
int init_new_context(struct task_struct *t, struct mm_struct *mm) int init_new_context(struct task_struct *t, struct mm_struct *mm)
{ {
/*
* We have MMU_NO_CONTEXT set to be ~0. Hence check
* explicitly against context.id == 0. This ensures that we properly
* initialize context slice details for newly allocated mm's (which will
* have id == 0) and don't alter context slice inherited via fork (which
* will have id != 0).
*/
if (mm->context.id == 0)
slice_init_new_context_exec(mm);
mm->context.id = MMU_NO_CONTEXT; mm->context.id = MMU_NO_CONTEXT;
mm->context.active = 0; mm->context.active = 0;
pte_frag_set(&mm->context, NULL); pte_frag_set(&mm->context, NULL);
......
...@@ -773,9 +773,5 @@ void __init early_init_mmu(void) ...@@ -773,9 +773,5 @@ void __init early_init_mmu(void)
#ifdef CONFIG_PPC_47x #ifdef CONFIG_PPC_47x
early_init_mmu_47x(); early_init_mmu_47x();
#endif #endif
#ifdef CONFIG_PPC_MM_SLICES
mm_ctx_set_slb_addr_limit(&init_mm.context, SLB_ADDR_LIMIT_DEFAULT);
#endif
} }
#endif /* CONFIG_PPC64 */ #endif /* CONFIG_PPC64 */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment