mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
s390: KVM preparation: provide hook to enable pgstes in user pagetable
The SIE instruction on s390 uses the 2nd half of the page table page to virtualize the storage keys of a guest. This patch offers the s390_enable_sie function, which reorganizes the page tables of a single-threaded process to reserve space in the page table: s390_enable_sie makes sure that the process is single threaded and then uses dup_mm to create a new mm with reorganized page tables. The old mm is freed and the process has now a page status extended field after every page table. Code that wants to exploit pgstes should SELECT CONFIG_PGSTE. This patch has a small common code hit, namely making dup_mm non-static. Edit (Carsten): I've modified Martin's patch, following Jeremy Fitzhardinge's review feedback. Now we do have the prototype for dup_mm in include/linux/sched.h. Following Martin's suggestion, s390_enable_sie() does now call task_lock() to prevent race against ptrace modification of mm_users. Signed-off-by: Martin Schwidefsky <[email protected]> Signed-off-by: Carsten Otte <[email protected]> Acked-by: Andrew Morton <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
This commit is contained in:
parent
37817f2982
commit
402b08622d
8 changed files with 82 additions and 5 deletions
|
|
@ -7,6 +7,7 @@ typedef struct {
|
|||
unsigned long asce_bits;
|
||||
unsigned long asce_limit;
|
||||
int noexec;
|
||||
int pgstes;
|
||||
} mm_context_t;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -20,7 +20,13 @@ static inline int init_new_context(struct task_struct *tsk,
|
|||
#ifdef CONFIG_64BIT
|
||||
mm->context.asce_bits |= _ASCE_TYPE_REGION3;
|
||||
#endif
|
||||
mm->context.noexec = s390_noexec;
|
||||
if (current->mm->context.pgstes) {
|
||||
mm->context.noexec = 0;
|
||||
mm->context.pgstes = 1;
|
||||
} else {
|
||||
mm->context.noexec = s390_noexec;
|
||||
mm->context.pgstes = 0;
|
||||
}
|
||||
mm->context.asce_limit = STACK_TOP_MAX;
|
||||
crst_table_init((unsigned long *) mm->pgd, pgd_entry_type(mm));
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -966,6 +966,7 @@ static inline pte_t mk_swap_pte(unsigned long type, unsigned long offset)
|
|||
|
||||
extern int add_shared_memory(unsigned long start, unsigned long size);
|
||||
extern int remove_shared_memory(unsigned long start, unsigned long size);
|
||||
extern int s390_enable_sie(void);
|
||||
|
||||
/*
|
||||
* No page table caches to initialise
|
||||
|
|
|
|||
Loading…
Reference in a new issue