[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] qemu-system-sparc uses all host cpu while targetsystem
From: |
Aurelien Jarno |
Subject: |
Re: [Qemu-devel] qemu-system-sparc uses all host cpu while targetsystem is idle |
Date: |
Wed, 20 Sep 2006 20:44:42 +0200 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
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
`. `' address@hidden | address@hidden
`- people.debian.org/~aurel32 | www.aurel32.net