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

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


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Anandu Padinhare <Anandu.Padinhare@xxxxxxxxxxxxxx>
  • Date: Fri, 27 Nov 2026 10:14:21 +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=9FHyFniPgp9lfYLYWs8SoPQ3mAegLG/K8Ho1cP0NzCs=; b=WFJ2OInve+PB978IYYLfW0fb4rRl//O7aKD6XaM3wfWmmZK/fnYeKw3VtgvdIIZwQdRlTG8aChBNV2RUMKzsY0F0z1tU/jn2PlW5L4vwniW+JzFbBOWXUt0e/OtxHHQvBNUVvxvAAJ1ZcJr7vGttaD+K7dVkZ1RarE/iU0Z4FVkBc7ERbQvbsdt4EMAa89IERaeGPzEpPhuOduivZjflGKXiNiRM9W488c+0D9qs1hqqp/A4V1jfHj6LQAa6KTRS506TNcCrNb4Vm/luCEBQ9EHLwl9ky/pZzw96JhwhGLxV81PfAS8ZRAyUzLHDCWGnnZKt9kPl9yXqij+v5AJwjw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nqfuC+Ptksi4W7C0YTtSCSvdYIpewiiwfw/O99y3racClAgeW98XLW+wPgoINTImIqpASiajvWtmD9bHdRch2BzMowVCp6VP4brGfcdU4IYEAA/5es0CaGzFZV7XjUJdgFex5YM5K8oOUlUO+NSx2xpRip77Cpolx/sFmdra3TUR51srExYtbVVhugUHz4l+5wYBm06hh799ceBL0yDGtJ6AWj/1m9znUlNIAZDNd3i9rPKLjy13tlgafqEVt0C9LGlE4a4G7dWFP0LoQ2VjqxAy6QkzCUFwwPNAV3bmNLzrJC/y/cTRQHUSZDzezkj+Kl5y7eUI8QYqzJVjt5cwbA==
  • 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>
  • Delivery-date: Fri, 27 Nov 2026 10:14:48 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Msip_labels:
  • Thread-index: AQHdflcCVjVULQ1VPEqVO8X9w+aVsw==
  • Thread-topic: [PATCH 0/2] 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.

Side effects:
- 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.
- A panic in the RISC-V QEMU smoke test now reboots until the test
  times out. I can add -no-reboot to its QEMU command, as the Arm
  smoke tests do, if that's wanted.

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, and timebase-frequency overridden
in the DT. Not tested on real hardware.

Anandu Padinhare (2):
  xen/riscv: implement udelay()
  xen/riscv: use the SBI SRST extension to reboot in machine_restart()

 xen/arch/riscv/Makefile          |  1 +
 xen/arch/riscv/delay.c           | 17 +++++++++++++++++
 xen/arch/riscv/include/asm/sbi.h | 11 +++++++++++
 xen/arch/riscv/sbi.c             | 21 +++++++++++++++++++++
 xen/arch/riscv/shutdown.c        | 10 +++++-----
 xen/arch/riscv/stubs.c           |  7 -------
 6 files changed, 55 insertions(+), 12 deletions(-)
 create mode 100644 xen/arch/riscv/delay.c


base-commit: 4565af21821a005e8b2e39871c13a4c81c7fb736



 


Rackspace

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