Skip to content

Commit b950bdd

Browse files
ozbenhpaulusmack
authored andcommitted
powerpc: Expose PMCs & cache topology in sysfs on 32-bit
The file arch/powerpc/kernel/sysfs.c is currently only compiled for 64-bit kernels. It contain code to register CPU sysdevs in sysfs and add various properties such as cache topology and raw access by root to performance monitor counters (PMCs). A lot of that can be re-used as is on 32-bits. This makes the file be built for both, with appropriate ifdef'ing for the few bits that are really 64-bit specific, and adds some support for the raw PMCs for 75x and 74xx processors. Signed-off-by: Benjamin Herrenschmidt <[email protected]> Signed-off-by: Paul Mackerras <[email protected]>
1 parent 41eba0a commit b950bdd

File tree

6 files changed

+117
-33
lines changed

6 files changed

+117
-33
lines changed

arch/powerpc/include/asm/cputable.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ enum powerpc_pmc_type {
6262
PPC_PMC_DEFAULT = 0,
6363
PPC_PMC_IBM = 1,
6464
PPC_PMC_PA6T = 2,
65+
PPC_PMC_G4 = 3,
6566
};
6667

6768
struct pt_regs;

arch/powerpc/kernel/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ endif
2727
obj-y := cputable.o ptrace.o syscalls.o \
2828
irq.o align.o signal_32.o pmc.o vdso.o \
2929
init_task.o process.o systbl.o idle.o \
30-
signal.o
30+
signal.o sysfs.o
3131
obj-y += vdso32/
3232
obj-$(CONFIG_PPC64) += setup_64.o sys_ppc32.o \
3333
signal_64.o ptrace32.o \
3434
paca.o cpu_setup_ppc970.o \
3535
cpu_setup_pa6t.o \
36-
firmware.o sysfs.o nvram_64.o
36+
firmware.o nvram_64.o
3737
obj-$(CONFIG_PPC64) += vdso64/
3838
obj-$(CONFIG_ALTIVEC) += vecemu.o vector.o
3939
obj-$(CONFIG_PPC_970_NAP) += idle_power4.o

arch/powerpc/kernel/cputable.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
610610
.icache_bsize = 32,
611611
.dcache_bsize = 32,
612612
.num_pmcs = 4,
613+
.pmc_type = PPC_PMC_IBM,
613614
.cpu_setup = __setup_cpu_750cx,
614615
.machine_check = machine_check_generic,
615616
.platform = "ppc750",
@@ -623,6 +624,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
623624
.icache_bsize = 32,
624625
.dcache_bsize = 32,
625626
.num_pmcs = 4,
627+
.pmc_type = PPC_PMC_IBM,
626628
.cpu_setup = __setup_cpu_750cx,
627629
.machine_check = machine_check_generic,
628630
.platform = "ppc750",
@@ -636,6 +638,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
636638
.icache_bsize = 32,
637639
.dcache_bsize = 32,
638640
.num_pmcs = 4,
641+
.pmc_type = PPC_PMC_IBM,
639642
.cpu_setup = __setup_cpu_750cx,
640643
.machine_check = machine_check_generic,
641644
.platform = "ppc750",
@@ -649,6 +652,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
649652
.icache_bsize = 32,
650653
.dcache_bsize = 32,
651654
.num_pmcs = 4,
655+
.pmc_type = PPC_PMC_IBM,
652656
.cpu_setup = __setup_cpu_750,
653657
.machine_check = machine_check_generic,
654658
.platform = "ppc750",
@@ -662,6 +666,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
662666
.icache_bsize = 32,
663667
.dcache_bsize = 32,
664668
.num_pmcs = 4,
669+
.pmc_type = PPC_PMC_IBM,
665670
.cpu_setup = __setup_cpu_750,
666671
.machine_check = machine_check_generic,
667672
.platform = "ppc750",
@@ -675,6 +680,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
675680
.icache_bsize = 32,
676681
.dcache_bsize = 32,
677682
.num_pmcs = 4,
683+
.pmc_type = PPC_PMC_IBM,
678684
.cpu_setup = __setup_cpu_750,
679685
.machine_check = machine_check_generic,
680686
.platform = "ppc750",
@@ -688,6 +694,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
688694
.icache_bsize = 32,
689695
.dcache_bsize = 32,
690696
.num_pmcs = 4,
697+
.pmc_type = PPC_PMC_IBM,
691698
.cpu_setup = __setup_cpu_750,
692699
.machine_check = machine_check_generic,
693700
.platform = "ppc750",
@@ -701,6 +708,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
701708
.icache_bsize = 32,
702709
.dcache_bsize = 32,
703710
.num_pmcs = 4,
711+
.pmc_type = PPC_PMC_IBM,
704712
.cpu_setup = __setup_cpu_750fx,
705713
.machine_check = machine_check_generic,
706714
.platform = "ppc750",
@@ -714,6 +722,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
714722
.icache_bsize = 32,
715723
.dcache_bsize = 32,
716724
.num_pmcs = 4,
725+
.pmc_type = PPC_PMC_IBM,
717726
.cpu_setup = __setup_cpu_750fx,
718727
.machine_check = machine_check_generic,
719728
.platform = "ppc750",
@@ -727,6 +736,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
727736
.icache_bsize = 32,
728737
.dcache_bsize = 32,
729738
.num_pmcs = 4,
739+
.pmc_type = PPC_PMC_IBM,
730740
.cpu_setup = __setup_cpu_750,
731741
.machine_check = machine_check_generic,
732742
.platform = "ppc750",
@@ -741,6 +751,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
741751
.icache_bsize = 32,
742752
.dcache_bsize = 32,
743753
.num_pmcs = 4,
754+
.pmc_type = PPC_PMC_G4,
744755
.cpu_setup = __setup_cpu_7400,
745756
.machine_check = machine_check_generic,
746757
.platform = "ppc7400",
@@ -755,6 +766,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
755766
.icache_bsize = 32,
756767
.dcache_bsize = 32,
757768
.num_pmcs = 4,
769+
.pmc_type = PPC_PMC_G4,
758770
.cpu_setup = __setup_cpu_7400,
759771
.machine_check = machine_check_generic,
760772
.platform = "ppc7400",
@@ -769,6 +781,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
769781
.icache_bsize = 32,
770782
.dcache_bsize = 32,
771783
.num_pmcs = 4,
784+
.pmc_type = PPC_PMC_G4,
772785
.cpu_setup = __setup_cpu_7410,
773786
.machine_check = machine_check_generic,
774787
.platform = "ppc7400",
@@ -783,6 +796,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
783796
.icache_bsize = 32,
784797
.dcache_bsize = 32,
785798
.num_pmcs = 6,
799+
.pmc_type = PPC_PMC_G4,
786800
.cpu_setup = __setup_cpu_745x,
787801
.oprofile_cpu_type = "ppc/7450",
788802
.oprofile_type = PPC_OPROFILE_G4,
@@ -799,6 +813,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
799813
.icache_bsize = 32,
800814
.dcache_bsize = 32,
801815
.num_pmcs = 6,
816+
.pmc_type = PPC_PMC_G4,
802817
.cpu_setup = __setup_cpu_745x,
803818
.oprofile_cpu_type = "ppc/7450",
804819
.oprofile_type = PPC_OPROFILE_G4,
@@ -815,6 +830,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
815830
.icache_bsize = 32,
816831
.dcache_bsize = 32,
817832
.num_pmcs = 6,
833+
.pmc_type = PPC_PMC_G4,
818834
.cpu_setup = __setup_cpu_745x,
819835
.oprofile_cpu_type = "ppc/7450",
820836
.oprofile_type = PPC_OPROFILE_G4,
@@ -831,6 +847,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
831847
.icache_bsize = 32,
832848
.dcache_bsize = 32,
833849
.num_pmcs = 6,
850+
.pmc_type = PPC_PMC_G4,
834851
.cpu_setup = __setup_cpu_745x,
835852
.oprofile_cpu_type = "ppc/7450",
836853
.oprofile_type = PPC_OPROFILE_G4,
@@ -847,6 +864,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
847864
.icache_bsize = 32,
848865
.dcache_bsize = 32,
849866
.num_pmcs = 6,
867+
.pmc_type = PPC_PMC_G4,
850868
.cpu_setup = __setup_cpu_745x,
851869
.oprofile_cpu_type = "ppc/7450",
852870
.oprofile_type = PPC_OPROFILE_G4,
@@ -863,6 +881,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
863881
.icache_bsize = 32,
864882
.dcache_bsize = 32,
865883
.num_pmcs = 6,
884+
.pmc_type = PPC_PMC_G4,
866885
.cpu_setup = __setup_cpu_745x,
867886
.oprofile_cpu_type = "ppc/7450",
868887
.oprofile_type = PPC_OPROFILE_G4,
@@ -879,6 +898,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
879898
.icache_bsize = 32,
880899
.dcache_bsize = 32,
881900
.num_pmcs = 6,
901+
.pmc_type = PPC_PMC_G4,
882902
.cpu_setup = __setup_cpu_745x,
883903
.oprofile_cpu_type = "ppc/7450",
884904
.oprofile_type = PPC_OPROFILE_G4,
@@ -895,6 +915,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
895915
.icache_bsize = 32,
896916
.dcache_bsize = 32,
897917
.num_pmcs = 6,
918+
.pmc_type = PPC_PMC_G4,
898919
.cpu_setup = __setup_cpu_745x,
899920
.oprofile_cpu_type = "ppc/7450",
900921
.oprofile_type = PPC_OPROFILE_G4,
@@ -910,6 +931,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
910931
.icache_bsize = 32,
911932
.dcache_bsize = 32,
912933
.num_pmcs = 6,
934+
.pmc_type = PPC_PMC_G4,
913935
.cpu_setup = __setup_cpu_745x,
914936
.oprofile_cpu_type = "ppc/7450",
915937
.oprofile_type = PPC_OPROFILE_G4,
@@ -926,6 +948,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
926948
.icache_bsize = 32,
927949
.dcache_bsize = 32,
928950
.num_pmcs = 6,
951+
.pmc_type = PPC_PMC_G4,
929952
.cpu_setup = __setup_cpu_745x,
930953
.oprofile_cpu_type = "ppc/7450",
931954
.oprofile_type = PPC_OPROFILE_G4,
@@ -942,6 +965,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
942965
.icache_bsize = 32,
943966
.dcache_bsize = 32,
944967
.num_pmcs = 6,
968+
.pmc_type = PPC_PMC_G4,
945969
.cpu_setup = __setup_cpu_745x,
946970
.oprofile_cpu_type = "ppc/7450",
947971
.oprofile_type = PPC_OPROFILE_G4,

arch/powerpc/kernel/setup_32.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -209,23 +209,12 @@ EXPORT_SYMBOL(nvram_sync);
209209

210210
#endif /* CONFIG_NVRAM */
211211

212-
static DEFINE_PER_CPU(struct cpu, cpu_devices);
213-
214212
int __init ppc_init(void)
215213
{
216-
int cpu;
217-
218214
/* clear the progress line */
219215
if (ppc_md.progress)
220216
ppc_md.progress(" ", 0xffff);
221217

222-
/* register CPU devices */
223-
for_each_possible_cpu(cpu) {
224-
struct cpu *c = &per_cpu(cpu_devices, cpu);
225-
c->hotpluggable = 1;
226-
register_cpu(c, cpu);
227-
}
228-
229218
/* call platform init */
230219
if (ppc_md.init != NULL) {
231220
ppc_md.init();

0 commit comments

Comments
 (0)