Skip to content

Commit

Permalink
[PATCH] ppc64: add number of PMCs to cputable
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Anton Blanchard authored and Paul Mackerras committed Sep 6, 2005
1 parent 7183926 commit fd5b437
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 19 deletions.
13 changes: 13 additions & 0 deletions arch/ppc64/kernel/cputable.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ struct cpu_spec cpu_specs[] = {
.cpu_user_features = COMMON_USER_PPC64,
.icache_bsize = 128,
.dcache_bsize = 128,
.num_pmcs = 8,
.cpu_setup = __setup_cpu_power3,
},
{ /* Power3+ */
Expand All @@ -71,6 +72,7 @@ struct cpu_spec cpu_specs[] = {
.cpu_user_features = COMMON_USER_PPC64,
.icache_bsize = 128,
.dcache_bsize = 128,
.num_pmcs = 8,
.cpu_setup = __setup_cpu_power3,
},
{ /* Northstar */
Expand All @@ -83,6 +85,7 @@ struct cpu_spec cpu_specs[] = {
.cpu_user_features = COMMON_USER_PPC64,
.icache_bsize = 128,
.dcache_bsize = 128,
.num_pmcs = 8,
.cpu_setup = __setup_cpu_power3,
},
{ /* Pulsar */
Expand All @@ -95,6 +98,7 @@ struct cpu_spec cpu_specs[] = {
.cpu_user_features = COMMON_USER_PPC64,
.icache_bsize = 128,
.dcache_bsize = 128,
.num_pmcs = 8,
.cpu_setup = __setup_cpu_power3,
},
{ /* I-star */
Expand All @@ -107,6 +111,7 @@ struct cpu_spec cpu_specs[] = {
.cpu_user_features = COMMON_USER_PPC64,
.icache_bsize = 128,
.dcache_bsize = 128,
.num_pmcs = 8,
.cpu_setup = __setup_cpu_power3,
},
{ /* S-star */
Expand All @@ -119,6 +124,7 @@ struct cpu_spec cpu_specs[] = {
.cpu_user_features = COMMON_USER_PPC64,
.icache_bsize = 128,
.dcache_bsize = 128,
.num_pmcs = 8,
.cpu_setup = __setup_cpu_power3,
},
{ /* Power4 */
Expand All @@ -131,6 +137,7 @@ struct cpu_spec cpu_specs[] = {
.cpu_user_features = COMMON_USER_PPC64,
.icache_bsize = 128,
.dcache_bsize = 128,
.num_pmcs = 8,
.cpu_setup = __setup_cpu_power4,
},
{ /* Power4+ */
Expand All @@ -143,6 +150,7 @@ struct cpu_spec cpu_specs[] = {
.cpu_user_features = COMMON_USER_PPC64,
.icache_bsize = 128,
.dcache_bsize = 128,
.num_pmcs = 8,
.cpu_setup = __setup_cpu_power4,
},
{ /* PPC970 */
Expand All @@ -157,6 +165,7 @@ struct cpu_spec cpu_specs[] = {
PPC_FEATURE_HAS_ALTIVEC_COMP,
.icache_bsize = 128,
.dcache_bsize = 128,
.num_pmcs = 8,
.cpu_setup = __setup_cpu_ppc970,
},
{ /* PPC970FX */
Expand All @@ -171,6 +180,7 @@ struct cpu_spec cpu_specs[] = {
PPC_FEATURE_HAS_ALTIVEC_COMP,
.icache_bsize = 128,
.dcache_bsize = 128,
.num_pmcs = 8,
.cpu_setup = __setup_cpu_ppc970,
},
{ /* PPC970MP */
Expand Down Expand Up @@ -199,6 +209,7 @@ struct cpu_spec cpu_specs[] = {
.cpu_user_features = COMMON_USER_PPC64,
.icache_bsize = 128,
.dcache_bsize = 128,
.num_pmcs = 6,
.cpu_setup = __setup_cpu_power4,
},
{ /* Power5 */
Expand All @@ -213,6 +224,7 @@ struct cpu_spec cpu_specs[] = {
.cpu_user_features = COMMON_USER_PPC64,
.icache_bsize = 128,
.dcache_bsize = 128,
.num_pmcs = 6,
.cpu_setup = __setup_cpu_power4,
},
{ /* BE DD1.x */
Expand All @@ -239,6 +251,7 @@ struct cpu_spec cpu_specs[] = {
.cpu_user_features = COMMON_USER_PPC64,
.icache_bsize = 128,
.dcache_bsize = 128,
.num_pmcs = 6,
.cpu_setup = __setup_cpu_power4,
}
};
48 changes: 29 additions & 19 deletions arch/ppc64/kernel/sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,18 +215,23 @@ static void register_cpu_online(unsigned int cpu)
if (cpu_has_feature(CPU_FTR_MMCRA))
sysdev_create_file(s, &attr_mmcra);

sysdev_create_file(s, &attr_pmc1);
sysdev_create_file(s, &attr_pmc2);
sysdev_create_file(s, &attr_pmc3);
sysdev_create_file(s, &attr_pmc4);
sysdev_create_file(s, &attr_pmc5);
sysdev_create_file(s, &attr_pmc6);

if (cpu_has_feature(CPU_FTR_PMC8)) {
if (cur_cpu_spec->num_pmcs >= 1)
sysdev_create_file(s, &attr_pmc1);
if (cur_cpu_spec->num_pmcs >= 2)
sysdev_create_file(s, &attr_pmc2);
if (cur_cpu_spec->num_pmcs >= 3)
sysdev_create_file(s, &attr_pmc3);
if (cur_cpu_spec->num_pmcs >= 4)
sysdev_create_file(s, &attr_pmc4);
if (cur_cpu_spec->num_pmcs >= 5)
sysdev_create_file(s, &attr_pmc5);
if (cur_cpu_spec->num_pmcs >= 6)
sysdev_create_file(s, &attr_pmc6);
if (cur_cpu_spec->num_pmcs >= 7)
sysdev_create_file(s, &attr_pmc7);
if (cur_cpu_spec->num_pmcs >= 8)
sysdev_create_file(s, &attr_pmc8);
}


if (cpu_has_feature(CPU_FTR_SMT))
sysdev_create_file(s, &attr_purr);
}
Expand All @@ -252,17 +257,22 @@ static void unregister_cpu_online(unsigned int cpu)
if (cpu_has_feature(CPU_FTR_MMCRA))
sysdev_remove_file(s, &attr_mmcra);

sysdev_remove_file(s, &attr_pmc1);
sysdev_remove_file(s, &attr_pmc2);
sysdev_remove_file(s, &attr_pmc3);
sysdev_remove_file(s, &attr_pmc4);
sysdev_remove_file(s, &attr_pmc5);
sysdev_remove_file(s, &attr_pmc6);

if (cpu_has_feature(CPU_FTR_PMC8)) {
if (cur_cpu_spec->num_pmcs >= 1)
sysdev_remove_file(s, &attr_pmc1);
if (cur_cpu_spec->num_pmcs >= 2)
sysdev_remove_file(s, &attr_pmc2);
if (cur_cpu_spec->num_pmcs >= 3)
sysdev_remove_file(s, &attr_pmc3);
if (cur_cpu_spec->num_pmcs >= 4)
sysdev_remove_file(s, &attr_pmc4);
if (cur_cpu_spec->num_pmcs >= 5)
sysdev_remove_file(s, &attr_pmc5);
if (cur_cpu_spec->num_pmcs >= 6)
sysdev_remove_file(s, &attr_pmc6);
if (cur_cpu_spec->num_pmcs >= 7)
sysdev_remove_file(s, &attr_pmc7);
if (cur_cpu_spec->num_pmcs >= 8)
sysdev_remove_file(s, &attr_pmc8);
}

if (cpu_has_feature(CPU_FTR_SMT))
sysdev_remove_file(s, &attr_purr);
Expand Down
3 changes: 3 additions & 0 deletions include/asm-ppc64/cputable.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ struct cpu_spec {
unsigned int icache_bsize;
unsigned int dcache_bsize;

/* number of performance monitor counters */
unsigned int num_pmcs;

/* this is called to initialize various CPU bits like L1 cache,
* BHT, SPD, etc... from head.S before branching to identify_machine
*/
Expand Down

0 comments on commit fd5b437

Please sign in to comment.