At least on Qemu, we might have the case that external interrupts stuck pending in hip when enabling the hypervisor. This happens, if a IRQ is set pending before it got migrated to the guest. This might be a misbehaviour in Qemu.
Signed-off-by: Ralf Ramsauer <ralf.ramsa...@oth-regensburg.de> --- hypervisor/arch/riscv/setup.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hypervisor/arch/riscv/setup.c b/hypervisor/arch/riscv/setup.c index 62911055..32d5b4da 100644 --- a/hypervisor/arch/riscv/setup.c +++ b/hypervisor/arch/riscv/setup.c @@ -189,6 +189,7 @@ void __attribute__ ((noreturn)) arch_cpu_activate_vmm(void) * well as MSIs) are migrated, and we can safely migrate all pending * IRQs from the old S-Mode file to the VS-File. */ + if (csr_read(CSR_HSTATUS) & HSTATUS_VGEIN) { imsic_migrate_regs(imsic_migrate_to_vs); imsic_migration_done = true; @@ -200,6 +201,11 @@ void __attribute__ ((noreturn)) arch_cpu_activate_vmm(void) ext_disable(); } + // HACK: Qemu: If VSEIP is set in hip (via hvip) is pending when + // enabling the hypervisor, clear it. Otherwise it will remain + // indefinetly set (at least in Qemu) + csr_clear(CSR_HVIP, VIE_EIE | VIE_TIE); + tmp = csr_swap(sscratch, regs->sp); asm volatile("mv sp, %0\n" "j vmreturn\n" : : "r"(tmp)); -- 2.40.1 -- You received this message because you are subscribed to the Google Groups "Jailhouse" group. To unsubscribe from this group and stop receiving emails from it, send an email to jailhouse-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jailhouse-dev/20230519204033.643200-73-ralf.ramsauer%40oth-regensburg.de.