From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LMMPf-0005It-3e for qemu-devel@nongnu.org; Mon, 12 Jan 2009 08:01:03 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LMMPe-0005IX-Dn for qemu-devel@nongnu.org; Mon, 12 Jan 2009 08:01:02 -0500 Received: from [199.232.76.173] (port=53404 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LMMPe-0005IT-9C for qemu-devel@nongnu.org; Mon, 12 Jan 2009 08:01:02 -0500 Received: from mta23.gyao.ne.jp ([125.63.38.249]:24363 helo=mx.gate01.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LMMPd-0001DD-Fa for qemu-devel@nongnu.org; Mon, 12 Jan 2009 08:01:02 -0500 Date: Mon, 12 Jan 2009 21:58:26 +0900 From: Paul Mundt Subject: Re: [Qemu-devel] sh: dcache flush breaks text region? Message-ID: <20090112125826.GA14489@linux-sh.org> References: <4968DD28.3030709@juno.dti.ne.jp> <20090110195332.GD26952@edgar.se.axis.com> <49696E54.9030102@juno.dti.ne.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <49696E54.9030102@juno.dti.ne.jp> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Shin-ichiro KAWASAKI Cc: qemu-devel@nongnu.org, "linux-sh@vger.kernel.org" On Sun, Jan 11, 2009 at 12:58:12PM +0900, Shin-ichiro KAWASAKI wrote: > Edgar E. Iglesias wrote: > >One way to handle this particular cacheflush sequence might be to delay all > >movca stores until there's another load/store or cache control insn being > >issued to help you figure out if you can ignore previous movca. That will > >not by any means cover all cases though. > It seems a good way to avoid this problem. > My current modification plan is as follows. > - On executing 'movca', just record the store task which movca > should do into CPUStatus. > - On executing 'ocbi', delete the store task. > - Let TCG produce 'delayed_movca' instruction for > the first 'memory touching insn' or 'exception producing insn' > after movca. > - On executing 'delayed_movca', do the store tasks. > There are other ways in which movca is used as well, including with ocbi/ocbwb (SH-X2 and later can also do ocbp), as well as with the movca line being operated on by mov later without any explicit manipulation of the dcache (common behaviour in read paths). If you are going to model it in CPUStatus, you are going to have to effectively have something that spans the size of the cache and watch out for accessors. Not all will be through the dcache modifier instructions, remember that memory-mapped access is also used for flushing in other areas. > >Another solution might be for linux to use a ocpb followed by a ocpi insn > >on the line. IIUC that should achieve the same results net results. > I'm not sure about it. But I think we should not modify linux, > because now I guess that the current linux works on real silicon. > Yes, we do not want to modify linux for this. Implementing real caches in qemu is not going to be easy, but the kernel at least does have a CONFIG_CACHE_OFF which you can select for qemu. If there is a page we can test somewhere to figure out if we are under emulation we can likewise just turn them off directly at boot. Note that qemu also needs to be aware of the movca behavioural differences between cache enabled and disabled.