File Index
Files and directories
Sign in
FILE

mmu_context.h

File preview with syntax highlighting.

linux-6.19.14/arch/riscv/include/asm/mmu_context.h C
 1/* SPDX-License-Identifier: GPL-2.0-only */
 2/*
 3 * Copyright (C) 2012 Regents of the University of California
 4 * Copyright (C) 2017 SiFive
 5 */
 6
 7#ifndef _ASM_RISCV_MMU_CONTEXT_H
 8#define _ASM_RISCV_MMU_CONTEXT_H
 9
10#include <linux/mm_types.h>
11#include <asm-generic/mm_hooks.h>
12
13#include <linux/mm.h>
14#include <linux/sched.h>
15
16void switch_mm(struct mm_struct *prev, struct mm_struct *next,
17	struct task_struct *task);
18
19#define activate_mm activate_mm
20static inline void activate_mm(struct mm_struct *prev,
21			       struct mm_struct *next)
22{
23#ifdef CONFIG_RISCV_ISA_SUPM
24	next->context.pmlen = 0;
25#endif
26	switch_mm(prev, next, NULL);
27}
28
29#define init_new_context init_new_context
30static inline int init_new_context(struct task_struct *tsk,
31			struct mm_struct *mm)
32{
33#ifdef CONFIG_MMU
34	atomic_long_set(&mm->context.id, 0);
35#endif
36	if (IS_ENABLED(CONFIG_RISCV_ISA_SUPM))
37		clear_bit(MM_CONTEXT_LOCK_PMLEN, &mm->context.flags);
38	return 0;
39}
40
41DECLARE_STATIC_KEY_FALSE(use_asid_allocator);
42
43#ifdef CONFIG_RISCV_ISA_SUPM
44#define mm_untag_mask mm_untag_mask
45static inline unsigned long mm_untag_mask(struct mm_struct *mm)
46{
47	return -1UL >> mm->context.pmlen;
48}
49#endif
50
51#include <asm-generic/mmu_context.h>
52
53#endif /* _ASM_RISCV_MMU_CONTEXT_H */
~/ Read-only file preview.