History

RISC-V: KVM: Add extensible CSR emulation framework

We add an extensible CSR emulation framework which is based upon the existing system instruction emulation. This will be useful to upcoming AIA, PMU, Nested and other virtualization features. The CSR emulation framework also has provision to emulate CSR in user space but this will be used only in very specific cases such as AIA IMSIC CSR emulation in user space or vendor specific CSR emulation in user space. By default, all CSRs not handled by KVM RISC-V will be redirected back to Guest VCPU as illegal instruction trap.

Anup Patel committed 4 years ago

Commit 8a061561 parent 1222b555 files · +209 −16Browse files

Showing the changes to include/uapi (1 of 5 files). Show all

Unified · Split

include/uapi/linux/kvm.h+8−0
@@ -270,6 +270,7 @@ struct kvm_xen_exit { · 269 unmodified lines
270#define KVM_EXIT_X86_BUS_LOCK 33270#define KVM_EXIT_X86_BUS_LOCK 33
271#define KVM_EXIT_XEN 34271#define KVM_EXIT_XEN 34
272#define KVM_EXIT_RISCV_SBI 35272#define KVM_EXIT_RISCV_SBI 35
273#define KVM_EXIT_RISCV_CSR 36
273 274
274/* For KVM_EXIT_INTERNAL_ERROR */275/* For KVM_EXIT_INTERNAL_ERROR */
275/* Emulate instruction failed. */276/* Emulate instruction failed. */
@@ -496,6 +497,13 @@ struct kvm_run { · 220 unmodified lines
496 unsigned long args[6];497 unsigned long args[6];
497 unsigned long ret[2];498 unsigned long ret[2];
498 } riscv_sbi;499 } riscv_sbi;
500 /* KVM_EXIT_RISCV_CSR */
501 struct {
502 unsigned long csr_num;
503 unsigned long new_value;
504 unsigned long write_mask;
505 unsigned long ret_value;
506 } riscv_csr;
499 /* Fix the size of the union. */507 /* Fix the size of the union. */
500 char padding[256];508 char padding[256];
501 };509 };

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t