提交 5ba15740 编写于 作者: H He Sheng 提交者: guzitao

sw64: always use cpu_data and simplify it

Sunway inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I56OLG

--------------------------------

Make use of cpu_data no matter SMP is yes or no, and remove unused
fields from it. After that, some function calls can be simplified.
Signed-off-by: NHe Sheng <hesheng@wxiat.com>
Signed-off-by: NGu Zitao <guzitao@wxiat.com>
上级 87fc3939
......@@ -23,11 +23,6 @@ struct cpuinfo_sw64 {
int need_new_asn;
int asn_lock;
unsigned long ipi_count;
unsigned long prof_multiplier;
unsigned long prof_counter;
unsigned char mcheck_expected;
unsigned char mcheck_taken;
unsigned char mcheck_extra;
struct cache_desc icache; /* Primary I-cache */
struct cache_desc dcache; /* Primary D or combined I/D cache */
struct cache_desc scache; /* Secondary cache */
......@@ -73,6 +68,8 @@ struct memmap_entry {
};
extern struct cpuinfo_sw64 cpu_data[NR_CPUS];
extern void store_cpu_data(int cpu);
extern struct cpu_desc_t cpu_desc;
extern struct socket_desc_t socket_desc[MAX_NUMSOCKETS];
extern int memmap_nr;
......
......@@ -60,12 +60,7 @@ __reload_thread(struct pcb_struct *pcb)
*/
#include <asm/hw_init.h>
#ifdef CONFIG_SMP
#define cpu_last_asn(cpuid) (cpu_data[cpuid].last_asn)
#else
extern unsigned long last_asn;
#define cpu_last_asn(cpuid) last_asn
#endif /* CONFIG_SMP */
#define ASN_FIRST_VERSION (1UL << WIDTH_HARDWARE_ASN)
#define HARDWARE_ASN_MASK ((1UL << WIDTH_HARDWARE_ASN) - 1)
......
......@@ -28,9 +28,10 @@
#include <linux/genalloc.h>
#include <linux/acpi.h>
#include <asm/sw64_init.h>
#include <asm/efi.h>
#include <asm/kvm_cma.h>
#include <asm/mmu_context.h>
#include <asm/sw64_init.h>
#include "proto.h"
#include "pci_impl.h"
......@@ -137,6 +138,17 @@ struct screen_info screen_info = {
};
EXPORT_SYMBOL(screen_info);
/*
* Move global data into per-processor storage.
*/
void store_cpu_data(int cpu)
{
cpu_data[cpu].loops_per_jiffy = loops_per_jiffy;
cpu_data[cpu].last_asn = ASN_FIRST_VERSION;
cpu_data[cpu].need_new_asn = 0;
cpu_data[cpu].asn_lock = 0;
}
#ifdef CONFIG_KEXEC
void *kexec_control_page;
......@@ -859,13 +871,12 @@ setup_arch(char **cmdline_p)
/* Default root filesystem to sda2. */
ROOT_DEV = Root_SDA2;
/*
* Identify the flock of penguins.
*/
#ifdef CONFIG_SMP
setup_smp();
#else
store_cpu_data(0);
#endif
#ifdef CONFIG_NUMA
cpu_set_node();
#endif
......
......@@ -59,29 +59,6 @@ EXPORT_SYMBOL(smp_num_cpus);
#define send_sleep_interrupt(cpu) send_ipi((cpu), II_SLEEP)
#define send_wakeup_interrupt(cpu) send_ipi((cpu), II_WAKE)
/*
* Called by both boot and secondaries to move global data into
* per-processor storage.
*/
static inline void __init
smp_store_cpu_info(int cpuid)
{
cpu_data[cpuid].loops_per_jiffy = loops_per_jiffy;
cpu_data[cpuid].last_asn = ASN_FIRST_VERSION;
cpu_data[cpuid].need_new_asn = 0;
cpu_data[cpuid].asn_lock = 0;
}
/*
* Ideally sets up per-cpu profiling hooks. Doesn't do much now...
*/
static inline void __init
smp_setup_percpu_timer(int cpuid)
{
setup_timer();
cpu_data[cpuid].prof_counter = 1;
cpu_data[cpuid].prof_multiplier = 1;
}
static void __init wait_boot_cpu_to_stop(int cpuid)
{
......@@ -128,7 +105,7 @@ void smp_callin(void)
wrent(entInt, 0);
/* Get our local ticker going. */
smp_setup_percpu_timer(cpuid);
setup_timer();
/* All kernel threads share the same mm context. */
mmgrab(&init_mm);
......@@ -298,7 +275,7 @@ void __init setup_smp(void)
__cpu_to_rcid[num] = i;
__rcid_to_cpu[i] = num;
set_cpu_possible(num, true);
smp_store_cpu_info(num);
store_cpu_data(num);
if (!cpumask_test_cpu(i, &cpu_offline))
set_cpu_present(num, true);
num++;
......
......@@ -96,10 +96,6 @@ void setup_clocksource(void)
}
#endif /* !CONFIG_SMP */
void __init common_init_rtc(void)
{
setup_timer();
}
void __init
time_init(void)
......@@ -114,7 +110,7 @@ time_init(void)
setup_clocksource();
of_clk_init(NULL);
/* Startup the timer source. */
common_init_rtc();
setup_timer();
}
void calibrate_delay(void)
......
......@@ -64,13 +64,7 @@ void show_all_vma(void)
/*
* Force a new ASN for a task.
*/
#ifndef CONFIG_SMP
unsigned long last_asn = ASN_FIRST_VERSION;
#endif
void
__load_new_mm_context(struct mm_struct *next_mm)
void __load_new_mm_context(struct mm_struct *next_mm)
{
unsigned long mmc;
struct pcb_struct *pcb;
......@@ -85,7 +79,6 @@ __load_new_mm_context(struct mm_struct *next_mm)
__reload_thread(pcb);
}
/*
* This routine handles page faults. It determines the address,
* and the problem, and then passes it off to handle_mm_fault().
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册