提交 7a6af5e3 编写于 作者: S Stephen Rothwell 提交者: Paul Mackerras

[PATCH] ppc64: remove firmware features from cpu_spec

The firmware_features field of struct cpu_spec should really be a separate
variable as the firmware features do not depend on the chip and the
bitmask is constructed independently.  By removing it, we save 112 bytes
from the cpu_specs array and we access the bitmask directly instead of via
the cur_cpu_spec pointer.
Signed-off-by: NStephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: NPaul Mackerras <paulus@samba.org>
上级 6fbb49d5
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
struct cpu_spec* cur_cpu_spec = NULL; struct cpu_spec* cur_cpu_spec = NULL;
EXPORT_SYMBOL(cur_cpu_spec); EXPORT_SYMBOL(cur_cpu_spec);
unsigned long ppc64_firmware_features;
/* NOTE: /* NOTE:
* Unlike ppc32, ppc64 will only call this once for the boot CPU, it's * Unlike ppc32, ppc64 will only call this once for the boot CPU, it's
...@@ -60,7 +61,6 @@ struct cpu_spec cpu_specs[] = { ...@@ -60,7 +61,6 @@ struct cpu_spec cpu_specs[] = {
.icache_bsize = 128, .icache_bsize = 128,
.dcache_bsize = 128, .dcache_bsize = 128,
.cpu_setup = __setup_cpu_power3, .cpu_setup = __setup_cpu_power3,
.firmware_features = COMMON_PPC64_FW,
}, },
{ /* Power3+ */ { /* Power3+ */
.pvr_mask = 0xffff0000, .pvr_mask = 0xffff0000,
...@@ -73,7 +73,6 @@ struct cpu_spec cpu_specs[] = { ...@@ -73,7 +73,6 @@ struct cpu_spec cpu_specs[] = {
.icache_bsize = 128, .icache_bsize = 128,
.dcache_bsize = 128, .dcache_bsize = 128,
.cpu_setup = __setup_cpu_power3, .cpu_setup = __setup_cpu_power3,
.firmware_features = COMMON_PPC64_FW,
}, },
{ /* Northstar */ { /* Northstar */
.pvr_mask = 0xffff0000, .pvr_mask = 0xffff0000,
...@@ -86,7 +85,6 @@ struct cpu_spec cpu_specs[] = { ...@@ -86,7 +85,6 @@ struct cpu_spec cpu_specs[] = {
.icache_bsize = 128, .icache_bsize = 128,
.dcache_bsize = 128, .dcache_bsize = 128,
.cpu_setup = __setup_cpu_power3, .cpu_setup = __setup_cpu_power3,
.firmware_features = COMMON_PPC64_FW,
}, },
{ /* Pulsar */ { /* Pulsar */
.pvr_mask = 0xffff0000, .pvr_mask = 0xffff0000,
...@@ -99,7 +97,6 @@ struct cpu_spec cpu_specs[] = { ...@@ -99,7 +97,6 @@ struct cpu_spec cpu_specs[] = {
.icache_bsize = 128, .icache_bsize = 128,
.dcache_bsize = 128, .dcache_bsize = 128,
.cpu_setup = __setup_cpu_power3, .cpu_setup = __setup_cpu_power3,
.firmware_features = COMMON_PPC64_FW,
}, },
{ /* I-star */ { /* I-star */
.pvr_mask = 0xffff0000, .pvr_mask = 0xffff0000,
...@@ -112,7 +109,6 @@ struct cpu_spec cpu_specs[] = { ...@@ -112,7 +109,6 @@ struct cpu_spec cpu_specs[] = {
.icache_bsize = 128, .icache_bsize = 128,
.dcache_bsize = 128, .dcache_bsize = 128,
.cpu_setup = __setup_cpu_power3, .cpu_setup = __setup_cpu_power3,
.firmware_features = COMMON_PPC64_FW,
}, },
{ /* S-star */ { /* S-star */
.pvr_mask = 0xffff0000, .pvr_mask = 0xffff0000,
...@@ -125,7 +121,6 @@ struct cpu_spec cpu_specs[] = { ...@@ -125,7 +121,6 @@ struct cpu_spec cpu_specs[] = {
.icache_bsize = 128, .icache_bsize = 128,
.dcache_bsize = 128, .dcache_bsize = 128,
.cpu_setup = __setup_cpu_power3, .cpu_setup = __setup_cpu_power3,
.firmware_features = COMMON_PPC64_FW,
}, },
{ /* Power4 */ { /* Power4 */
.pvr_mask = 0xffff0000, .pvr_mask = 0xffff0000,
...@@ -138,7 +133,6 @@ struct cpu_spec cpu_specs[] = { ...@@ -138,7 +133,6 @@ struct cpu_spec cpu_specs[] = {
.icache_bsize = 128, .icache_bsize = 128,
.dcache_bsize = 128, .dcache_bsize = 128,
.cpu_setup = __setup_cpu_power4, .cpu_setup = __setup_cpu_power4,
.firmware_features = COMMON_PPC64_FW,
}, },
{ /* Power4+ */ { /* Power4+ */
.pvr_mask = 0xffff0000, .pvr_mask = 0xffff0000,
...@@ -151,7 +145,6 @@ struct cpu_spec cpu_specs[] = { ...@@ -151,7 +145,6 @@ struct cpu_spec cpu_specs[] = {
.icache_bsize = 128, .icache_bsize = 128,
.dcache_bsize = 128, .dcache_bsize = 128,
.cpu_setup = __setup_cpu_power4, .cpu_setup = __setup_cpu_power4,
.firmware_features = COMMON_PPC64_FW,
}, },
{ /* PPC970 */ { /* PPC970 */
.pvr_mask = 0xffff0000, .pvr_mask = 0xffff0000,
...@@ -166,7 +159,6 @@ struct cpu_spec cpu_specs[] = { ...@@ -166,7 +159,6 @@ struct cpu_spec cpu_specs[] = {
.icache_bsize = 128, .icache_bsize = 128,
.dcache_bsize = 128, .dcache_bsize = 128,
.cpu_setup = __setup_cpu_ppc970, .cpu_setup = __setup_cpu_ppc970,
.firmware_features = COMMON_PPC64_FW,
}, },
{ /* PPC970FX */ { /* PPC970FX */
.pvr_mask = 0xffff0000, .pvr_mask = 0xffff0000,
...@@ -181,7 +173,6 @@ struct cpu_spec cpu_specs[] = { ...@@ -181,7 +173,6 @@ struct cpu_spec cpu_specs[] = {
.icache_bsize = 128, .icache_bsize = 128,
.dcache_bsize = 128, .dcache_bsize = 128,
.cpu_setup = __setup_cpu_ppc970, .cpu_setup = __setup_cpu_ppc970,
.firmware_features = COMMON_PPC64_FW,
}, },
{ /* PPC970MP */ { /* PPC970MP */
.pvr_mask = 0xffff0000, .pvr_mask = 0xffff0000,
...@@ -196,7 +187,6 @@ struct cpu_spec cpu_specs[] = { ...@@ -196,7 +187,6 @@ struct cpu_spec cpu_specs[] = {
.icache_bsize = 128, .icache_bsize = 128,
.dcache_bsize = 128, .dcache_bsize = 128,
.cpu_setup = __setup_cpu_ppc970, .cpu_setup = __setup_cpu_ppc970,
.firmware_features = COMMON_PPC64_FW,
}, },
{ /* Power5 */ { /* Power5 */
.pvr_mask = 0xffff0000, .pvr_mask = 0xffff0000,
...@@ -211,7 +201,6 @@ struct cpu_spec cpu_specs[] = { ...@@ -211,7 +201,6 @@ struct cpu_spec cpu_specs[] = {
.icache_bsize = 128, .icache_bsize = 128,
.dcache_bsize = 128, .dcache_bsize = 128,
.cpu_setup = __setup_cpu_power4, .cpu_setup = __setup_cpu_power4,
.firmware_features = COMMON_PPC64_FW,
}, },
{ /* Power5 */ { /* Power5 */
.pvr_mask = 0xffff0000, .pvr_mask = 0xffff0000,
...@@ -226,7 +215,6 @@ struct cpu_spec cpu_specs[] = { ...@@ -226,7 +215,6 @@ struct cpu_spec cpu_specs[] = {
.icache_bsize = 128, .icache_bsize = 128,
.dcache_bsize = 128, .dcache_bsize = 128,
.cpu_setup = __setup_cpu_power4, .cpu_setup = __setup_cpu_power4,
.firmware_features = COMMON_PPC64_FW,
}, },
{ /* BE DD1.x */ { /* BE DD1.x */
.pvr_mask = 0xffff0000, .pvr_mask = 0xffff0000,
...@@ -241,7 +229,6 @@ struct cpu_spec cpu_specs[] = { ...@@ -241,7 +229,6 @@ struct cpu_spec cpu_specs[] = {
.icache_bsize = 128, .icache_bsize = 128,
.dcache_bsize = 128, .dcache_bsize = 128,
.cpu_setup = __setup_cpu_be, .cpu_setup = __setup_cpu_be,
.firmware_features = COMMON_PPC64_FW,
}, },
{ /* default match */ { /* default match */
.pvr_mask = 0x00000000, .pvr_mask = 0x00000000,
...@@ -254,7 +241,6 @@ struct cpu_spec cpu_specs[] = { ...@@ -254,7 +241,6 @@ struct cpu_spec cpu_specs[] = {
.icache_bsize = 128, .icache_bsize = 128,
.dcache_bsize = 128, .dcache_bsize = 128,
.cpu_setup = __setup_cpu_power4, .cpu_setup = __setup_cpu_power4,
.firmware_features = COMMON_PPC64_FW,
} }
}; };
......
...@@ -377,7 +377,7 @@ static int lparcfg_data(struct seq_file *m, void *v) ...@@ -377,7 +377,7 @@ static int lparcfg_data(struct seq_file *m, void *v)
partition_active_processors = lparcfg_count_active_processors(); partition_active_processors = lparcfg_count_active_processors();
if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) { if (ppc64_firmware_features & FW_FEATURE_SPLPAR) {
unsigned long h_entitled, h_unallocated; unsigned long h_entitled, h_unallocated;
unsigned long h_aggregation, h_resource; unsigned long h_aggregation, h_resource;
unsigned long pool_idle_time, pool_procs; unsigned long pool_idle_time, pool_procs;
...@@ -571,7 +571,7 @@ int __init lparcfg_init(void) ...@@ -571,7 +571,7 @@ int __init lparcfg_init(void)
mode_t mode = S_IRUSR; mode_t mode = S_IRUSR;
/* Allow writing if we have FW_FEATURE_SPLPAR */ /* Allow writing if we have FW_FEATURE_SPLPAR */
if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) { if (ppc64_firmware_features & FW_FEATURE_SPLPAR) {
lparcfg_fops.write = lparcfg_write; lparcfg_fops.write = lparcfg_write;
mode |= S_IWUSR; mode |= S_IWUSR;
} }
......
...@@ -546,7 +546,7 @@ void iommu_init_early_pSeries(void) ...@@ -546,7 +546,7 @@ void iommu_init_early_pSeries(void)
} }
if (systemcfg->platform & PLATFORM_LPAR) { if (systemcfg->platform & PLATFORM_LPAR) {
if (cur_cpu_spec->firmware_features & FW_FEATURE_MULTITCE) { if (ppc64_firmware_features & FW_FEATURE_MULTITCE) {
ppc_md.tce_build = tce_buildmulti_pSeriesLP; ppc_md.tce_build = tce_buildmulti_pSeriesLP;
ppc_md.tce_free = tce_freemulti_pSeriesLP; ppc_md.tce_free = tce_freemulti_pSeriesLP;
} else { } else {
......
...@@ -231,11 +231,11 @@ static void __init pSeries_setup_arch(void) ...@@ -231,11 +231,11 @@ static void __init pSeries_setup_arch(void)
pSeries_nvram_init(); pSeries_nvram_init();
if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) if (ppc64_firmware_features & FW_FEATURE_SPLPAR)
vpa_init(boot_cpuid); vpa_init(boot_cpuid);
/* Choose an idle loop */ /* Choose an idle loop */
if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) { if (ppc64_firmware_features & FW_FEATURE_SPLPAR) {
if (get_paca()->lppaca.shared_proc) { if (get_paca()->lppaca.shared_proc) {
printk(KERN_INFO "Using shared processor idle loop\n"); printk(KERN_INFO "Using shared processor idle loop\n");
ppc_md.idle_loop = pseries_shared_idle; ppc_md.idle_loop = pseries_shared_idle;
...@@ -260,7 +260,7 @@ static int __init pSeries_init_panel(void) ...@@ -260,7 +260,7 @@ static int __init pSeries_init_panel(void)
arch_initcall(pSeries_init_panel); arch_initcall(pSeries_init_panel);
/* Build up the firmware_features bitmask field /* Build up the ppc64_firmware_features bitmask field
* using contents of device-tree/ibm,hypertas-functions. * using contents of device-tree/ibm,hypertas-functions.
* Ultimately this functionality may be moved into prom.c prom_init(). * Ultimately this functionality may be moved into prom.c prom_init().
*/ */
...@@ -272,7 +272,7 @@ void __init fw_feature_init(void) ...@@ -272,7 +272,7 @@ void __init fw_feature_init(void)
DBG(" -> fw_feature_init()\n"); DBG(" -> fw_feature_init()\n");
cur_cpu_spec->firmware_features = 0; ppc64_firmware_features = 0;
dn = of_find_node_by_path("/rtas"); dn = of_find_node_by_path("/rtas");
if (dn == NULL) { if (dn == NULL) {
printk(KERN_ERR "WARNING ! Cannot find RTAS in device-tree !\n"); printk(KERN_ERR "WARNING ! Cannot find RTAS in device-tree !\n");
...@@ -288,7 +288,7 @@ void __init fw_feature_init(void) ...@@ -288,7 +288,7 @@ void __init fw_feature_init(void)
if ((firmware_features_table[i].name) && if ((firmware_features_table[i].name) &&
(strcmp(firmware_features_table[i].name,hypertas))==0) { (strcmp(firmware_features_table[i].name,hypertas))==0) {
/* we have a match */ /* we have a match */
cur_cpu_spec->firmware_features |= ppc64_firmware_features |=
(firmware_features_table[i].val); (firmware_features_table[i].val);
break; break;
} }
...@@ -302,7 +302,7 @@ void __init fw_feature_init(void) ...@@ -302,7 +302,7 @@ void __init fw_feature_init(void)
of_node_put(dn); of_node_put(dn);
no_rtas: no_rtas:
printk(KERN_INFO "firmware_features = 0x%lx\n", printk(KERN_INFO "firmware_features = 0x%lx\n",
cur_cpu_spec->firmware_features); ppc64_firmware_features);
DBG(" <- fw_feature_init()\n"); DBG(" <- fw_feature_init()\n");
} }
......
...@@ -326,7 +326,7 @@ static void __devinit smp_xics_setup_cpu(int cpu) ...@@ -326,7 +326,7 @@ static void __devinit smp_xics_setup_cpu(int cpu)
if (cpu != boot_cpuid) if (cpu != boot_cpuid)
xics_setup_cpu(); xics_setup_cpu();
if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) if (ppc64_firmware_features & FW_FEATURE_SPLPAR)
vpa_init(cpu); vpa_init(cpu);
cpu_clear(cpu, of_spin_map); cpu_clear(cpu, of_spin_map);
......
...@@ -206,7 +206,7 @@ struct task_struct *__switch_to(struct task_struct *prev, ...@@ -206,7 +206,7 @@ struct task_struct *__switch_to(struct task_struct *prev,
/* purr is nothing but processor time base */ /* purr is nothing but processor time base */
#if defined(CONFIG_PPC_PSERIES) #if defined(CONFIG_PPC_PSERIES)
if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) { if (ppc64_firmware_features & FW_FEATURE_SPLPAR) {
struct cpu_usage *cu = &__get_cpu_var(cpu_usage_array); struct cpu_usage *cu = &__get_cpu_var(cpu_usage_array);
long unsigned start_tb, current_tb; long unsigned start_tb, current_tb;
start_tb = old_thread->start_tb; start_tb = old_thread->start_tb;
......
...@@ -154,7 +154,7 @@ void ppc64_enable_pmcs(void) ...@@ -154,7 +154,7 @@ void ppc64_enable_pmcs(void)
#ifdef CONFIG_PPC_PSERIES #ifdef CONFIG_PPC_PSERIES
/* instruct hypervisor to maintain PMCs */ /* instruct hypervisor to maintain PMCs */
if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) if (ppc64_firmware_features & FW_FEATURE_SPLPAR)
get_paca()->lppaca.pmcregs_in_use = 1; get_paca()->lppaca.pmcregs_in_use = 1;
#endif /* CONFIG_PPC_PSERIES */ #endif /* CONFIG_PPC_PSERIES */
} }
......
...@@ -372,7 +372,7 @@ int timer_interrupt(struct pt_regs * regs) ...@@ -372,7 +372,7 @@ int timer_interrupt(struct pt_regs * regs)
/* collect purr register values often, for accurate calculations */ /* collect purr register values often, for accurate calculations */
#if defined(CONFIG_PPC_PSERIES) #if defined(CONFIG_PPC_PSERIES)
if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) { if (ppc64_firmware_features & FW_FEATURE_SPLPAR) {
struct cpu_usage *cu = &__get_cpu_var(cpu_usage_array); struct cpu_usage *cu = &__get_cpu_var(cpu_usage_array);
cu->current_tb = mfspr(SPRN_PURR); cu->current_tb = mfspr(SPRN_PURR);
} }
......
...@@ -56,11 +56,6 @@ struct cpu_spec { ...@@ -56,11 +56,6 @@ struct cpu_spec {
* BHT, SPD, etc... from head.S before branching to identify_machine * BHT, SPD, etc... from head.S before branching to identify_machine
*/ */
cpu_setup_t cpu_setup; cpu_setup_t cpu_setup;
/* This is used to identify firmware features which are available
* to the kernel.
*/
unsigned long firmware_features;
}; };
extern struct cpu_spec cpu_specs[]; extern struct cpu_spec cpu_specs[];
...@@ -72,6 +67,11 @@ static inline unsigned long cpu_has_feature(unsigned long feature) ...@@ -72,6 +67,11 @@ static inline unsigned long cpu_has_feature(unsigned long feature)
} }
/* This is used to identify firmware features which are available
* to the kernel.
*/
extern unsigned long ppc64_firmware_features;
/* firmware feature bitmask values */ /* firmware feature bitmask values */
#define FIRMWARE_MAX_FEATURES 63 #define FIRMWARE_MAX_FEATURES 63
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册