kfd_kernel_queue.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. */
  23. #ifndef KFD_KERNEL_QUEUE_H_
  24. #define KFD_KERNEL_QUEUE_H_
  25. #include <linux/list.h>
  26. #include <linux/types.h>
  27. #include "kfd_priv.h"
  28. struct kernel_queue {
  29. /* interface */
  30. bool (*initialize)(struct kernel_queue *kq, struct kfd_dev *dev,
  31. enum kfd_queue_type type, unsigned int queue_size);
  32. void (*uninitialize)(struct kernel_queue *kq);
  33. int (*acquire_packet_buffer)(struct kernel_queue *kq,
  34. size_t packet_size_in_dwords,
  35. unsigned int **buffer_ptr);
  36. void (*submit_packet)(struct kernel_queue *kq);
  37. int (*sync_with_hw)(struct kernel_queue *kq,
  38. unsigned long timeout_ms);
  39. void (*rollback_packet)(struct kernel_queue *kq);
  40. /* data */
  41. struct kfd_dev *dev;
  42. struct mqd_manager *mqd;
  43. struct queue *queue;
  44. uint32_t pending_wptr;
  45. unsigned int nop_packet;
  46. struct kfd_mem_obj *rptr_mem;
  47. uint32_t *rptr_kernel;
  48. uint64_t rptr_gpu_addr;
  49. struct kfd_mem_obj *wptr_mem;
  50. uint32_t *wptr_kernel;
  51. uint64_t wptr_gpu_addr;
  52. struct kfd_mem_obj *pq;
  53. uint64_t pq_gpu_addr;
  54. uint32_t *pq_kernel_addr;
  55. struct kfd_mem_obj *fence_mem_obj;
  56. uint64_t fence_gpu_addr;
  57. void *fence_kernel_address;
  58. struct list_head list;
  59. };
  60. #endif /* KFD_KERNEL_QUEUE_H_ */