powerpc/mm: Extend pte_fragment functionality to PPC32
In order to allow the 8xx to handle pte_fragments, this patch extends the use of pte_fragments to PPC32 platforms. Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Este cometimento está contido em:

cometido por
Michael Ellerman

ascendente
a74791dd98
cometimento
32ea4c1499
@@ -18,6 +18,7 @@ obj-$(CONFIG_PPC_BOOK3E_64) += pgtable-book3e.o
|
||||
obj-$(CONFIG_PPC_BOOK3S_64) += pgtable-hash64.o hash_utils_64.o slb.o \
|
||||
$(hash64-y) mmu_context_book3s64.o \
|
||||
pgtable-book3s64.o pgtable-frag.o
|
||||
obj-$(CONFIG_PPC32) += pgtable-frag.o
|
||||
obj-$(CONFIG_PPC_RADIX_MMU) += pgtable-radix.o tlb-radix.o
|
||||
obj-$(CONFIG_PPC_BOOK3S_32) += ppc_mmu_32.o hash_low_32.o mmu_context_hash32.o
|
||||
obj-$(CONFIG_PPC_BOOK3S) += tlb_hash$(BITS).o
|
||||
|
@@ -15,6 +15,7 @@
|
||||
#include <linux/sched/mm.h>
|
||||
|
||||
#include <asm/mmu_context.h>
|
||||
#include <asm/pgalloc.h>
|
||||
|
||||
#if defined(CONFIG_PPC32)
|
||||
static inline void switch_mm_pgdir(struct task_struct *tsk,
|
||||
@@ -97,3 +98,12 @@ void switch_mm_irqs_off(struct mm_struct *prev, struct mm_struct *next,
|
||||
switch_mmu_context(prev, next, tsk);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PPC32
|
||||
void arch_exit_mmap(struct mm_struct *mm)
|
||||
{
|
||||
void *frag = pte_frag_get(&mm->context);
|
||||
|
||||
if (frag)
|
||||
pte_frag_destroy(frag);
|
||||
}
|
||||
#endif
|
||||
|
@@ -385,6 +385,7 @@ int init_new_context(struct task_struct *t, struct mm_struct *mm)
|
||||
#endif
|
||||
mm->context.id = MMU_NO_CONTEXT;
|
||||
mm->context.active = 0;
|
||||
pte_frag_set(&mm->context, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -487,4 +488,3 @@ void __init mmu_context_init(void)
|
||||
next_context = FIRST_CONTEXT;
|
||||
nr_free_contexts = LAST_CONTEXT - FIRST_CONTEXT + 1;
|
||||
}
|
||||
|
||||
|
@@ -45,32 +45,15 @@ extern char etext[], _stext[], _sinittext[], _einittext[];
|
||||
|
||||
__ref pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
|
||||
{
|
||||
pte_t *pte;
|
||||
if (!slab_is_available())
|
||||
return memblock_alloc(PTE_FRAG_SIZE, PTE_FRAG_SIZE);
|
||||
|
||||
if (slab_is_available()) {
|
||||
pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_ZERO);
|
||||
} else {
|
||||
pte = __va(memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE));
|
||||
if (pte)
|
||||
clear_page(pte);
|
||||
}
|
||||
return pte;
|
||||
return (pte_t *)pte_fragment_alloc(mm, address, 1);
|
||||
}
|
||||
|
||||
pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address)
|
||||
{
|
||||
struct page *ptepage;
|
||||
|
||||
gfp_t flags = GFP_KERNEL | __GFP_ZERO | __GFP_ACCOUNT;
|
||||
|
||||
ptepage = alloc_pages(flags, 0);
|
||||
if (!ptepage)
|
||||
return NULL;
|
||||
if (!pgtable_page_ctor(ptepage)) {
|
||||
__free_page(ptepage);
|
||||
return NULL;
|
||||
}
|
||||
return ptepage;
|
||||
return (pgtable_t)pte_fragment_alloc(mm, address, 0);
|
||||
}
|
||||
|
||||
void __iomem *
|
||||
|
Criar uma nova questão referindo esta
Bloquear um utilizador