linux-m68k.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] m68knommu: fix overwriting of bits in ColdFire V3 cache control
@ 2020-06-15  6:35 Greg Ungerer
  2020-06-15 11:26 ` Geert Uytterhoeven
  0 siblings, 1 reply; 3+ messages in thread
From: Greg Ungerer @ 2020-06-15  6:35 UTC (permalink / raw)
  To: linux-m68k; +Cc: Greg Ungerer

The Cache Control Register (CACR) of the ColdFire V3 has bits that
control high level caching functions, and also enable/disable the use
of the alternate stack pointer register (the EUSP bit) to provide
separate supervisor and user stack pointer registers. The code as
it is today will blindly clear the EUSP bit on cache actions like
invalidation. So it is broken for this case - and that will result
in failed booting (interrupt entry and exit processing will be
completely hosed).

This only affects ColdFire V3 parts that support the alternate stack
register (like the 5329 for example) - generally speaking new parts do,
older parts don't. It has no impact on ColdFire V3 parts with the single
stack pointer, like the 5307 for example.

Fix the cache bit defines used, so they maintain the EUSP bit when
carrying out cache actions through the CACR register.

Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
---
 arch/m68k/include/asm/m53xxacr.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/m68k/include/asm/m53xxacr.h b/arch/m68k/include/asm/m53xxacr.h
index 9138a624c5c8..25b144495234 100644
--- a/arch/m68k/include/asm/m53xxacr.h
+++ b/arch/m68k/include/asm/m53xxacr.h
@@ -89,9 +89,9 @@
  * coherency though in all cases. And for copyback caches we will need
  * to push cached data as well.
  */
-#define CACHE_INIT	  CACR_CINVA
-#define CACHE_INVALIDATE  CACR_CINVA
-#define CACHE_INVALIDATED CACR_CINVA
+#define CACHE_INIT        (CACHE_MODE + CACR_CINVA)
+#define CACHE_INVALIDATE  (CACHE_MODE + CACR_CINVA)
+#define CACHE_INVALIDATED (CACHE_MODE + CACR_CINVA)
 
 #define ACR0_MODE	((CONFIG_RAMBASE & 0xff000000) + \
 			 (0x000f0000) + \
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/5] m68knommu: fix overwriting of bits in ColdFire V3 cache control
  2020-06-15  6:35 [PATCH 1/5] m68knommu: fix overwriting of bits in ColdFire V3 cache control Greg Ungerer
@ 2020-06-15 11:26 ` Geert Uytterhoeven
  2020-06-15 13:32   ` Greg Ungerer
  0 siblings, 1 reply; 3+ messages in thread
From: Geert Uytterhoeven @ 2020-06-15 11:26 UTC (permalink / raw)
  To: Greg Ungerer; +Cc: Linux/m68k, Joachim Dietrich

Hi Greg,

On Mon, Jun 15, 2020 at 8:38 AM Greg Ungerer <gerg@linux-m68k.org> wrote:
> The Cache Control Register (CACR) of the ColdFire V3 has bits that
> control high level caching functions, and also enable/disable the use
> of the alternate stack pointer register (the EUSP bit) to provide
> separate supervisor and user stack pointer registers. The code as
> it is today will blindly clear the EUSP bit on cache actions like
> invalidation. So it is broken for this case - and that will result
> in failed booting (interrupt entry and exit processing will be
> completely hosed).
>
> This only affects ColdFire V3 parts that support the alternate stack
> register (like the 5329 for example) - generally speaking new parts do,
> older parts don't. It has no impact on ColdFire V3 parts with the single
> stack pointer, like the 5307 for example.
>
> Fix the cache bit defines used, so they maintain the EUSP bit when
> carrying out cache actions through the CACR register.
>
> Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>

Thanks for your patch!

> --- a/arch/m68k/include/asm/m53xxacr.h
> +++ b/arch/m68k/include/asm/m53xxacr.h
> @@ -89,9 +89,9 @@
>   * coherency though in all cases. And for copyback caches we will need
>   * to push cached data as well.
>   */
> -#define CACHE_INIT       CACR_CINVA
> -#define CACHE_INVALIDATE  CACR_CINVA
> -#define CACHE_INVALIDATED CACR_CINVA
> +#define CACHE_INIT        (CACHE_MODE + CACR_CINVA)

This line is different from the RFC v2 in
https://www.spinics.net/lists/linux-m68k/msg13973.html ?

> +#define CACHE_INVALIDATE  (CACHE_MODE + CACR_CINVA)
> +#define CACHE_INVALIDATED (CACHE_MODE + CACR_CINVA)

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/5] m68knommu: fix overwriting of bits in ColdFire V3 cache control
  2020-06-15 11:26 ` Geert Uytterhoeven
@ 2020-06-15 13:32   ` Greg Ungerer
  0 siblings, 0 replies; 3+ messages in thread
From: Greg Ungerer @ 2020-06-15 13:32 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Linux/m68k, Joachim Dietrich

Hi Geert,

On 15/6/20 9:26 pm, Geert Uytterhoeven wrote:
> On Mon, Jun 15, 2020 at 8:38 AM Greg Ungerer <gerg@linux-m68k.org> wrote:
>> The Cache Control Register (CACR) of the ColdFire V3 has bits that
>> control high level caching functions, and also enable/disable the use
>> of the alternate stack pointer register (the EUSP bit) to provide
>> separate supervisor and user stack pointer registers. The code as
>> it is today will blindly clear the EUSP bit on cache actions like
>> invalidation. So it is broken for this case - and that will result
>> in failed booting (interrupt entry and exit processing will be
>> completely hosed).
>>
>> This only affects ColdFire V3 parts that support the alternate stack
>> register (like the 5329 for example) - generally speaking new parts do,
>> older parts don't. It has no impact on ColdFire V3 parts with the single
>> stack pointer, like the 5307 for example.
>>
>> Fix the cache bit defines used, so they maintain the EUSP bit when
>> carrying out cache actions through the CACR register.
>>
>> Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
> 
> Thanks for your patch!
> 
>> --- a/arch/m68k/include/asm/m53xxacr.h
>> +++ b/arch/m68k/include/asm/m53xxacr.h
>> @@ -89,9 +89,9 @@
>>    * coherency though in all cases. And for copyback caches we will need
>>    * to push cached data as well.
>>    */
>> -#define CACHE_INIT       CACR_CINVA
>> -#define CACHE_INVALIDATE  CACR_CINVA
>> -#define CACHE_INVALIDATED CACR_CINVA
>> +#define CACHE_INIT        (CACHE_MODE + CACR_CINVA)
> 
> This line is different from the RFC v2 in
> https://www.spinics.net/lists/linux-m68k/msg13973.html ?

Thanks Geert, you are absolutely correct. I will generate a v2
with the correct change.

Regards
Greg


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-06-15 13:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-15  6:35 [PATCH 1/5] m68knommu: fix overwriting of bits in ColdFire V3 cache control Greg Ungerer
2020-06-15 11:26 ` Geert Uytterhoeven
2020-06-15 13:32   ` Greg Ungerer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).