Commit eaecca9e authored by Kefeng Wang's avatar Kefeng Wang Committed by Catalin Marinas

arm64: Fix __cpu_logical_map undefined issue

The __cpu_logical_map undefined issue occued when the new
tegra194-cpufreq drvier building as a module.

ERROR: modpost: "__cpu_logical_map" [drivers/cpufreq/tegra194-cpufreq.ko] undefined!

The driver using cpu_logical_map() macro which will expand to
__cpu_logical_map, we can't access it in a drvier. Let's turn
cpu_logical_map() into a C wrapper and export it to fix the
build issue.

Also create a function set_cpu_logical_map(cpu, hwid) when assign
a value to cpu_logical_map(cpu).
Reported-by: default avatarHulk Robot <hulkci@huawei.com>
Signed-off-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
parent 489577d7
...@@ -47,7 +47,12 @@ DECLARE_PER_CPU_READ_MOSTLY(int, cpu_number); ...@@ -47,7 +47,12 @@ DECLARE_PER_CPU_READ_MOSTLY(int, cpu_number);
* Logical CPU mapping. * Logical CPU mapping.
*/ */
extern u64 __cpu_logical_map[NR_CPUS]; extern u64 __cpu_logical_map[NR_CPUS];
#define cpu_logical_map(cpu) __cpu_logical_map[cpu] extern u64 cpu_logical_map(int cpu);
static inline void set_cpu_logical_map(int cpu, u64 hwid)
{
__cpu_logical_map[cpu] = hwid;
}
struct seq_file; struct seq_file;
......
...@@ -85,7 +85,7 @@ u64 __cacheline_aligned boot_args[4]; ...@@ -85,7 +85,7 @@ u64 __cacheline_aligned boot_args[4];
void __init smp_setup_processor_id(void) void __init smp_setup_processor_id(void)
{ {
u64 mpidr = read_cpuid_mpidr() & MPIDR_HWID_BITMASK; u64 mpidr = read_cpuid_mpidr() & MPIDR_HWID_BITMASK;
cpu_logical_map(0) = mpidr; set_cpu_logical_map(0, mpidr);
/* /*
* clear __my_cpu_offset on boot CPU to avoid hang caused by * clear __my_cpu_offset on boot CPU to avoid hang caused by
...@@ -276,6 +276,12 @@ arch_initcall(reserve_memblock_reserved_regions); ...@@ -276,6 +276,12 @@ arch_initcall(reserve_memblock_reserved_regions);
u64 __cpu_logical_map[NR_CPUS] = { [0 ... NR_CPUS-1] = INVALID_HWID }; u64 __cpu_logical_map[NR_CPUS] = { [0 ... NR_CPUS-1] = INVALID_HWID };
u64 cpu_logical_map(int cpu)
{
return __cpu_logical_map[cpu];
}
EXPORT_SYMBOL_GPL(cpu_logical_map);
void __init setup_arch(char **cmdline_p) void __init setup_arch(char **cmdline_p)
{ {
init_mm.start_code = (unsigned long) _text; init_mm.start_code = (unsigned long) _text;
......
...@@ -567,7 +567,7 @@ acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor) ...@@ -567,7 +567,7 @@ acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor)
return; return;
/* map the logical cpu id to cpu MPIDR */ /* map the logical cpu id to cpu MPIDR */
cpu_logical_map(cpu_count) = hwid; set_cpu_logical_map(cpu_count, hwid);
cpu_madt_gicc[cpu_count] = *processor; cpu_madt_gicc[cpu_count] = *processor;
...@@ -681,7 +681,7 @@ static void __init of_parse_and_init_cpus(void) ...@@ -681,7 +681,7 @@ static void __init of_parse_and_init_cpus(void)
goto next; goto next;
pr_debug("cpu logical map 0x%llx\n", hwid); pr_debug("cpu logical map 0x%llx\n", hwid);
cpu_logical_map(cpu_count) = hwid; set_cpu_logical_map(cpu_count, hwid);
early_map_cpu_to_node(cpu_count, of_node_to_nid(dn)); early_map_cpu_to_node(cpu_count, of_node_to_nid(dn));
next: next:
...@@ -722,7 +722,7 @@ void __init smp_init_cpus(void) ...@@ -722,7 +722,7 @@ void __init smp_init_cpus(void)
for (i = 1; i < nr_cpu_ids; i++) { for (i = 1; i < nr_cpu_ids; i++) {
if (cpu_logical_map(i) != INVALID_HWID) { if (cpu_logical_map(i) != INVALID_HWID) {
if (smp_cpu_setup(i)) if (smp_cpu_setup(i))
cpu_logical_map(i) = INVALID_HWID; set_cpu_logical_map(i, INVALID_HWID);
} }
} }
} }
......
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