From: Kuan-Wei Chiu <visitorckw@gmail.com>
To: geert@linux-m68k.org, sre@kernel.org
Cc: jserv@ccns.ncku.edu.tw, eleanor15x@gmail.com, daniel@0x0f.com,
laurent@vivier.eu, linux-kernel@vger.kernel.org,
linux-m68k@lists.linux-m68k.org, linux-pm@vger.kernel.org,
Kuan-Wei Chiu <visitorckw@gmail.com>
Subject: [PATCH v3 0/2] Add QEMU virt-ctrl driver and update m68k virt
Date: Sun, 22 Feb 2026 17:32:23 +0000 [thread overview]
Message-ID: <20260222173225.1105572-1-visitorckw@gmail.com> (raw)
Introduce a generic platform driver for the QEMU 'virt-ctrl' device [1]
and transitions the m68k 'virt' machine to use it, replacing
architecture-specific hooks.
The new driver ('qemu-virt-ctrl') registers a restart handler and
populates the global 'pm_power_off' callback.
On the m68k side, the platform initialization is updated to register
the 'qemu-virt-ctrl' platform device. Additionally, the 'mach_reset'
hook is bridged to 'do_kernel_restart()' to ensure the kernel's restart
handler chain is correctly invoked.
Verified on QEMU m68k virt. Both system reset and power-off were
confirmed functional by invoking 'reboot(LINUX_REBOOT_CMD_RESTART)',
'reboot(LINUX_REBOOT_CMD_POWER_OFF)', and
'reboot(LINUX_REBOOT_CMD_HALT)' from userspace.
Link: https://gitlab.com/qemu-project/qemu/-/blob/v10.2.0/hw/misc/virt_ctrl.c [1]
---
Changes in v3:
- Add a reboot notifier in the driver to handle LINUX_REBOOT_CMD_HALT.
- Handle native endianness in the driver instead of hardcoding
big-endian I/O writes.
- Select POWER_RESET and POWER_RESET_QEMU_VIRT_CTRL in m68k
Kconfig.machine.
Changes in v2:
- Use devm_register_sys_off_handler() instead of register_restart_handler()
and global pm_power_off.
- Switch Kconfig to tristate to support modular build.
- Add .id_table to platform_driver and use MODULE_DEVICE_TABLE() to correct
module auto-loading.
v2: https://lore.kernel.org/lkml/20260203170824.2968045-1-visitorckw@gmail.com/
v1: https://lore.kernel.org/lkml/20260112182258.1851769-1-visitorckw@gmail.com/
Kuan-Wei Chiu (2):
power: reset: Add QEMU virt-ctrl driver
m68k: virt: Switch to qemu-virt-ctrl driver
MAINTAINERS | 6 ++
arch/m68k/Kconfig.machine | 2 +
arch/m68k/virt/config.c | 42 +--------
arch/m68k/virt/platform.c | 20 ++++-
drivers/power/reset/Kconfig | 10 +++
drivers/power/reset/Makefile | 1 +
drivers/power/reset/qemu-virt-ctrl.c | 122 +++++++++++++++++++++++++++
7 files changed, 159 insertions(+), 44 deletions(-)
create mode 100644 drivers/power/reset/qemu-virt-ctrl.c
--
2.53.0.345.g96ddfc5eaa-goog
next reply other threads:[~2026-02-22 17:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-22 17:32 Kuan-Wei Chiu [this message]
2026-02-22 17:32 ` [PATCH v3 1/2] power: reset: Add QEMU virt-ctrl driver Kuan-Wei Chiu
2026-04-02 21:52 ` Sebastian Reichel
2026-04-08 9:10 ` Geert Uytterhoeven
2026-04-08 9:10 ` Geert Uytterhoeven
2026-02-22 17:32 ` [PATCH v3 2/2] m68k: virt: Switch to qemu-virt-ctrl driver Kuan-Wei Chiu
2026-04-08 1:17 ` Kuan-Wei Chiu
2026-04-08 9:12 ` Geert Uytterhoeven
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=20260222173225.1105572-1-visitorckw@gmail.com \
--to=visitorckw@gmail.com \
--cc=daniel@0x0f.com \
--cc=eleanor15x@gmail.com \
--cc=geert@linux-m68k.org \
--cc=jserv@ccns.ncku.edu.tw \
--cc=laurent@vivier.eu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.org \
--cc=linux-pm@vger.kernel.org \
--cc=sre@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.