Commit fd5b4377 authored by Anton Blanchard's avatar Anton Blanchard Committed by Paul Mackerras

[PATCH] ppc64: add number of PMCs to cputable

Add a field in the cputable struct to store the number of PMCs.
Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 71839267
...@@ -59,6 +59,7 @@ struct cpu_spec cpu_specs[] = { ...@@ -59,6 +59,7 @@ struct cpu_spec cpu_specs[] = {
.cpu_user_features = COMMON_USER_PPC64, .cpu_user_features = COMMON_USER_PPC64,
.icache_bsize = 128, .icache_bsize = 128,
.dcache_bsize = 128, .dcache_bsize = 128,
.num_pmcs = 8,
.cpu_setup = __setup_cpu_power3, .cpu_setup = __setup_cpu_power3,
}, },
{ /* Power3+ */ { /* Power3+ */
...@@ -71,6 +72,7 @@ struct cpu_spec cpu_specs[] = { ...@@ -71,6 +72,7 @@ struct cpu_spec cpu_specs[] = {
.cpu_user_features = COMMON_USER_PPC64, .cpu_user_features = COMMON_USER_PPC64,
.icache_bsize = 128, .icache_bsize = 128,
.dcache_bsize = 128, .dcache_bsize = 128,
.num_pmcs = 8,
.cpu_setup = __setup_cpu_power3, .cpu_setup = __setup_cpu_power3,
}, },
{ /* Northstar */ { /* Northstar */
...@@ -83,6 +85,7 @@ struct cpu_spec cpu_specs[] = { ...@@ -83,6 +85,7 @@ struct cpu_spec cpu_specs[] = {
.cpu_user_features = COMMON_USER_PPC64, .cpu_user_features = COMMON_USER_PPC64,
.icache_bsize = 128, .icache_bsize = 128,
.dcache_bsize = 128, .dcache_bsize = 128,
.num_pmcs = 8,
.cpu_setup = __setup_cpu_power3, .cpu_setup = __setup_cpu_power3,
}, },
{ /* Pulsar */ { /* Pulsar */
...@@ -95,6 +98,7 @@ struct cpu_spec cpu_specs[] = { ...@@ -95,6 +98,7 @@ struct cpu_spec cpu_specs[] = {
.cpu_user_features = COMMON_USER_PPC64, .cpu_user_features = COMMON_USER_PPC64,
.icache_bsize = 128, .icache_bsize = 128,
.dcache_bsize = 128, .dcache_bsize = 128,
.num_pmcs = 8,
.cpu_setup = __setup_cpu_power3, .cpu_setup = __setup_cpu_power3,
}, },
{ /* I-star */ { /* I-star */
...@@ -107,6 +111,7 @@ struct cpu_spec cpu_specs[] = { ...@@ -107,6 +111,7 @@ struct cpu_spec cpu_specs[] = {
.cpu_user_features = COMMON_USER_PPC64, .cpu_user_features = COMMON_USER_PPC64,
.icache_bsize = 128, .icache_bsize = 128,
.dcache_bsize = 128, .dcache_bsize = 128,
.num_pmcs = 8,
.cpu_setup = __setup_cpu_power3, .cpu_setup = __setup_cpu_power3,
}, },
{ /* S-star */ { /* S-star */
...@@ -119,6 +124,7 @@ struct cpu_spec cpu_specs[] = { ...@@ -119,6 +124,7 @@ struct cpu_spec cpu_specs[] = {
.cpu_user_features = COMMON_USER_PPC64, .cpu_user_features = COMMON_USER_PPC64,
.icache_bsize = 128, .icache_bsize = 128,
.dcache_bsize = 128, .dcache_bsize = 128,
.num_pmcs = 8,
.cpu_setup = __setup_cpu_power3, .cpu_setup = __setup_cpu_power3,
}, },
{ /* Power4 */ { /* Power4 */
...@@ -131,6 +137,7 @@ struct cpu_spec cpu_specs[] = { ...@@ -131,6 +137,7 @@ struct cpu_spec cpu_specs[] = {
.cpu_user_features = COMMON_USER_PPC64, .cpu_user_features = COMMON_USER_PPC64,
.icache_bsize = 128, .icache_bsize = 128,
.dcache_bsize = 128, .dcache_bsize = 128,
.num_pmcs = 8,
.cpu_setup = __setup_cpu_power4, .cpu_setup = __setup_cpu_power4,
}, },
{ /* Power4+ */ { /* Power4+ */
...@@ -143,6 +150,7 @@ struct cpu_spec cpu_specs[] = { ...@@ -143,6 +150,7 @@ struct cpu_spec cpu_specs[] = {
.cpu_user_features = COMMON_USER_PPC64, .cpu_user_features = COMMON_USER_PPC64,
.icache_bsize = 128, .icache_bsize = 128,
.dcache_bsize = 128, .dcache_bsize = 128,
.num_pmcs = 8,
.cpu_setup = __setup_cpu_power4, .cpu_setup = __setup_cpu_power4,
}, },
{ /* PPC970 */ { /* PPC970 */
...@@ -157,6 +165,7 @@ struct cpu_spec cpu_specs[] = { ...@@ -157,6 +165,7 @@ struct cpu_spec cpu_specs[] = {
PPC_FEATURE_HAS_ALTIVEC_COMP, PPC_FEATURE_HAS_ALTIVEC_COMP,
.icache_bsize = 128, .icache_bsize = 128,
.dcache_bsize = 128, .dcache_bsize = 128,
.num_pmcs = 8,
.cpu_setup = __setup_cpu_ppc970, .cpu_setup = __setup_cpu_ppc970,
}, },
{ /* PPC970FX */ { /* PPC970FX */
...@@ -171,6 +180,7 @@ struct cpu_spec cpu_specs[] = { ...@@ -171,6 +180,7 @@ struct cpu_spec cpu_specs[] = {
PPC_FEATURE_HAS_ALTIVEC_COMP, PPC_FEATURE_HAS_ALTIVEC_COMP,
.icache_bsize = 128, .icache_bsize = 128,
.dcache_bsize = 128, .dcache_bsize = 128,
.num_pmcs = 8,
.cpu_setup = __setup_cpu_ppc970, .cpu_setup = __setup_cpu_ppc970,
}, },
{ /* PPC970MP */ { /* PPC970MP */
...@@ -199,6 +209,7 @@ struct cpu_spec cpu_specs[] = { ...@@ -199,6 +209,7 @@ struct cpu_spec cpu_specs[] = {
.cpu_user_features = COMMON_USER_PPC64, .cpu_user_features = COMMON_USER_PPC64,
.icache_bsize = 128, .icache_bsize = 128,
.dcache_bsize = 128, .dcache_bsize = 128,
.num_pmcs = 6,
.cpu_setup = __setup_cpu_power4, .cpu_setup = __setup_cpu_power4,
}, },
{ /* Power5 */ { /* Power5 */
...@@ -213,6 +224,7 @@ struct cpu_spec cpu_specs[] = { ...@@ -213,6 +224,7 @@ struct cpu_spec cpu_specs[] = {
.cpu_user_features = COMMON_USER_PPC64, .cpu_user_features = COMMON_USER_PPC64,
.icache_bsize = 128, .icache_bsize = 128,
.dcache_bsize = 128, .dcache_bsize = 128,
.num_pmcs = 6,
.cpu_setup = __setup_cpu_power4, .cpu_setup = __setup_cpu_power4,
}, },
{ /* BE DD1.x */ { /* BE DD1.x */
...@@ -239,6 +251,7 @@ struct cpu_spec cpu_specs[] = { ...@@ -239,6 +251,7 @@ struct cpu_spec cpu_specs[] = {
.cpu_user_features = COMMON_USER_PPC64, .cpu_user_features = COMMON_USER_PPC64,
.icache_bsize = 128, .icache_bsize = 128,
.dcache_bsize = 128, .dcache_bsize = 128,
.num_pmcs = 6,
.cpu_setup = __setup_cpu_power4, .cpu_setup = __setup_cpu_power4,
} }
}; };
...@@ -215,17 +215,22 @@ static void register_cpu_online(unsigned int cpu) ...@@ -215,17 +215,22 @@ static void register_cpu_online(unsigned int cpu)
if (cpu_has_feature(CPU_FTR_MMCRA)) if (cpu_has_feature(CPU_FTR_MMCRA))
sysdev_create_file(s, &attr_mmcra); sysdev_create_file(s, &attr_mmcra);
if (cur_cpu_spec->num_pmcs >= 1)
sysdev_create_file(s, &attr_pmc1); sysdev_create_file(s, &attr_pmc1);
if (cur_cpu_spec->num_pmcs >= 2)
sysdev_create_file(s, &attr_pmc2); sysdev_create_file(s, &attr_pmc2);
if (cur_cpu_spec->num_pmcs >= 3)
sysdev_create_file(s, &attr_pmc3); sysdev_create_file(s, &attr_pmc3);
if (cur_cpu_spec->num_pmcs >= 4)
sysdev_create_file(s, &attr_pmc4); sysdev_create_file(s, &attr_pmc4);
if (cur_cpu_spec->num_pmcs >= 5)
sysdev_create_file(s, &attr_pmc5); sysdev_create_file(s, &attr_pmc5);
if (cur_cpu_spec->num_pmcs >= 6)
sysdev_create_file(s, &attr_pmc6); sysdev_create_file(s, &attr_pmc6);
if (cur_cpu_spec->num_pmcs >= 7)
if (cpu_has_feature(CPU_FTR_PMC8)) {
sysdev_create_file(s, &attr_pmc7); sysdev_create_file(s, &attr_pmc7);
if (cur_cpu_spec->num_pmcs >= 8)
sysdev_create_file(s, &attr_pmc8); sysdev_create_file(s, &attr_pmc8);
}
if (cpu_has_feature(CPU_FTR_SMT)) if (cpu_has_feature(CPU_FTR_SMT))
sysdev_create_file(s, &attr_purr); sysdev_create_file(s, &attr_purr);
...@@ -252,17 +257,22 @@ static void unregister_cpu_online(unsigned int cpu) ...@@ -252,17 +257,22 @@ static void unregister_cpu_online(unsigned int cpu)
if (cpu_has_feature(CPU_FTR_MMCRA)) if (cpu_has_feature(CPU_FTR_MMCRA))
sysdev_remove_file(s, &attr_mmcra); sysdev_remove_file(s, &attr_mmcra);
if (cur_cpu_spec->num_pmcs >= 1)
sysdev_remove_file(s, &attr_pmc1); sysdev_remove_file(s, &attr_pmc1);
if (cur_cpu_spec->num_pmcs >= 2)
sysdev_remove_file(s, &attr_pmc2); sysdev_remove_file(s, &attr_pmc2);
if (cur_cpu_spec->num_pmcs >= 3)
sysdev_remove_file(s, &attr_pmc3); sysdev_remove_file(s, &attr_pmc3);
if (cur_cpu_spec->num_pmcs >= 4)
sysdev_remove_file(s, &attr_pmc4); sysdev_remove_file(s, &attr_pmc4);
if (cur_cpu_spec->num_pmcs >= 5)
sysdev_remove_file(s, &attr_pmc5); sysdev_remove_file(s, &attr_pmc5);
if (cur_cpu_spec->num_pmcs >= 6)
sysdev_remove_file(s, &attr_pmc6); sysdev_remove_file(s, &attr_pmc6);
if (cur_cpu_spec->num_pmcs >= 7)
if (cpu_has_feature(CPU_FTR_PMC8)) {
sysdev_remove_file(s, &attr_pmc7); sysdev_remove_file(s, &attr_pmc7);
if (cur_cpu_spec->num_pmcs >= 8)
sysdev_remove_file(s, &attr_pmc8); sysdev_remove_file(s, &attr_pmc8);
}
if (cpu_has_feature(CPU_FTR_SMT)) if (cpu_has_feature(CPU_FTR_SMT))
sysdev_remove_file(s, &attr_purr); sysdev_remove_file(s, &attr_purr);
......
...@@ -52,6 +52,9 @@ struct cpu_spec { ...@@ -52,6 +52,9 @@ struct cpu_spec {
unsigned int icache_bsize; unsigned int icache_bsize;
unsigned int dcache_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, /* this is called to initialize various CPU bits like L1 cache,
* BHT, SPD, etc... from head.S before branching to identify_machine * BHT, SPD, etc... from head.S before branching to identify_machine
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment