Add RPMI support for the RISC-V server reference platform by wiring the
existing RISC-V RPMI device and FDT helpers into the riscv-server-ref
machine.

The series enables Base, System Reset, HSM, and System Suspend service
groups for riscv-server-ref.  When QEMU is built with librpmi support,
the riscv-server-ref machine always advertises reset, shutdown, HSM, and
suspend through RPMI and has no rpmi=on|off machine option.

If librpmi is not enabled in a default riscv64-softmmu build, configure
warns that riscv-server-ref will be built without RPMI support and
continues so RISC-V machines that do not require RPMI still build without
librpmi.  Booting riscv-server-ref from such a build also emits a warning
that RPMI support is not compiled in.

Dependencies:
- Daniel Henrique Barboza's prerequisite server reference board series:
  [PATCH v9 0/5] hw/riscv: Server Platform Reference Board
  
https://lore.kernel.org/qemu-devel/[email protected]/
- RPMI virt prerequisite:
  [PATCH v10 00/10] riscv: add initial RPMI virt support
  
https://lore.kernel.org/qemu-devel/[email protected]/

Public branch for this exact stack:
https://github.com/slingappa/qemu/tree/server-ref-platform

The PR/review branch is based on a replay of the RPMI virt support on
top of Daniel's server-ref v9 branch:
https://github.com/slingappa/qemu/tree/server-ref-platform-base

Testing:
- Built riscv64-softmmu with librpmi.
- Ran focused RPMI qtests:
  - qemu:qtest-riscv64/riscv-rpmi-virt-test: 18 subtests passed
  - qemu:qtest-riscv64/riscv-rpmi-server-ref-test: 15 subtests passed
- Built riscv64-softmmu without librpmi.
- Checked that riscv-server-ref boots from the no-librpmi build and
  reports that RPMI support is not compiled in.
- Booted riscv-server-ref Linux guest and checked OpenSBI, Linux, board
  model, e1000e, and init startup console messages.
- Booted riscv-server-ref Linux guest to login prompt and validated
  RPMI-backed poweroff, reboot, and suspend/wakeup from the guest console.

Subrahmanya Lingappa (2):
  hw/riscv: add RPMI support for server reference platform
  tests/qtest: split RISC-V RPMI tests by machine

 MAINTAINERS                              |   2 +-
 docs/system/riscv/riscv-server-ref.rst   |  41 ++
 hw/riscv/Kconfig                         |   1 +
 hw/riscv/server_platform_ref.c           | 146 ++++++-
 meson.build                              |   4 +
 tests/qtest/meson.build                  |   4 +-
 tests/qtest/riscv-rpmi-server-ref-test.c |  36 ++
 tests/qtest/riscv-rpmi-test.c            | 476 ++++++++++++-----------
 tests/qtest/riscv-rpmi-test.h            | 131 +++++++
 tests/qtest/riscv-rpmi-virt-test.c       |  45 +++
 10 files changed, 659 insertions(+), 227 deletions(-)
 create mode 100644 tests/qtest/riscv-rpmi-server-ref-test.c
 create mode 100644 tests/qtest/riscv-rpmi-test.h
 create mode 100644 tests/qtest/riscv-rpmi-virt-test.c


base-commit: 8e3bcd4648eea7e4f38781308eff13cbf828ae82
-- 
2.43.0

Reply via email to