Commit fd5b4377eacac42293b1a349dbb0f9892bf7f74a
Committed by
Paul Mackerras
1 parent
71839267f2
Exists in
master
and in
4 other branches
[PATCH] ppc64: add number of PMCs to cputable
Add a field in the cputable struct to store the number of PMCs. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Showing 3 changed files with 45 additions and 19 deletions Side-by-side Diff
arch/ppc64/kernel/cputable.c
| ... | ... | @@ -59,6 +59,7 @@ |
| 59 | 59 | .cpu_user_features = COMMON_USER_PPC64, |
| 60 | 60 | .icache_bsize = 128, |
| 61 | 61 | .dcache_bsize = 128, |
| 62 | + .num_pmcs = 8, | |
| 62 | 63 | .cpu_setup = __setup_cpu_power3, |
| 63 | 64 | }, |
| 64 | 65 | { /* Power3+ */ |
| ... | ... | @@ -71,6 +72,7 @@ |
| 71 | 72 | .cpu_user_features = COMMON_USER_PPC64, |
| 72 | 73 | .icache_bsize = 128, |
| 73 | 74 | .dcache_bsize = 128, |
| 75 | + .num_pmcs = 8, | |
| 74 | 76 | .cpu_setup = __setup_cpu_power3, |
| 75 | 77 | }, |
| 76 | 78 | { /* Northstar */ |
| ... | ... | @@ -83,6 +85,7 @@ |
| 83 | 85 | .cpu_user_features = COMMON_USER_PPC64, |
| 84 | 86 | .icache_bsize = 128, |
| 85 | 87 | .dcache_bsize = 128, |
| 88 | + .num_pmcs = 8, | |
| 86 | 89 | .cpu_setup = __setup_cpu_power3, |
| 87 | 90 | }, |
| 88 | 91 | { /* Pulsar */ |
| ... | ... | @@ -95,6 +98,7 @@ |
| 95 | 98 | .cpu_user_features = COMMON_USER_PPC64, |
| 96 | 99 | .icache_bsize = 128, |
| 97 | 100 | .dcache_bsize = 128, |
| 101 | + .num_pmcs = 8, | |
| 98 | 102 | .cpu_setup = __setup_cpu_power3, |
| 99 | 103 | }, |
| 100 | 104 | { /* I-star */ |
| ... | ... | @@ -107,6 +111,7 @@ |
| 107 | 111 | .cpu_user_features = COMMON_USER_PPC64, |
| 108 | 112 | .icache_bsize = 128, |
| 109 | 113 | .dcache_bsize = 128, |
| 114 | + .num_pmcs = 8, | |
| 110 | 115 | .cpu_setup = __setup_cpu_power3, |
| 111 | 116 | }, |
| 112 | 117 | { /* S-star */ |
| ... | ... | @@ -119,6 +124,7 @@ |
| 119 | 124 | .cpu_user_features = COMMON_USER_PPC64, |
| 120 | 125 | .icache_bsize = 128, |
| 121 | 126 | .dcache_bsize = 128, |
| 127 | + .num_pmcs = 8, | |
| 122 | 128 | .cpu_setup = __setup_cpu_power3, |
| 123 | 129 | }, |
| 124 | 130 | { /* Power4 */ |
| ... | ... | @@ -131,6 +137,7 @@ |
| 131 | 137 | .cpu_user_features = COMMON_USER_PPC64, |
| 132 | 138 | .icache_bsize = 128, |
| 133 | 139 | .dcache_bsize = 128, |
| 140 | + .num_pmcs = 8, | |
| 134 | 141 | .cpu_setup = __setup_cpu_power4, |
| 135 | 142 | }, |
| 136 | 143 | { /* Power4+ */ |
| ... | ... | @@ -143,6 +150,7 @@ |
| 143 | 150 | .cpu_user_features = COMMON_USER_PPC64, |
| 144 | 151 | .icache_bsize = 128, |
| 145 | 152 | .dcache_bsize = 128, |
| 153 | + .num_pmcs = 8, | |
| 146 | 154 | .cpu_setup = __setup_cpu_power4, |
| 147 | 155 | }, |
| 148 | 156 | { /* PPC970 */ |
| ... | ... | @@ -157,6 +165,7 @@ |
| 157 | 165 | PPC_FEATURE_HAS_ALTIVEC_COMP, |
| 158 | 166 | .icache_bsize = 128, |
| 159 | 167 | .dcache_bsize = 128, |
| 168 | + .num_pmcs = 8, | |
| 160 | 169 | .cpu_setup = __setup_cpu_ppc970, |
| 161 | 170 | }, |
| 162 | 171 | { /* PPC970FX */ |
| ... | ... | @@ -171,6 +180,7 @@ |
| 171 | 180 | PPC_FEATURE_HAS_ALTIVEC_COMP, |
| 172 | 181 | .icache_bsize = 128, |
| 173 | 182 | .dcache_bsize = 128, |
| 183 | + .num_pmcs = 8, | |
| 174 | 184 | .cpu_setup = __setup_cpu_ppc970, |
| 175 | 185 | }, |
| 176 | 186 | { /* PPC970MP */ |
| ... | ... | @@ -199,6 +209,7 @@ |
| 199 | 209 | .cpu_user_features = COMMON_USER_PPC64, |
| 200 | 210 | .icache_bsize = 128, |
| 201 | 211 | .dcache_bsize = 128, |
| 212 | + .num_pmcs = 6, | |
| 202 | 213 | .cpu_setup = __setup_cpu_power4, |
| 203 | 214 | }, |
| 204 | 215 | { /* Power5 */ |
| ... | ... | @@ -213,6 +224,7 @@ |
| 213 | 224 | .cpu_user_features = COMMON_USER_PPC64, |
| 214 | 225 | .icache_bsize = 128, |
| 215 | 226 | .dcache_bsize = 128, |
| 227 | + .num_pmcs = 6, | |
| 216 | 228 | .cpu_setup = __setup_cpu_power4, |
| 217 | 229 | }, |
| 218 | 230 | { /* BE DD1.x */ |
| ... | ... | @@ -239,6 +251,7 @@ |
| 239 | 251 | .cpu_user_features = COMMON_USER_PPC64, |
| 240 | 252 | .icache_bsize = 128, |
| 241 | 253 | .dcache_bsize = 128, |
| 254 | + .num_pmcs = 6, | |
| 242 | 255 | .cpu_setup = __setup_cpu_power4, |
| 243 | 256 | } |
| 244 | 257 | }; |
arch/ppc64/kernel/sysfs.c
| ... | ... | @@ -215,18 +215,23 @@ |
| 215 | 215 | if (cpu_has_feature(CPU_FTR_MMCRA)) |
| 216 | 216 | sysdev_create_file(s, &attr_mmcra); |
| 217 | 217 | |
| 218 | - sysdev_create_file(s, &attr_pmc1); | |
| 219 | - sysdev_create_file(s, &attr_pmc2); | |
| 220 | - sysdev_create_file(s, &attr_pmc3); | |
| 221 | - sysdev_create_file(s, &attr_pmc4); | |
| 222 | - sysdev_create_file(s, &attr_pmc5); | |
| 223 | - sysdev_create_file(s, &attr_pmc6); | |
| 224 | - | |
| 225 | - if (cpu_has_feature(CPU_FTR_PMC8)) { | |
| 218 | + if (cur_cpu_spec->num_pmcs >= 1) | |
| 219 | + sysdev_create_file(s, &attr_pmc1); | |
| 220 | + if (cur_cpu_spec->num_pmcs >= 2) | |
| 221 | + sysdev_create_file(s, &attr_pmc2); | |
| 222 | + if (cur_cpu_spec->num_pmcs >= 3) | |
| 223 | + sysdev_create_file(s, &attr_pmc3); | |
| 224 | + if (cur_cpu_spec->num_pmcs >= 4) | |
| 225 | + sysdev_create_file(s, &attr_pmc4); | |
| 226 | + if (cur_cpu_spec->num_pmcs >= 5) | |
| 227 | + sysdev_create_file(s, &attr_pmc5); | |
| 228 | + if (cur_cpu_spec->num_pmcs >= 6) | |
| 229 | + sysdev_create_file(s, &attr_pmc6); | |
| 230 | + if (cur_cpu_spec->num_pmcs >= 7) | |
| 226 | 231 | sysdev_create_file(s, &attr_pmc7); |
| 232 | + if (cur_cpu_spec->num_pmcs >= 8) | |
| 227 | 233 | sysdev_create_file(s, &attr_pmc8); |
| 228 | - } | |
| 229 | - | |
| 234 | + | |
| 230 | 235 | if (cpu_has_feature(CPU_FTR_SMT)) |
| 231 | 236 | sysdev_create_file(s, &attr_purr); |
| 232 | 237 | } |
| 233 | 238 | |
| 234 | 239 | |
| ... | ... | @@ -252,17 +257,22 @@ |
| 252 | 257 | if (cpu_has_feature(CPU_FTR_MMCRA)) |
| 253 | 258 | sysdev_remove_file(s, &attr_mmcra); |
| 254 | 259 | |
| 255 | - sysdev_remove_file(s, &attr_pmc1); | |
| 256 | - sysdev_remove_file(s, &attr_pmc2); | |
| 257 | - sysdev_remove_file(s, &attr_pmc3); | |
| 258 | - sysdev_remove_file(s, &attr_pmc4); | |
| 259 | - sysdev_remove_file(s, &attr_pmc5); | |
| 260 | - sysdev_remove_file(s, &attr_pmc6); | |
| 261 | - | |
| 262 | - if (cpu_has_feature(CPU_FTR_PMC8)) { | |
| 260 | + if (cur_cpu_spec->num_pmcs >= 1) | |
| 261 | + sysdev_remove_file(s, &attr_pmc1); | |
| 262 | + if (cur_cpu_spec->num_pmcs >= 2) | |
| 263 | + sysdev_remove_file(s, &attr_pmc2); | |
| 264 | + if (cur_cpu_spec->num_pmcs >= 3) | |
| 265 | + sysdev_remove_file(s, &attr_pmc3); | |
| 266 | + if (cur_cpu_spec->num_pmcs >= 4) | |
| 267 | + sysdev_remove_file(s, &attr_pmc4); | |
| 268 | + if (cur_cpu_spec->num_pmcs >= 5) | |
| 269 | + sysdev_remove_file(s, &attr_pmc5); | |
| 270 | + if (cur_cpu_spec->num_pmcs >= 6) | |
| 271 | + sysdev_remove_file(s, &attr_pmc6); | |
| 272 | + if (cur_cpu_spec->num_pmcs >= 7) | |
| 263 | 273 | sysdev_remove_file(s, &attr_pmc7); |
| 274 | + if (cur_cpu_spec->num_pmcs >= 8) | |
| 264 | 275 | sysdev_remove_file(s, &attr_pmc8); |
| 265 | - } | |
| 266 | 276 | |
| 267 | 277 | if (cpu_has_feature(CPU_FTR_SMT)) |
| 268 | 278 | sysdev_remove_file(s, &attr_purr); |
include/asm-ppc64/cputable.h
| ... | ... | @@ -52,6 +52,9 @@ |
| 52 | 52 | unsigned int icache_bsize; |
| 53 | 53 | unsigned int dcache_bsize; |
| 54 | 54 | |
| 55 | + /* number of performance monitor counters */ | |
| 56 | + unsigned int num_pmcs; | |
| 57 | + | |
| 55 | 58 | /* this is called to initialize various CPU bits like L1 cache, |
| 56 | 59 | * BHT, SPD, etc... from head.S before branching to identify_machine |
| 57 | 60 | */ |