Skip to content

Commit 9b6de13

Browse files
committed
Merge tag 'loongarch-fixes-6.7-1' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
Pull LoongArch fixes from Huacai Chen: "Fix several build errors, a potential kernel panic, a cpu hotplug issue and update links in documentations" * tag 'loongarch-fixes-6.7-1' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson: Docs/zh_CN/LoongArch: Update links in LoongArch introduction.rst Docs/LoongArch: Update links in LoongArch introduction.rst LoongArch: Implement constant timer shutdown interface LoongArch: Mark {dmw,tlb}_virt_to_page() exports as non-GPL LoongArch: Silence the boot warning about 'nokaslr' LoongArch: Add __percpu annotation for __percpu_read()/__percpu_write() LoongArch: Record pc instead of offset in la_abs relocation LoongArch: Explicitly set -fdirect-access-external-data for vmlinux LoongArch: Add dependency between vmlinuz.efi and vmlinux.efi
2 parents 05c8c94 + c517fd2 commit 9b6de13

File tree

9 files changed

+34
-30
lines changed

9 files changed

+34
-30
lines changed

Documentation/arch/loongarch/introduction.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,9 +375,9 @@ Developer web site of Loongson and LoongArch (Software and Documentation):
375375

376376
Documentation of LoongArch ISA:
377377

378-
https://github.com/loongson/LoongArch-Documentation/releases/latest/download/LoongArch-Vol1-v1.02-CN.pdf (in Chinese)
378+
https://github.com/loongson/LoongArch-Documentation/releases/latest/download/LoongArch-Vol1-v1.10-CN.pdf (in Chinese)
379379

380-
https://github.com/loongson/LoongArch-Documentation/releases/latest/download/LoongArch-Vol1-v1.02-EN.pdf (in English)
380+
https://github.com/loongson/LoongArch-Documentation/releases/latest/download/LoongArch-Vol1-v1.10-EN.pdf (in English)
381381

382382
Documentation of LoongArch ELF psABI:
383383

Documentation/translations/zh_CN/arch/loongarch/introduction.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,9 +338,9 @@ Loongson与LoongArch的开发者网站(软件与文档资源):
338338

339339
LoongArch指令集架构的文档:
340340

341-
https://github.com/loongson/LoongArch-Documentation/releases/latest/download/LoongArch-Vol1-v1.02-CN.pdf (中文版)
341+
https://github.com/loongson/LoongArch-Documentation/releases/latest/download/LoongArch-Vol1-v1.10-CN.pdf (中文版)
342342

343-
https://github.com/loongson/LoongArch-Documentation/releases/latest/download/LoongArch-Vol1-v1.02-EN.pdf (英文版)
343+
https://github.com/loongson/LoongArch-Documentation/releases/latest/download/LoongArch-Vol1-v1.10-EN.pdf (英文版)
344344

345345
LoongArch的ELF psABI文档:
346346

arch/loongarch/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ LDFLAGS_vmlinux += -static -n -nostdlib
6868
ifdef CONFIG_AS_HAS_EXPLICIT_RELOCS
6969
cflags-y += $(call cc-option,-mexplicit-relocs)
7070
KBUILD_CFLAGS_KERNEL += $(call cc-option,-mdirect-extern-access)
71+
KBUILD_CFLAGS_KERNEL += $(call cc-option,-fdirect-access-external-data)
7172
KBUILD_AFLAGS_MODULE += $(call cc-option,-fno-direct-access-external-data)
7273
KBUILD_CFLAGS_MODULE += $(call cc-option,-fno-direct-access-external-data)
7374
KBUILD_AFLAGS_MODULE += $(call cc-option,-mno-relax) $(call cc-option,-Wa$(comma)-mno-relax)
@@ -142,6 +143,8 @@ vdso-install-y += arch/loongarch/vdso/vdso.so.dbg
142143

143144
all: $(notdir $(KBUILD_IMAGE))
144145

146+
vmlinuz.efi: vmlinux.efi
147+
145148
vmlinux.elf vmlinux.efi vmlinuz.efi: vmlinux
146149
$(Q)$(MAKE) $(build)=$(boot) $(bootvars-y) $(boot)/$@
147150

arch/loongarch/include/asm/asmmacro.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,8 +609,7 @@
609609
lu32i.d \reg, 0
610610
lu52i.d \reg, \reg, 0
611611
.pushsection ".la_abs", "aw", %progbits
612-
768:
613-
.dword 768b-766b
612+
.dword 766b
614613
.dword \sym
615614
.popsection
616615
#endif

arch/loongarch/include/asm/percpu.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ static __always_inline unsigned long __percpu_##op(void *ptr, \
4040
switch (size) { \
4141
case 4: \
4242
__asm__ __volatile__( \
43-
"am"#asm_op".w" " %[ret], %[val], %[ptr] \n" \
43+
"am"#asm_op".w" " %[ret], %[val], %[ptr] \n" \
4444
: [ret] "=&r" (ret), [ptr] "+ZB"(*(u32 *)ptr) \
4545
: [val] "r" (val)); \
4646
break; \
4747
case 8: \
4848
__asm__ __volatile__( \
49-
"am"#asm_op".d" " %[ret], %[val], %[ptr] \n" \
49+
"am"#asm_op".d" " %[ret], %[val], %[ptr] \n" \
5050
: [ret] "=&r" (ret), [ptr] "+ZB"(*(u64 *)ptr) \
5151
: [val] "r" (val)); \
5252
break; \
@@ -63,7 +63,7 @@ PERCPU_OP(and, and, &)
6363
PERCPU_OP(or, or, |)
6464
#undef PERCPU_OP
6565

66-
static __always_inline unsigned long __percpu_read(void *ptr, int size)
66+
static __always_inline unsigned long __percpu_read(void __percpu *ptr, int size)
6767
{
6868
unsigned long ret;
6969

@@ -100,7 +100,7 @@ static __always_inline unsigned long __percpu_read(void *ptr, int size)
100100
return ret;
101101
}
102102

103-
static __always_inline void __percpu_write(void *ptr, unsigned long val, int size)
103+
static __always_inline void __percpu_write(void __percpu *ptr, unsigned long val, int size)
104104
{
105105
switch (size) {
106106
case 1:
@@ -132,8 +132,7 @@ static __always_inline void __percpu_write(void *ptr, unsigned long val, int siz
132132
}
133133
}
134134

135-
static __always_inline unsigned long __percpu_xchg(void *ptr, unsigned long val,
136-
int size)
135+
static __always_inline unsigned long __percpu_xchg(void *ptr, unsigned long val, int size)
137136
{
138137
switch (size) {
139138
case 1:

arch/loongarch/include/asm/setup.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ extern void set_merr_handler(unsigned long offset, void *addr, unsigned long len
2525
#ifdef CONFIG_RELOCATABLE
2626

2727
struct rela_la_abs {
28-
long offset;
28+
long pc;
2929
long symvalue;
3030
};
3131

arch/loongarch/kernel/relocate.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ static inline void __init relocate_absolute(long random_offset)
5252
for (p = begin; (void *)p < end; p++) {
5353
long v = p->symvalue;
5454
uint32_t lu12iw, ori, lu32id, lu52id;
55-
union loongarch_instruction *insn = (void *)p - p->offset;
55+
union loongarch_instruction *insn = (void *)p->pc;
5656

5757
lu12iw = (v >> 12) & 0xfffff;
5858
ori = v & 0xfff;
@@ -102,6 +102,14 @@ static inline __init unsigned long get_random_boot(void)
102102
return hash;
103103
}
104104

105+
static int __init nokaslr(char *p)
106+
{
107+
pr_info("KASLR is disabled.\n");
108+
109+
return 0; /* Print a notice and silence the boot warning */
110+
}
111+
early_param("nokaslr", nokaslr);
112+
105113
static inline __init bool kaslr_disabled(void)
106114
{
107115
char *str;

arch/loongarch/kernel/time.c

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,43 +58,38 @@ static int constant_set_state_oneshot(struct clock_event_device *evt)
5858
return 0;
5959
}
6060

61-
static int constant_set_state_oneshot_stopped(struct clock_event_device *evt)
61+
static int constant_set_state_periodic(struct clock_event_device *evt)
6262
{
63+
unsigned long period;
6364
unsigned long timer_config;
6465

6566
raw_spin_lock(&state_lock);
6667

67-
timer_config = csr_read64(LOONGARCH_CSR_TCFG);
68-
timer_config &= ~CSR_TCFG_EN;
68+
period = const_clock_freq / HZ;
69+
timer_config = period & CSR_TCFG_VAL;
70+
timer_config |= (CSR_TCFG_PERIOD | CSR_TCFG_EN);
6971
csr_write64(timer_config, LOONGARCH_CSR_TCFG);
7072

7173
raw_spin_unlock(&state_lock);
7274

7375
return 0;
7476
}
7577

76-
static int constant_set_state_periodic(struct clock_event_device *evt)
78+
static int constant_set_state_shutdown(struct clock_event_device *evt)
7779
{
78-
unsigned long period;
7980
unsigned long timer_config;
8081

8182
raw_spin_lock(&state_lock);
8283

83-
period = const_clock_freq / HZ;
84-
timer_config = period & CSR_TCFG_VAL;
85-
timer_config |= (CSR_TCFG_PERIOD | CSR_TCFG_EN);
84+
timer_config = csr_read64(LOONGARCH_CSR_TCFG);
85+
timer_config &= ~CSR_TCFG_EN;
8686
csr_write64(timer_config, LOONGARCH_CSR_TCFG);
8787

8888
raw_spin_unlock(&state_lock);
8989

9090
return 0;
9191
}
9292

93-
static int constant_set_state_shutdown(struct clock_event_device *evt)
94-
{
95-
return 0;
96-
}
97-
9893
static int constant_timer_next_event(unsigned long delta, struct clock_event_device *evt)
9994
{
10095
unsigned long timer_config;
@@ -161,7 +156,7 @@ int constant_clockevent_init(void)
161156
cd->rating = 320;
162157
cd->cpumask = cpumask_of(cpu);
163158
cd->set_state_oneshot = constant_set_state_oneshot;
164-
cd->set_state_oneshot_stopped = constant_set_state_oneshot_stopped;
159+
cd->set_state_oneshot_stopped = constant_set_state_shutdown;
165160
cd->set_state_periodic = constant_set_state_periodic;
166161
cd->set_state_shutdown = constant_set_state_shutdown;
167162
cd->set_next_event = constant_timer_next_event;

arch/loongarch/mm/pgtable.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ struct page *dmw_virt_to_page(unsigned long kaddr)
1313
{
1414
return pfn_to_page(virt_to_pfn(kaddr));
1515
}
16-
EXPORT_SYMBOL_GPL(dmw_virt_to_page);
16+
EXPORT_SYMBOL(dmw_virt_to_page);
1717

1818
struct page *tlb_virt_to_page(unsigned long kaddr)
1919
{
2020
return pfn_to_page(pte_pfn(*virt_to_kpte(kaddr)));
2121
}
22-
EXPORT_SYMBOL_GPL(tlb_virt_to_page);
22+
EXPORT_SYMBOL(tlb_virt_to_page);
2323

2424
pgd_t *pgd_alloc(struct mm_struct *mm)
2525
{

0 commit comments

Comments
 (0)