aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc64/kernel/sysfs.c
diff options
context:
space:
mode:
authorMichael Ellerman <michael@ellerman.id.au>2005-08-08 21:13:36 -0400
committerPaul Mackerras <paulus@samba.org>2005-08-28 20:53:38 -0400
commit180a33627d958d5d9d3602dde6ac74b315e136f0 (patch)
tree2c480741288f1f27ff3b65a95bb67fdf2f206a8f /arch/ppc64/kernel/sysfs.c
parentb13cfd173f73c3f6f9a307b7b6e64d45fbd756b2 (diff)
[PATCH] ppc64: Move ppc64_enable_pmcs() logic into a ppc_md function
This patch moves power4_enable_pmcs() to arch/ppc64/kernel/pmc.c. I've tested it on P5 LPAR and P4. It does what it used to. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/ppc64/kernel/sysfs.c')
-rw-r--r--arch/ppc64/kernel/sysfs.c54
1 files changed, 4 insertions, 50 deletions
diff --git a/arch/ppc64/kernel/sysfs.c b/arch/ppc64/kernel/sysfs.c
index eca15d25e026..f311ee7c0070 100644
--- a/arch/ppc64/kernel/sysfs.c
+++ b/arch/ppc64/kernel/sysfs.c
@@ -101,6 +101,8 @@ static int __init setup_smt_snooze_delay(char *str)
101} 101}
102__setup("smt-snooze-delay=", setup_smt_snooze_delay); 102__setup("smt-snooze-delay=", setup_smt_snooze_delay);
103 103
104#endif /* CONFIG_PPC_MULTIPLATFORM */
105
104/* 106/*
105 * Enabling PMCs will slow partition context switch times so we only do 107 * Enabling PMCs will slow partition context switch times so we only do
106 * it the first time we write to the PMCs. 108 * it the first time we write to the PMCs.
@@ -110,63 +112,15 @@ static DEFINE_PER_CPU(char, pmcs_enabled);
110 112
111void ppc64_enable_pmcs(void) 113void ppc64_enable_pmcs(void)
112{ 114{
113 unsigned long hid0;
114#ifdef CONFIG_PPC_PSERIES
115 unsigned long set, reset;
116#endif /* CONFIG_PPC_PSERIES */
117
118 /* Only need to enable them once */ 115 /* Only need to enable them once */
119 if (__get_cpu_var(pmcs_enabled)) 116 if (__get_cpu_var(pmcs_enabled))
120 return; 117 return;
121 118
122 __get_cpu_var(pmcs_enabled) = 1; 119 __get_cpu_var(pmcs_enabled) = 1;
123 120
124 switch (systemcfg->platform) { 121 if (ppc_md.enable_pmcs)
125 case PLATFORM_PSERIES: 122 ppc_md.enable_pmcs();
126 case PLATFORM_POWERMAC:
127 hid0 = mfspr(HID0);
128 hid0 |= 1UL << (63 - 20);
129
130 /* POWER4 requires the following sequence */
131 asm volatile(
132 "sync\n"
133 "mtspr %1, %0\n"
134 "mfspr %0, %1\n"
135 "mfspr %0, %1\n"
136 "mfspr %0, %1\n"
137 "mfspr %0, %1\n"
138 "mfspr %0, %1\n"
139 "mfspr %0, %1\n"
140 "isync" : "=&r" (hid0) : "i" (HID0), "0" (hid0):
141 "memory");
142 break;
143
144#ifdef CONFIG_PPC_PSERIES
145 case PLATFORM_PSERIES_LPAR:
146 set = 1UL << 63;
147 reset = 0;
148 plpar_hcall_norets(H_PERFMON, set, reset);
149 break;
150#endif /* CONFIG_PPC_PSERIES */
151
152 default:
153 break;
154 }
155
156 /* instruct hypervisor to maintain PMCs */
157 if (firmware_has_feature(FW_FEATURE_SPLPAR))
158 get_paca()->lppaca.pmcregs_in_use = 1;
159} 123}
160
161#else
162
163/* PMC stuff */
164void ppc64_enable_pmcs(void)
165{
166 /* XXX Implement for iseries */
167}
168#endif /* CONFIG_PPC_MULTIPLATFORM */
169
170EXPORT_SYMBOL(ppc64_enable_pmcs); 124EXPORT_SYMBOL(ppc64_enable_pmcs);
171 125
172/* XXX convert to rusty's on_one_cpu */ 126/* XXX convert to rusty's on_one_cpu */