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

Commit 4815b883 authored by Philippe Gerum's avatar Philippe Gerum Committed by Mike Frysinger
Browse files

Blackfin/ipipe: introduce support for CONFIG_MPU



Signed-off-by: default avatarPhilippe Gerum <rpm@xenomai.org>
Signed-off-by: default avatarLi Yi <yi.li@analog.com>
Signed-off-by: default avatarMike Frysinger <vapier@gentoo.org>
parent 7d4a005c
Loading
Loading
Loading
Loading
+31 −2
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ activate_l1stack(struct mm_struct *mm, unsigned long sp_base)

#define activate_mm(prev, next) switch_mm(prev, next, NULL)

static inline void switch_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm,
static inline void __switch_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm,
			       struct task_struct *tsk)
{
#ifdef CONFIG_MPU
@@ -95,7 +95,24 @@ static inline void switch_mm(struct mm_struct *prev_mm, struct mm_struct *next_m
#endif
}

#ifdef CONFIG_IPIPE
#define lock_mm_switch(flags)	local_irq_save_hw_cond(flags)
#define unlock_mm_switch(flags)	local_irq_restore_hw_cond(flags)
#else
#define lock_mm_switch(flags)	do { (void)(flags); } while (0)
#define unlock_mm_switch(flags)	do { (void)(flags); } while (0)
#endif /* CONFIG_IPIPE */

#ifdef CONFIG_MPU
static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
			     struct task_struct *tsk)
{
	unsigned long flags;
	lock_mm_switch(flags);
	__switch_mm(prev, next, tsk);
	unlock_mm_switch(flags);
}

static inline void protect_page(struct mm_struct *mm, unsigned long addr,
				unsigned long flags)
{
@@ -128,6 +145,12 @@ static inline void update_protections(struct mm_struct *mm)
		set_mask_dcplbs(mm->context.page_rwx_mask, cpu);
	}
}
#else /* !CONFIG_MPU */
static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
			     struct task_struct *tsk)
{
	__switch_mm(prev, next, tsk);
}
#endif

static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
@@ -173,4 +196,10 @@ static inline void destroy_context(struct mm_struct *mm)
#endif
}

#define ipipe_mm_switch_protect(flags)		\
	local_irq_save_hw_cond(flags)

#define ipipe_mm_switch_unprotect(flags)	\
	local_irq_restore_hw_cond(flags)

#endif