Skip to content

Commit 1e53860

Browse files
Julien MassotMaureenHelm
authored andcommitted
arch: arm: aarch32: Do not relocate vector table on ARMv8-R
ARMv8-R allows to set the vector table address using VBAR register, so there is no need to relocate it. Move away vector_table setting from reset.S and move it to relocate vector table function as it's done for Cortex-M CPU. Signed-off-by: Julien Massot <[email protected]>
1 parent 14bac3f commit 1e53860

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

arch/arm/core/aarch32/cortex_a_r/reset.S

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,7 @@ SECTION_SUBSEC_FUNC(TEXT, _reset_section, __start)
6161
ldr r0, =HACTLR_INIT
6262
mcr p15, 4, r0, c1, c0, 1
6363

64-
/* Change EL1 exception base address */
65-
ldr r0,=_vector_table
66-
mcr p15, 0, r0, c12, c0, 0 /* Write to VBAR */
67-
68-
/* Go to SVC mode */
64+
/* Go to SVC mode */
6965
mrs r0, cpsr
7066
bic r0, #MODE_MASK
7167
orr r0, #MODE_SVC

arch/arm/core/aarch32/prep_c.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,17 @@ static inline void relocate_vector_table(void)
5353
__ISB();
5454
}
5555

56-
#else
56+
#elif defined(CONFIG_AARCH32_ARMV8_R)
57+
58+
#define VECTOR_ADDRESS ((uintptr_t)_vector_start)
5759

60+
static inline void relocate_vector_table(void)
61+
{
62+
write_vbar(VECTOR_ADDRESS & VBAR_MASK);
63+
__ISB();
64+
}
65+
66+
#else
5867
#define VECTOR_ADDRESS 0
5968

6069
void __weak relocate_vector_table(void)

include/arch/arm/aarch32/cortex_a_r/cpu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
#define DFSR_AXI_SLAVE_MASK (1 << 12)
4949

5050
/* Armv8-R AArch32 architecture profile */
51+
#define VBAR_MASK (0xFFFFFFE0U)
5152
#define SCTLR_M_BIT BIT(0)
5253
#define SCTLR_A_BIT BIT(1)
5354
#define SCTLR_C_BIT BIT(2)

include/arch/arm/aarch32/cortex_a_r/lib_helpers.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ MAKE_REG_HELPER(sctlr, 0, 1, 0, 0);
6868
MAKE_REG_HELPER(prselr, 0, 6, 2, 1);
6969
MAKE_REG_HELPER(prbar, 0, 6, 3, 0);
7070
MAKE_REG_HELPER(prlar, 0, 6, 3, 1);
71+
MAKE_REG_HELPER(vbar, 0, 12, 0, 0);
7172
MAKE_REG_HELPER(cntv_ctl, 0, 14, 3, 1);
7273
MAKE_REG64_HELPER(ICC_SGI1R, 0, 12);
7374
MAKE_REG64_HELPER(cntvct, 1, 14);

0 commit comments

Comments
 (0)