Skip to content

Commit 3bfd8fc

Browse files
committed
Merge tag 'loongarch-fixes-6.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
Pull LoongArch fixes from Huacai Chen: "Fix two build warnings, a copy_thread() bug, two page table manipulation bugs, and some trivial cleanups" * tag 'loongarch-fixes-6.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson: docs/zh_CN/LoongArch: Fix wrong description of FPRs Note LoongArch: Fix unsigned comparison with less than zero LoongArch: Set _PAGE_DIRTY only if _PAGE_MODIFIED is set in {pmd,pte}_mkwrite() LoongArch: Set _PAGE_DIRTY only if _PAGE_WRITE is set in {pmd,pte}_mkdirty() LoongArch: Clear FPU/SIMD thread info flags for kernel thread LoongArch: SMP: Change prefix from loongson3 to loongson LoongArch: Combine acpi_boot_table_init() and acpi_boot_init() LoongArch: Makefile: Use "grep -E" instead of "egrep"
2 parents 6fd2152 + fa0e381 commit 3bfd8fc

11 files changed

Lines changed: 71 additions & 73 deletions

File tree

Documentation/translations/zh_CN/loongarch/introduction.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ LA64中每个寄存器为64位宽。 ``$r0`` 的内容总是固定为0,而其
7070
================= ================== =================== ==========
7171

7272
.. note::
73-
注意:在一些遗留代码中有时可能见到 ``$v0`` 和 ``$v1`` ,它们是
74-
``$a0`` 和 ``$a1`` 的别名,属于已经废弃的用法。
73+
注意:在一些遗留代码中有时可能见到 ``$fv0`` 和 ``$fv1`` ,它们是
74+
``$fa0`` 和 ``$fa1`` 的别名,属于已经废弃的用法。
7575

7676

7777
向量寄存器

arch/loongarch/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ KBUILD_LDFLAGS += -m $(ld-emul)
9797

9898
ifdef CONFIG_LOONGARCH
9999
CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \
100-
egrep -vw '__GNUC_(MINOR_|PATCHLEVEL_)?_' | \
100+
grep -E -vw '__GNUC_(MINOR_|PATCHLEVEL_)?_' | \
101101
sed -e "s/^\#define /-D'/" -e "s/ /'='/" -e "s/$$/'/" -e 's/\$$/&&/g')
102102
endif
103103

arch/loongarch/include/asm/irq.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ extern struct fwnode_handle *liointc_handle;
117117
extern struct fwnode_handle *pch_lpc_handle;
118118
extern struct fwnode_handle *pch_pic_handle[MAX_IO_PICS];
119119

120-
extern irqreturn_t loongson3_ipi_interrupt(int irq, void *dev);
120+
extern irqreturn_t loongson_ipi_interrupt(int irq, void *dev);
121121

122122
#include <asm-generic/irq.h>
123123

arch/loongarch/include/asm/pgtable.h

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,13 +349,17 @@ static inline pte_t pte_mkclean(pte_t pte)
349349

350350
static inline pte_t pte_mkdirty(pte_t pte)
351351
{
352-
pte_val(pte) |= (_PAGE_DIRTY | _PAGE_MODIFIED);
352+
pte_val(pte) |= _PAGE_MODIFIED;
353+
if (pte_val(pte) & _PAGE_WRITE)
354+
pte_val(pte) |= _PAGE_DIRTY;
353355
return pte;
354356
}
355357

356358
static inline pte_t pte_mkwrite(pte_t pte)
357359
{
358-
pte_val(pte) |= (_PAGE_WRITE | _PAGE_DIRTY);
360+
pte_val(pte) |= _PAGE_WRITE;
361+
if (pte_val(pte) & _PAGE_MODIFIED)
362+
pte_val(pte) |= _PAGE_DIRTY;
359363
return pte;
360364
}
361365

@@ -455,7 +459,9 @@ static inline int pmd_write(pmd_t pmd)
455459

456460
static inline pmd_t pmd_mkwrite(pmd_t pmd)
457461
{
458-
pmd_val(pmd) |= (_PAGE_WRITE | _PAGE_DIRTY);
462+
pmd_val(pmd) |= _PAGE_WRITE;
463+
if (pmd_val(pmd) & _PAGE_MODIFIED)
464+
pmd_val(pmd) |= _PAGE_DIRTY;
459465
return pmd;
460466
}
461467

@@ -478,7 +484,9 @@ static inline pmd_t pmd_mkclean(pmd_t pmd)
478484

479485
static inline pmd_t pmd_mkdirty(pmd_t pmd)
480486
{
481-
pmd_val(pmd) |= (_PAGE_DIRTY | _PAGE_MODIFIED);
487+
pmd_val(pmd) |= _PAGE_MODIFIED;
488+
if (pmd_val(pmd) & _PAGE_WRITE)
489+
pmd_val(pmd) |= _PAGE_DIRTY;
482490
return pmd;
483491
}
484492

arch/loongarch/include/asm/smp.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,21 @@ extern cpumask_t cpu_sibling_map[];
1919
extern cpumask_t cpu_core_map[];
2020
extern cpumask_t cpu_foreign_map[];
2121

22-
void loongson3_smp_setup(void);
23-
void loongson3_prepare_cpus(unsigned int max_cpus);
24-
void loongson3_boot_secondary(int cpu, struct task_struct *idle);
25-
void loongson3_init_secondary(void);
26-
void loongson3_smp_finish(void);
27-
void loongson3_send_ipi_single(int cpu, unsigned int action);
28-
void loongson3_send_ipi_mask(const struct cpumask *mask, unsigned int action);
22+
void loongson_smp_setup(void);
23+
void loongson_prepare_cpus(unsigned int max_cpus);
24+
void loongson_boot_secondary(int cpu, struct task_struct *idle);
25+
void loongson_init_secondary(void);
26+
void loongson_smp_finish(void);
27+
void loongson_send_ipi_single(int cpu, unsigned int action);
28+
void loongson_send_ipi_mask(const struct cpumask *mask, unsigned int action);
2929
#ifdef CONFIG_HOTPLUG_CPU
30-
int loongson3_cpu_disable(void);
31-
void loongson3_cpu_die(unsigned int cpu);
30+
int loongson_cpu_disable(void);
31+
void loongson_cpu_die(unsigned int cpu);
3232
#endif
3333

3434
static inline void plat_smp_setup(void)
3535
{
36-
loongson3_smp_setup();
36+
loongson_smp_setup();
3737
}
3838

3939
static inline int raw_smp_processor_id(void)
@@ -85,28 +85,28 @@ extern void show_ipi_list(struct seq_file *p, int prec);
8585
*/
8686
static inline void smp_send_reschedule(int cpu)
8787
{
88-
loongson3_send_ipi_single(cpu, SMP_RESCHEDULE);
88+
loongson_send_ipi_single(cpu, SMP_RESCHEDULE);
8989
}
9090

9191
static inline void arch_send_call_function_single_ipi(int cpu)
9292
{
93-
loongson3_send_ipi_single(cpu, SMP_CALL_FUNCTION);
93+
loongson_send_ipi_single(cpu, SMP_CALL_FUNCTION);
9494
}
9595

9696
static inline void arch_send_call_function_ipi_mask(const struct cpumask *mask)
9797
{
98-
loongson3_send_ipi_mask(mask, SMP_CALL_FUNCTION);
98+
loongson_send_ipi_mask(mask, SMP_CALL_FUNCTION);
9999
}
100100

101101
#ifdef CONFIG_HOTPLUG_CPU
102102
static inline int __cpu_disable(void)
103103
{
104-
return loongson3_cpu_disable();
104+
return loongson_cpu_disable();
105105
}
106106

107107
static inline void __cpu_die(unsigned int cpu)
108108
{
109-
loongson3_cpu_die(cpu);
109+
loongson_cpu_die(cpu);
110110
}
111111

112112
extern void play_dead(void);

arch/loongarch/kernel/acpi.c

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,6 @@ void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)
5656
return ioremap_cache(phys, size);
5757
}
5858

59-
void __init acpi_boot_table_init(void)
60-
{
61-
/*
62-
* If acpi_disabled, bail out
63-
*/
64-
if (acpi_disabled)
65-
return;
66-
67-
/*
68-
* Initialize the ACPI boot-time table parser.
69-
*/
70-
if (acpi_table_init()) {
71-
disable_acpi();
72-
return;
73-
}
74-
}
75-
7659
#ifdef CONFIG_SMP
7760
static int set_processor_mask(u32 id, u32 flags)
7861
{
@@ -156,13 +139,21 @@ static void __init acpi_process_madt(void)
156139
loongson_sysconf.nr_cpus = num_processors;
157140
}
158141

159-
int __init acpi_boot_init(void)
142+
void __init acpi_boot_table_init(void)
160143
{
161144
/*
162145
* If acpi_disabled, bail out
163146
*/
164147
if (acpi_disabled)
165-
return -1;
148+
return;
149+
150+
/*
151+
* Initialize the ACPI boot-time table parser.
152+
*/
153+
if (acpi_table_init()) {
154+
disable_acpi();
155+
return;
156+
}
166157

167158
loongson_sysconf.boot_cpu_id = read_csr_cpuid();
168159

@@ -173,8 +164,6 @@ int __init acpi_boot_init(void)
173164

174165
/* Do not enable ACPI SPCR console by default */
175166
acpi_parse_spcr(earlycon_acpi_spcr_enable, false);
176-
177-
return 0;
178167
}
179168

180169
#ifdef CONFIG_ACPI_NUMA

arch/loongarch/kernel/irq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ void __init init_IRQ(void)
117117
if (ipi_irq < 0)
118118
panic("IPI IRQ mapping failed\n");
119119
irq_set_percpu_devid(ipi_irq);
120-
r = request_percpu_irq(ipi_irq, loongson3_ipi_interrupt, "IPI", &ipi_dummy_dev);
120+
r = request_percpu_irq(ipi_irq, loongson_ipi_interrupt, "IPI", &ipi_dummy_dev);
121121
if (r < 0)
122122
panic("IPI IRQ request failed\n");
123123
#endif

arch/loongarch/kernel/process.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
152152
childregs->csr_crmd = p->thread.csr_crmd;
153153
childregs->csr_prmd = p->thread.csr_prmd;
154154
childregs->csr_ecfg = p->thread.csr_ecfg;
155-
return 0;
155+
goto out;
156156
}
157157

158158
/* user thread */
@@ -171,14 +171,15 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
171171
*/
172172
childregs->csr_euen = 0;
173173

174+
if (clone_flags & CLONE_SETTLS)
175+
childregs->regs[2] = tls;
176+
177+
out:
174178
clear_tsk_thread_flag(p, TIF_USEDFPU);
175179
clear_tsk_thread_flag(p, TIF_USEDSIMD);
176180
clear_tsk_thread_flag(p, TIF_LSX_CTX_LIVE);
177181
clear_tsk_thread_flag(p, TIF_LASX_CTX_LIVE);
178182

179-
if (clone_flags & CLONE_SETTLS)
180-
childregs->regs[2] = tls;
181-
182183
return 0;
183184
}
184185

arch/loongarch/kernel/setup.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@ void __init platform_init(void)
257257
#ifdef CONFIG_ACPI
258258
acpi_gbl_use_default_register_widths = false;
259259
acpi_boot_table_init();
260-
acpi_boot_init();
261260
#endif
262261

263262
#ifdef CONFIG_NUMA

0 commit comments

Comments
 (0)