.. | .. |
---|
26 | 26 | |
---|
27 | 27 | #include "kfd_priv.h" |
---|
28 | 28 | |
---|
| 29 | +#define KFD_MAX_NUM_SE 8 |
---|
| 30 | +#define KFD_MAX_NUM_SH_PER_SE 2 |
---|
| 31 | + |
---|
29 | 32 | /** |
---|
30 | 33 | * struct mqd_manager |
---|
31 | 34 | * |
---|
.. | .. |
---|
39 | 42 | * @destroy_mqd: Destroys the HQD slot and by that preempt the relevant queue. |
---|
40 | 43 | * Used only for no cp scheduling. |
---|
41 | 44 | * |
---|
42 | | - * @uninit_mqd: Releases the mqd buffer from local gpu memory. |
---|
| 45 | + * @free_mqd: Releases the mqd buffer from local gpu memory. |
---|
43 | 46 | * |
---|
44 | 47 | * @is_occupied: Checks if the relevant HQD slot is occupied. |
---|
| 48 | + * |
---|
| 49 | + * @get_wave_state: Retrieves context save state and optionally copies the |
---|
| 50 | + * control stack, if kept in the MQD, to the given userspace address. |
---|
45 | 51 | * |
---|
46 | 52 | * @mqd_mutex: Mqd manager mutex. |
---|
47 | 53 | * |
---|
.. | .. |
---|
59 | 65 | * per KFD_MQD_TYPE for each device. |
---|
60 | 66 | * |
---|
61 | 67 | */ |
---|
62 | | - |
---|
| 68 | +extern int pipe_priority_map[]; |
---|
63 | 69 | struct mqd_manager { |
---|
64 | | - int (*init_mqd)(struct mqd_manager *mm, void **mqd, |
---|
65 | | - struct kfd_mem_obj **mqd_mem_obj, uint64_t *gart_addr, |
---|
| 70 | + struct kfd_mem_obj* (*allocate_mqd)(struct kfd_dev *kfd, |
---|
| 71 | + struct queue_properties *q); |
---|
| 72 | + |
---|
| 73 | + void (*init_mqd)(struct mqd_manager *mm, void **mqd, |
---|
| 74 | + struct kfd_mem_obj *mqd_mem_obj, uint64_t *gart_addr, |
---|
66 | 75 | struct queue_properties *q); |
---|
67 | 76 | |
---|
68 | 77 | int (*load_mqd)(struct mqd_manager *mm, void *mqd, |
---|
.. | .. |
---|
70 | 79 | struct queue_properties *p, |
---|
71 | 80 | struct mm_struct *mms); |
---|
72 | 81 | |
---|
73 | | - int (*update_mqd)(struct mqd_manager *mm, void *mqd, |
---|
| 82 | + void (*update_mqd)(struct mqd_manager *mm, void *mqd, |
---|
74 | 83 | struct queue_properties *q); |
---|
75 | 84 | |
---|
76 | 85 | int (*destroy_mqd)(struct mqd_manager *mm, void *mqd, |
---|
.. | .. |
---|
78 | 87 | unsigned int timeout, uint32_t pipe_id, |
---|
79 | 88 | uint32_t queue_id); |
---|
80 | 89 | |
---|
81 | | - void (*uninit_mqd)(struct mqd_manager *mm, void *mqd, |
---|
| 90 | + void (*free_mqd)(struct mqd_manager *mm, void *mqd, |
---|
82 | 91 | struct kfd_mem_obj *mqd_mem_obj); |
---|
83 | 92 | |
---|
84 | 93 | bool (*is_occupied)(struct mqd_manager *mm, void *mqd, |
---|
85 | 94 | uint64_t queue_address, uint32_t pipe_id, |
---|
86 | 95 | uint32_t queue_id); |
---|
| 96 | + |
---|
| 97 | + int (*get_wave_state)(struct mqd_manager *mm, void *mqd, |
---|
| 98 | + void __user *ctl_stack, |
---|
| 99 | + u32 *ctl_stack_used_size, |
---|
| 100 | + u32 *save_area_used_size); |
---|
87 | 101 | |
---|
88 | 102 | #if defined(CONFIG_DEBUG_FS) |
---|
89 | 103 | int (*debugfs_show_mqd)(struct seq_file *m, void *data); |
---|
.. | .. |
---|
91 | 105 | |
---|
92 | 106 | struct mutex mqd_mutex; |
---|
93 | 107 | struct kfd_dev *dev; |
---|
| 108 | + uint32_t mqd_size; |
---|
94 | 109 | }; |
---|
95 | 110 | |
---|
| 111 | +struct kfd_mem_obj *allocate_hiq_mqd(struct kfd_dev *dev, |
---|
| 112 | + struct queue_properties *q); |
---|
| 113 | + |
---|
| 114 | +struct kfd_mem_obj *allocate_sdma_mqd(struct kfd_dev *dev, |
---|
| 115 | + struct queue_properties *q); |
---|
| 116 | +void free_mqd_hiq_sdma(struct mqd_manager *mm, void *mqd, |
---|
| 117 | + struct kfd_mem_obj *mqd_mem_obj); |
---|
| 118 | + |
---|
96 | 119 | void mqd_symmetrically_map_cu_mask(struct mqd_manager *mm, |
---|
97 | 120 | const uint32_t *cu_mask, uint32_t cu_mask_count, |
---|
98 | 121 | uint32_t *se_mask); |
---|