[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v3 0/3] xen/riscv: make machine_restart() reboot


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Anandu Padinhare <Anandu.Padinhare@xxxxxxxxxxxxxx>
  • Date: Fri, 4 Dec 2026 02:52:16 +0000
  • Accept-language: en-IN, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=electrifex.com; dmarc=pass action=none header.from=electrifex.com; dkim=pass header.d=electrifex.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JmX9pMfEDz8lRlpBUdFfwoh+JrSt8czUD7nsVpOkPDo=; b=wmQAME6CIdqxGEfHoD3JEmJYWHvXjWuXVsN+WcKKSlXjskvMwV+TwNyBd1NF1T20JMrr/J7EQrZ5Li7YVKjf5R7z3/+klUGKUh0ZKHVwqJHjVD5um50fZBUo0Wd5VckYK53xWx1EWlLhoJN4wjNWuFpqbFzRRqVlhVSI+dS1thX0yoQXLErUTKT4gbRRUd3PTvLau8yr1/FStaq3qNg/diAp/b6T3tCQQbS4nR6JN9pbCLEihZ++qurWpWhGZYOYUCAk87+YD/O781SxVw/qW8XxzQYqvQP1DaMbcsvVGz4VH7V7/OulLYru6BRBHGaGCtJKkSXI8cS1cENNLIueSQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=TqaKo8ROaDhwVaKYEcCHq3ZmcvU6MDVutnlHK7mkzE40sddJd3Jgdb6fGYx/kVHC8lFQvlnlUzcjzZOPgDMhCzmGnKR+ncpgkSqjc1jlvXUqIEqG93ngBZyJ3i74zgi4IfQ+adXmgZ8CTwk4Q3yL1gBFiTimaLSsTvw03mbBfH6C++ED0qzZ7okIiAhQebDD1gBQECxLSR9e7F3NKaHqEf9jL4VYc0HlG+aAOLYCKglVuWouHs8Nqnk3/ccrZCzyRZZzHkw74xhAv3CWy+HurBKv2XvhFNxSE2xuhoFzVMWwWlxJ5IF9BV77crPAp9IQ39Il6dzYTbCFHgDpQ8X71w==
  • Authentication-results: eu.smtp.expurgate.cloud; none
  • Authentication-results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=electrifex.com;
  • Cc: Alistair Francis <alistair.francis@xxxxxxx>, Baptiste Le Duc <baptiste.le-duc@xxxxxxxxxx>, Connor Davis <connojdavis@xxxxxxxxx>, Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>, "andrew.cooper3@xxxxxxxxxx" <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, "roger@xxxxxxxxxxxxxx" <roger@xxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Doug Goldstein <cardoe@xxxxxxxxxx>
  • Delivery-date: Fri, 04 Dec 2026 02:52:31 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Msip_labels:
  • Thread-index: AQHdg5mmuw46hOvaBEKvNSEU+XeleA==
  • Thread-topic: [PATCH v3 0/3] xen/riscv: make machine_restart() reboot

On RISC-V, machine_restart() ignores its delay and powers off instead
of rebooting, so a panic's "Reboot in five seconds..." ends in an
immediate power-off.

Patch 1 implements udelay() using the time CSR, as Linux does. Until
the timebase frequency is known, it returns without waiting.

Patch 2 uses the SBI SRST extension, when present, to reboot after the
delay. Without SRST, it falls back to the legacy SHUTDOWN call as
before, now after the delay. Like Arm and x86, it calls
console_start_sync() first, so pending console output isn't lost.

Patch 3 passes -no-reboot to QEMU in the RISC-V smoke test. Without
it, a panic there would now reboot until the test times out, instead
of failing the job straight away.

A panic that recurs early in every boot (e.g. "-cpu rv64,svpbmt=off"
on QEMU virt) is now a reboot loop. "noreboot" still powers off.
machine_halt() still uses the legacy SHUTDOWN call. I intend to switch
it to SRST in a follow-up.

Tested on QEMU 10.2.1 virt with OpenSBI v1.8: early and late panics,
"noreboot", SRST missing or failing, timebase-frequency overridden in
the DT, and the smoke test script with a passing and a panicking Xen.
Not tested on real hardware.

Changes in v3:
- Patch 1: move udelay() into time.c (Baptiste).
- Patch 2: separate the reset type and reason definitions and drop
  __func__ from the error message (Baptiste).
- Patch 3: no changes.

Changes in v2:
- Patch 1: reword the commit message and return early when cpu_khz is
  0 (Baptiste).
- Patch 2: call console_start_sync() first and add comments (Baptiste).
- New patch 3: pass -no-reboot to QEMU in the RISC-V smoke test
  (Baptiste).

v1: 
https://lore.kernel.org/xen-devel/MA0PR01MB92178FEAFBB95A225781351CFD412@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/
v2: 
https://lore.kernel.org/xen-devel/MA0PR01MB9217D3268CB5A83F0AB3D6CCFD4C2@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/

Anandu Padinhare (3):
  xen/riscv: implement udelay()
  xen/riscv: use the SBI SRST extension to reboot in machine_restart()
  CI: Pass -no-reboot to QEMU in the RISC-V smoke test

 automation/scripts/qemu-smoke-riscv64.sh |  1 +
 xen/arch/riscv/include/asm/sbi.h         | 13 +++++++++++++
 xen/arch/riscv/sbi.c                     | 21 +++++++++++++++++++++
 xen/arch/riscv/shutdown.c                | 16 +++++++++++-----
 xen/arch/riscv/stubs.c                   |  7 -------
 xen/arch/riscv/time.c                    | 16 ++++++++++++++++
 6 files changed, 62 insertions(+), 12 deletions(-)


base-commit: 0f5037b465b647428b66ba2d413f44315d5b97d0
-- 
2.53.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.