Skip to content

Commit 3729fe8

Browse files
luxukernelavpatel
authored andcommitted
RISC-V: KVM: Delegate illegal instruction fault to VS mode
Delegate illegal instruction fault to VS mode by default to avoid such exceptions being trapped to HS and redirected back to VS. The delegation of illegal instruction fault is particularly important to guest applications that use vector instructions frequently. In such cases, an illegal instruction fault will be raised when guest user thread uses vector instruction the first time and then guest kernel will enable user thread to execute following vector instructions. The fw pmu event counter remains undeleted so that guest can still query illegal instruction events via sbi call. Guest will only see zero count on illegal instruction faults and know 'firmware' has delegated it. Reviewed-by: Anup Patel <anup@brainfault.org> Signed-off-by: Xu Lu <luxu.kernel@bytedance.com> Link: https://lore.kernel.org/r/20250714094554.89151-1-luxu.kernel@bytedance.com Signed-off-by: Anup Patel <anup@brainfault.org>
1 parent 1f6d0ee commit 3729fe8

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

arch/riscv/include/asm/kvm_host.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
#define __KVM_HAVE_ARCH_FLUSH_REMOTE_TLBS_RANGE
4848

4949
#define KVM_HEDELEG_DEFAULT (BIT(EXC_INST_MISALIGNED) | \
50+
BIT(EXC_INST_ILLEGAL) | \
5051
BIT(EXC_BREAKPOINT) | \
5152
BIT(EXC_SYSCALL) | \
5253
BIT(EXC_INST_PAGE_FAULT) | \

0 commit comments

Comments
 (0)