File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -76,6 +76,7 @@ extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_rfence;
7676extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_srst ;
7777extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_hsm ;
7878extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_dbcn ;
79+ extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_sta ;
7980extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_experimental ;
8081extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_vendor ;
8182
Original file line number Diff line number Diff line change @@ -157,6 +157,7 @@ enum KVM_RISCV_SBI_EXT_ID {
157157 KVM_RISCV_SBI_EXT_EXPERIMENTAL ,
158158 KVM_RISCV_SBI_EXT_VENDOR ,
159159 KVM_RISCV_SBI_EXT_DBCN ,
160+ KVM_RISCV_SBI_EXT_STA ,
160161 KVM_RISCV_SBI_EXT_MAX ,
161162};
162163
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ kvm-$(CONFIG_RISCV_SBI_V01) += vcpu_sbi_v01.o
2626kvm-y += vcpu_sbi_base.o
2727kvm-y += vcpu_sbi_replace.o
2828kvm-y += vcpu_sbi_hsm.o
29+ kvm-y += vcpu_sbi_sta.o
2930kvm-y += vcpu_timer.o
3031kvm-$(CONFIG_RISCV_PMU_SBI) += vcpu_pmu.o vcpu_sbi_pmu.o
3132kvm-y += aia.o
Original file line number Diff line number Diff line change @@ -70,6 +70,10 @@ static const struct kvm_riscv_sbi_extension_entry sbi_ext[] = {
7070 .ext_idx = KVM_RISCV_SBI_EXT_DBCN ,
7171 .ext_ptr = & vcpu_sbi_ext_dbcn ,
7272 },
73+ {
74+ .ext_idx = KVM_RISCV_SBI_EXT_STA ,
75+ .ext_ptr = & vcpu_sbi_ext_sta ,
76+ },
7377 {
7478 .ext_idx = KVM_RISCV_SBI_EXT_EXPERIMENTAL ,
7579 .ext_ptr = & vcpu_sbi_ext_experimental ,
Original file line number Diff line number Diff line change 1+ // SPDX-License-Identifier: GPL-2.0
2+ /*
3+ * Copyright (c) 2023 Ventana Micro Systems Inc.
4+ */
5+
6+ #include <linux/kvm_host.h>
7+
8+ #include <asm/kvm_vcpu_sbi.h>
9+ #include <asm/sbi.h>
10+
11+ static int kvm_sbi_sta_steal_time_set_shmem (struct kvm_vcpu * vcpu )
12+ {
13+ return SBI_ERR_FAILURE ;
14+ }
15+
16+ static int kvm_sbi_ext_sta_handler (struct kvm_vcpu * vcpu , struct kvm_run * run ,
17+ struct kvm_vcpu_sbi_return * retdata )
18+ {
19+ struct kvm_cpu_context * cp = & vcpu -> arch .guest_context ;
20+ unsigned long funcid = cp -> a6 ;
21+ int ret ;
22+
23+ switch (funcid ) {
24+ case SBI_EXT_STA_STEAL_TIME_SET_SHMEM :
25+ ret = kvm_sbi_sta_steal_time_set_shmem (vcpu );
26+ break ;
27+ default :
28+ ret = SBI_ERR_NOT_SUPPORTED ;
29+ break ;
30+ }
31+
32+ retdata -> err_val = ret ;
33+
34+ return 0 ;
35+ }
36+
37+ static unsigned long kvm_sbi_ext_sta_probe (struct kvm_vcpu * vcpu )
38+ {
39+ return 0 ;
40+ }
41+
42+ const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_sta = {
43+ .extid_start = SBI_EXT_STA ,
44+ .extid_end = SBI_EXT_STA ,
45+ .handler = kvm_sbi_ext_sta_handler ,
46+ .probe = kvm_sbi_ext_sta_probe ,
47+ };
You can’t perform that action at this time.
0 commit comments