On Tue, Nov 03, 2009 at 09:12:41PM +0100, Laurent Desnogues wrote: > On Tue, Nov 3, 2009 at 8:50 PM, Glauber Costa <glom...@redhat.com> wrote: > > There is absolutely no need to call reset functions when initializing > > devices. Since we are already registering them, calling qemu_system_reset() > > should suffice. Actually, it is what happens when we reboot the machine, > > and using the same process instead of a special case semantics will even > > allow us to find bugs easier. > > > > Furthermore, the fact that we initialize things like the cpu quite early, > > leads to the need to introduce synchronization stuff like qemu_system_cond. > > This patch removes it entirely. All we need to do is call > > qemu_system_reset() > > only when we're already sure the system is up and running > > > > I tested it with qemu (with and without io-thread) and qemu-kvm, and it > > seems to be doing okay - although qemu-kvm uses a slightly different patch. > > > > Signed-off-by: Glauber Costa <glom...@redhat.com> > > --- > > hw/apic.c | 1 - > > hw/e1000.c | 1 - > > hw/hpet.c | 1 - > > hw/i8254.c | 2 -- > > hw/ide/piix.c | 1 - > > hw/piix4.c | 1 - > > hw/piix_pci.c | 1 - > > hw/rtl8139.c | 2 +- > > hw/serial.c | 1 - > > hw/usb-ohci.c | 1 - > > hw/usb-uhci.c | 1 - > > hw/vga.c | 1 - > > target-i386/helper.c | 1 - > > vl.c | 15 +-------------- > > 14 files changed, 2 insertions(+), 28 deletions(-) > [...] > > diff --git a/target-i386/helper.c b/target-i386/helper.c > > index c961544..957b3fc 100644 > > --- a/target-i386/helper.c > > +++ b/target-i386/helper.c > > @@ -1885,7 +1885,6 @@ CPUX86State *cpu_x86_init(const char *cpu_model) > > return NULL; > > } > > mce_init(env); > > - cpu_reset(env); > > Who will call cpu_reset for user mode QEMU then?
I believe we can then call it explicitly right after we call cpu_init for user mode, then or can't we?