Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 957b778a authored by Aneesh Kumar K.V's avatar Aneesh Kumar K.V Committed by Michael Ellerman
Browse files

powerpc/mm: Add addr_limit to mm_context and use it to derive max slice index



In the followup patch, we will increase the slice array size to handle
512TB range, but will limit the max addr to 128TB. Avoid doing
unnecessary computation and avoid doing slice mask related operation
above address limit.

Signed-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent f6eedbba
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -598,6 +598,7 @@ extern void slb_set_size(u16 size);

/* 4 bits per slice and we have one slice per 1TB */
#define SLICE_ARRAY_SIZE	(H_PGTABLE_RANGE >> 41)
#define TASK_SLICE_ARRAY_SZ(x)	((x)->context.addr_limit >> 41)

#ifndef __ASSEMBLY__

+1 −0
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ typedef struct {
#ifdef CONFIG_PPC_MM_SLICES
	u64 low_slices_psize;	/* SLB page size encodings */
	unsigned char high_slices_psize[SLICE_ARRAY_SIZE];
	unsigned long addr_limit;
#else
	u16 sllp;		/* SLB page size encoding */
#endif
+2 −1
Original line number Diff line number Diff line
@@ -253,9 +253,10 @@ void copy_mm_to_paca(struct mm_struct *mm)

	get_paca()->mm_ctx_id = context->id;
#ifdef CONFIG_PPC_MM_SLICES
	VM_BUG_ON(!mm->context.addr_limit);
	get_paca()->mm_ctx_low_slices_psize = context->low_slices_psize;
	memcpy(&get_paca()->mm_ctx_high_slices_psize,
	       &context->high_slices_psize, SLICE_ARRAY_SIZE);
	       &context->high_slices_psize, TASK_SLICE_ARRAY_SZ(mm));
#else /* CONFIG_PPC_MM_SLICES */
	get_paca()->mm_ctx_user_psize = context->user_psize;
	get_paca()->mm_ctx_sllp = context->sllp;
+9 −0
Original line number Diff line number Diff line
@@ -920,6 +920,15 @@ void __init setup_arch(char **cmdline_p)
	init_mm.end_code = (unsigned long) _etext;
	init_mm.end_data = (unsigned long) _edata;
	init_mm.brk = klimit;

#ifdef CONFIG_PPC_MM_SLICES
#ifdef CONFIG_PPC64
	init_mm.context.addr_limit = TASK_SIZE_USER64;
#else
#error	"context.addr_limit not initialized."
#endif
#endif

#ifdef CONFIG_PPC_64K_PAGES
	init_mm.context.pte_frag = NULL;
#endif
+7 −0
Original line number Diff line number Diff line
@@ -78,6 +78,13 @@ static int hash__init_new_context(struct mm_struct *mm)
	if (index < 0)
		return index;

	/*
	 * We do switch_slb() early in fork, even before we setup the
	 * mm->context.addr_limit. Default to max task size so that we copy the
	 * default values to paca which will help us to handle slb miss early.
	 */
	mm->context.addr_limit = TASK_SIZE_USER64;

	/*
	 * The old code would re-promote on fork, we don't do that when using
	 * slices as it could cause problem promoting slices that have been
Loading