amdgpu_amdkfd.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Copyright 2014 Advanced Micro Devices, Inc.
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  17. * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  18. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  19. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  20. * OTHER DEALINGS IN THE SOFTWARE.
  21. */
  22. /* amdgpu_amdkfd.h defines the private interface between amdgpu and amdkfd. */
  23. #ifndef AMDGPU_AMDKFD_H_INCLUDED
  24. #define AMDGPU_AMDKFD_H_INCLUDED
  25. #include <linux/types.h>
  26. #include <kgd_kfd_interface.h>
  27. struct amdgpu_device;
  28. struct kgd_mem {
  29. struct amdgpu_bo *bo;
  30. uint64_t gpu_addr;
  31. void *cpu_ptr;
  32. };
  33. bool amdgpu_amdkfd_init(void);
  34. void amdgpu_amdkfd_fini(void);
  35. bool amdgpu_amdkfd_load_interface(struct amdgpu_device *rdev);
  36. void amdgpu_amdkfd_suspend(struct amdgpu_device *rdev);
  37. int amdgpu_amdkfd_resume(struct amdgpu_device *rdev);
  38. void amdgpu_amdkfd_interrupt(struct amdgpu_device *rdev,
  39. const void *ih_ring_entry);
  40. void amdgpu_amdkfd_device_probe(struct amdgpu_device *rdev);
  41. void amdgpu_amdkfd_device_init(struct amdgpu_device *rdev);
  42. void amdgpu_amdkfd_device_fini(struct amdgpu_device *rdev);
  43. struct kfd2kgd_calls *amdgpu_amdkfd_gfx_7_get_functions(void);
  44. struct kfd2kgd_calls *amdgpu_amdkfd_gfx_8_0_get_functions(void);
  45. /* Shared API */
  46. int alloc_gtt_mem(struct kgd_dev *kgd, size_t size,
  47. void **mem_obj, uint64_t *gpu_addr,
  48. void **cpu_ptr);
  49. void free_gtt_mem(struct kgd_dev *kgd, void *mem_obj);
  50. uint64_t get_vmem_size(struct kgd_dev *kgd);
  51. uint64_t get_gpu_clock_counter(struct kgd_dev *kgd);
  52. uint32_t get_max_engine_clock_in_mhz(struct kgd_dev *kgd);
  53. #endif /* AMDGPU_AMDKFD_H_INCLUDED */