* [PATCH] hw: debugexit: use runstate API instead of plain exit()
@ 2024-05-23 7:09 Thomas Weißschuh
2024-05-27 16:43 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Weißschuh @ 2024-05-23 7:09 UTC (permalink / raw)
To: Michael S. Tsirkin, Paolo Bonzini; +Cc: qemu-devel, Thomas Weißschuh
Directly calling exit() prevents any kind of management or handling.
Instead use the corresponding runstate API.
The default behavior of the runstate API is the same as exit().
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
---
hw/misc/debugexit.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/hw/misc/debugexit.c b/hw/misc/debugexit.c
index ab6de69ce72f..c5c562fd9357 100644
--- a/hw/misc/debugexit.c
+++ b/hw/misc/debugexit.c
@@ -12,6 +12,7 @@
#include "hw/qdev-properties.h"
#include "qemu/module.h"
#include "qom/object.h"
+#include "sysemu/runstate.h"
#define TYPE_ISA_DEBUG_EXIT_DEVICE "isa-debug-exit"
OBJECT_DECLARE_SIMPLE_TYPE(ISADebugExitState, ISA_DEBUG_EXIT_DEVICE)
@@ -32,7 +33,8 @@ static uint64_t debug_exit_read(void *opaque, hwaddr addr, unsigned size)
static void debug_exit_write(void *opaque, hwaddr addr, uint64_t val,
unsigned width)
{
- exit((val << 1) | 1);
+ qemu_system_shutdown_request_with_code(SHUTDOWN_CAUSE_GUEST_SHUTDOWN,
+ (val << 1) | 1);
}
static const MemoryRegionOps debug_exit_ops = {
---
base-commit: 7e1c0047015ffbd408e1aa4a5ec1abe4751dbf7e
change-id: 20240523-debugexit-22e7587adbeb
Best regards,
--
Thomas Weißschuh <thomas@t-8ch.de>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] hw: debugexit: use runstate API instead of plain exit()
2024-05-23 7:09 [PATCH] hw: debugexit: use runstate API instead of plain exit() Thomas Weißschuh
@ 2024-05-27 16:43 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 2+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-05-27 16:43 UTC (permalink / raw)
To: Thomas Weißschuh, Michael S. Tsirkin, Paolo Bonzini; +Cc: qemu-devel
On 23/5/24 09:09, Thomas Weißschuh wrote:
> Directly calling exit() prevents any kind of management or handling.
> Instead use the corresponding runstate API.
> The default behavior of the runstate API is the same as exit().
>
> Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
> ---
> hw/misc/debugexit.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-05-27 16:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-23 7:09 [PATCH] hw: debugexit: use runstate API instead of plain exit() Thomas Weißschuh
2024-05-27 16:43 ` Philippe Mathieu-Daudé
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).