On Tue, Mar 15, 2022 at 12:18 PM Alistair Francis <alistai...@gmail.com> wrote: > > On Sun, Mar 13, 2022 at 12:12 PM Ralf Ramsauer > <ralf.ramsa...@oth-regensburg.de> wrote: > > > > Hi, > > > > I'm trying to run Linux/QEMU+KVM inside an emulated > > qemu-system-riscv64 VM (x86 host). On latest&greatest QEMU (1416688c53), > > I run Linux inside QEMU. On host side: > > > > qemu-system-riscv64 -nographic \ > > -machine virt \ > > -cpu 'rv64,h=true' \ > > -smp 8 -m 8G \ > > -bios $latest_opensbi \ > > -kernel $latest_upstream_linux \ > > […snip…] > > > > Inside that machine, I boot Linux with KVM enabled: > > > > […] > > [ 0.228939] kvm [1]: hypervisor extension available > > [ 0.229000] kvm [1]: using Sv48x4 G-stage page table format > > [ 0.229033] kvm [1]: VMID 14 bits available > > […] > > > > KVM seems to load correctly. Inside that machine, I compiled QEMU from > > the same sources with the KVM accelerator enabled. When I try to start > > QEMU with KVM enabled, I get > > > > ./qemu-system-riscv64 -nographic \ > > -monitor none \ > > -machine virt \ > > -smp 1 -m 1G \ > > -bios ./pc-bios/opensbi-riscv64-generic-fw_dynamic.bin \ > > -serial stdio \ > > -enable-kvm
The QEMU RISC-V KVM support is quite new so I haven't got a chance to play with it. Nevertheless, we should not pass any firmware when using KVM so can you try "-bios none" ? Regards, Anup > > > > [ 4860.559194] kvm [9942]: VCPU exit error -95 > > [ 4860.584262] kvm [9942]: SEPC=0x0 SSTATUS=0x200004120 HSTATUS=0x2002001c0 > > [ 4860.586839] kvm [9942]: SCAUSE=0x14 STVAL=0x0 HTVAL=0x0 HTINST=0x0 > > > > on the ringbuffer, together with a register dump of qemu [1] on the > > console. Needless to say, but without -enable-kvm, it works fine. > > > > As far as I see that, SCAUSE=0x14 reports a 'Instruction Guest PF', > > which would be kind of correct, if the guest's PC really tries to > > execute at phys 0x0. DRAM of the 'virt' machine definition should start > > at 0x80000000, where OpenSBI resides. So I wonder if an erroneous reset > > PC might be the culprit… > > > > Before digging deeper into that issue, I wanted to ask if Qemu/KVM > > inside an emulated riscv64+H-extension is actually supported, or if this > > is a known bug and has some ongoing work. > > RISC-V KVM should work. I haven't had a chance to try it myself though. > > I have CCed two people who hopefully can help. > > Alistair > > > > > Thanks > > Ralf > > > > [1] > > > > pc 0000000000000000 > > mhartid 0000000000000000 > > mstatus 0000000200000000 > > mip 0000000000000000 > > mie 0000000000000000 > > mideleg 0000000000000000 > > medeleg 0000000000000000 > > mtvec 0000000000000000 > > stvec 0000000000000000 > > mepc 0000000000000000 > > sepc 0000000000000000 > > mcause 0000000000000000 > > scause 0000000000000000 > > mtval 0000000000000000 > > stval 0000000000000000 > > mscratch 0000000000000000 > > sscratch 0000000000000000 > > satp 0000000000000000 > > x0/zero 0000000000000000 x1/ra 0000000000000000 x2/sp > > 0000000000000000 x3/gp 0000000000000000 > > x4/tp 0000000000000000 x5/t0 0000000000000000 x6/t1 > > 0000000000000000 x7/t2 0000000000000000 > > x8/s0 0000000000000000 x9/s1 0000000000000000 x10/a0 > > 0000000000000000 x11/a1 00000000bf000000 > > x12/a2 0000000000000000 x13/a3 0000000000000000 x14/a4 > > 0000000000000000 x15/a5 0000000000000000 > > x16/a6 0000000000000000 x17/a7 0000000000000000 x18/s2 > > 0000000000000000 x19/s3 0000000000000000 > > x20/s4 0000000000000000 x21/s5 0000000000000000 x22/s6 > > 0000000000000000 x23/s7 0000000000000000 > > x24/s8 0000000000000000 x25/s9 0000000000000000 x26/s10 > > 0000000000000000 x27/s11 0000000000000000 > > x28/t3 0000000000000000 x29/t4 0000000000000000 x30/t5 > > 0000000000000000 x31/t6 0000000000000000 > >