* [Qemu-devel] [PATCH 0/5 v3] convert system_powerdown command to notifiers @ 2012-09-05 21:06 Igor Mammedov 2012-09-05 21:06 ` [Qemu-devel] [PATCH 1/5] Introduce powerdown_notifiers Igor Mammedov ` (7 more replies) 0 siblings, 8 replies; 17+ messages in thread From: Igor Mammedov @ 2012-09-05 21:06 UTC (permalink / raw) To: peter.maydell, qemu-devel Cc: aliguori, mst, jan.kiszka, lcapitulino, blauwirbel, alex.williamson, kraxel, pbonzini global variable qemu_system_powerdown in sysemu.h is the only dep for qemu_irq and qemu_rise_irq is not a generic way to signal guest that it should shutdown. replace it by notifiers and allow each implementation to have it's own way to notify guest. git repo for testing: https://github.com/imammedo/qemu/tree/shutdown_notifier.v3 compile tested: target-list=x86_64-linux-user,x86_64-softmmu,sparc-softmmu,arm-softmmu runtime tested: x86_64-softmmu + win7 guest v3-v2: - fixed bisectably issues of series - make series independed of cpu_as_device series Igor Mammedov (5): Introduce powerdown_notifiers acpi: use notifier for signaling guest system_powerdown command target-arm: use notifier for signaling guest system_powerdown command target-sparc: use notifier for signaling guest system_powerdown command Cleanup unused global var qemu_system_powerdown hw/acpi_piix4.c | 8 +++++--- hw/nseries.c | 14 +++++++++++++- hw/sun4m.c | 14 +++++++++++++- sysemu.h | 2 +- vl.c | 18 ++++++++++++++---- 5 files changed, 46 insertions(+), 10 deletions(-) -- 1.7.11.4 ^ permalink raw reply [flat|nested] 17+ messages in thread
* [Qemu-devel] [PATCH 1/5] Introduce powerdown_notifiers 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 2012-09-05 21:06 ` [Qemu-devel] [PATCH 2/5] acpi: use notifier for signaling guest system_powerdown command Igor Mammedov ` (6 subsequent siblings) 7 siblings, 0 replies; 17+ messages in thread From: Igor Mammedov @ 2012-09-05 21:06 UTC (permalink / raw) To: peter.maydell, qemu-devel Cc: aliguori, mst, jan.kiszka, lcapitulino, blauwirbel, alex.williamson, kraxel, pbonzini 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 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [Qemu-devel] [PATCH 2/5] acpi: use notifier for signaling guest system_powerdown command 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 2012-09-05 21:06 ` [Qemu-devel] [PATCH 3/5] target-arm: " Igor Mammedov ` (5 subsequent siblings) 7 siblings, 0 replies; 17+ messages in thread From: Igor Mammedov @ 2012-09-05 21:06 UTC (permalink / raw) To: peter.maydell, qemu-devel Cc: aliguori, mst, jan.kiszka, lcapitulino, blauwirbel, alex.williamson, kraxel, pbonzini 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 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [Qemu-devel] [PATCH 3/5] target-arm: use notifier for signaling guest system_powerdown command 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 ` [Qemu-devel] [PATCH 2/5] acpi: use notifier for signaling guest system_powerdown command Igor Mammedov @ 2012-09-05 21:06 ` Igor Mammedov 2012-09-18 16:13 ` Peter Maydell 2012-09-05 21:06 ` [Qemu-devel] [PATCH 4/5] target-sparc: " Igor Mammedov ` (4 subsequent siblings) 7 siblings, 1 reply; 17+ messages in thread From: Igor Mammedov @ 2012-09-05 21:06 UTC (permalink / raw) To: peter.maydell, qemu-devel Cc: aliguori, mst, jan.kiszka, lcapitulino, blauwirbel, alex.williamson, kraxel, pbonzini Signed-off-by: Igor Mammedov <imammedo@redhat.com> --- hw/nseries.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/hw/nseries.c b/hw/nseries.c index 4df2670..6df71eb 100644 --- a/hw/nseries.c +++ b/hw/nseries.c @@ -189,6 +189,17 @@ static void n8x0_nand_setup(struct n800_s *s) /* XXX: in theory should also update the OOB for both pages */ } +static qemu_irq n8x0_system_powerdown; + +static void n8x0_powerdown_req(Notifier *n, void *opaque) +{ + qemu_irq_raise(n8x0_system_powerdown); +} + +static Notifier n8x0_system_powerdown_notifier = { + .notify = n8x0_powerdown_req +}; + static void n8x0_i2c_setup(struct n800_s *s) { DeviceState *dev; @@ -201,7 +212,8 @@ static void n8x0_i2c_setup(struct n800_s *s) qdev_get_gpio_in(s->mpu->ih[0], OMAP_INT_24XX_SYS_NIRQ)); - qemu_system_powerdown = qdev_get_gpio_in(dev, 3); + n8x0_system_powerdown = qdev_get_gpio_in(dev, 3); + qemu_register_powerdown_notifier(&n8x0_system_powerdown_notifier); /* Attach a TMP105 PM chip (A0 wired to ground) */ dev = i2c_create_slave(i2c, "tmp105", N8X0_TMP105_ADDR); -- 1.7.11.4 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [Qemu-devel] [PATCH 3/5] target-arm: use notifier for signaling guest system_powerdown command 2012-09-05 21:06 ` [Qemu-devel] [PATCH 3/5] target-arm: " Igor Mammedov @ 2012-09-18 16:13 ` Peter Maydell 0 siblings, 0 replies; 17+ messages in thread From: Peter Maydell @ 2012-09-18 16:13 UTC (permalink / raw) To: Igor Mammedov Cc: aliguori, mst, jan.kiszka, qemu-devel, lcapitulino, blauwirbel, alex.williamson, kraxel, pbonzini On 5 September 2012 22:06, Igor Mammedov <imammedo@redhat.com> wrote: > Signed-off-by: Igor Mammedov <imammedo@redhat.com> Acked-by: Peter Maydell <peter.maydell@linaro.org> ^ permalink raw reply [flat|nested] 17+ messages in thread
* [Qemu-devel] [PATCH 4/5] target-sparc: use notifier for signaling guest system_powerdown command 2012-09-05 21:06 [Qemu-devel] [PATCH 0/5 v3] convert system_powerdown command to notifiers Igor Mammedov ` (2 preceding siblings ...) 2012-09-05 21:06 ` [Qemu-devel] [PATCH 3/5] target-arm: " Igor Mammedov @ 2012-09-05 21:06 ` Igor Mammedov 2012-09-05 21:06 ` [Qemu-devel] [PATCH 5/5] Cleanup unused global var qemu_system_powerdown Igor Mammedov ` (3 subsequent siblings) 7 siblings, 0 replies; 17+ messages in thread From: Igor Mammedov @ 2012-09-05 21:06 UTC (permalink / raw) To: peter.maydell, qemu-devel Cc: aliguori, mst, jan.kiszka, lcapitulino, blauwirbel, alex.williamson, kraxel, pbonzini Signed-off-by: Igor Mammedov <imammedo@redhat.com> --- hw/sun4m.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/hw/sun4m.c b/hw/sun4m.c index 0f909b5..c98cd5e 100644 --- a/hw/sun4m.c +++ b/hw/sun4m.c @@ -472,6 +472,17 @@ static void slavio_timer_init_all(target_phys_addr_t addr, qemu_irq master_irq, } } +static qemu_irq slavio_system_powerdown; + +static void slavio_powerdown_req(Notifier *n, void *opaque) +{ + qemu_irq_raise(slavio_system_powerdown); +} + +static Notifier slavio_system_powerdown_notifier = { + .notify = slavio_powerdown_req +}; + #define MISC_LEDS 0x01600000 #define MISC_CFG 0x01800000 #define MISC_DIAG 0x01a00000 @@ -514,7 +525,8 @@ static void slavio_misc_init(target_phys_addr_t base, } sysbus_connect_irq(s, 0, irq); sysbus_connect_irq(s, 1, fdc_tc); - qemu_system_powerdown = qdev_get_gpio_in(dev, 0); + slavio_system_powerdown = qdev_get_gpio_in(dev, 0); + qemu_register_powerdown_notifier(&slavio_system_powerdown_notifier); } static void ecc_init(target_phys_addr_t base, qemu_irq irq, uint32_t version) -- 1.7.11.4 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [Qemu-devel] [PATCH 5/5] Cleanup unused global var qemu_system_powerdown 2012-09-05 21:06 [Qemu-devel] [PATCH 0/5 v3] convert system_powerdown command to notifiers Igor Mammedov ` (3 preceding siblings ...) 2012-09-05 21:06 ` [Qemu-devel] [PATCH 4/5] target-sparc: " Igor Mammedov @ 2012-09-05 21:06 ` Igor Mammedov 2012-09-06 6:57 ` [Qemu-devel] [PATCH 0/5 v3] convert system_powerdown command to notifiers Paolo Bonzini ` (2 subsequent siblings) 7 siblings, 0 replies; 17+ messages in thread From: Igor Mammedov @ 2012-09-05 21:06 UTC (permalink / raw) To: peter.maydell, qemu-devel Cc: aliguori, mst, jan.kiszka, lcapitulino, blauwirbel, alex.williamson, kraxel, pbonzini All deps that used global qemu_system_powerdown var are now converted to notifiers, so remove it. Signed-off-by: Igor Mammedov <imammedo@redhat.com> --- v2: - removed hunk with #include "hw/irq.h", for patch not to depend on cpu_as_device series. - reuse name of removed qemu_system_powerdown var as a function name for initiating system powerdown, by uninling monitor and notifiers call in it at the last commit to fix bisectability of series. Suggested-by: Paolo Bonzini <pbonzini@redhat.com> --- sysemu.h | 1 - vl.c | 12 +++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/sysemu.h b/sysemu.h index 803c858..1093046 100644 --- a/sysemu.h +++ b/sysemu.h @@ -62,7 +62,6 @@ int qemu_reset_requested(void); int qemu_powerdown_requested(void); void qemu_system_killed(int signal, pid_t pid); void qemu_kill_report(void); -extern qemu_irq qemu_system_powerdown; void qemu_devices_reset(void); void qemu_system_reset(bool report); diff --git a/vl.c b/vl.c index 4893192..e0d1295 100644 --- a/vl.c +++ b/vl.c @@ -1565,6 +1565,12 @@ void qemu_system_shutdown_request(void) qemu_notify_event(); } +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 = 1; @@ -1588,8 +1594,6 @@ void qemu_system_vmstop_request(RunState state) qemu_notify_event(); } -qemu_irq qemu_system_powerdown; - static bool main_loop_should_exit(void) { RunState r; @@ -1626,9 +1630,7 @@ static bool main_loop_should_exit(void) monitor_protocol_event(QEVENT_WAKEUP, NULL); } if (qemu_powerdown_requested()) { - monitor_protocol_event(QEVENT_POWERDOWN, NULL); - notifier_list_notify(&powerdown_notifiers, NULL); - qemu_irq_raise(qemu_system_powerdown); + qemu_system_powerdown(); } if (qemu_vmstop_requested(&r)) { vm_stop(r); -- 1.7.11.4 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [Qemu-devel] [PATCH 0/5 v3] convert system_powerdown command to notifiers 2012-09-05 21:06 [Qemu-devel] [PATCH 0/5 v3] convert system_powerdown command to notifiers Igor Mammedov ` (4 preceding siblings ...) 2012-09-05 21:06 ` [Qemu-devel] [PATCH 5/5] Cleanup unused global var qemu_system_powerdown Igor Mammedov @ 2012-09-06 6:57 ` Paolo Bonzini 2012-09-18 15:58 ` Igor Mammedov 2012-09-26 12:38 ` [Qemu-devel] " Anthony Liguori 7 siblings, 0 replies; 17+ messages in thread From: Paolo Bonzini @ 2012-09-06 6:57 UTC (permalink / raw) To: Igor Mammedov Cc: peter.maydell, aliguori, mst, jan.kiszka, qemu-devel, lcapitulino, blauwirbel, alex.williamson, kraxel Il 05/09/2012 23:06, Igor Mammedov ha scritto: > global variable qemu_system_powerdown in sysemu.h is the only dep for qemu_irq > and qemu_rise_irq is not a generic way to signal guest that it should shutdown. > > replace it by notifiers and allow each implementation to have it's own way > to notify guest. > > git repo for testing: > https://github.com/imammedo/qemu/tree/shutdown_notifier.v3 > > compile tested: > target-list=x86_64-linux-user,x86_64-softmmu,sparc-softmmu,arm-softmmu > runtime tested: > x86_64-softmmu + win7 guest > > v3-v2: > - fixed bisectably issues of series > - make series independed of cpu_as_device series > > Igor Mammedov (5): > Introduce powerdown_notifiers > acpi: use notifier for signaling guest system_powerdown command > target-arm: use notifier for signaling guest system_powerdown command > target-sparc: use notifier for signaling guest system_powerdown > command > Cleanup unused global var qemu_system_powerdown > > hw/acpi_piix4.c | 8 +++++--- > hw/nseries.c | 14 +++++++++++++- > hw/sun4m.c | 14 +++++++++++++- > sysemu.h | 2 +- > vl.c | 18 ++++++++++++++---- > 5 files changed, 46 insertions(+), 10 deletions(-) > Series Reviewed-by: Paolo Bonzini <pboznini@redhat.com> Paolo ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Qemu-devel] [PATCH 0/5 v3] convert system_powerdown command to notifiers 2012-09-05 21:06 [Qemu-devel] [PATCH 0/5 v3] convert system_powerdown command to notifiers Igor Mammedov ` (5 preceding siblings ...) 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 7 siblings, 1 reply; 17+ messages in thread From: Igor Mammedov @ 2012-09-18 15:58 UTC (permalink / raw) To: qemu-devel; +Cc: qemu-trivial, aliguori On Wed, 5 Sep 2012 23:06:20 +0200 Igor Mammedov <imammedo@redhat.com> wrote: ping > global variable qemu_system_powerdown in sysemu.h is the only dep for > qemu_irq and qemu_rise_irq is not a generic way to signal guest that it > should shutdown. > > replace it by notifiers and allow each implementation to have it's own way > to notify guest. > > git repo for testing: > https://github.com/imammedo/qemu/tree/shutdown_notifier.v3 > > compile tested: > target-list=x86_64-linux-user,x86_64-softmmu,sparc-softmmu,arm-softmmu > runtime tested: > x86_64-softmmu + win7 guest > > v3-v2: > - fixed bisectably issues of series > - make series independed of cpu_as_device series > > Igor Mammedov (5): > Introduce powerdown_notifiers > acpi: use notifier for signaling guest system_powerdown command > target-arm: use notifier for signaling guest system_powerdown command > target-sparc: use notifier for signaling guest system_powerdown > command > Cleanup unused global var qemu_system_powerdown > > hw/acpi_piix4.c | 8 +++++--- > hw/nseries.c | 14 +++++++++++++- > hw/sun4m.c | 14 +++++++++++++- > sysemu.h | 2 +- > vl.c | 18 ++++++++++++++---- > 5 files changed, 46 insertions(+), 10 deletions(-) > ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Qemu-devel] [Qemu-trivial] [PATCH 0/5 v3] convert system_powerdown command to notifiers 2012-09-18 15:58 ` Igor Mammedov @ 2012-09-22 16:18 ` Stefan Hajnoczi 0 siblings, 0 replies; 17+ messages in thread From: Stefan Hajnoczi @ 2012-09-22 16:18 UTC (permalink / raw) To: Igor Mammedov; +Cc: qemu-trivial, aliguori, qemu-devel On Tue, Sep 18, 2012 at 05:58:14PM +0200, Igor Mammedov wrote: > On Wed, 5 Sep 2012 23:06:20 +0200 > Igor Mammedov <imammedo@redhat.com> wrote: > > ping This series has acks and should be ready to go. qemu-trivial is a bit of a stretch, please merge directly into qemu.git through Anthony, Blue, etc. Stefan ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Qemu-devel] [PATCH 0/5 v3] convert system_powerdown command to notifiers 2012-09-05 21:06 [Qemu-devel] [PATCH 0/5 v3] convert system_powerdown command to notifiers Igor Mammedov ` (6 preceding siblings ...) 2012-09-18 15:58 ` Igor Mammedov @ 2012-09-26 12:38 ` Anthony Liguori 7 siblings, 0 replies; 17+ messages in thread From: Anthony Liguori @ 2012-09-26 12:38 UTC (permalink / raw) To: Igor Mammedov, peter.maydell, qemu-devel Cc: mst, jan.kiszka, lcapitulino, blauwirbel, alex.williamson, kraxel, pbonzini Igor Mammedov <imammedo@redhat.com> writes: > global variable qemu_system_powerdown in sysemu.h is the only dep for qemu_irq > and qemu_rise_irq is not a generic way to signal guest that it should shutdown. > > replace it by notifiers and allow each implementation to have it's own way > to notify guest. > > git repo for testing: > https://github.com/imammedo/qemu/tree/shutdown_notifier.v3 > > compile tested: > target-list=x86_64-linux-user,x86_64-softmmu,sparc-softmmu,arm-softmmu > runtime tested: > x86_64-softmmu + win7 guest > > v3-v2: > - fixed bisectably issues of series > - make series independed of cpu_as_device series > Applied. Thanks. Regards, Anthony Liguori > Igor Mammedov (5): > Introduce powerdown_notifiers > acpi: use notifier for signaling guest system_powerdown command > target-arm: use notifier for signaling guest system_powerdown command > target-sparc: use notifier for signaling guest system_powerdown > command > Cleanup unused global var qemu_system_powerdown > > hw/acpi_piix4.c | 8 +++++--- > hw/nseries.c | 14 +++++++++++++- > hw/sun4m.c | 14 +++++++++++++- > sysemu.h | 2 +- > vl.c | 18 ++++++++++++++---- > 5 files changed, 46 insertions(+), 10 deletions(-) > > -- > 1.7.11.4 ^ permalink raw reply [flat|nested] 17+ messages in thread
* [Qemu-devel] [PATCH 0/5 v2] convert system_powerdown command to notifiers @ 2012-08-29 17:02 Igor Mammedov 2012-08-29 17:02 ` [Qemu-devel] [PATCH 1/5] introduce powerdown_notifiers Igor Mammedov 0 siblings, 1 reply; 17+ messages in thread From: Igor Mammedov @ 2012-08-29 17:02 UTC (permalink / raw) To: peter.maydell, qemu-devel Cc: aliguori, mst, jan.kiszka, lcapitulino, blauwirbel, alex.williamson, kraxel, pbonzini global variable qemu_system_powerdown in sysemu.h is the only dep for qemu_irq and qemu_rise_irq is not a generic way to signal guest that it should shutdown. So replace it by notifiers and allow each implementation to have it's own way to notify guest. git repo for testing: last 5 commits https://github.com/imammedo/qemu/tree/cpu_as_device.WIP compile tested: target-list=x86_64-linux-user,x86_64-softmmu,sparc-softmmu,arm-softmmu runtime tested: x86_64-softmmu + win7 guest ps: reposting because I forgot to add qemu-devel address. Igor Mammedov (5): introduce powerdown_notifiers acpi: use notifier for signaling guest system_powerdown command target-arm: use notifier for signaling guest system_powerdown command target-sparc: use notifier for signaling guest system_powerdown command cleanup unused qemu_system_powerdown hw/acpi_piix4.c | 8 +++++--- hw/nseries.c | 14 +++++++++++++- hw/sun4m.c | 14 +++++++++++++- sysemu.h | 3 +-- vl.c | 18 ++++++++++++++---- 5 files changed, 46 insertions(+), 11 deletions(-) -- 1.7.11.4 ^ permalink raw reply [flat|nested] 17+ messages in thread
* [Qemu-devel] [PATCH 1/5] introduce powerdown_notifiers 2012-08-29 17:02 [Qemu-devel] [PATCH 0/5 v2] " Igor Mammedov @ 2012-08-29 17:02 ` Igor Mammedov 2012-08-29 17:06 ` Andreas Färber 0 siblings, 1 reply; 17+ messages in thread From: Igor Mammedov @ 2012-08-29 17:02 UTC (permalink / raw) To: peter.maydell, qemu-devel Cc: aliguori, mst, jan.kiszka, lcapitulino, blauwirbel, alex.williamson, kraxel, pbonzini 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. v2: do not make qemu_system_powerdown static, spotted-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Igor Mammedov <imammedo@redhat.com> --- sysemu.h | 1 + vl.c | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) 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, 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..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 = + NOTIFIER_LIST_INITIALIZER(powerdown_notifiers); static NotifierList suspend_notifiers = NOTIFIER_LIST_INITIALIZER(suspend_notifiers); static NotifierList wakeup_notifiers = @@ -1563,12 +1565,23 @@ void qemu_system_shutdown_request(void) qemu_notify_event(); } +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 = 1; 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; @@ -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)) { -- 1.7.11.4 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [Qemu-devel] [PATCH 1/5] introduce powerdown_notifiers 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 0 siblings, 2 replies; 17+ messages in thread From: Andreas Färber @ 2012-08-29 17:06 UTC (permalink / raw) To: Igor Mammedov Cc: peter.maydell, aliguori, mst, jan.kiszka, qemu-devel, lcapitulino, blauwirbel, alex.williamson, kraxel, pbonzini 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. > > v2: > do not make qemu_system_powerdown static, > spotted-by: Paolo Bonzini <pbonzini@redhat.com> Is the "not" a typo or did you send the wrong patch? It seems to be static below. Andreas > > Signed-off-by: Igor Mammedov <imammedo@redhat.com> > --- > sysemu.h | 1 + > vl.c | 15 ++++++++++++++- > 2 files changed, 15 insertions(+), 1 deletion(-) > > 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, 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..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 = > + NOTIFIER_LIST_INITIALIZER(powerdown_notifiers); > static NotifierList suspend_notifiers = > NOTIFIER_LIST_INITIALIZER(suspend_notifiers); > static NotifierList wakeup_notifiers = > @@ -1563,12 +1565,23 @@ void qemu_system_shutdown_request(void) > qemu_notify_event(); > } > > +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 = 1; > 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; > @@ -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)) { > -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Qemu-devel] [PATCH 1/5] introduce powerdown_notifiers 2012-08-29 17:06 ` Andreas Färber @ 2012-08-29 21:55 ` Igor Mammedov 2012-08-30 6:49 ` Igor Mammedov 1 sibling, 0 replies; 17+ messages in thread From: Igor Mammedov @ 2012-08-29 21:55 UTC (permalink / raw) To: Andreas Färber Cc: peter.maydell, aliguori, mst, jan.kiszka, qemu-devel, lcapitulino, blauwirbel, alex.williamson, kraxel, pbonzini On Wed, 29 Aug 2012 19:06:45 +0200 Andreas Färber <afaerber@suse.de> 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. > > > > v2: > > do not make qemu_system_powerdown static, > > spotted-by: Paolo Bonzini <pbonzini@redhat.com> > > 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. > > Andreas > > > > > Signed-off-by: Igor Mammedov <imammedo@redhat.com> > > --- > > sysemu.h | 1 + > > vl.c | 15 ++++++++++++++- > > 2 files changed, 15 insertions(+), 1 deletion(-) > > > > 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, 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..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 = > > + NOTIFIER_LIST_INITIALIZER(powerdown_notifiers); > > static NotifierList suspend_notifiers = > > NOTIFIER_LIST_INITIALIZER(suspend_notifiers); > > static NotifierList wakeup_notifiers = > > @@ -1563,12 +1565,23 @@ void qemu_system_shutdown_request(void) > > qemu_notify_event(); > > } > > > > +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 = 1; > > 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; > > @@ -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)) { > > > > > -- > SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany > GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg > -- Regards, Igor ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Qemu-devel] [PATCH 1/5] introduce powerdown_notifiers 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 1 sibling, 1 reply; 17+ messages in thread From: Igor Mammedov @ 2012-08-30 6:49 UTC (permalink / raw) To: Andreas Färber Cc: peter.maydell, aliguori, mst, jan.kiszka, qemu-devel, lcapitulino, blauwirbel, alex.williamson, kraxel, pbonzini On Wed, 29 Aug 2012 19:06:45 +0200 Andreas Färber <afaerber@suse.de> 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. > > > > v2: > > do not make qemu_system_powerdown static, > > spotted-by: Paolo Bonzini <pbonzini@redhat.com> > > Is the "not" a typo or did you send the wrong patch? It seems to be > static below. > > Andreas > > > > > Signed-off-by: Igor Mammedov <imammedo@redhat.com> > > --- > > sysemu.h | 1 + > > vl.c | 15 ++++++++++++++- > > 2 files changed, 15 insertions(+), 1 deletion(-) > > > > 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, 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..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 = > > + NOTIFIER_LIST_INITIALIZER(powerdown_notifiers); > > static NotifierList suspend_notifiers = > > NOTIFIER_LIST_INITIALIZER(suspend_notifiers); > > static NotifierList wakeup_notifiers = > > @@ -1563,12 +1565,23 @@ void qemu_system_shutdown_request(void) > > qemu_notify_event(); > > } > > > > +static void qemu_system_powerdown(void) this is a bad naming that conflicts with global var qemu_system_powerdown, so bisectability of series is still broken. perhaps qemu_do_system_powerdown() would be better for function name, although it doesn't match common name pattern used for this kind of functions. > > +{ > > + monitor_protocol_event(QEVENT_POWERDOWN, NULL); > > + notifier_list_notify(&powerdown_notifiers, NULL); > > +} > > + > > void qemu_system_powerdown_request(void) > > { > > powerdown_requested = 1; > > 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; > > @@ -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)) { > > > > > -- > SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany > GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg -- Regards, Igor ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Qemu-devel] [PATCH 1/5] introduce powerdown_notifiers 2012-08-30 6:49 ` Igor Mammedov @ 2012-08-30 7:41 ` Paolo Bonzini 2012-08-30 8:17 ` Igor Mammedov 0 siblings, 1 reply; 17+ messages in thread From: Paolo Bonzini @ 2012-08-30 7:41 UTC (permalink / raw) To: Igor Mammedov Cc: peter.maydell, aliguori, mst, jan.kiszka, qemu-devel, lcapitulino, blauwirbel, alex.williamson, kraxel, Andreas Färber Il 30/08/2012 08:49, Igor Mammedov ha scritto: >>> > > +static void qemu_system_powerdown(void) > this is a bad naming that conflicts with global var qemu_system_powerdown, so > bisectability of series is still broken. > perhaps qemu_do_system_powerdown() would be better for function name, > although it doesn't match common name pattern used for this kind of functions. > Just inline the function in this patch, and uninline it later. Paolo ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Qemu-devel] [PATCH 1/5] introduce powerdown_notifiers 2012-08-30 7:41 ` Paolo Bonzini @ 2012-08-30 8:17 ` Igor Mammedov 0 siblings, 0 replies; 17+ messages in thread From: Igor Mammedov @ 2012-08-30 8:17 UTC (permalink / raw) To: Paolo Bonzini Cc: peter.maydell, aliguori, mst, jan.kiszka, qemu-devel, lcapitulino, blauwirbel, alex.williamson, kraxel, Andreas Färber On Thu, 30 Aug 2012 09:41:55 +0200 Paolo Bonzini <pbonzini@redhat.com> wrote: > Il 30/08/2012 08:49, Igor Mammedov ha scritto: > >>> > > +static void qemu_system_powerdown(void) > > this is a bad naming that conflicts with global var qemu_system_powerdown, so > > bisectability of series is still broken. > > perhaps qemu_do_system_powerdown() would be better for function name, > > although it doesn't match common name pattern used for this kind of functions. > > > > Just inline the function in this patch, and uninline it later. Thanks, fixed in https://github.com/imammedo/qemu/tree/cpu_as_device.WIP > > Paolo > -- Regards, Igor ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2012-09-26 12:39 UTC | newest] Thread overview: 17+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 ` [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
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).