Commit ce68ff35 authored by Huacai Chen's avatar Huacai Chen

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: default avatarHuacai Chen <chenhuacai@loongson.cn>
parent d23b7795
...@@ -24,13 +24,15 @@ struct loongson_board_info { ...@@ -24,13 +24,15 @@ struct loongson_board_info {
const char *board_vendor; const char *board_vendor;
}; };
#define NR_WORDS DIV_ROUND_UP(NR_CPUS, BITS_PER_LONG)
struct loongson_system_configuration { struct loongson_system_configuration {
int nr_cpus; int nr_cpus;
int nr_nodes; int nr_nodes;
int boot_cpu_id; int boot_cpu_id;
int cores_per_node; int cores_per_node;
int cores_per_package; int cores_per_package;
unsigned long cores_io_master; unsigned long cores_io_master[NR_WORDS];
unsigned long suspend_addr; unsigned long suspend_addr;
const char *cpuname; const char *cpuname;
}; };
...@@ -42,7 +44,7 @@ extern struct loongson_system_configuration loongson_sysconf; ...@@ -42,7 +44,7 @@ extern struct loongson_system_configuration loongson_sysconf;
static inline bool io_master(int cpu) static inline bool io_master(int cpu)
{ {
return test_bit(cpu, &loongson_sysconf.cores_io_master); return test_bit(cpu, loongson_sysconf.cores_io_master);
} }
#endif /* _ASM_BOOTINFO_H */ #endif /* _ASM_BOOTINFO_H */
...@@ -119,7 +119,7 @@ acpi_parse_eio_master(union acpi_subtable_headers *header, const unsigned long e ...@@ -119,7 +119,7 @@ acpi_parse_eio_master(union acpi_subtable_headers *header, const unsigned long e
return -EINVAL; return -EINVAL;
core = eiointc->node * CORES_PER_EIO_NODE; core = eiointc->node * CORES_PER_EIO_NODE;
set_bit(core, &(loongson_sysconf.cores_io_master)); set_bit(core, loongson_sysconf.cores_io_master);
return 0; return 0;
} }
......
...@@ -208,7 +208,7 @@ static void __init fdt_smp_setup(void) ...@@ -208,7 +208,7 @@ static void __init fdt_smp_setup(void)
} }
loongson_sysconf.nr_cpus = num_processors; loongson_sysconf.nr_cpus = num_processors;
set_bit(0, &(loongson_sysconf.cores_io_master)); set_bit(0, loongson_sysconf.cores_io_master);
#endif #endif
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment