hcall_ctrl.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2021, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef __GH_HCALL_CTRL_H
  6. #define __GH_HCALL_CTRL_H
  7. #include <linux/err.h>
  8. #include <linux/types.h>
  9. #include <linux/gunyah/hcall_common.h>
  10. #include <linux/gunyah/gh_common.h>
  11. #include <asm/gunyah/hcall.h>
  12. struct gh_hcall_hyp_identify_resp {
  13. u64 api_info;
  14. u64 flags[3];
  15. };
  16. static inline int gh_hcall_hyp_identify(struct gh_hcall_hyp_identify_resp *resp)
  17. {
  18. struct gh_hcall_resp _resp = {0};
  19. _gh_hcall(0x6000,
  20. (struct gh_hcall_args){ 0 },
  21. &_resp);
  22. if (resp) {
  23. resp->api_info = _resp.resp0;
  24. resp->flags[0] = _resp.resp1;
  25. resp->flags[1] = _resp.resp2;
  26. resp->flags[2] = _resp.resp3;
  27. }
  28. return 0;
  29. }
  30. static inline int gh_hcall_trace_update_class_flags(
  31. uint64_t set_flags, uint64_t clear_flags,
  32. uint64_t *new_flags)
  33. {
  34. int ret;
  35. struct gh_hcall_resp _resp = {0};
  36. ret = _gh_hcall(0x603f,
  37. (struct gh_hcall_args){ set_flags, clear_flags, 0 },
  38. &_resp);
  39. if (!ret && new_flags)
  40. *new_flags = _resp.resp1;
  41. return ret;
  42. }
  43. #endif