s390/ipl: fix ipl with -no-reboot
PATCH v3 1/1 s390/ipl: fix ipl with -no-reboot
kexec/kdump as well as the bootloader use a subcode of diagnose 308 that is supposed to reset the subsystem but not comprise a full "reboot". With the latest refactoring this is now broken when -no-reboot is used. This for example breaks virt-install from iso images.
We need to mark these "soft" reboots as ok for rebooting.
--- hw/s390x/ipl.c | 8 +++++++- include/sysemu/sysemu.h | 3 +++ vl.c | 4 ++-- 3 files changed, 12 insertions(+), 3 deletions(-)
hw/s390x/ipl.c +7 -1
@@ -535,7 +535,13 @@ void s390_ipl_reset_request(CPUState *cs, enum s390_reset reset_type) ipl->iplb_valid =s390_gen_initial_iplb (ipl); } } -qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); +if (reset_type ==S390_RESET_MODIFIED_CLEAR || + reset_type ==S390_RESET_LOAD_NORMAL ) { +/* ignore -no-reboot */ +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET_FORCE ); + }else { +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); + }/* as this is triggered by a CPU, make sure to exit the loop */ if (tcg_enabled ()) {cpu_loop_exit (cs);
include/sysemu/sysemu.h +3 -0
@@ -44,6 +44,9 @@ typedef enum ShutdownCause {turns that into a shutdown */ SHUTDOWN_CAUSE_GUEST_PANIC ,/* Guest panicked, and command line turns that into a shutdown */ +SHUTDOWN_CAUSE_GUEST_RESET_FORCE ,/* Guest reset that should ignore +--no-reboot. This is useful for reset +like actions as s390 kexec/kdump */ SHUTDOWN_CAUSE__MAX , } ShutdownCause;
vl.c +2 -2
@@ -1628,7 +1628,7 @@ void qemu_system_reset(ShutdownCause reason) }else {qemu_devices_reset (); } -if (reason) { +if (reason !=SHUTDOWN_CAUSE_GUEST_RESET_FORCE ) {qapi_event_send_reset (shutdown_caused_by_guest (reason), &error_abort); }
@@ -1674,7 +1674,7 @@ void qemu_system_guest_panicked(GuestPanicInformation *info)void qemu_system_reset_request (ShutdownCause reason) { -if (no_reboot) { +if (no_reboot && reason !=SHUTDOWN_CAUSE_GUEST_RESET_FORCE ) { shutdown_requested = reason; }else { reset_requested = reason;
Signature · 1 line
2.17.0
Quoted 10 lines · Christian Borntraeger
kexec/kdump as well as the bootloader use a subcode of diagnose 308 that is supposed to reset the subsystem but not comprise a full "reboot". With the latest refactoring this is now broken when -no-reboot is used. This for example breaks virt-install from iso images.
We need to mark these "soft" reboots as ok for rebooting.
Fixes a30fb811cbe9 (s390x: refactor reset/reipl handling)Signed-off-by Christian Borntraeger <[email protected]>
Ok, then my suggestion made even more sense. :) No other objections apart from the name of the constant.
Paolo
Quoted 62 lines
--- hw/s390x/ipl.c | 8 +++++++- include/sysemu/sysemu.h | 3 +++ vl.c | 4 ++-- 3 files changed, 12 insertions(+), 3 deletions(-)hw/s390x/ipl.c +7
-1@@ -535,7 +535,13 @@ void s390_ipl_reset_request(CPUState *cs, enum s390_reset reset_type) ipl->iplb_valid =s390_gen_initial_iplb (ipl); } } -qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); +if (reset_type ==S390_RESET_MODIFIED_CLEAR || + reset_type ==S390_RESET_LOAD_NORMAL ) { +/* ignore -no-reboot */ +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET_FORCE ); + }else { +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); + }/* as this is triggered by a CPU, make sure to exit the loop */ if (tcg_enabled ()) {cpu_loop_exit (cs);include/sysemu/sysemu.h +3
-0@@ -44,6 +44,9 @@ typedef enum ShutdownCause {turns that into a shutdown */ SHUTDOWN_CAUSE_GUEST_PANIC ,/* Guest panicked, and command line turns that into a shutdown */ +SHUTDOWN_CAUSE_GUEST_RESET_FORCE ,/* Guest reset that should ignore +--no-reboot. This is useful for reset +like actions as s390 kexec/kdump */ SHUTDOWN_CAUSE__MAX , } ShutdownCause;vl.c +2
-2@@ -1628,7 +1628,7 @@ void qemu_system_reset(ShutdownCause reason) }else {qemu_devices_reset (); } -if (reason) { +if (reason !=SHUTDOWN_CAUSE_GUEST_RESET_FORCE ) {qapi_event_send_reset (shutdown_caused_by_guest (reason), &error_abort); }@@ -1674,7 +1674,7 @@ void qemu_system_guest_panicked(GuestPanicInformation *info)void qemu_system_reset_request (ShutdownCause reason) { -if (no_reboot) { +if (no_reboot && reason !=SHUTDOWN_CAUSE_GUEST_RESET_FORCE ) { shutdown_requested = reason; }else { reset_requested = reason;
Quoted 9 lines · Paolo Bonzini
Quoted 8 lines · Christian Borntraeger
kexec/kdump as well as the bootloader use a subcode of diagnose 308 that is supposed to reset the subsystem but not comprise a full "reboot". With the latest refactoring this is now broken when -no-reboot is used. This for example breaks virt-install from iso images.
We need to mark these "soft" reboots as ok for rebooting.
Quoted 7 lines
Quoted 2 lines
Fixes a30fb811cbe9 (s390x: refactor reset/reipl handling)Signed-off-by Christian Borntraeger <[email protected]>Ok, then my suggestion made even more sense. :) No other objections apart from the name of the constant.
Paolo
SHUTDOWN_CAUSE_S390_PARTIAL ?
SHUTDOWN_CAUSE_S390_SUBSYS_RESET?
Quoted 64 lines
Quoted 63 lines
--- hw/s390x/ipl.c | 8 +++++++- include/sysemu/sysemu.h | 3 +++ vl.c | 4 ++-- 3 files changed, 12 insertions(+), 3 deletions(-)hw/s390x/ipl.c +7
-1@@ -535,7 +535,13 @@ void s390_ipl_reset_request(CPUState *cs, enum s390_reset reset_type) ipl->iplb_valid =s390_gen_initial_iplb (ipl); } } -qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); +if (reset_type ==S390_RESET_MODIFIED_CLEAR || + reset_type ==S390_RESET_LOAD_NORMAL ) { +/* ignore -no-reboot */ +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET_FORCE ); + }else { +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); + }/* as this is triggered by a CPU, make sure to exit the loop */ if (tcg_enabled ()) {cpu_loop_exit (cs);include/sysemu/sysemu.h +3
-0@@ -44,6 +44,9 @@ typedef enum ShutdownCause {turns that into a shutdown */ SHUTDOWN_CAUSE_GUEST_PANIC ,/* Guest panicked, and command line turns that into a shutdown */ +SHUTDOWN_CAUSE_GUEST_RESET_FORCE ,/* Guest reset that should ignore +--no-reboot. This is useful for reset +like actions as s390 kexec/kdump */ SHUTDOWN_CAUSE__MAX , } ShutdownCause;vl.c +2
-2@@ -1628,7 +1628,7 @@ void qemu_system_reset(ShutdownCause reason) }else {qemu_devices_reset (); } -if (reason) { +if (reason !=SHUTDOWN_CAUSE_GUEST_RESET_FORCE ) {qapi_event_send_reset (shutdown_caused_by_guest (reason), &error_abort); }@@ -1674,7 +1674,7 @@ void qemu_system_guest_panicked(GuestPanicInformation *info)void qemu_system_reset_request (ShutdownCause reason) { -if (no_reboot) { +if (no_reboot && reason !=SHUTDOWN_CAUSE_GUEST_RESET_FORCE ) { shutdown_requested = reason; }else { reset_requested = reason;
Quoted 13 lines · On Thu, 21 Jun 2018 22:34:49 +0200 Christian Borntraeger…
Quoted 12 lines · Paolo Bonzini
Quoted 10 lines · Christian Borntraeger
kexec/kdump as well as the bootloader use a subcode of diagnose 308 that is supposed to reset the subsystem but not comprise a full "reboot". With the latest refactoring this is now broken when -no-reboot is used. This for example breaks virt-install from iso images.
We need to mark these "soft" reboots as ok for rebooting.
Fixes a30fb811cbe9 (s390x: refactor reset/reipl handling)Signed-off-by Christian Borntraeger <[email protected]>
Quoted 6 lines
Quoted 4 lines
Ok, then my suggestion made even more sense. :) No other objections apart from the name of the constant.
Paolo
SHUTDOWN_CAUSE_S390_PARTIAL?
Don't like that one much.
Quoted 2 lines
SHUTDOWN_CAUSE_S390_SUBSYS_RESET?
Either that, or drop the 'S390' (is it conceivable that other architectures have something similar)?
Quoted 57 lines
Quoted 57 lines
Quoted 57 lines
--- hw/s390x/ipl.c | 8 +++++++- include/sysemu/sysemu.h | 3 +++ vl.c | 4 ++-- 3 files changed, 12 insertions(+), 3 deletions(-)hw/s390x/ipl.c +7
-1@@ -535,7 +535,13 @@ void s390_ipl_reset_request(CPUState *cs, enum s390_reset reset_type) ipl->iplb_valid =s390_gen_initial_iplb (ipl); } } -qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); +if (reset_type ==S390_RESET_MODIFIED_CLEAR || + reset_type ==S390_RESET_LOAD_NORMAL ) { +/* ignore -no-reboot */ +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET_FORCE ); + }else { +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); + }/* as this is triggered by a CPU, make sure to exit the loop */ if (tcg_enabled ()) {cpu_loop_exit (cs);include/sysemu/sysemu.h +3
-0@@ -44,6 +44,9 @@ typedef enum ShutdownCause {turns that into a shutdown */ SHUTDOWN_CAUSE_GUEST_PANIC ,/* Guest panicked, and command line turns that into a shutdown */ +SHUTDOWN_CAUSE_GUEST_RESET_FORCE ,/* Guest reset that should ignore +--no-reboot. This is useful for reset +like actions as s390 kexec/kdump */ SHUTDOWN_CAUSE__MAX , } ShutdownCause;vl.c +1
-1@@ -1628,7 +1628,7 @@ void qemu_system_reset(ShutdownCause reason) }else {qemu_devices_reset (); } -if (reason) { +if (reason !=SHUTDOWN_CAUSE_GUEST_RESET_FORCE ) {qapi_event_send_reset (shutdown_caused_by_guest (reason), &error_abort); }@@ -1674,7 +1674,7 @@ void qemu_system_guest_panicked(GuestPanicInformation *info)
Quoted 10 lines
Quoted 9 lines
vl.c void qemu_system_guest_panicked(GuestPanicInformation *info) · line 1680
Quoted 8 lines
vl.c +1
-1void qemu_system_reset_request (ShutdownCause reason) { -if (no_reboot) { +if (no_reboot && reason !=SHUTDOWN_CAUSE_GUEST_RESET_FORCE ) { shutdown_requested = reason; }else { reset_requested = reason;
The patch looks sane to me.
Quoted 11 lines · Cornelia Huck
Quoted 5 lines
Quoted 4 lines
Ok, then my suggestion made even more sense. :) No other objections apart from the name of the constant.
Paolo
SHUTDOWN_CAUSE_S390_PARTIAL?Don't like that one much.
Quoted 1 line
SHUTDOWN_CAUSE_S390_SUBSYS_RESET?Either that, or drop the 'S390' (is it conceivable that other architectures have something similar)?
I don't know exactly what is going on here, so I'm not very suited to answer this. The difference just from reading the C code seems to be that it calls s390_cpu_load_normal instead of s390_ipl_prepare_cpu, and that it calls subsystem_reset instead of qemu_devices_reset.
For a more generic name I'd go with SHUTDOWN_CAUSE_OS_BOOT (or OS_BOOTING, or BOOT_OS), but an s390-specific name is of course fine as well, especially if you have a specific moniker for the "thing that IPL gives control to".
Paolo
Quoted 13 lines · Paolo Bonzini
Quoted 11 lines · Cornelia Huck
Quoted 5 lines
Quoted 4 lines
Ok, then my suggestion made even more sense. :) No other objections apart from the name of the constant.
Paolo
SHUTDOWN_CAUSE_S390_PARTIAL?Don't like that one much.
Quoted 1 line
SHUTDOWN_CAUSE_S390_SUBSYS_RESET?Either that, or drop the 'S390' (is it conceivable that other architectures have something similar)?
Quoted 8 lines
I don't know exactly what is going on here, so I'm not very suited to answer this. The difference just from reading the C code seems to be that it calls
s390_cpu_load_normalinstead ofs390_ipl_prepare_cpu, and that it callssubsystem_resetinstead ofqemu_devices_reset.For a more generic name I'd go with
SHUTDOWN_CAUSE_OS_BOOT(orOS_BOOTING, orBOOT_OS), but an s390-specific name is of course fine as well, especially if you have a specific moniker for the "thing that IPL
It is not a BOOT, it is in fact an reset just to the devices. Right now I favor
SHUTDOWN_CAUSE_SUBSYSTEM_RESET
Quoted 21 lines · Christian Borntraeger
Quoted 18 lines · Paolo Bonzini
Quoted 11 lines · Cornelia Huck
Quoted 5 lines
Quoted 4 lines
Ok, then my suggestion made even more sense. :) No other objections apart from the name of the constant.
Paolo
SHUTDOWN_CAUSE_S390_PARTIAL?Don't like that one much.
Quoted 1 line
SHUTDOWN_CAUSE_S390_SUBSYS_RESET?Either that, or drop the 'S390' (is it conceivable that other architectures have something similar)?
I don't know exactly what is going on here, so I'm not very suited to answer this. The difference just from reading the C code seems to be that it calls
s390_cpu_load_normalinstead ofs390_ipl_prepare_cpu, and that it callssubsystem_resetinstead ofqemu_devices_reset.
Quoted 9 lines
Quoted 3 lines
For a more generic name I'd go with
SHUTDOWN_CAUSE_OS_BOOT(orOS_BOOTING, orBOOT_OS), but an s390-specific name is of course fine as well, especially if you have a specific moniker for the "thing that IPLIt is not a BOOT, it is in fact an reset just to the devices. Right now I favor
SHUTDOWN_CAUSE_SUBSYSTEM_RESET
+1
Signature · 3 lines
Thanks, David / dhildenb
Quoted 64 lines · Christian Borntraeger
kexec/kdump as well as the bootloader use a subcode of diagnose 308 that is supposed to reset the subsystem but not comprise a full "reboot". With the latest refactoring this is now broken when -no-reboot is used. This for example breaks virt-install from iso images.
We need to mark these "soft" reboots as ok for rebooting.
Fixes a30fb811cbe9 (s390x: refactor reset/reipl handling)Signed-off-by Christian Borntraeger <[email protected]>--- hw/s390x/ipl.c | 8 +++++++- include/sysemu/sysemu.h | 3 +++ vl.c | 4 ++-- 3 files changed, 12 insertions(+), 3 deletions(-)hw/s390x/ipl.c +7
-1@@ -535,7 +535,13 @@ void s390_ipl_reset_request(CPUState *cs, enum s390_reset reset_type) ipl->iplb_valid =s390_gen_initial_iplb (ipl); } } -qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); +if (reset_type ==S390_RESET_MODIFIED_CLEAR || + reset_type ==S390_RESET_LOAD_NORMAL ) { +/* ignore -no-reboot */ +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET_FORCE ); + }else { +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); + }/* as this is triggered by a CPU, make sure to exit the loop */ if (tcg_enabled ()) {cpu_loop_exit (cs);include/sysemu/sysemu.h +3
-0@@ -44,6 +44,9 @@ typedef enum ShutdownCause {turns that into a shutdown */ SHUTDOWN_CAUSE_GUEST_PANIC ,/* Guest panicked, and command line turns that into a shutdown */ +SHUTDOWN_CAUSE_GUEST_RESET_FORCE ,/* Guest reset that should ignore +--no-reboot. This is useful for reset +like actions as s390 kexec/kdump */ SHUTDOWN_CAUSE__MAX , } ShutdownCause;vl.c +1
-1@@ -1628,7 +1628,7 @@ void qemu_system_reset(ShutdownCause reason) }else {qemu_devices_reset (); } -if (reason) { +if (reason !=SHUTDOWN_CAUSE_GUEST_RESET_FORCE ) {qapi_event_send_reset (shutdown_caused_by_guest (reason), &error_abort); }
vl.c void qemu_system_guest_panicked(GuestPanicInformation *info) · line 1680
Quoted 8 lines
vl.c +1
-1@@ -1674,7 +1674,7 @@ void qemu_system_guest_panicked(GuestPanicInformation *info)void qemu_system_reset_request (ShutdownCause reason) { -if (no_reboot) { +if (no_reboot && reason !=SHUTDOWN_CAUSE_GUEST_RESET_FORCE ) { shutdown_requested = reason; }else { reset_requested = reason;
With whatever name you will end up using for the constant
Signature · 3 lines
Thanks, David / dhildenb