qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: peter.maydell@linaro.org, qemu-devel@nongnu.org
Cc: aliguori@us.ibm.com, mst@redhat.com, jan.kiszka@siemens.com,
	lcapitulino@redhat.com, blauwirbel@gmail.com,
	alex.williamson@redhat.com, kraxel@redhat.com,
	pbonzini@redhat.com
Subject: [Qemu-devel] [PATCH 1/5] Introduce powerdown_notifiers
Date: Wed,  5 Sep 2012 23:06:21 +0200	[thread overview]
Message-ID: <1346879185-19299-2-git-send-email-imammedo@redhat.com> (raw)
In-Reply-To: <1346879185-19299-1-git-send-email-imammedo@redhat.com>

Notifier will be used for signaling powerdown request to guest in
a 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.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 sysemu.h | 1 +
 vl.c     | 8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/sysemu.h b/sysemu.h
index 65552ac..803c858 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -52,6 +52,7 @@ void qemu_system_wakeup_enable(WakeupReason reason, bool 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..4893192 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 =
+    NOTIFIER_LIST_INITIALIZER(powerdown_notifiers);
 static NotifierList suspend_notifiers =
     NOTIFIER_LIST_INITIALIZER(suspend_notifiers);
 static NotifierList wakeup_notifiers =
@@ -1569,6 +1571,11 @@ void qemu_system_powerdown_request(void)
     qemu_notify_event();
 }
 
+void qemu_register_powerdown_notifier(Notifier *notifier)
+{
+    notifier_list_add(&powerdown_notifiers, notifier);
+}
+
 void qemu_system_debug_request(void)
 {
     debug_requested = 1;
@@ -1620,6 +1627,7 @@ static bool main_loop_should_exit(void)
     }
     if (qemu_powerdown_requested()) {
         monitor_protocol_event(QEVENT_POWERDOWN, NULL);
+        notifier_list_notify(&powerdown_notifiers, NULL);
         qemu_irq_raise(qemu_system_powerdown);
     }
     if (qemu_vmstop_requested(&r)) {
-- 
1.7.11.4

  reply	other threads:[~2012-09-05 21:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-05 21:06 [Qemu-devel] [PATCH 0/5 v3] convert system_powerdown command to notifiers Igor Mammedov
2012-09-05 21:06 ` Igor Mammedov [this message]
2012-09-05 21:06 ` [Qemu-devel] [PATCH 2/5] acpi: use notifier for signaling guest system_powerdown command Igor Mammedov
2012-09-05 21:06 ` [Qemu-devel] [PATCH 3/5] target-arm: " Igor Mammedov
2012-09-18 16:13   ` Peter Maydell
2012-09-05 21:06 ` [Qemu-devel] [PATCH 4/5] target-sparc: " Igor Mammedov
2012-09-05 21:06 ` [Qemu-devel] [PATCH 5/5] Cleanup unused global var qemu_system_powerdown Igor Mammedov
2012-09-06  6:57 ` [Qemu-devel] [PATCH 0/5 v3] convert system_powerdown command to notifiers Paolo Bonzini
2012-09-18 15:58 ` Igor Mammedov
2012-09-22 16:18   ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
2012-09-26 12:38 ` [Qemu-devel] " Anthony Liguori
  -- strict thread matches above, loose matches on Subject: below --
2012-08-29 17:02 [Qemu-devel] [PATCH 0/5 v2] " Igor Mammedov
2012-08-29 17:02 ` [Qemu-devel] [PATCH 1/5] introduce powerdown_notifiers Igor Mammedov
2012-08-29 17:06   ` Andreas Färber
2012-08-29 21:55     ` Igor Mammedov
2012-08-30  6:49     ` Igor Mammedov
2012-08-30  7:41       ` Paolo Bonzini
2012-08-30  8:17         ` Igor Mammedov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1346879185-19299-2-git-send-email-imammedo@redhat.com \
    --to=imammedo@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=blauwirbel@gmail.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kraxel@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).