Skip to content

Commit e7681be

Browse files
RISC-V: Split out the XIP fixups into their own file
This was broken by the original refactoring (as the XIP definitions depend on <asm/pgtable.h>) and then more broken by the merge (as I accidentally took the old version). This fixes both breakages, while also pulling this out of <asm/asm.h> to avoid polluting most assembly files with the XIP fixups. Fixes: bee7fbc ("RISC-V CPU Idle Support") Fixes: 63b13e6 ("RISC-V: Add arch functions for non-retentive suspend entry/exit") Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Guo Ren <[email protected]> Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 1ae4159 commit e7681be

File tree

4 files changed

+33
-26
lines changed

4 files changed

+33
-26
lines changed

arch/riscv/include/asm/asm.h

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -67,30 +67,4 @@
6767
#error "Unexpected __SIZEOF_SHORT__"
6868
#endif
6969

70-
#ifdef __ASSEMBLY__
71-
72-
/* Common assembly source macros */
73-
74-
#ifdef CONFIG_XIP_KERNEL
75-
.macro XIP_FIXUP_OFFSET reg
76-
REG_L t0, _xip_fixup
77-
add \reg, \reg, t0
78-
.endm
79-
.macro XIP_FIXUP_FLASH_OFFSET reg
80-
la t1, __data_loc
81-
REG_L t1, _xip_phys_offset
82-
sub \reg, \reg, t1
83-
add \reg, \reg, t0
84-
.endm
85-
_xip_fixup: .dword CONFIG_PHYS_RAM_BASE - CONFIG_XIP_PHYS_ADDR - XIP_OFFSET
86-
_xip_phys_offset: .dword CONFIG_XIP_PHYS_ADDR + XIP_OFFSET
87-
#else
88-
.macro XIP_FIXUP_OFFSET reg
89-
.endm
90-
.macro XIP_FIXUP_FLASH_OFFSET reg
91-
.endm
92-
#endif /* CONFIG_XIP_KERNEL */
93-
94-
#endif /* __ASSEMBLY__ */
95-
9670
#endif /* _ASM_RISCV_ASM_H */

arch/riscv/include/asm/xip_fixup.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only */
2+
/*
3+
* XIP fixup macros, only useful in assembly.
4+
*/
5+
#ifndef _ASM_RISCV_XIP_FIXUP_H
6+
#define _ASM_RISCV_XIP_FIXUP_H
7+
8+
#include <linux/pgtable.h>
9+
10+
#ifdef CONFIG_XIP_KERNEL
11+
.macro XIP_FIXUP_OFFSET reg
12+
REG_L t0, _xip_fixup
13+
add \reg, \reg, t0
14+
.endm
15+
.macro XIP_FIXUP_FLASH_OFFSET reg
16+
la t1, __data_loc
17+
REG_L t1, _xip_phys_offset
18+
sub \reg, \reg, t1
19+
add \reg, \reg, t0
20+
.endm
21+
22+
_xip_fixup: .dword CONFIG_PHYS_RAM_BASE - CONFIG_XIP_PHYS_ADDR - XIP_OFFSET
23+
_xip_phys_offset: .dword CONFIG_XIP_PHYS_ADDR + XIP_OFFSET
24+
#else
25+
.macro XIP_FIXUP_OFFSET reg
26+
.endm
27+
.macro XIP_FIXUP_FLASH_OFFSET reg
28+
.endm
29+
#endif /* CONFIG_XIP_KERNEL */
30+
31+
#endif

arch/riscv/kernel/head.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <asm/cpu_ops_sbi.h>
1515
#include <asm/hwcap.h>
1616
#include <asm/image.h>
17+
#include <asm/xip_fixup.h>
1718
#include "efi-header.S"
1819

1920
__HEAD

arch/riscv/kernel/suspend_entry.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <asm/asm.h>
99
#include <asm/asm-offsets.h>
1010
#include <asm/csr.h>
11+
#include <asm/xip_fixup.h>
1112

1213
.text
1314
.altmacro

0 commit comments

Comments
 (0)