~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/riscv/include/asm/kvm_vcpu_sbi.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 /**
  3  * Copyright (c) 2021 Western Digital Corporation or its affiliates.
  4  *
  5  * Authors:
  6  *     Atish Patra <atish.patra@wdc.com>
  7  */
  8 
  9 #ifndef __RISCV_KVM_VCPU_SBI_H__
 10 #define __RISCV_KVM_VCPU_SBI_H__
 11 
 12 #define KVM_SBI_IMPID 3
 13 
 14 #define KVM_SBI_VERSION_MAJOR 2
 15 #define KVM_SBI_VERSION_MINOR 0
 16 
 17 enum kvm_riscv_sbi_ext_status {
 18         KVM_RISCV_SBI_EXT_STATUS_UNINITIALIZED,
 19         KVM_RISCV_SBI_EXT_STATUS_UNAVAILABLE,
 20         KVM_RISCV_SBI_EXT_STATUS_ENABLED,
 21         KVM_RISCV_SBI_EXT_STATUS_DISABLED,
 22 };
 23 
 24 struct kvm_vcpu_sbi_context {
 25         int return_handled;
 26         enum kvm_riscv_sbi_ext_status ext_status[KVM_RISCV_SBI_EXT_MAX];
 27 };
 28 
 29 struct kvm_vcpu_sbi_return {
 30         unsigned long out_val;
 31         unsigned long err_val;
 32         struct kvm_cpu_trap *utrap;
 33         bool uexit;
 34 };
 35 
 36 struct kvm_vcpu_sbi_extension {
 37         unsigned long extid_start;
 38         unsigned long extid_end;
 39 
 40         bool default_disabled;
 41 
 42         /**
 43          * SBI extension handler. It can be defined for a given extension or group of
 44          * extension. But it should always return linux error codes rather than SBI
 45          * specific error codes.
 46          */
 47         int (*handler)(struct kvm_vcpu *vcpu, struct kvm_run *run,
 48                        struct kvm_vcpu_sbi_return *retdata);
 49 
 50         /* Extension specific probe function */
 51         unsigned long (*probe)(struct kvm_vcpu *vcpu);
 52 };
 53 
 54 void kvm_riscv_vcpu_sbi_forward(struct kvm_vcpu *vcpu, struct kvm_run *run);
 55 void kvm_riscv_vcpu_sbi_system_reset(struct kvm_vcpu *vcpu,
 56                                      struct kvm_run *run,
 57                                      u32 type, u64 flags);
 58 int kvm_riscv_vcpu_sbi_return(struct kvm_vcpu *vcpu, struct kvm_run *run);
 59 int kvm_riscv_vcpu_set_reg_sbi_ext(struct kvm_vcpu *vcpu,
 60                                    const struct kvm_one_reg *reg);
 61 int kvm_riscv_vcpu_get_reg_sbi_ext(struct kvm_vcpu *vcpu,
 62                                    const struct kvm_one_reg *reg);
 63 int kvm_riscv_vcpu_set_reg_sbi(struct kvm_vcpu *vcpu,
 64                                const struct kvm_one_reg *reg);
 65 int kvm_riscv_vcpu_get_reg_sbi(struct kvm_vcpu *vcpu,
 66                                const struct kvm_one_reg *reg);
 67 const struct kvm_vcpu_sbi_extension *kvm_vcpu_sbi_find_ext(
 68                                 struct kvm_vcpu *vcpu, unsigned long extid);
 69 bool riscv_vcpu_supports_sbi_ext(struct kvm_vcpu *vcpu, int idx);
 70 int kvm_riscv_vcpu_sbi_ecall(struct kvm_vcpu *vcpu, struct kvm_run *run);
 71 void kvm_riscv_vcpu_sbi_init(struct kvm_vcpu *vcpu);
 72 
 73 int kvm_riscv_vcpu_get_reg_sbi_sta(struct kvm_vcpu *vcpu, unsigned long reg_num,
 74                                    unsigned long *reg_val);
 75 int kvm_riscv_vcpu_set_reg_sbi_sta(struct kvm_vcpu *vcpu, unsigned long reg_num,
 76                                    unsigned long reg_val);
 77 
 78 #ifdef CONFIG_RISCV_SBI_V01
 79 extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_v01;
 80 #endif
 81 extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_base;
 82 extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_time;
 83 extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_ipi;
 84 extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_rfence;
 85 extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_srst;
 86 extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_hsm;
 87 extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_dbcn;
 88 extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_sta;
 89 extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_experimental;
 90 extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_vendor;
 91 
 92 #ifdef CONFIG_RISCV_PMU_SBI
 93 extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_pmu;
 94 #endif
 95 #endif /* __RISCV_KVM_VCPU_SBI_H__ */
 96 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php