Add hardware information service for host-to-guest data passing#1380
Add hardware information service for host-to-guest data passing#1380brianmcgillion merged 4 commits intotiiuae:mainfrom
Conversation
Introduces a service for passing hardware information from host systems to guest VMs using QEMU's fw_cfg interface. Detects NVMe serial numbers and MAC addresses on the host and makes them available to guest VMs. The implementation is cross-platform and integrates with Ghaf's microvm infrastructure. Signed-off-by: Julius Koskela <julius.koskela@unikie.com> Signed-off-by: juliuskoskela <julius@koskela.email>
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a hardware information service that enables passing hardware data from host systems to guest VMs using QEMU's fw_cfg interface. The service collects NVMe serial numbers and MAC addresses on the host and makes them accessible to guest VMs through a cross-platform mechanism.
Key changes:
- Implements host-side hardware detection service that generates JSON files with system information
- Adds guest-side service for reading hardware information via QEMU fw_cfg interface
- Enables the service specifically for the net-vm on Jetson AGX target
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| modules/reference/hardware/jetpack/agx/orin-agx.nix | Enables hwinfo service on host and configures net-vm to receive hardware data via fw_cfg |
| modules/common/services/hwinfo/host.nix | Host service that detects NVMe serial, MAC address, hostname and generates JSON output |
| modules/common/services/hwinfo/guest.nix | Guest service providing tools to read hardware information from fw_cfg interface |
| modules/common/services/hwinfo/default.nix | Module entry point importing both host and guest services |
| modules/common/services/default.nix | Adds hwinfo module to common services imports |
|
I have not had a chance to review this patch yet, but it reminded me of a feature we are following. https://lists.gnu.org/archive/html/qemu-devel/2025-08/msg04138.html This improved version of the patch set will replace the patches that we currently carry. https://github.com/tiiuae/ghaf/blob/main/overlays/custom-packages/qemu/acpi-devices-passthrough-qemu-8.1.patch Interesting how these hw events and statuses are shared in the new qemu API. More of a discussion point for later |
Apply the same hardware info service configuration already present in AGX to both AGX64 and NX platforms for consistency. Signed-off-by: juliuskoskela <julius.koskela@unikie.com>
emrahbillur
left a comment
There was a problem hiding this comment.
There was agx64 and nx targets missing where it is now added. I tested all agx, nx and agx64 targets with this PR and now it works.
|
If this pull request is not urgent, I recommend enabling |
Some extra considerations.
|
I think fog-ghaf needs this relatively urgently. What's the state of givc on Jetson? Last time I checked it wasn't ready, but that's some months ago. |
AFAIK, there are still some cross compilation issues when enabling |
|
A note on doing this with |
|
Please rebase and address |
- Replace writeScriptBin with writeShellApplication for better dependency management - Use lib.getExe for systemd service scripts - Replace string concatenation with jq for JSON generation - Fix shellcheck warnings (useless cat, ls usage) - Add proper runtime inputs for all dependencies These changes address review feedback and improve code quality. Signed-off-by: Julius Koskela <julius.koskela@unikie.com>
da52b78 to
5234732
Compare
|
Review comments have been taken into account and branch has been rebased. |
|
Something failed in the pipeline, investigating. |
Orin-AGX test devices were offline on Friday afternoon for some reason. All tests passed on rerun. |
Description of Changes
Introduces a service for passing hardware information from host systems to guest VMs using QEMU's fw_cfg interface. Detects NVMe serial numbers and MAC addresses on the host and makes them available to guest VMs.
The implementation is cross-platform and integrates with Ghaf's microvm infrastructure.
Implementation Details
ghaf.services.hwinfomodule for host systems that automatically detects and exports hardware informationghaf.services.hwinfo-guestmodule for guest VMs to read the hardware information-fw_cfgQEMU argumentTechnical Considerations
Initially attempted to use ACPI table injection via
-acpitablefor this feature, but discovered it is not supported on ARM architectures in QEMU. The error "Option not supported for this target" occurs even with ACPI enabled on the virt machine. Implementing ACPI table injection for ARM would require upstream changes to both QEMU and potentially the microvm framework. The fw_cfg approach was chosen as it provides a clean, cross-platform solution that works on all supported architectures.Type of Change
Related Issues / Tickets
None
Checklist
make-checksand it passesTesting Instructions
Applicable Targets
aarch64aarch64x86_64x86_64x86_64Installation Method
nixos-rebuild ... switchTest Steps To Verify:
# In net-vm sudo read-hwinfoNotes
qemu_fw_cfg) must be loaded in the guestEnabling for Other Targets and VMs
To enable this service on other targets or guest VMs:
Enable host service in the target hardware configuration:
For each guest VM, add to the VM's
extraModules:This approach works identically on both ARM and x86_64 targets.