|
|
Log in / Subscribe / Register

Add QEMU virt-ctrl driver and update m68k virt

From:  Kuan-Wei Chiu <visitorckw-AT-gmail.com>
To:  geert-AT-linux-m68k.org, sre-AT-kernel.org
Subject:  [PATCH v2 0/2] Add QEMU virt-ctrl driver and update m68k virt
Date:  Tue, 03 Feb 2026 17:08:22 +0000
Message-ID:  <20260203170824.2968045-1-visitorckw@gmail.com>
Cc:  jserv-AT-ccns.ncku.edu.tw, eleanor15x-AT-gmail.com, daniel-AT-0x0f.com, linux-kernel-AT-vger.kernel.org, linux-m68k-AT-lists.linux-m68k.org, linux-pm-AT-vger.kernel.org, Kuan-Wei Chiu <visitorckw-AT-gmail.com>
Archive-link:  Article

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)' and
'reboot(LINUX_REBOOT_CMD_POWER_OFF)' from userspace.

Link: https://gitlab.com/qemu-project/qemu/-/blob/v10.2.0/hw/mi... [1]
---
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.

v1: https://lore.kernel.org/lkml/20260112182258.1851769-1-vis...

Kuan-Wei Chiu (2):
  power: reset: Add QEMU virt-ctrl driver
  m68k: virt: Switch to qemu-virt-ctrl driver

 MAINTAINERS                          |  6 ++
 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 | 89 ++++++++++++++++++++++++++++
 6 files changed, 124 insertions(+), 44 deletions(-)
 create mode 100644 drivers/power/reset/qemu-virt-ctrl.c

-- 
2.53.0.rc1.225.gd81095ad13-goog




Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds