From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:39883) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T6qEl-0004kB-61 for qemu-devel@nongnu.org; Wed, 29 Aug 2012 17:55:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T6qEj-0003fb-6e for qemu-devel@nongnu.org; Wed, 29 Aug 2012 17:55:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:62904) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T6qEi-0003f4-NR for qemu-devel@nongnu.org; Wed, 29 Aug 2012 17:55:44 -0400 Date: Wed, 29 Aug 2012 23:55:31 +0200 From: Igor Mammedov Message-ID: <20120829235531.63481ab7@thinkpad.mammed.net> In-Reply-To: <503E4C25.3050102@suse.de> References: <1346259767-991-1-git-send-email-imammedo@redhat.com> <1346259767-991-2-git-send-email-imammedo@redhat.com> <503E4C25.3050102@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 1/5] introduce powerdown_notifiers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?ISO-8859-1?B?RuRyYmVy?= Cc: peter.maydell@linaro.org, aliguori@us.ibm.com, mst@redhat.com, jan.kiszka@siemens.com, qemu-devel@nongnu.org, lcapitulino@redhat.com, blauwirbel@gmail.com, alex.williamson@redhat.com, kraxel@redhat.com, pbonzini@redhat.com On Wed, 29 Aug 2012 19:06:45 +0200 Andreas F=E4rber wrote: > Am 29.08.2012 19:02, schrieb Igor Mammedov: > > notifier will be used for signaling powerdown request to guest in more > > general way and intended to replace very specific > > qemu_irq_rise(qemu_system_powerdown) and will allow to remove global > > variable qemu_system_powerdown. > >=20 > > v2: > > do not make qemu_system_powerdown static, > > spotted-by: Paolo Bonzini >=20 > Is the "not" a typo or did you send the wrong patch? It seems to be > static below. Nope, it's not typo. There is global var qemu_system_powerdown, and in the first version I've changed it to static for no good reason and that killed bisectability of series. So I've reverted it to original state. >=20 > Andreas >=20 > >=20 > > Signed-off-by: Igor Mammedov > > --- > > sysemu.h | 1 + > > vl.c | 15 ++++++++++++++- > > 2 files changed, 15 insertions(+), 1 deletion(-) > >=20 > > diff --git a/sysemu.h b/sysemu.h > > index f765821..eb9a750 100644 > > --- a/sysemu.h > > +++ b/sysemu.h > > @@ -53,6 +53,7 @@ void qemu_system_wakeup_enable(WakeupReason reason, b= ool enabled); > > void qemu_register_wakeup_notifier(Notifier *notifier); > > void qemu_system_shutdown_request(void); > > void qemu_system_powerdown_request(void); > > +void qemu_register_powerdown_notifier(Notifier *notifier); > > void qemu_system_debug_request(void); > > void qemu_system_vmstop_request(RunState reason); > > int qemu_shutdown_requested_get(void); > > diff --git a/vl.c b/vl.c > > index 7c577fa..8dc4b4f 100644 > > --- a/vl.c > > +++ b/vl.c > > @@ -1355,6 +1355,8 @@ static int powerdown_requested; > > static int debug_requested; > > static int suspend_requested; > > static int wakeup_requested; > > +static NotifierList powerdown_notifiers =3D > > + NOTIFIER_LIST_INITIALIZER(powerdown_notifiers); > > static NotifierList suspend_notifiers =3D > > NOTIFIER_LIST_INITIALIZER(suspend_notifiers); > > static NotifierList wakeup_notifiers =3D > > @@ -1563,12 +1565,23 @@ void qemu_system_shutdown_request(void) > > qemu_notify_event(); > > } > > =20 > > +static void qemu_system_powerdown(void) > > +{ > > + monitor_protocol_event(QEVENT_POWERDOWN, NULL); > > + notifier_list_notify(&powerdown_notifiers, NULL); > > +} > > + > > void qemu_system_powerdown_request(void) > > { > > powerdown_requested =3D 1; > > qemu_notify_event(); > > } > > =20 > > +void qemu_register_powerdown_notifier(Notifier *notifier) > > +{ > > + notifier_list_add(&powerdown_notifiers, notifier); > > +} > > + > > void qemu_system_debug_request(void) > > { > > debug_requested =3D 1; > > @@ -1619,7 +1632,7 @@ static bool main_loop_should_exit(void) > > monitor_protocol_event(QEVENT_WAKEUP, NULL); > > } > > if (qemu_powerdown_requested()) { > > - monitor_protocol_event(QEVENT_POWERDOWN, NULL); > > + qemu_system_powerdown(); > > qemu_irq_raise(qemu_system_powerdown); > > } > > if (qemu_vmstop_requested(&r)) { > >=20 >=20 >=20 > --=20 > SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany > GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg >=20 --=20 Regards, Igor