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 2/5] acpi: use notifier for signaling guest system_powerdown command
Date: Wed,  5 Sep 2012 23:06:22 +0200	[thread overview]
Message-ID: <1346879185-19299-3-git-send-email-imammedo@redhat.com> (raw)
In-Reply-To: <1346879185-19299-1-git-send-email-imammedo@redhat.com>

In addition, there is no need to allocate an extra irq just for
rising SCI in irq handler. Just rise SCI right from notifier
handler instead.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi_piix4.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c
index c56220b..15275cf 100644
--- a/hw/acpi_piix4.c
+++ b/hw/acpi_piix4.c
@@ -67,6 +67,7 @@ typedef struct PIIX4PMState {
     qemu_irq smi_irq;
     int kvm_enabled;
     Notifier machine_ready;
+    Notifier powerdown_notifier;
 
     /* for pci hotplug */
     struct pci_status pci0_status;
@@ -362,9 +363,9 @@ static void piix4_reset(void *opaque)
     piix4_update_hotplug(s);
 }
 
-static void piix4_powerdown(void *opaque, int irq, int power_failing)
+static void piix4_pm_powerdown_req(Notifier *n, void *opaque)
 {
-    PIIX4PMState *s = opaque;
+    PIIX4PMState *s = container_of(n, PIIX4PMState, powerdown_notifier);
 
     assert(s != NULL);
     acpi_pm1_evt_power_down(&s->ar);
@@ -416,7 +417,8 @@ static int piix4_pm_initfn(PCIDevice *dev)
     acpi_pm_tmr_init(&s->ar, pm_tmr_timer);
     acpi_gpe_init(&s->ar, GPE_LEN);
 
-    qemu_system_powerdown = *qemu_allocate_irqs(piix4_powerdown, s, 1);
+    s->powerdown_notifier.notify = piix4_pm_powerdown_req;
+    qemu_register_powerdown_notifier(&s->powerdown_notifier);
 
     pm_smbus_init(&s->dev.qdev, &s->smb);
     s->machine_ready.notify = piix4_pm_machine_ready;
-- 
1.7.11.4

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

Thread overview: 12+ 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 ` [Qemu-devel] [PATCH 1/5] Introduce powerdown_notifiers Igor Mammedov
2012-09-05 21:06 ` Igor Mammedov [this message]
2012-09-05 21:06 ` [Qemu-devel] [PATCH 3/5] target-arm: use notifier for signaling guest system_powerdown command 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 2/5] acpi: use notifier for signaling guest system_powerdown command 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-3-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).