Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

arm64: head.S: cleanup SCTLR_ELx initialization

Let's make SCTLR_ELx initialization a bit clearer by using meaningful
names for the initialization values, following the same scheme for
SCTLR_EL1 and SCTLR_EL2.

These definitions will be used more widely in subsequent patches.

There should be no functional change as a result of this patch.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: James Morse <james.morse@arm.com>
Cc: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20201113124937.20574-5-mark.rutland@arm.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>

authored by

Mark Rutland and committed by
Catalin Marinas
2ffac9e3 ecbb11ab

+16 -10
+12 -6
arch/arm64/include/asm/sysreg.h
··· 582 582 #define ENDIAN_SET_EL2 0 583 583 #endif 584 584 585 + #define INIT_SCTLR_EL2_MMU_OFF \ 586 + (SCTLR_EL2_RES1 | ENDIAN_SET_EL2) 587 + 585 588 /* SCTLR_EL1 specific flags. */ 586 589 #define SCTLR_EL1_ATA0 (BIT(42)) 587 590 ··· 618 615 #define ENDIAN_SET_EL1 0 619 616 #endif 620 617 621 - #define SCTLR_EL1_SET (SCTLR_ELx_M | SCTLR_ELx_C | SCTLR_ELx_SA |\ 622 - SCTLR_EL1_SA0 | SCTLR_EL1_SED | SCTLR_ELx_I |\ 623 - SCTLR_EL1_DZE | SCTLR_EL1_UCT |\ 624 - SCTLR_EL1_NTWE | SCTLR_ELx_IESB | SCTLR_EL1_SPAN |\ 625 - SCTLR_ELx_ITFSB| SCTLR_ELx_ATA | SCTLR_EL1_ATA0 |\ 626 - ENDIAN_SET_EL1 | SCTLR_EL1_UCI | SCTLR_EL1_RES1) 618 + #define INIT_SCTLR_EL1_MMU_OFF \ 619 + (ENDIAN_SET_EL1 | SCTLR_EL1_RES1) 620 + 621 + #define INIT_SCTLR_EL1_MMU_ON \ 622 + (SCTLR_ELx_M | SCTLR_ELx_C | SCTLR_ELx_SA | SCTLR_EL1_SA0 | \ 623 + SCTLR_EL1_SED | SCTLR_ELx_I | SCTLR_EL1_DZE | SCTLR_EL1_UCT | \ 624 + SCTLR_EL1_NTWE | SCTLR_ELx_IESB | SCTLR_EL1_SPAN | SCTLR_ELx_ITFSB | \ 625 + SCTLR_ELx_ATA | SCTLR_EL1_ATA0 | ENDIAN_SET_EL1 | SCTLR_EL1_UCI | \ 626 + SCTLR_EL1_RES1) 627 627 628 628 /* MAIR_ELx memory attributes (used by Linux) */ 629 629 #define MAIR_ATTR_DEVICE_nGnRnE UL(0x00)
+3 -3
arch/arm64/kernel/head.S
··· 494 494 mrs x0, CurrentEL 495 495 cmp x0, #CurrentEL_EL2 496 496 b.eq 1f 497 - mov_q x0, (SCTLR_EL1_RES1 | ENDIAN_SET_EL1) 497 + mov_q x0, INIT_SCTLR_EL1_MMU_OFF 498 498 msr sctlr_el1, x0 499 499 mov w0, #BOOT_CPU_MODE_EL1 // This cpu booted in EL1 500 500 isb 501 501 ret 502 502 503 - 1: mov_q x0, (SCTLR_EL2_RES1 | ENDIAN_SET_EL2) 503 + 1: mov_q x0, INIT_SCTLR_EL2_MMU_OFF 504 504 msr sctlr_el2, x0 505 505 506 506 #ifdef CONFIG_ARM64_VHE ··· 621 621 * requires no configuration, and all non-hyp-specific EL2 setup 622 622 * will be done via the _EL1 system register aliases in __cpu_setup. 623 623 */ 624 - mov_q x0, (SCTLR_EL1_RES1 | ENDIAN_SET_EL1) 624 + mov_q x0, INIT_SCTLR_EL1_MMU_OFF 625 625 msr sctlr_el1, x0 626 626 627 627 /* Coprocessor traps. */
+1 -1
arch/arm64/mm/proc.S
··· 489 489 /* 490 490 * Prepare SCTLR 491 491 */ 492 - mov_q x0, SCTLR_EL1_SET 492 + mov_q x0, INIT_SCTLR_EL1_MMU_ON 493 493 ret // return to head.S 494 494 SYM_FUNC_END(__cpu_setup)