History

RISC-V: KVM: Add SBI v0.1 support

The KVM host kernel is running in HS-mode needs so we need to handle the SBI calls coming from guest kernel running in VS-mode. This patch adds SBI v0.1 support in KVM RISC-V. Almost all SBI v0.1 calls are implemented in KVM kernel module except GETCHAR and PUTCHART calls which are forwarded to user space because these calls cannot be implemented in kernel space. In future, when we implement SBI v0.2 for Guest, we will forward SBI v0.2 experimental and vendor extension calls to user space.

Atish Patra committed 5 years ago

Commit dea8ee31 parent 4d9c5c06 files · +217 −0Browse files

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

Unified · Split

include/uapi/linux/kvm.h+8−0
@@ -269,6 +269,7 @@ struct kvm_xen_exit { · 268 unmodified lines
269#define KVM_EXIT_AP_RESET_HOLD 32269#define KVM_EXIT_AP_RESET_HOLD 32
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 35
272 273
273/* For KVM_EXIT_INTERNAL_ERROR */274/* For KVM_EXIT_INTERNAL_ERROR */
274/* Emulate instruction failed. */275/* Emulate instruction failed. */
@@ -469,6 +470,13 @@ struct kvm_run { · 194 unmodified lines
469 } msr;470 } msr;
470 /* KVM_EXIT_XEN */471 /* KVM_EXIT_XEN */
471 struct kvm_xen_exit xen;472 struct kvm_xen_exit xen;
473 /* KVM_EXIT_RISCV_SBI */
474 struct {
475 unsigned long extension_id;
476 unsigned long function_id;
477 unsigned long args[6];
478 unsigned long ret[2];
479 } riscv_sbi;
472 /* Fix the size of the union. */480 /* Fix the size of the union. */
473 char padding[256];481 char padding[256];
474 };482 };