History

powerpc: Save the TAR register earlier

This moves us to save the Target Address Register (TAR) a earlier in __switch_to. It introduces a new function save_tar() to do this. We need to save the TAR earlier as we will overwrite it in the transactional memory reclaim/recheckpoint path. We are going to do this in a subsequent patch which will fix saving the TAR register when it's modified inside a transaction.

Michael Neuling committed 13 years ago

Commit c2d52641 parent 25176173 files · +19 −9Browse files

Unified · Split

3 files
  1. arch/powerpc/include/asm/switch_to.h +9 −0
  2. arch/powerpc/kernel/entry_64.S +0 −9
  3. arch/powerpc/kernel/process.c +10 −0
arch/powerpc/include/asm/switch_to.h+9−0
@@ -15,6 +15,15 @@ extern struct task_struct *__switch_to(struct task_struct *, · 14 unmodified lines
1515 struct thread_struct;
1616 extern struct task_struct *_switch(struct thread_struct *prev,
1717 struct thread_struct *next);
18+#ifdef CONFIG_PPC_BOOK3S_64
19+static inline void save_tar(struct thread_struct *prev)
20+{
21+ if (cpu_has_feature(CPU_FTR_ARCH_207S))
22+ prev->tar = mfspr(SPRN_TAR);
23+}
24+#else
25+static inline void save_tar(struct thread_struct *prev) {}
26+#endif
1827
1928 extern void giveup_fpu(struct task_struct *);
2029 extern void load_up_fpu(void);
arch/powerpc/kernel/entry_64.S+0−9
@@ -449,15 +449,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_DSCR) · 448 unmodified lines
449449
450450 #ifdef CONFIG_PPC_BOOK3S_64
451451 BEGIN_FTR_SECTION
452− /*
453− * Back up the TAR across context switches. Note that the TAR is not
454− * available for use in the kernel. (To provide this, the TAR should
455− * be backed up/restored on exception entry/exit instead, and be in
456− * pt_regs. FIXME, this should be in pt_regs anyway (for debug).)
457− */
458− mfspr r0,SPRN_TAR
459− std r0,THREAD_TAR(r3)
460−
461452 /* Event based branch registers */
462453 mfspr r0, SPRN_BESCR
463454 std r0, THREAD_BESCR(r3)
arch/powerpc/kernel/process.c+10−0
@@ -600,6 +600,16 @@ struct task_struct *__switch_to(struct task_struct *prev, · 599 unmodified lines
600600 struct ppc64_tlb_batch *batch;
601601 #endif
602602
603+ /* Back up the TAR across context switches.
604+ * Note that the TAR is not available for use in the kernel. (To
605+ * provide this, the TAR should be backed up/restored on exception
606+ * entry/exit instead, and be in pt_regs. FIXME, this should be in
607+ * pt_regs anyway (for debug).)
608+ * Save the TAR here before we do treclaim/trecheckpoint as these
609+ * will change the TAR.
610+ */
611+ save_tar(&prev->thread);
612+
603613 __switch_to_tm(prev);
604614
605615 #ifdef CONFIG_SMP

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t