Linux KVM on HiFive Unmatched?

I’d like to run virtual machines with KVM support on HiFive Unmatched. To this end, I installed Ubuntu 21.04 following this instruction, and installed the virt-manager package.

But it seems it doesn’t work. systemctl status libvirtd says:

Jun 28 11:08:28 ubuntu libvirtd[7706]: internal error: Invalid unsigned integer value '-1' in file '/sys/devices/system/cpu/cpu0/topology/core_id'
Jun 28 11:08:30 ubuntu libvirtd[7706]: riscv64 is not supported by the /proc/cpuinfo parser
Jun 28 11:08:30 ubuntu libvirtd[7706]: internal error: Invalid unsigned integer value '-1' in file '/sys/devices/system/cpu/cpu0/topology/core_id'
Jun 28 11:08:30 ubuntu libvirtd[7706]: riscv64 is not supported by the /proc/cpuinfo parser
Jun 28 11:08:30 ubuntu libvirtd[7706]: internal error: Invalid unsigned integer value '-1' in file '/sys/devices/system/cpu/cpu0/topology/core_id'
Jun 28 11:09:29 ubuntu libvirtd[7706]: riscv64 is not supported by the /proc/cpuinfo parser
Jun 28 11:09:29 ubuntu libvirtd[7706]: internal error: Invalid unsigned integer value '-1' in file '/sys/devices/system/cpu/cpu0/topology/core_id'
Jun 28 11:09:40 ubuntu libvirtd[7706]: operation failed: pool 'default' already exists with uuid 25079f52-dbdb-49e2-8631-7a740bdb94b4
Jun 28 11:09:40 ubuntu libvirtd[7706]: riscv64 is not supported by the /proc/cpuinfo parser
Jun 28 11:09:40 ubuntu libvirtd[7706]: internal error: Invalid unsigned integer value '-1' in file '/sys/devices/system/cpu/cpu0/topology/core_id'

I wonder if (1) HiFive Unmatched supports KVM; and (2) if so, how can I use it. Thanks in advance!

Looks like KVM on RISC-V is a ways off.

1 Like

You can follow the instructions here to experiment with the current draft extension in QEMU:

2 Likes

Isn’t KVM meant for systems with hardware acceleration for virtualisation? As far as I know the CPU on the Unmatched doesn’t have the V-extension.

The V-extension is for the vector instructions. This is for Single Instruction Multiple Data (SIMD) instructions which are used to process large datasets that need the same operations applied to the whole dataset, similar-ish to the AVX instructions on x86 CPUs. I’m not sure how hardware accelerated virtualization is going to be implemented on RISC-V, but I believe virtualization is intended to be implement as part of the privileged specification at the supervisor level. The preface to the privileged specification says there is a hypervisor extension in draft, so I imagine that is not included in the Unmatched. However even if the Unmatched lacks hardware support, that shouldn’t prevent virtualization outright, but it might limit performance somewhat.

Standard RISC-V is fully virtualizable using the traditional technique of running the virtualized OS in User mode and trapping and emulating use of supervisor mode instructions and registers.

3 Likes

I’m sorry, I was mistaken about the extension. I thought there was a specific hypervisor extension, but I can’t find it in the ISA documentation. Good to know that virtualisation can be done :slight_smile: .

Draft 0.6.1 of the Hypervisor spec is included in the latest ISA docs snapshot from early June

https://github.com/riscv/riscv-isa-manual/releases/download/draft-20210612-98f3349/riscv-privileged.pdf

1 Like