Repository navigation
vhost: add openRuyi Server RISC-V support - #38
chengchen512 wants to merge 2 commits into
Conversation
|
@codex review |
|
To use Codex here, create a Codex account and connect to github. |
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
| binary: build/qemu/qemu-system-riscv64 | ||
| memory: 4G | ||
| cpus: 2 | ||
| accel: tcg |
There was a problem hiding this comment.
Follow-up suggestion: once a RISC-V host with working KVM support is available, could we probe the host's capabilities and prefer KVM with a matching CPU configuration? Keeping TCG for the current x86-hosted setup is fine; this can be handled as follow-up work rather than a requirement for this PR.
| - id: uefi-code | ||
| path: build/firmware/openruyi/RISCV_VIRT_CODE.fd | ||
| format: raw | ||
| bus: pflash |
There was a problem hiding this comment.
Could you clarify why openRuyi uses UEFI/pflash instead of exporting its kernel and using the existing direct-boot flow with -kernel, as the Ubuntu recipe does? Is there a requirement from the distribution, GPU initialization, or PCIe BAR allocation that makes UEFI necessary?
If there is no such requirement, I would prefer to reuse the existing boot flow to reduce firmware-build and variable-store maintenance. If UEFI is necessary, please document the constraint and why the firmware-related extensions to resources/vhosts/qemu.yaml and resources/images/packer/qemu.pkr.hcl are needed.
There was a problem hiding this comment.
Thanks for the question. The UEFI path is only used during Packer provisioning to boot the official openRuyi Server QCOW2, which ships with an EFI bootloader. The simulation runtime has been switched to direct kernel boot using OpenSBI and QEMU's -kernel option, as described in the updated PR description. Testing confirmed the Linux kernel handles BAR allocation and VBIOS reading without UEFI, so the pflash/VARS overlays are no longer needed at simulation time. The firmware paths in qemu.pkr.hcl are retained solely for provisioning the stock image.
There was a problem hiding this comment.
Please also add vhost-riscv to the built-in profiles section in this page and its Chinese counterpart, docs/zh/topology/hosts/index.rst. Both pages still describe five profiles and omit the new one. Please update the stated count and describe the RISC-V QEMU executable, TCG/CPU settings, and guest RAM mapping.
| {% set drivers = {"virtio": "virtio-blk-pci", "nvme": "nvme", | ||
| "scsi": "scsi-hd", "ide": "ide-hd"} %} | ||
| {% for disk in disks %} | ||
| {% if disk.bus == "pflash" %} |
There was a problem hiding this comment.
This is the shared runtime-template extension related to the boot-flow discussion. Could openRuyi reuse the existing exported-kernel/direct-boot flow, or is firmware boot required at runtime? Please clarify that constraint before retaining this additional boot path.
| disk_interface = var.architecture == "riscv64" ? "virtio" : "ide" | ||
| net_device = var.architecture == "riscv64" ? "virtio-net-pci" : "e1000" | ||
| disable_vnc = var.architecture == "riscv64" | ||
| efi_boot = var.efi_firmware_code != "" |
There was a problem hiding this comment.
Related to the boot-flow discussion: does the openRuyi base image require EFI to boot the provisioning VM? Please explain this separately from the simulation-session boot choice. Unifying runtime boot with the existing -kernel flow would not necessarily remove the need for these Packer EFI settings.
|
@codex review this PR thoroughly |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
zevorn
left a comment
There was a problem hiding this comment.
I don't have many review comments right now. Let's prioritize fixing the issues we've already found. Thanks.
zevorn
left a comment
There was a problem hiding this comment.
We need to split this PR into two commits:
- The first commit includes the code changes explaining why they were made, the issues resolved, and some planned targets. This serves as the basic feature.
- The second commit explains the addition of a new platform, for example, OpenSBI for the RISC-V platform (or openRuyi for the RISC-V platform).
The second commit depends on the first, and every commit is an atomic patch. This will give us a clear patch series that is easy for other maintainers to review.
QEMU builds assume the emulation target matches the host ISA and require vfio-user server support even when a cross target only provides a client. The image entry point fixes the Ubuntu recipe and kernel verification assumes ELF, preventing reuse for RISC-V Linux Images. Allow target and recipe selection while keeping existing defaults. Retain configured QEMU targets and check optional server support from generated per-target features. Recognize the RISC-V Image header and read optional provisioning firmware paths from existing recipe metadata. Add a distribution-independent TCG vHost profile with RAM at 0x80000000. Advance gem5 to upstream merge ddd3efc for the RISC-V GPU fixes. This provides the foundation for OpenRuyi Server and other RISC-V images. A native RISC-V/KVM profile can reuse these feature checks after host capability and matching CPU selection are validated. Validation: both QEMU targets, image unit tests, bilingual documentation, ShellCheck, maintainer coverage and checkpatch. Signed-off-by: chengchen512 <2497083717@qq.com>
Add the official openRuyi Server 2026.09 RVA23 QCOW2 recipe in the existing image-recipe hierarchy. Install native ROCm/HIP 7.2.4 through DNF and export package and compiler version records. Packer provisions the stock disk with QEMU's bundled EDK II and exports its kernel. Simulation sessions use the existing OpenSBI/direct-kernel flow with a VirtIO root disk at /dev/vda2. Keep 4 GiB RAM, 4 GiB VRAM, two vCPUs and four compute units. Use the preceding reusable RISC-V support, add the platform memory-map test, and document build, login, rocm-smi and native HIP use in Chinese and English. Validation: direct-kernel GPU/HIP execution, default-device Packer boot with NoCloud/SSH and Ansible checks, Rust checks, bilingual documentation, maintainer coverage and checkpatch. Signed-off-by: chengchen512 <2497083717@qq.com>
a25f44a to
3918105
Compare
|
I have updated the PR based on the review: Simulation now uses direct kernel boot (-kernel + OpenSBI); UEFI/pflash is limited to Packer provisioning of the stock QCOW2. The QEMU build script now checks CONFIG_VFIO_USER_SERVER from the generated per-target configuration, so a RISC-V vHost only requires the vfio-user client instead of failing on the server check. Commit split into two atomic patches as requested. vhost-riscv added to both English and Chinese documentation. |
|
Thanks for the update. The direct-kernel boot flow, provisioning-only EFI setup, and updated documentation address my comments. As a follow-up, we could publish prebuilt vHost images together with matching kernels and checksums, so users can download, verify, and launch them directly. Recipes and Packer would remain available for rebuilding and updating the images. |
zevorn
left a comment
There was a problem hiding this comment.
we need a ci for openruyi vhost also
Summary
This PR adds openRuyi Server 2026.09 as a RISC-V vHost with native ROCm/HIP 7.2.4.
The implementation uses the current image recipe and topology structure. The machine uses 4 GiB RAM, 4 GiB VRAM, two vCPUs, and four compute units.
Commit 1: Prepare reusable RISC-V support
QEMU build
The previous build command selected the QEMU target from the host architecture. The command now accepts a target argument.
scripts/host/build.shkeeps the targets already in the build configuration. This permits x86_64 and riscv64 binaries in the same build directory.The previous script required
x-vfio-user-serverfor every target. A RISC-V vHost needs thevfio-user-pciclient.In a cross-build on x86_64, the riscv64 target has no KVM support. The server depends on
MULTIPROCESS, which requires KVM. Thus, the previous server check rejected a valid riscv64 build.The script now reads
CONFIG_VFIO_USER_SERVERfrom the generated configuration for the target. It requires the server only when that feature is enabled. It always requires the client.Image build
The previous image build command selected the Ubuntu recipe.
just build-rocm-assetsnow accepts a recipe argument and keeps Ubuntu as the default.The official openRuyi Server QCOW2 contains an EFI bootloader and its kernel. Packer uses QEMU's bundled EDK II firmware to start this disk.
This method uses the bootloader supplied with the image. It avoids a separate kernel extraction step before image preparation.
resources/images/packer/qemu.pkr.hclnow accepts optional EFI firmware paths. The recipe supplies these paths through the current[provision.files]mapping.After software installation, the recipe exports the installed kernel for simulation.
The previous bundle verification used
readelfand required an ELF kernel. The openRuyi kernel uses the RISC-V LinuxImageformat.resources/images/bundle.pynow identifies the RISC-VImageheader. Other kernel formats continue through the previous ELF verification path.Shared resources
vhost-riscvprofile with TCG, AIA, Sv48, and guest RAM at0x80000000.Commit 2: Add the openRuyi Server platform
resources/images/recipes/openruyi/2026.09/riscv64/rocm/7.2.4/.Simulation boot
Simulation uses OpenSBI and the exported kernel through QEMU's
-kerneloption.The kernel mounts the VirtIO root disk at
/dev/vda2. EFI firmware is part of image preparation, not the simulation boot path.Test results
The following tests passed:
The image tests and documentation tests also passed with the first commit alone.
Manual test
Run these commands from the repository root:
Start the simulation with a new run directory:
Connect to the serial console from another terminal:
Log in with the official Server account:
rootopenruyiLoad the GPU driver:
Run the GPU and compiler checks:
Compile a HIP program inside the guest:
Run the program: