From patchwork Sat Jan 10 17:38:48 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shin-ichiro KAWASAKI X-Patchwork-Id: 1707 X-Patchwork-Delegate: lethal@linux-sh.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n0AHhJ6l007150 for ; Sat, 10 Jan 2009 09:43:19 -0800 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752674AbZAJRqm (ORCPT ); Sat, 10 Jan 2009 12:46:42 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754114AbZAJRqm (ORCPT ); Sat, 10 Jan 2009 12:46:42 -0500 Received: from vsmtp04.dti.ne.jp ([202.216.231.139]:54306 "EHLO vsmtp04.dti.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752674AbZAJRql (ORCPT ); Sat, 10 Jan 2009 12:46:41 -0500 X-Greylist: delayed 470 seconds by postgrey-1.27 at vger.kernel.org; Sat, 10 Jan 2009 12:46:41 EST Received: from [192.168.1.21] (PPPa1787.e11.eacc.dti.ne.jp [124.255.93.17]) by vsmtp04.dti.ne.jp (3.11v) with ESMTP AUTH id n0AHchNK027476; Sun, 11 Jan 2009 02:38:44 +0900 (JST) Message-ID: <4968DD28.3030709@juno.dti.ne.jp> Date: Sun, 11 Jan 2009 02:38:48 +0900 From: Shin-ichiro KAWASAKI User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: "linux-sh@vger.kernel.org" CC: qemu-devel@nongnu.org Subject: sh: dcache flush breaks text region? Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org Hi, all. I'm now working on to expand qemu-sh to emulate "Solution Engine 7750", and found one odd thing. Could you give me some advice? My SH7750 emulation environment fails to boot up. I made some investigation and found that, - the linux kernel for SE7750(se7750_defconfig) flushes dcache on its boot sequence. - SH7750's dcache is 16KB and direct-map. Then 16KB memory region are touched and modified to flush it. - empty_zero_page is used for this flush, but it only has 4KB. The text region after it has got broken and causes boot failure. I added a patch against linux kernel to this mail for a reference. It only reduces the flush region size to 4KB=PAGE_SIZE, but avoids the problem and let the kernel boot up cleanly. Of course it is not a good solution, because it does not flush all caches. I wonder two points. - Does this problem happen on real SE7750 board? In other words, does the current linux kernel work on it? I don't have it, and can't check it out by myself. - How should I solve the problem? 16KB region should be allocated for flush by kernel? The patches for SE7750 emulation is not yet posted to qemu-devel. Before it, I'd like to solve the problem. Any comments will be appreciated. Regards, Shin-ichiro KAWASAKI --- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/sh/mm/cache-sh4.c b/arch/sh/mm/cache-sh4.c index 5cfe08d..4042c8c 100644 --- a/arch/sh/mm/cache-sh4.c +++ b/arch/sh/mm/cache-sh4.c @@ -612,6 +612,9 @@ static void __flush_dcache_segment_1way(unsigned long start, a0 = base_addr; a0e = base_addr + extent_per_way; + if (a0e > ((unsigned long)&empty_zero_page[0]) + PAGE_SIZE) { + a0e = ((unsigned long)&empty_zero_page[0]) + PAGE_SIZE; + } do { asm volatile("ldc %0, sr" : : "r" (sr_with_bl)); asm volatile("movca.l r0, @%0\n\t"