Skip to content

Commit ce68ff3

Browse files
committed
LoongArch: Let cores_io_master cover the largest NR_CPUS
Now loongson_system_configuration::cores_io_master only covers 64 cpus, if NR_CPUS > 64 there will be memory corruption. So let cores_io_master cover the largest NR_CPUS (256). Signed-off-by: Huacai Chen <[email protected]>
1 parent d23b779 commit ce68ff3

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

arch/loongarch/include/asm/bootinfo.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@ struct loongson_board_info {
2424
const char *board_vendor;
2525
};
2626

27+
#define NR_WORDS DIV_ROUND_UP(NR_CPUS, BITS_PER_LONG)
28+
2729
struct loongson_system_configuration {
2830
int nr_cpus;
2931
int nr_nodes;
3032
int boot_cpu_id;
3133
int cores_per_node;
3234
int cores_per_package;
33-
unsigned long cores_io_master;
35+
unsigned long cores_io_master[NR_WORDS];
3436
unsigned long suspend_addr;
3537
const char *cpuname;
3638
};
@@ -42,7 +44,7 @@ extern struct loongson_system_configuration loongson_sysconf;
4244

4345
static inline bool io_master(int cpu)
4446
{
45-
return test_bit(cpu, &loongson_sysconf.cores_io_master);
47+
return test_bit(cpu, loongson_sysconf.cores_io_master);
4648
}
4749

4850
#endif /* _ASM_BOOTINFO_H */

arch/loongarch/kernel/acpi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ acpi_parse_eio_master(union acpi_subtable_headers *header, const unsigned long e
119119
return -EINVAL;
120120

121121
core = eiointc->node * CORES_PER_EIO_NODE;
122-
set_bit(core, &(loongson_sysconf.cores_io_master));
122+
set_bit(core, loongson_sysconf.cores_io_master);
123123

124124
return 0;
125125
}

arch/loongarch/kernel/smp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ static void __init fdt_smp_setup(void)
208208
}
209209

210210
loongson_sysconf.nr_cpus = num_processors;
211-
set_bit(0, &(loongson_sysconf.cores_io_master));
211+
set_bit(0, loongson_sysconf.cores_io_master);
212212
#endif
213213
}
214214

0 commit comments

Comments
 (0)