From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GQ75x-00034m-6Q for qemu-devel@nongnu.org; Wed, 20 Sep 2006 14:46:53 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GQ75v-00033o-QD for qemu-devel@nongnu.org; Wed, 20 Sep 2006 14:46:52 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GQ75v-00033i-Ie for qemu-devel@nongnu.org; Wed, 20 Sep 2006 14:46:51 -0400 Received: from [82.232.2.251] (helo=farad.aurel32.net) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1GQ79G-0000Wm-1a for qemu-devel@nongnu.org; Wed, 20 Sep 2006 14:50:19 -0400 Received: from sparc.aurel32.net ([2001:618:400:fc13:216:3eff:fe00:1112]) by farad.aurel32.net with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.50) id 1GQ75o-0000g9-Mn for qemu-devel@nongnu.org; Wed, 20 Sep 2006 20:46:44 +0200 Received: from aurel32 by sparc.aurel32.lan with local (Exim 4.63) (envelope-from ) id 1GQ73s-0000vF-Js for qemu-devel@nongnu.org; Wed, 20 Sep 2006 20:44:44 +0200 Date: Wed, 20 Sep 2006 20:44:42 +0200 From: Aurelien Jarno Subject: Re: [Qemu-devel] qemu-system-sparc uses all host cpu while targetsystem is idle Message-ID: <20060920184442.GA3541@sparc.aurel32.net> References: <200609201445.03988.paul@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On Wed, Sep 20, 2006 at 05:48:48PM +0200, Blue Swirl wrote: > >CPU suspend is not implemented for sparc guests. > >Unlike most other targets, suspending the CPU is controlled by the system > >chipset, not by an instruction on the CPU. See slavio_misc.c > > Suspending is disabled, because it crashes qemu. It can be tested by > tweaking slavio_misc.c and renaming the device in OpenBIOS from > xxxpower-management to power-management. I can't see why it should crash, > the implementation is very straightforward. Or maybe halting the CPU should > be delayed until the TB is finished executing and halt only from main loop? > Please find below a patch that "works". It is probably wrong as I wrote it by copying code from other architectures and trying until it works. Well I am however convinced of two things: - "return EXCP_HALTED;" causes the crash. By removing this line qemu doesn't crash anymore, but the patch does not work as expected (freeze of the target). - The interrupt should be cleared, if not the target freeze. Now the host CPU is not used at 100% when the Sparc target is idle. I am using it for about one our with a Debian unstable, and I am writing this mail from this emulated system. Ah yes, you aslo need to the trivial patch to openbios. Bye, Aurelien Index: hw/slavio_misc.c =================================================================== RCS file: /sources/qemu/qemu/hw/slavio_misc.c,v retrieving revision 1.3 diff -u -r1.3 slavio_misc.c --- hw/slavio_misc.c 5 Dec 2005 20:31:52 -0000 1.3 +++ hw/slavio_misc.c 20 Sep 2006 18:16:29 -0000 @@ -123,7 +123,7 @@ break; case 0xa000000: MISC_DPRINTF("Write power management %2.2x\n", val & 0xff); -#if 0 +#if 1 // XXX almost works cpu_interrupt(cpu_single_env, CPU_INTERRUPT_HALT); #endif Index: cpu-exec.c =================================================================== RCS file: /sources/qemu/qemu/cpu-exec.c,v retrieving revision 1.84 diff -u -r1.84 cpu-exec.c --- cpu-exec.c 29 Jul 2006 19:09:31 -0000 1.84 +++ cpu-exec.c 20 Sep 2006 18:16:30 -0000 @@ -548,8 +548,10 @@ //do_interrupt(0, 0, 0, 0, 0); env->interrupt_request &= ~CPU_INTERRUPT_TIMER; } else if (interrupt_request & CPU_INTERRUPT_HALT) { - env1->halted = 1; - return EXCP_HALTED; + env->interrupt_request &= ~CPU_INTERRUPT_HALT; + env->halted = 1; + env->exception_index = EXCP_HLT; + cpu_loop_exit(); } #elif defined(TARGET_ARM) if (interrupt_request & CPU_INTERRUPT_FIQ -- .''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' aurel32@debian.org | aurelien@aurel32.net `- people.debian.org/~aurel32 | www.aurel32.net