[PATCH] ppc64: add number of PMCs to cputable
authorAnton Blanchard <anton@samba.org>
Tue, 6 Sep 2005 04:47:49 +0000 (14:47 +1000)
committerPaul Mackerras <paulus@samba.org>
Tue, 6 Sep 2005 06:09:20 +0000 (16:09 +1000)
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>
arch/ppc64/kernel/cputable.c
arch/ppc64/kernel/sysfs.c
include/asm-ppc64/cputable.h

index 4847f2ac8c9fe1d9d8de70ce428d46925699e162..a20960e47105ed9957804485faf297a4835cb6df 100644 (file)
@@ -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+ */
@@ -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 */
@@ -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 */
@@ -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 */
@@ -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 */
@@ -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 */
@@ -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+ */
@@ -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 */
@@ -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 */
@@ -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 */
@@ -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 */
@@ -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 */
@@ -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,
        }
 };
index f311ee7c0070d2d024d25b78b88622e154793ce5..6654b350979cfd3a868c029677fff0239d9972ed 100644 (file)
@@ -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);
 }
@@ -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);
index ae6cf3830108c0d59e22a637378e9ed100ddbdb2..0c8affc657faa4889470670ca940190b7d15048d 100644 (file)
@@ -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
         */