From: Helge Deller <deller@gmx.de>
To: linux-parisc@vger.kernel.org
Subject: [PATCH] parisc: Add qemu power-off handler
Date: Sun, 8 Oct 2023 23:54:39 +0200 [thread overview]
Message-ID: <ZSMlH4LkRTbOt8xr@p100> (raw)
When running on qemu, use the artificial "system halt" instruction
to power the system off.
Signed-off-by: Helge Deller <deller@gmx.de>
diff --git a/arch/parisc/kernel/setup.c b/arch/parisc/kernel/setup.c
index 2f434f2da185..c934ec47d915 100644
--- a/arch/parisc/kernel/setup.c
+++ b/arch/parisc/kernel/setup.c
@@ -25,6 +25,7 @@
#include <linux/sched.h>
#include <linux/sched/clock.h>
#include <linux/start_kernel.h>
+#include <linux/reboot.h>
#include <asm/cacheflush.h>
#include <asm/processor.h>
@@ -235,6 +236,13 @@ static int __init parisc_init_resources(void)
return 0;
}
+static int qemu_power_off(struct sys_off_data *data)
+{
+ /* call qemu artificial "system halt" instruction */
+ asm volatile(".word 0xfffdead0": : :"memory");
+ return NOTIFY_DONE;
+}
+
static int __init parisc_init(void)
{
u32 osid = (OS_ID_LINUX << 16);
@@ -242,6 +250,11 @@ static int __init parisc_init(void)
parisc_init_resources();
do_device_inventory(); /* probe for hardware */
+ /* register QEMU power off function */
+ if (running_on_qemu)
+ register_sys_off_handler(SYS_OFF_MODE_POWER_OFF,
+ SYS_OFF_PRIO_DEFAULT, qemu_power_off, NULL);
+
parisc_pdc_chassis_init();
/* set up a new led state on systems shipped LED State panel */
reply other threads:[~2023-10-08 21:54 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=ZSMlH4LkRTbOt8xr@p100 \
--to=deller@gmx.de \
--cc=linux-parisc@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.