[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[pbsd-mg2] MachFlushDCache problem?



御無沙汰しております。篠原です。

カーネルのソースを眺めていたら、MachFlushDCacheの問題と思われるものに気
が付きました。(以下は本日(1999/06/25)取ってきたソースのスナップショット
ftp://ftp.jp.netbsd.org/pub/NetBSD-jp/hpcmips/sys.tgzについての話です。
最新のCVSのリポジトリで直っていたら失礼。)

arch/mips/include/locore.hでは以下のようにMachFlushDCacheが#defineされて
いて、hpcmipsカーネルではMachFlushDCacheがmips52xx_FlushDCacheに置き変わ
ります。

#if defined(MIPS3) && !defined (MIPS1)
#define MachFlushCache          mips3_FlushCache
#if     defined(MIPS3_L2CACHE_ABSENT) && !defined(MIPS3_L2CACHE_PRESENT)
#define MachFlushDCache         mips52xx_FlushDCache
#elif   !defined(MIPS3_L2CACHE_ABSENT) && defined(MIPS3_L2CACHE_PRESENT)
#define MachFlushDCache         mips3_FlushDCache
#else
#define MachFlushDCache         (*(mips_locore_jumpvec.flushDCache))
#endif  

mips52xx_FlushDCacheはarch/mips/mips/locore_mips3.Sに実体がありますが、
QEDのRM52xx用にかかれていて、以下の二つを仮定しています。

	1. primary data cacheは2-way set associativeである
	2. primary data cacheのline sizeは32バイトである

これは、RM52xx用としては正しいのですが、VR4111/VR4121のprimary data
cacheは、

	1. direct mappedである
	2. line sizeは4 words(16バイト)である

なので、VR41x1では正しく動作しないはずです。ソースコードのループの部分は
以下のようになっているので、VR41x1では2 lineに1 lineしかcache操作が行わ
れません。

1:      
        cache   1, 0(a0)
        cache   1, 0(a3)        # Two way set-associative cache
        cache   1, 32(a0)
        cache   1, 32(a3) 
        cache   1, 64(a0)
        cache   1, 64(a3)       
        cache   1, 96(a0)
        cache   1, 96(a3)
        addu    a1, -1
        addu    a3, 128 
        bne     a1, zero, 1b
        addu    a0, 128  

arch/mips/include/locore.hを修正して、VR41x1の場合は、

#define MachFlushDCache         mips3_FlushDCache

が使われるようにすれば大丈夫だと思います。(mips3_FlushDCacheはdirect
mapped, line size 16 bytes用に書かれています。)

今まで発生していたcache関係の問題は、これが原因(の少なくとも一部)であっ
たと思われます。

私はまだ実機で動作確認をする環境を持っていないので、以下のテストをして結
果を教えていただけると嬉しいです。

1. まずMachFlushDCacheがmips3_FlushDCacheになるような修正をして動かして
   みる
2. 1.がOKだったら、arch/mips/mips/trap.cのuvm_fault()後に
   MachFlushCache()を呼ぶのを止めてみる
3. 2.がOKだったら、ページサイズを4KBに戻してみる

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Takao Shinohara <shin@sm.sony.co.jp>
篠原孝夫