kvm_vcpu_fp.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. * Anup Patel <anup.patel@wdc.com>
  8. */
  9. #ifndef __KVM_VCPU_RISCV_FP_H
  10. #define __KVM_VCPU_RISCV_FP_H
  11. #include <linux/types.h>
  12. struct kvm_cpu_context;
  13. #ifdef CONFIG_FPU
  14. void __kvm_riscv_fp_f_save(struct kvm_cpu_context *context);
  15. void __kvm_riscv_fp_f_restore(struct kvm_cpu_context *context);
  16. void __kvm_riscv_fp_d_save(struct kvm_cpu_context *context);
  17. void __kvm_riscv_fp_d_restore(struct kvm_cpu_context *context);
  18. void kvm_riscv_vcpu_fp_reset(struct kvm_vcpu *vcpu);
  19. void kvm_riscv_vcpu_guest_fp_save(struct kvm_cpu_context *cntx,
  20. const unsigned long *isa);
  21. void kvm_riscv_vcpu_guest_fp_restore(struct kvm_cpu_context *cntx,
  22. const unsigned long *isa);
  23. void kvm_riscv_vcpu_host_fp_save(struct kvm_cpu_context *cntx);
  24. void kvm_riscv_vcpu_host_fp_restore(struct kvm_cpu_context *cntx);
  25. #else
  26. static inline void kvm_riscv_vcpu_fp_reset(struct kvm_vcpu *vcpu)
  27. {
  28. }
  29. static inline void kvm_riscv_vcpu_guest_fp_save(struct kvm_cpu_context *cntx,
  30. const unsigned long *isa)
  31. {
  32. }
  33. static inline void kvm_riscv_vcpu_guest_fp_restore(
  34. struct kvm_cpu_context *cntx,
  35. const unsigned long *isa)
  36. {
  37. }
  38. static inline void kvm_riscv_vcpu_host_fp_save(struct kvm_cpu_context *cntx)
  39. {
  40. }
  41. static inline void kvm_riscv_vcpu_host_fp_restore(
  42. struct kvm_cpu_context *cntx)
  43. {
  44. }
  45. #endif
  46. int kvm_riscv_vcpu_get_reg_fp(struct kvm_vcpu *vcpu,
  47. const struct kvm_one_reg *reg,
  48. unsigned long rtype);
  49. int kvm_riscv_vcpu_set_reg_fp(struct kvm_vcpu *vcpu,
  50. const struct kvm_one_reg *reg,
  51. unsigned long rtype);
  52. #endif