Skip to content

Commit

Permalink
arm64: kernel: Move config_sctlr_el1
Browse files Browse the repository at this point in the history
Later patches need config_sctlr_el1 to set/clear bits in the sctlr_el1
register.

This patch moves this function into header a file.

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
  • Loading branch information
James Morse authored and Will Deacon committed Jul 27, 2015
1 parent fc03242 commit 870828e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
3 changes: 0 additions & 3 deletions arch/arm64/include/asm/cputype.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@
#define ID_AA64MMFR0_BIGEND(mmfr0) \
(((mmfr0) & ID_AA64MMFR0_BIGEND_MASK) >> ID_AA64MMFR0_BIGEND_SHIFT)

#define SCTLR_EL1_CP15BEN (0x1 << 5)
#define SCTLR_EL1_SED (0x1 << 8)

#ifndef __ASSEMBLY__

/*
Expand Down
12 changes: 12 additions & 0 deletions arch/arm64/include/asm/sysreg.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
#ifndef __ASM_SYSREG_H
#define __ASM_SYSREG_H

#define SCTLR_EL1_CP15BEN (0x1 << 5)
#define SCTLR_EL1_SED (0x1 << 8)

#define sys_reg(op0, op1, crn, crm, op2) \
((((op0)-2)<<19)|((op1)<<16)|((crn)<<12)|((crm)<<8)|((op2)<<5))

Expand Down Expand Up @@ -55,6 +58,15 @@ asm(
" .endm\n"
);

static inline void config_sctlr_el1(u32 clear, u32 set)
{
u32 val;

asm volatile("mrs %0, sctlr_el1" : "=r" (val));
val &= ~clear;
val |= set;
asm volatile("msr sctlr_el1, %0" : : "r" (val));
}
#endif

#endif /* __ASM_SYSREG_H */
11 changes: 1 addition & 10 deletions arch/arm64/kernel/armv8_deprecated.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include <asm/insn.h>
#include <asm/opcodes.h>
#include <asm/sysreg.h>
#include <asm/system_misc.h>
#include <asm/traps.h>
#include <asm/uaccess.h>
Expand Down Expand Up @@ -504,16 +505,6 @@ static int cp15barrier_handler(struct pt_regs *regs, u32 instr)
return 0;
}

static inline void config_sctlr_el1(u32 clear, u32 set)
{
u32 val;

asm volatile("mrs %0, sctlr_el1" : "=r" (val));
val &= ~clear;
val |= set;
asm volatile("msr sctlr_el1, %0" : : "r" (val));
}

static int cp15_barrier_set_hw_mode(bool enable)
{
if (enable)
Expand Down

0 comments on commit 870828e

Please sign in to comment.