diff options
author | Becky Bruce <becky.bruce@freescale.com> | 2007-11-09 17:17:49 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-11-13 00:22:43 -0500 |
commit | b64f87c16f3c00fe593f632e1ee5798ba3f4f3f4 (patch) | |
tree | 1e0c63707b73c4b2f316a01b2e3c6ebd82c6356a /arch | |
parent | 64c911a3f7c9864a4bbddbb77b722d5553ddcd32 (diff) |
[POWERPC] Avoid unpaired stwcx. on some processors
The context switch code in the kernel issues a dummy stwcx. to clear the
reservation, as recommended by the architecture. However, some processors
can have issues if this stwcx to address A occurs while the reservation
is already held to a different address B. To avoid this problem, the dummy
stwcx. needs to be paired with a dummy lwarx to the same address.
This adds the dummy lwarx, and creates a cpu feature bit to indicate
which cpus are affected. Tested on mpc8641_hpcn_defconfig in
arch/powerpc; build tested in arch/ppc.
Signed-off-by: Becky Bruce <becky.bruce@freescale.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/kernel/entry_32.S | 6 | ||||
-rw-r--r-- | arch/ppc/kernel/entry.S | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S index a7572cf464bd..69a91bd46115 100644 --- a/arch/powerpc/kernel/entry_32.S +++ b/arch/powerpc/kernel/entry_32.S | |||
@@ -251,6 +251,9 @@ syscall_exit_cont: | |||
251 | bne- 2f | 251 | bne- 2f |
252 | 1: | 252 | 1: |
253 | #endif /* CONFIG_44x */ | 253 | #endif /* CONFIG_44x */ |
254 | BEGIN_FTR_SECTION | ||
255 | lwarx r7,0,r1 | ||
256 | END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRED_STWCX) | ||
254 | stwcx. r0,0,r1 /* to clear the reservation */ | 257 | stwcx. r0,0,r1 /* to clear the reservation */ |
255 | lwz r4,_LINK(r1) | 258 | lwz r4,_LINK(r1) |
256 | lwz r5,_CCR(r1) | 259 | lwz r5,_CCR(r1) |
@@ -717,6 +720,9 @@ restore: | |||
717 | mtctr r11 | 720 | mtctr r11 |
718 | 721 | ||
719 | PPC405_ERR77(0,r1) | 722 | PPC405_ERR77(0,r1) |
723 | BEGIN_FTR_SECTION | ||
724 | lwarx r11,0,r1 | ||
725 | END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRED_STWCX) | ||
720 | stwcx. r0,0,r1 /* to clear the reservation */ | 726 | stwcx. r0,0,r1 /* to clear the reservation */ |
721 | 727 | ||
722 | #if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE)) | 728 | #if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE)) |
diff --git a/arch/ppc/kernel/entry.S b/arch/ppc/kernel/entry.S index b19bfef2034d..59e77eb63338 100644 --- a/arch/ppc/kernel/entry.S +++ b/arch/ppc/kernel/entry.S | |||
@@ -251,6 +251,9 @@ syscall_exit_cont: | |||
251 | bne- 2f | 251 | bne- 2f |
252 | 1: | 252 | 1: |
253 | #endif /* CONFIG_44x */ | 253 | #endif /* CONFIG_44x */ |
254 | BEGIN_FTR_SECTION | ||
255 | lwarx r7,0,r1 | ||
256 | END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRED_STWCX) | ||
254 | stwcx. r0,0,r1 /* to clear the reservation */ | 257 | stwcx. r0,0,r1 /* to clear the reservation */ |
255 | lwz r4,_LINK(r1) | 258 | lwz r4,_LINK(r1) |
256 | lwz r5,_CCR(r1) | 259 | lwz r5,_CCR(r1) |
@@ -713,6 +716,9 @@ restore: | |||
713 | mtctr r11 | 716 | mtctr r11 |
714 | 717 | ||
715 | PPC405_ERR77(0,r1) | 718 | PPC405_ERR77(0,r1) |
719 | BEGIN_FTR_SECTION | ||
720 | lwarx r11,0,r1 | ||
721 | END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRED_STWCX) | ||
716 | stwcx. r0,0,r1 /* to clear the reservation */ | 722 | stwcx. r0,0,r1 /* to clear the reservation */ |
717 | 723 | ||
718 | #if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE)) | 724 | #if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE)) |