Hi all!
I boot an arm64 Linux kernel using GEM5 v20.0.0.0, using the following script:
# Current directory is gem5/
./build/ARM/gem5.opt configs/example/arm/fs_bigLITTLE.py \
--caches --cpu-type=atomic \
--bootloader="${IMG_ROOT}/binaries/boot.arm64" \
--disk=${DISK} \
--kernel=${KERNEL}
```sh
I try using KVM on that Linux. I use the script in `https://github.com/Lenz-K/arm64-kvm-hello-world`, and `qemu-system-aarch64 -machine virt -cpu host --enable-kvm -kernel vmlinux ...`.
GEM5 feature 'VIRTUALIZATION' is enabled as default, but 'FEAT_VHE' is not. By the way, is this problem `https://www.mail-archive.com/gem5-users@gem5.org/msg20708.html` fixed?
Without VHE, I still cannot use KVM. The executing trace is:
https://gem5.googlesource.com/arm/linux/+/refs/heads/gem5/v4.14/virt/kvm/arm/arm.c#702
https://gem5.googlesource.com/arm/linux/+/refs/heads/gem5/v4.14/arch/arm64/kvm/hyp.S#44: __kvm_call_hyp (without VHE, it will execute hvc)
https://gem5.googlesource.com/arm/linux/+/refs/heads/gem5/v4.14/arch/arm64/kvm/hyp/entry.S#56: __guest_enter
The last instruction of `__guest_enter` is eret and the guest is back. GDB shows that the guest stalls on one PC and the Linux continues executing as the above trace.
There is a warning from GEM5:
build/ARM/arch/arm/isa.cc:2144: warn: Doing AT (address translation) in functional mode! Fix Me!
So I try using `--cpu-type=timing` instead of `--cpu-type=atomic`. But KVM fails to initialize.
[ 0.000153] arch_timer: Unable to find a suitable frame in timer @ 0x000000002a810000
[ 0.000223] Failed to initialize '/timer@2a810000': -22
...
[ 0.168868] kvm [1]: vgic interrupt IRQ1
[ 0.168895] kvm [1]: kvm_arch_timer: uninitialized timecounter
To conclude, my question is:
1. Can Linux running on GEM5 use KVM (in VHE or non-VHE)?
2. How to solve the issue of `fail to initialze arch_timer`?
Best Regards,
Yifan Tan