* [Qemu-devel] [PATCH v2 0/3] Series to implement suspend for ppc/spapr
@ 2019-07-22 5:32 Nicholas Piggin
2019-07-22 5:32 ` [Qemu-devel] [PATCH v2 1/3] machine: Add wakeup method to MachineClass Nicholas Piggin
2019-07-22 8:39 ` [Qemu-devel] [PATCH v2 0/3] Series to implement suspend for ppc/spapr David Gibson
0 siblings, 2 replies; 8+ messages in thread
From: Nicholas Piggin @ 2019-07-22 5:32 UTC (permalink / raw)
To: qemu-devel
Cc: Liu Jinsong, Eduardo Habkost, Michael S. Tsirkin, Nicholas Piggin,
Luiz Capitulino, qemu-ppc, Gerd Hoffmann, Paolo Bonzini,
David Gibson, Richard Henderson
Hi, this series is rebased on top of the qmp event fix, and takes
Paolo's suggestion to implement ->wakeup for i386 before adding
ppc, which makes it much nicer.
If the first two patches can be agreed on initially and merged, I
can take the third patch through the ppc list after that.
Thanks,
Nick
Nicholas Piggin (3):
machine: Add wakeup method to MachineClass
i386: use machine class ->wakeup method
spapr: Implement ibm,suspend-me
hw/i386/pc.c | 8 ++++++++
hw/ppc/spapr.c | 7 +++++++
hw/ppc/spapr_rtas.c | 32 ++++++++++++++++++++++++++++++++
include/hw/boards.h | 1 +
include/hw/ppc/spapr.h | 3 ++-
vl.c | 16 +++++++++++++++-
6 files changed, 65 insertions(+), 2 deletions(-)
--
2.20.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH v2 1/3] machine: Add wakeup method to MachineClass
2019-07-22 5:32 [Qemu-devel] [PATCH v2 0/3] Series to implement suspend for ppc/spapr Nicholas Piggin
@ 2019-07-22 5:32 ` Nicholas Piggin
2019-07-22 8:38 ` David Gibson
2019-07-22 8:39 ` [Qemu-devel] [PATCH v2 0/3] Series to implement suspend for ppc/spapr David Gibson
1 sibling, 1 reply; 8+ messages in thread
From: Nicholas Piggin @ 2019-07-22 5:32 UTC (permalink / raw)
To: qemu-devel
Cc: Liu Jinsong, Eduardo Habkost, Michael S. Tsirkin, Nicholas Piggin,
Luiz Capitulino, qemu-ppc, Gerd Hoffmann, Paolo Bonzini,
David Gibson, Richard Henderson
Waking from suspend is not logically a machine reset on all machines,
particularly in the paravirtualized case rather than hardware
emulated. The ppc spapr machine for example just invokes hypervisor
to suspend, and expects that call to return with the machine in the
same state (modulo some possible migration and reconfiguration
details).
Implement a machine ->wakeup method and use that if it exists.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
include/hw/boards.h | 1 +
vl.c | 18 +++++++++++++++++-
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/include/hw/boards.h b/include/hw/boards.h
index a71d1a53a5..915ac3352b 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -180,6 +180,7 @@ struct MachineClass {
void (*init)(MachineState *state);
void (*reset)(MachineState *state);
+ void (*wakeup)(MachineState *state);
void (*hot_add_cpu)(MachineState *state, const int64_t id, Error **errp);
int (*kvm_type)(MachineState *machine, const char *arg);
void (*smp_parse)(MachineState *ms, QemuOpts *opts);
diff --git a/vl.c b/vl.c
index cefe5a3968..45ea034410 100644
--- a/vl.c
+++ b/vl.c
@@ -1556,6 +1556,22 @@ void qemu_system_reset(ShutdownCause reason)
cpu_synchronize_all_post_reset();
}
+/*
+ * Wake the VM after suspend.
+ */
+static void qemu_system_wakeup(void)
+{
+ MachineClass *mc;
+
+ mc = current_machine ? MACHINE_GET_CLASS(current_machine) : NULL;
+
+ if (mc && mc->wakeup) {
+ mc->wakeup(current_machine);
+ } else {
+ qemu_system_reset(SHUTDOWN_CAUSE_NONE);
+ }
+}
+
void qemu_system_guest_panicked(GuestPanicInformation *info)
{
qemu_log_mask(LOG_GUEST_ERROR, "Guest crashed");
@@ -1764,7 +1780,7 @@ static bool main_loop_should_exit(void)
}
if (qemu_wakeup_requested()) {
pause_all_vcpus();
- qemu_system_reset(SHUTDOWN_CAUSE_NONE);
+ qemu_system_wakeup();
notifier_list_notify(&wakeup_notifiers, &wakeup_reason);
wakeup_reason = QEMU_WAKEUP_REASON_NONE;
resume_all_vcpus();
--
2.20.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [Qemu-devel] [PATCH v2 1/3] machine: Add wakeup method to MachineClass
2019-07-22 5:32 ` [Qemu-devel] [PATCH v2 1/3] machine: Add wakeup method to MachineClass Nicholas Piggin
@ 2019-07-22 8:38 ` David Gibson
0 siblings, 0 replies; 8+ messages in thread
From: David Gibson @ 2019-07-22 8:38 UTC (permalink / raw)
To: Nicholas Piggin
Cc: Liu Jinsong, Eduardo Habkost, Michael S. Tsirkin, qemu-devel,
Luiz Capitulino, qemu-ppc, Gerd Hoffmann, Paolo Bonzini,
Richard Henderson
[-- Attachment #1: Type: text/plain, Size: 2599 bytes --]
On Mon, Jul 22, 2019 at 03:32:13PM +1000, Nicholas Piggin wrote:
> Waking from suspend is not logically a machine reset on all machines,
> particularly in the paravirtualized case rather than hardware
> emulated. The ppc spapr machine for example just invokes hypervisor
> to suspend, and expects that call to return with the machine in the
> same state (modulo some possible migration and reconfiguration
> details).
>
> Implement a machine ->wakeup method and use that if it exists.
>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
> ---
> include/hw/boards.h | 1 +
> vl.c | 18 +++++++++++++++++-
> 2 files changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/include/hw/boards.h b/include/hw/boards.h
> index a71d1a53a5..915ac3352b 100644
> --- a/include/hw/boards.h
> +++ b/include/hw/boards.h
> @@ -180,6 +180,7 @@ struct MachineClass {
>
> void (*init)(MachineState *state);
> void (*reset)(MachineState *state);
> + void (*wakeup)(MachineState *state);
> void (*hot_add_cpu)(MachineState *state, const int64_t id, Error **errp);
> int (*kvm_type)(MachineState *machine, const char *arg);
> void (*smp_parse)(MachineState *ms, QemuOpts *opts);
> diff --git a/vl.c b/vl.c
> index cefe5a3968..45ea034410 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -1556,6 +1556,22 @@ void qemu_system_reset(ShutdownCause reason)
> cpu_synchronize_all_post_reset();
> }
>
> +/*
> + * Wake the VM after suspend.
> + */
> +static void qemu_system_wakeup(void)
> +{
> + MachineClass *mc;
> +
> + mc = current_machine ? MACHINE_GET_CLASS(current_machine) : NULL;
> +
> + if (mc && mc->wakeup) {
> + mc->wakeup(current_machine);
> + } else {
> + qemu_system_reset(SHUTDOWN_CAUSE_NONE);
> + }
> +}
> +
> void qemu_system_guest_panicked(GuestPanicInformation *info)
> {
> qemu_log_mask(LOG_GUEST_ERROR, "Guest crashed");
> @@ -1764,7 +1780,7 @@ static bool main_loop_should_exit(void)
> }
> if (qemu_wakeup_requested()) {
> pause_all_vcpus();
> - qemu_system_reset(SHUTDOWN_CAUSE_NONE);
> + qemu_system_wakeup();
> notifier_list_notify(&wakeup_notifiers, &wakeup_reason);
> wakeup_reason = QEMU_WAKEUP_REASON_NONE;
> resume_all_vcpus();
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH v2 0/3] Series to implement suspend for ppc/spapr
2019-07-22 5:32 [Qemu-devel] [PATCH v2 0/3] Series to implement suspend for ppc/spapr Nicholas Piggin
2019-07-22 5:32 ` [Qemu-devel] [PATCH v2 1/3] machine: Add wakeup method to MachineClass Nicholas Piggin
@ 2019-07-22 8:39 ` David Gibson
2019-07-22 11:20 ` Paolo Bonzini
1 sibling, 1 reply; 8+ messages in thread
From: David Gibson @ 2019-07-22 8:39 UTC (permalink / raw)
To: Nicholas Piggin
Cc: Liu Jinsong, Eduardo Habkost, Michael S. Tsirkin, qemu-devel,
Luiz Capitulino, qemu-ppc, Gerd Hoffmann, Paolo Bonzini,
Richard Henderson
[-- Attachment #1: Type: text/plain, Size: 1131 bytes --]
On Mon, Jul 22, 2019 at 03:32:12PM +1000, Nicholas Piggin wrote:
> Hi, this series is rebased on top of the qmp event fix, and takes
> Paolo's suggestion to implement ->wakeup for i386 before adding
> ppc, which makes it much nicer.
>
> If the first two patches can be agreed on initially and merged, I
> can take the third patch through the ppc list after that.
LGTM. Now, what tree(s) do we merge this through?
>
> Thanks,
> Nick
>
> Nicholas Piggin (3):
> machine: Add wakeup method to MachineClass
> i386: use machine class ->wakeup method
> spapr: Implement ibm,suspend-me
>
> hw/i386/pc.c | 8 ++++++++
> hw/ppc/spapr.c | 7 +++++++
> hw/ppc/spapr_rtas.c | 32 ++++++++++++++++++++++++++++++++
> include/hw/boards.h | 1 +
> include/hw/ppc/spapr.h | 3 ++-
> vl.c | 16 +++++++++++++++-
> 6 files changed, 65 insertions(+), 2 deletions(-)
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH v2 0/3] Series to implement suspend for ppc/spapr
2019-07-22 8:39 ` [Qemu-devel] [PATCH v2 0/3] Series to implement suspend for ppc/spapr David Gibson
@ 2019-07-22 11:20 ` Paolo Bonzini
2019-07-22 11:42 ` David Gibson
2019-07-23 3:40 ` David Gibson
0 siblings, 2 replies; 8+ messages in thread
From: Paolo Bonzini @ 2019-07-22 11:20 UTC (permalink / raw)
To: David Gibson, Nicholas Piggin
Cc: Liu Jinsong, Eduardo Habkost, Michael S. Tsirkin, qemu-devel,
Luiz Capitulino, qemu-ppc, Gerd Hoffmann, Richard Henderson
On 22/07/19 10:39, David Gibson wrote:
> On Mon, Jul 22, 2019 at 03:32:12PM +1000, Nicholas Piggin wrote:
>> Hi, this series is rebased on top of the qmp event fix, and takes
>> Paolo's suggestion to implement ->wakeup for i386 before adding
>> ppc, which makes it much nicer.
>>
>> If the first two patches can be agreed on initially and merged, I
>> can take the third patch through the ppc list after that.
>
> LGTM. Now, what tree(s) do we merge this through?
I have just spotted a volunteer!
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo
>>
>> Thanks,
>> Nick
>>
>> Nicholas Piggin (3):
>> machine: Add wakeup method to MachineClass
>> i386: use machine class ->wakeup method
>> spapr: Implement ibm,suspend-me
>>
>> hw/i386/pc.c | 8 ++++++++
>> hw/ppc/spapr.c | 7 +++++++
>> hw/ppc/spapr_rtas.c | 32 ++++++++++++++++++++++++++++++++
>> include/hw/boards.h | 1 +
>> include/hw/ppc/spapr.h | 3 ++-
>> vl.c | 16 +++++++++++++++-
>> 6 files changed, 65 insertions(+), 2 deletions(-)
>>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH v2 0/3] Series to implement suspend for ppc/spapr
2019-07-22 11:20 ` Paolo Bonzini
@ 2019-07-22 11:42 ` David Gibson
2019-07-23 3:40 ` David Gibson
1 sibling, 0 replies; 8+ messages in thread
From: David Gibson @ 2019-07-22 11:42 UTC (permalink / raw)
To: Paolo Bonzini
Cc: Liu Jinsong, Eduardo Habkost, Michael S. Tsirkin, qemu-devel,
Nicholas Piggin, Luiz Capitulino, qemu-ppc, Gerd Hoffmann,
Richard Henderson
[-- Attachment #1: Type: text/plain, Size: 1525 bytes --]
On Mon, Jul 22, 2019 at 01:20:08PM +0200, Paolo Bonzini wrote:
> On 22/07/19 10:39, David Gibson wrote:
> > On Mon, Jul 22, 2019 at 03:32:12PM +1000, Nicholas Piggin wrote:
> >> Hi, this series is rebased on top of the qmp event fix, and takes
> >> Paolo's suggestion to implement ->wakeup for i386 before adding
> >> ppc, which makes it much nicer.
> >>
> >> If the first two patches can be agreed on initially and merged, I
> >> can take the third patch through the ppc list after that.
> >
> > LGTM. Now, what tree(s) do we merge this through?
>
> I have just spotted a volunteer!
Well, merging an i386 patch through the ppc tree is kinda weird, but
yeah, I can do that.
>
> Acked-by: Paolo Bonzini <pbonzini@redhat.com>
>
> Paolo
>
> >>
> >> Thanks,
> >> Nick
> >>
> >> Nicholas Piggin (3):
> >> machine: Add wakeup method to MachineClass
> >> i386: use machine class ->wakeup method
> >> spapr: Implement ibm,suspend-me
> >>
> >> hw/i386/pc.c | 8 ++++++++
> >> hw/ppc/spapr.c | 7 +++++++
> >> hw/ppc/spapr_rtas.c | 32 ++++++++++++++++++++++++++++++++
> >> include/hw/boards.h | 1 +
> >> include/hw/ppc/spapr.h | 3 ++-
> >> vl.c | 16 +++++++++++++++-
> >> 6 files changed, 65 insertions(+), 2 deletions(-)
> >>
> >
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH v2 0/3] Series to implement suspend for ppc/spapr
2019-07-22 11:20 ` Paolo Bonzini
2019-07-22 11:42 ` David Gibson
@ 2019-07-23 3:40 ` David Gibson
1 sibling, 0 replies; 8+ messages in thread
From: David Gibson @ 2019-07-23 3:40 UTC (permalink / raw)
To: Paolo Bonzini
Cc: Liu Jinsong, Eduardo Habkost, Michael S. Tsirkin, qemu-devel,
Nicholas Piggin, Luiz Capitulino, qemu-ppc, Gerd Hoffmann,
Richard Henderson
[-- Attachment #1: Type: text/plain, Size: 1475 bytes --]
On Mon, Jul 22, 2019 at 01:20:08PM +0200, Paolo Bonzini wrote:
> On 22/07/19 10:39, David Gibson wrote:
> > On Mon, Jul 22, 2019 at 03:32:12PM +1000, Nicholas Piggin wrote:
> >> Hi, this series is rebased on top of the qmp event fix, and takes
> >> Paolo's suggestion to implement ->wakeup for i386 before adding
> >> ppc, which makes it much nicer.
> >>
> >> If the first two patches can be agreed on initially and merged, I
> >> can take the third patch through the ppc list after that.
> >
> > LGTM. Now, what tree(s) do we merge this through?
>
> I have just spotted a volunteer!
>
> Acked-by: Paolo Bonzini <pbonzini@redhat.com>
I've put this in the ppc-for-4.2 tree.
>
> Paolo
>
> >>
> >> Thanks,
> >> Nick
> >>
> >> Nicholas Piggin (3):
> >> machine: Add wakeup method to MachineClass
> >> i386: use machine class ->wakeup method
> >> spapr: Implement ibm,suspend-me
> >>
> >> hw/i386/pc.c | 8 ++++++++
> >> hw/ppc/spapr.c | 7 +++++++
> >> hw/ppc/spapr_rtas.c | 32 ++++++++++++++++++++++++++++++++
> >> include/hw/boards.h | 1 +
> >> include/hw/ppc/spapr.h | 3 ++-
> >> vl.c | 16 +++++++++++++++-
> >> 6 files changed, 65 insertions(+), 2 deletions(-)
> >>
> >
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH v2 0/3] Series to implement suspend for ppc/spapr
@ 2019-07-22 5:19 Nicholas Piggin
2019-07-22 5:19 ` [Qemu-devel] [PATCH v2 1/3] machine: Add wakeup method to MachineClass Nicholas Piggin
0 siblings, 1 reply; 8+ messages in thread
From: Nicholas Piggin @ 2019-07-22 5:19 UTC (permalink / raw)
To: qemu-devel
Cc: Liu, Jinsong, Eduardo Habkost, Michael S. Tsirkin,
Nicholas Piggin, Luiz Capitulino, qemu-ppc, Gerd Hoffmann,
Paolo Bonzini, David Gibson, Richard Henderson
Hi, this series is rebased on top of the qmp event fix, and takes
Paolo's suggestion to implement ->wakeup for i386 before adding
ppc, which makes it much nicer.
If the first two patches can be agreed on initially and merged, I
can take the third patch through the ppc list after that.
Thanks,
Nick
Nicholas Piggin (3):
machine: Add wakeup method to MachineClass
i386: use machine class ->wakeup method
spapr: Implement ibm,suspend-me
hw/i386/pc.c | 8 ++++++++
hw/ppc/spapr.c | 7 +++++++
hw/ppc/spapr_rtas.c | 32 ++++++++++++++++++++++++++++++++
include/hw/boards.h | 1 +
include/hw/ppc/spapr.h | 3 ++-
vl.c | 16 +++++++++++++++-
6 files changed, 65 insertions(+), 2 deletions(-)
--
2.20.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH v2 1/3] machine: Add wakeup method to MachineClass
2019-07-22 5:19 Nicholas Piggin
@ 2019-07-22 5:19 ` Nicholas Piggin
0 siblings, 0 replies; 8+ messages in thread
From: Nicholas Piggin @ 2019-07-22 5:19 UTC (permalink / raw)
To: qemu-devel
Cc: Liu, Jinsong, Eduardo Habkost, Michael S. Tsirkin,
Nicholas Piggin, Luiz Capitulino, qemu-ppc, Gerd Hoffmann,
Paolo Bonzini, David Gibson, Richard Henderson
Waking from suspend is not logically a machine reset on all machines,
particularly in the paravirtualized case rather than hardware
emulated. The ppc spapr machine for example just invokes hypervisor
to suspend, and expects that call to return with the machine in the
same state (modulo some possible migration and reconfiguration
details).
Implement a machine ->wakeup method and use that if it exists.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
include/hw/boards.h | 1 +
vl.c | 18 +++++++++++++++++-
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/include/hw/boards.h b/include/hw/boards.h
index a71d1a53a5..915ac3352b 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -180,6 +180,7 @@ struct MachineClass {
void (*init)(MachineState *state);
void (*reset)(MachineState *state);
+ void (*wakeup)(MachineState *state);
void (*hot_add_cpu)(MachineState *state, const int64_t id, Error **errp);
int (*kvm_type)(MachineState *machine, const char *arg);
void (*smp_parse)(MachineState *ms, QemuOpts *opts);
diff --git a/vl.c b/vl.c
index cefe5a3968..45ea034410 100644
--- a/vl.c
+++ b/vl.c
@@ -1556,6 +1556,22 @@ void qemu_system_reset(ShutdownCause reason)
cpu_synchronize_all_post_reset();
}
+/*
+ * Wake the VM after suspend.
+ */
+static void qemu_system_wakeup(void)
+{
+ MachineClass *mc;
+
+ mc = current_machine ? MACHINE_GET_CLASS(current_machine) : NULL;
+
+ if (mc && mc->wakeup) {
+ mc->wakeup(current_machine);
+ } else {
+ qemu_system_reset(SHUTDOWN_CAUSE_NONE);
+ }
+}
+
void qemu_system_guest_panicked(GuestPanicInformation *info)
{
qemu_log_mask(LOG_GUEST_ERROR, "Guest crashed");
@@ -1764,7 +1780,7 @@ static bool main_loop_should_exit(void)
}
if (qemu_wakeup_requested()) {
pause_all_vcpus();
- qemu_system_reset(SHUTDOWN_CAUSE_NONE);
+ qemu_system_wakeup();
notifier_list_notify(&wakeup_notifiers, &wakeup_reason);
wakeup_reason = QEMU_WAKEUP_REASON_NONE;
resume_all_vcpus();
--
2.20.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-07-23 5:19 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-22 5:32 [Qemu-devel] [PATCH v2 0/3] Series to implement suspend for ppc/spapr Nicholas Piggin
2019-07-22 5:32 ` [Qemu-devel] [PATCH v2 1/3] machine: Add wakeup method to MachineClass Nicholas Piggin
2019-07-22 8:38 ` David Gibson
2019-07-22 8:39 ` [Qemu-devel] [PATCH v2 0/3] Series to implement suspend for ppc/spapr David Gibson
2019-07-22 11:20 ` Paolo Bonzini
2019-07-22 11:42 ` David Gibson
2019-07-23 3:40 ` David Gibson
-- strict thread matches above, loose matches on Subject: below --
2019-07-22 5:19 Nicholas Piggin
2019-07-22 5:19 ` [Qemu-devel] [PATCH v2 1/3] machine: Add wakeup method to MachineClass Nicholas Piggin
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).