History

[PATCH] ppc64: cleanup iseries runlight support

The iseries has a bar graph on the front panel that shows how busy it is. The operating system sets and clears a bit in the CTRL register to control it. Instead of going to the complexity of using a thread info bit, just set and clear it in the idle loop. Also create two helper functions, ppc64_runlatch_on and ppc64_runlatch_off. Finally don't use the short form of the SPR defines.

Anton Blanchard committed 21 years ago

Commit 6dc2f0c1 parent 79f12487 files · +33 −36Browse files

Unified · Split

7 files
  1. arch/ppc64/kernel/entry.S +0 −9
  2. arch/ppc64/kernel/head.S +5 −5
  3. arch/ppc64/kernel/idle.c +3 −5
  4. arch/ppc64/kernel/process.c +0 −3
  5. arch/ppc64/kernel/sysfs.c +2 −6
  6. include/asm-ppc64/processor.h +21 −6
  7. include/asm-ppc64/thread_info.h +2 −2
arch/ppc64/kernel/entry.S+0−9
@@ -436,15 +436,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) · 435 unmodified lines
436 REST_8GPRS(14, r1)436 REST_8GPRS(14, r1)
437 REST_10GPRS(22, r1)437 REST_10GPRS(22, r1)
438 438
439#ifdef CONFIG_PPC_ISERIES
440 clrrdi r7,r1,THREAD_SHIFT /* get current_thread_info() */
441 ld r7,TI_FLAGS(r7) /* Get run light flag */
442 mfspr r9,CTRLF
443 srdi r7,r7,TIF_RUN_LIGHT
444 insrdi r9,r7,1,63 /* Insert run light into CTRL */
445 mtspr CTRLT,r9
446#endif
447
448 /* convert old thread to its task_struct for return value */439 /* convert old thread to its task_struct for return value */
449 addi r3,r3,-THREAD440 addi r3,r3,-THREAD
450 ld r7,_NIP(r1) /* Return to _switch caller in new task */441 ld r7,_NIP(r1) /* Return to _switch caller in new task */
arch/ppc64/kernel/head.S+5−5
@@ -626,10 +626,10 @@ system_reset_iSeries: · 625 unmodified lines
626 lhz r24,PACAPACAINDEX(r13) /* Get processor # */626 lhz r24,PACAPACAINDEX(r13) /* Get processor # */
627 cmpwi 0,r24,0 /* Are we processor 0? */627 cmpwi 0,r24,0 /* Are we processor 0? */
628 beq .__start_initialization_iSeries /* Start up the first processor */628 beq .__start_initialization_iSeries /* Start up the first processor */
629 mfspr r4,CTRLF629 mfspr r4,SPRN_CTRLF
630 li r5,RUNLATCH /* Turn off the run light */630 li r5,CTRL_RUNLATCH /* Turn off the run light */
631 andc r4,r4,r5631 andc r4,r4,r5
632 mtspr CTRLT,r4632 mtspr SPRN_CTRLT,r4
633 633
6341:6341:
635 HMT_LOW635 HMT_LOW
@@ -2082,9 +2082,9 @@ _GLOBAL(hmt_start_secondary) · 1446 unmodified lines
2082 mfspr r4, HID02082 mfspr r4, HID0
2083 ori r4, r4, 0x12083 ori r4, r4, 0x1
2084 mtspr HID0, r42084 mtspr HID0, r4
2085 mfspr r4, CTRLF2085 mfspr r4, SPRN_CTRLF
2086 oris r4, r4, 0x402086 oris r4, r4, 0x40
2087 mtspr CTRLT, r42087 mtspr SPRN_CTRLT, r4
2088 blr2088 blr
2089#endif2089#endif
2090 2090
arch/ppc64/kernel/idle.c+3−5
@@ -75,13 +75,9 @@ static int iSeries_idle(void) · 74 unmodified lines
75{75{
76 struct paca_struct *lpaca;76 struct paca_struct *lpaca;
77 long oldval;77 long oldval;
78 unsigned long CTRL;
79 78
80 /* ensure iSeries run light will be out when idle */79 /* ensure iSeries run light will be out when idle */
81 clear_thread_flag(TIF_RUN_LIGHT);80 ppc64_runlatch_off();
82 CTRL = mfspr(CTRLF);
83 CTRL &= ~RUNLATCH;
84 mtspr(CTRLT, CTRL);
85 81
86 lpaca = get_paca();82 lpaca = get_paca();
87 83
@@ -111,7 +107,9 @@ static int iSeries_idle(void) · 23 unmodified lines
111 }107 }
112 }108 }
113 109
110 ppc64_runlatch_on();
114 schedule();111 schedule();
112 ppc64_runlatch_off();
115 }113 }
116 114
117 return 0;115 return 0;
arch/ppc64/kernel/process.c+0−3
@@ -378,9 +378,6 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp, · 377 unmodified lines
378 childregs->gpr[1] = sp + sizeof(struct pt_regs);378 childregs->gpr[1] = sp + sizeof(struct pt_regs);
379 p->thread.regs = NULL; /* no user register state */379 p->thread.regs = NULL; /* no user register state */
380 clear_ti_thread_flag(p->thread_info, TIF_32BIT);380 clear_ti_thread_flag(p->thread_info, TIF_32BIT);
381#ifdef CONFIG_PPC_ISERIES
382 set_ti_thread_flag(p->thread_info, TIF_RUN_LIGHT);
383#endif
384 } else {381 } else {
385 childregs->gpr[1] = usp;382 childregs->gpr[1] = usp;
386 p->thread.regs = childregs;383 p->thread.regs = childregs;
arch/ppc64/kernel/sysfs.c+2−6
@@ -113,7 +113,6 @@ void ppc64_enable_pmcs(void) · 112 unmodified lines
113#ifdef CONFIG_PPC_PSERIES113#ifdef CONFIG_PPC_PSERIES
114 unsigned long set, reset;114 unsigned long set, reset;
115 int ret;115 int ret;
116 unsigned int ctrl;
117#endif /* CONFIG_PPC_PSERIES */116#endif /* CONFIG_PPC_PSERIES */
118 117
119 /* Only need to enable them once */118 /* Only need to enable them once */
@@ -167,11 +166,8 @@ void ppc64_enable_pmcs(void) · 47 unmodified lines
167 * On SMT machines we have to set the run latch in the ctrl register166 * On SMT machines we have to set the run latch in the ctrl register
168 * in order to make PMC6 spin.167 * in order to make PMC6 spin.
169 */168 */
170 if (cpu_has_feature(CPU_FTR_SMT)) {169 if (cpu_has_feature(CPU_FTR_SMT))
171 ctrl = mfspr(CTRLF);170 ppc64_runlatch_on();
172 ctrl |= RUNLATCH;
173 mtspr(CTRLT, ctrl);
174 }
175#endif /* CONFIG_PPC_PSERIES */171#endif /* CONFIG_PPC_PSERIES */
176}172}
177 173
include/asm-ppc64/processor.h+21−6
@@ -164,6 +164,9 @@ · 163 unmodified lines
164#define SPRN_USIA 0x3AB /* User Sampled Instruction Address Register */164#define SPRN_USIA 0x3AB /* User Sampled Instruction Address Register */
165#define SPRN_XER 0x001 /* Fixed Point Exception Register */165#define SPRN_XER 0x001 /* Fixed Point Exception Register */
166#define SPRN_VRSAVE 0x100 /* Vector save */166#define SPRN_VRSAVE 0x100 /* Vector save */
167#define SPRN_CTRLF 0x088
168#define SPRN_CTRLT 0x098
169#define CTRL_RUNLATCH 0x1
167 170
168/* Performance monitor SPRs */171/* Performance monitor SPRs */
169#define SPRN_SIAR 780172#define SPRN_SIAR 780
@@ -279,12 +282,6 @@ · 109 unmodified lines
279#define XGLUE(a,b) a##b282#define XGLUE(a,b) a##b
280#define GLUE(a,b) XGLUE(a,b)283#define GLUE(a,b) XGLUE(a,b)
281 284
282/* iSeries CTRL register (for runlatch) */
283
284#define CTRLT 0x098
285#define CTRLF 0x088
286#define RUNLATCH 0x0001
287
288#ifdef __ASSEMBLY__285#ifdef __ASSEMBLY__
289 286
290#define _GLOBAL(name) \287#define _GLOBAL(name) \
@@ -499,6 +496,24 @@ static inline void prefetchw(const void *x) · 208 unmodified lines
499 496
500#define HAVE_ARCH_PICK_MMAP_LAYOUT497#define HAVE_ARCH_PICK_MMAP_LAYOUT
501 498
499static inline void ppc64_runlatch_on(void)
500{
501 unsigned long ctrl;
502
503 ctrl = mfspr(SPRN_CTRLF);
504 ctrl |= CTRL_RUNLATCH;
505 mtspr(SPRN_CTRLT, ctrl);
506}
507
508static inline void ppc64_runlatch_off(void)
509{
510 unsigned long ctrl;
511
512 ctrl = mfspr(SPRN_CTRLF);
513 ctrl &= ~CTRL_RUNLATCH;
514 mtspr(SPRN_CTRLT, ctrl);
515}
516
502#endif /* __KERNEL__ */517#endif /* __KERNEL__ */
503 518
504#endif /* __ASSEMBLY__ */519#endif /* __ASSEMBLY__ */
include/asm-ppc64/thread_info.h+2−2
@@ -96,7 +96,7 @@ static inline struct thread_info *current_thread_info(void) · 95 unmodified lines
96#define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling96#define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling
97 TIF_NEED_RESCHED */97 TIF_NEED_RESCHED */
98#define TIF_32BIT 5 /* 32 bit binary */98#define TIF_32BIT 5 /* 32 bit binary */
99#define TIF_RUN_LIGHT 6 /* iSeries run light */99/* #define SPARE 6 */
100#define TIF_ABI_PENDING 7 /* 32/64 bit switch needed */100#define TIF_ABI_PENDING 7 /* 32/64 bit switch needed */
101#define TIF_SYSCALL_AUDIT 8 /* syscall auditing active */101#define TIF_SYSCALL_AUDIT 8 /* syscall auditing active */
102#define TIF_SINGLESTEP 9 /* singlestepping active */102#define TIF_SINGLESTEP 9 /* singlestepping active */
@@ -110,7 +110,7 @@ static inline struct thread_info *current_thread_info(void) · 7 unmodified lines
110#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)110#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
111#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)111#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
112#define _TIF_32BIT (1<<TIF_32BIT)112#define _TIF_32BIT (1<<TIF_32BIT)
113#define _TIF_RUN_LIGHT (1<<TIF_RUN_LIGHT)113/* #define _SPARE (1<<SPARE) */
114#define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING)114#define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING)
115#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)115#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
116#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)116#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)