qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] qdev: Reset hotplugged devices


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH] qdev: Reset hotplugged devices
Date: Fri, 20 Aug 2010 17:47:34 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Alex Williamson <address@hidden> writes:

> On Fri, 2010-08-20 at 11:00 +0200, Markus Armbruster wrote:
>> Alex Williamson <address@hidden> writes:
>> 
>> > Several devices rely on their reset() function being called to
>> > initialize device state, e1000 and rtl8139 in particular.  When
>> > the device is hot added, the reset doesn't occur, often leaving
>> > the device in an unusable state.  Adding a call to reset() after
>> > init() for hotplugged devices puts the device in the expected
>> > state for the guest.
>> >
>> > Signed-off-by: Alex Williamson <address@hidden>
>> > ---
>> >
>> >  0.13 candidate?
>> >
>> >  hw/qdev.c |    3 +++
>> >  1 files changed, 3 insertions(+), 0 deletions(-)
>> >
>> > diff --git a/hw/qdev.c b/hw/qdev.c
>> > index e99c73f..b156272 100644
>> > --- a/hw/qdev.c
>> > +++ b/hw/qdev.c
>> > @@ -278,6 +278,9 @@ int qdev_init(DeviceState *dev)
>> >          qdev_free(dev);
>> >          return rc;
>> >      }
>> > +    if (dev->hotplugged) {
>> > +        qdev_reset(dev);
>> > +    }
>> >      qemu_register_reset(qdev_reset, dev);
>> >      if (dev->info->vmsd) {
>> >          vmstate_register_with_alias_id(dev, -1, dev->info->vmsd, dev,
>> 
>> qdev_reset() isn't necessary when !dev->hotplugged, because then
>> qemu_system_reset() will run shortly, which will call qdev_reset().
>> Correct?
>
> Yes, exactly.

Hmm.  "qdev_init() automatically calls qdev_reset() if hotplug" feels
needlessly complicated.  I'd prefer qdev_init() to call it always or
never.

If "always", we reset twice for cold-plug.  Is that bad?

If "never", we need to reset somewhere else for hot-plug.  What about
do_device_add()?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]