Skip to content

Commit 0678afa

Browse files
committed
Merge tag 'loongarch-fixes-5.19-1' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
Pull LoongArch fixes from Huacai Chen. "Fix build errors and a stale comment" * tag 'loongarch-fixes-5.19-1' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson: LoongArch: Remove MIPS comment about cycle counter LoongArch: Fix copy_thread() build errors LoongArch: Fix the !CONFIG_SMP build
2 parents 1c27f1f + 5c95fe8 commit 0678afa

File tree

11 files changed

+31
-36
lines changed

11 files changed

+31
-36
lines changed

arch/loongarch/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ config NR_CPUS
343343

344344
config NUMA
345345
bool "NUMA Support"
346+
select SMP
346347
select ACPI_NUMA if ACPI
347348
help
348349
Say Y to compile the kernel with NUMA (Non-Uniform Memory Access)

arch/loongarch/include/asm/hardirq.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ typedef struct {
1919
unsigned int __softirq_pending;
2020
} ____cacheline_aligned irq_cpustat_t;
2121

22-
DECLARE_PER_CPU_ALIGNED(irq_cpustat_t, irq_stat);
22+
DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
2323

2424
#define __ARCH_IRQ_STAT
2525

arch/loongarch/include/asm/percpu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#define __ASM_PERCPU_H
77

88
#include <asm/cmpxchg.h>
9+
#include <asm/loongarch.h>
910

1011
/* Use r21 for fast access */
1112
register unsigned long __my_cpu_offset __asm__("$r21");

arch/loongarch/include/asm/smp.h

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,16 @@
99
#include <linux/atomic.h>
1010
#include <linux/bitops.h>
1111
#include <linux/linkage.h>
12-
#include <linux/smp.h>
1312
#include <linux/threads.h>
1413
#include <linux/cpumask.h>
1514

15+
extern int smp_num_siblings;
16+
extern int num_processors;
17+
extern int disabled_cpus;
18+
extern cpumask_t cpu_sibling_map[];
19+
extern cpumask_t cpu_core_map[];
20+
extern cpumask_t cpu_foreign_map[];
21+
1622
void loongson3_smp_setup(void);
1723
void loongson3_prepare_cpus(unsigned int max_cpus);
1824
void loongson3_boot_secondary(int cpu, struct task_struct *idle);
@@ -25,26 +31,11 @@ int loongson3_cpu_disable(void);
2531
void loongson3_cpu_die(unsigned int cpu);
2632
#endif
2733

28-
#ifdef CONFIG_SMP
29-
3034
static inline void plat_smp_setup(void)
3135
{
3236
loongson3_smp_setup();
3337
}
3438

35-
#else /* !CONFIG_SMP */
36-
37-
static inline void plat_smp_setup(void) { }
38-
39-
#endif /* !CONFIG_SMP */
40-
41-
extern int smp_num_siblings;
42-
extern int num_processors;
43-
extern int disabled_cpus;
44-
extern cpumask_t cpu_sibling_map[];
45-
extern cpumask_t cpu_core_map[];
46-
extern cpumask_t cpu_foreign_map[];
47-
4839
static inline int raw_smp_processor_id(void)
4940
{
5041
#if defined(__VDSO__)

arch/loongarch/include/asm/timex.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,6 @@
1212
#include <asm/cpu.h>
1313
#include <asm/cpu-features.h>
1414

15-
/*
16-
* Standard way to access the cycle counter.
17-
* Currently only used on SMP for scheduling.
18-
*
19-
* We know that all SMP capable CPUs have cycle counters.
20-
*/
21-
2215
typedef unsigned long cycles_t;
2316

2417
#define get_cycles get_cycles

arch/loongarch/kernel/acpi.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ void __init acpi_boot_table_init(void)
138138
}
139139
}
140140

141+
#ifdef CONFIG_SMP
141142
static int set_processor_mask(u32 id, u32 flags)
142143
{
143144

@@ -166,15 +167,18 @@ static int set_processor_mask(u32 id, u32 flags)
166167

167168
return cpu;
168169
}
170+
#endif
169171

170172
static void __init acpi_process_madt(void)
171173
{
174+
#ifdef CONFIG_SMP
172175
int i;
173176

174177
for (i = 0; i < NR_CPUS; i++) {
175178
__cpu_number_map[i] = -1;
176179
__cpu_logical_map[i] = -1;
177180
}
181+
#endif
178182

179183
loongson_sysconf.nr_cpus = num_processors;
180184
}

arch/loongarch/kernel/cacheinfo.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*
55
* Copyright (C) 2020-2022 Loongson Technology Corporation Limited
66
*/
7+
#include <asm/cpu-info.h>
78
#include <linux/cacheinfo.h>
89

910
/* Populates leaf and increments to next leaf */

arch/loongarch/kernel/irq.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
#include <asm/setup.h>
2323

2424
DEFINE_PER_CPU(unsigned long, irq_stack);
25+
DEFINE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
26+
EXPORT_PER_CPU_SYMBOL(irq_stat);
2527

2628
struct irq_domain *cpu_domain;
2729
struct irq_domain *liointc_domain;
@@ -56,8 +58,11 @@ int arch_show_interrupts(struct seq_file *p, int prec)
5658

5759
void __init init_IRQ(void)
5860
{
59-
int i, r, ipi_irq;
61+
int i;
62+
#ifdef CONFIG_SMP
63+
int r, ipi_irq;
6064
static int ipi_dummy_dev;
65+
#endif
6166
unsigned int order = get_order(IRQ_STACK_SIZE);
6267
struct page *page;
6368

arch/loongarch/kernel/process.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,12 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
120120
/*
121121
* Copy architecture-specific thread state
122122
*/
123-
int copy_thread(unsigned long clone_flags, unsigned long usp,
124-
unsigned long kthread_arg, struct task_struct *p, unsigned long tls)
123+
int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
125124
{
126125
unsigned long childksp;
126+
unsigned long tls = args->tls;
127+
unsigned long usp = args->stack;
128+
unsigned long clone_flags = args->flags;
127129
struct pt_regs *childregs, *regs = current_pt_regs();
128130

129131
childksp = (unsigned long)task_stack_page(p) + THREAD_SIZE - 32;
@@ -136,12 +138,12 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
136138
p->thread.csr_crmd = csr_read32(LOONGARCH_CSR_CRMD);
137139
p->thread.csr_prmd = csr_read32(LOONGARCH_CSR_PRMD);
138140
p->thread.csr_ecfg = csr_read32(LOONGARCH_CSR_ECFG);
139-
if (unlikely(p->flags & (PF_KTHREAD | PF_IO_WORKER))) {
141+
if (unlikely(args->fn)) {
140142
/* kernel thread */
141-
p->thread.reg23 = usp; /* fn */
142-
p->thread.reg24 = kthread_arg;
143143
p->thread.reg03 = childksp;
144-
p->thread.reg01 = (unsigned long) ret_from_kernel_thread;
144+
p->thread.reg23 = (unsigned long)args->fn;
145+
p->thread.reg24 = (unsigned long)args->fn_arg;
146+
p->thread.reg01 = (unsigned long)ret_from_kernel_thread;
145147
memset(childregs, 0, sizeof(struct pt_regs));
146148
childregs->csr_euen = p->thread.csr_euen;
147149
childregs->csr_crmd = p->thread.csr_crmd;

arch/loongarch/kernel/setup.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
#include <asm/pgalloc.h>
4040
#include <asm/sections.h>
4141
#include <asm/setup.h>
42-
#include <asm/smp.h>
4342
#include <asm/time.h>
4443

4544
#define SMBIOS_BIOSSIZE_OFFSET 0x09
@@ -349,8 +348,6 @@ static void __init prefill_possible_map(void)
349348

350349
nr_cpu_ids = possible;
351350
}
352-
#else
353-
static inline void prefill_possible_map(void) {}
354351
#endif
355352

356353
void __init setup_arch(char **cmdline_p)
@@ -367,8 +364,10 @@ void __init setup_arch(char **cmdline_p)
367364
arch_mem_init(cmdline_p);
368365

369366
resource_init();
367+
#ifdef CONFIG_SMP
370368
plat_smp_setup();
371369
prefill_possible_map();
370+
#endif
372371

373372
paging_init();
374373
}

0 commit comments

Comments
 (0)