qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* QEMU+KVM on RISC-V + Hypervisor Extension
@ 2022-03-13  2:12 Ralf Ramsauer
  2022-03-15  6:48 ` Alistair Francis
  0 siblings, 1 reply; 14+ messages in thread
From: Ralf Ramsauer @ 2022-03-13  2:12 UTC (permalink / raw)
  To: qemu-devel; +Cc: Stefan Huber

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

[ 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.

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


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2022-03-23 17:06 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-13  2:12 QEMU+KVM on RISC-V + Hypervisor Extension Ralf Ramsauer
2022-03-15  6:48 ` Alistair Francis
2022-03-15  8:33   ` Anup Patel
2022-03-15 12:17     ` [EXT] " Ralf Ramsauer
2022-03-15 12:25       ` Anup Patel
2022-03-15 12:44         ` Ralf Ramsauer
2022-03-15 12:42       ` Peter Maydell
2022-03-15 12:51         ` Ralf Ramsauer
2022-03-16 22:23           ` Alistair Francis
2022-03-17  9:45             ` Peter Maydell
2022-03-19 12:24               ` Ralf Ramsauer
2022-03-21  5:43               ` Alistair Francis
2022-03-21 20:47                 ` Palmer Dabbelt
2022-03-23 17:05                   ` Ralf Ramsauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).