linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Fixing SH cache assumptions
@ 2016-03-22 21:19 Rich Felker
  2016-03-23  5:08 ` Rob Landley
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Rich Felker @ 2016-03-22 21:19 UTC (permalink / raw)
  To: linux-sh

Currently arch/sh has a hard-coded assumption that the cache is
virtually indexed (and virtually tagged, from what I can tell), and
thus needs to account for pages that may alias. While this is correct
for SH3/4, it's wrong for anything NOMMU (since there are no virtual
addresses, only physical) and the only reason SH2 works at all is
because its small cache size (256 lines * 16 bytes per line) matches
the page size, yielding an alias_mask of 0. If the cache were any
larger (like it is on J2) then the alias avoidance logic would kick in
and lead to calling kmap_coherent (which is BUG() on NOMMU) and
possibly other incorrect or suboptimal behavior.

I've avoided the issue so far on J2 simply by lying that the cache is
small, but this needs a proper fix. It would be easy to just #ifndef
out the logic that sets up alias_mask and shm_align_mask on NOMMU, but
I think it would be better to somehow represent the cache indexing in
the cache_info struct or elsewhere. In case the future J4 has a
physically indexed cache (which is my hope), such an approach should
naturally work for it with no further modifications.

Any preferences for how I do this? Just add a type field to cache_info
and make the default VIVT for existing models?

Rich

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

end of thread, other threads:[~2016-03-23 16:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-22 21:19 Fixing SH cache assumptions Rich Felker
2016-03-23  5:08 ` Rob Landley
2016-03-23  7:45 ` Geert Uytterhoeven
2016-03-23 16:41 ` Rich Felker

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).