dt-bindings: mtd: ingenic: Use standard ecc-engine property
[linux/fpc-iii.git] / drivers / gpu / drm / amd / amdkfd / kfd_mqd_manager.h
blobf8261313ae7b128814399cc8dae1df2c922f9c69
1 /*
2 * Copyright 2014 Advanced Micro Devices, Inc.
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:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
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.
24 #ifndef KFD_MQD_MANAGER_H_
25 #define KFD_MQD_MANAGER_H_
27 #include "kfd_priv.h"
29 /**
30 * struct mqd_manager
32 * @init_mqd: Allocates the mqd buffer on local gpu memory and initialize it.
34 * @load_mqd: Loads the mqd to a concrete hqd slot. Used only for no cp
35 * scheduling mode.
37 * @update_mqd: Handles a update call for the MQD
39 * @destroy_mqd: Destroys the HQD slot and by that preempt the relevant queue.
40 * Used only for no cp scheduling.
42 * @uninit_mqd: Releases the mqd buffer from local gpu memory.
44 * @is_occupied: Checks if the relevant HQD slot is occupied.
46 * @get_wave_state: Retrieves context save state and optionally copies the
47 * control stack, if kept in the MQD, to the given userspace address.
49 * @mqd_mutex: Mqd manager mutex.
51 * @dev: The kfd device structure coupled with this module.
53 * MQD stands for Memory Queue Descriptor which represents the current queue
54 * state in the memory and initiate the HQD (Hardware Queue Descriptor) state.
55 * This structure is actually a base class for the different types of MQDs
56 * structures for the variant ASICs that should be supported in the future.
57 * This base class is also contains all the MQD specific operations.
58 * Another important thing to mention is that each queue has a MQD that keeps
59 * his state (or context) after each preemption or reassignment.
60 * Basically there are a instances of the mqd manager class per MQD type per
61 * ASIC. Currently the kfd driver supports only Kaveri so there are instances
62 * per KFD_MQD_TYPE for each device.
66 struct mqd_manager {
67 int (*init_mqd)(struct mqd_manager *mm, void **mqd,
68 struct kfd_mem_obj **mqd_mem_obj, uint64_t *gart_addr,
69 struct queue_properties *q);
71 int (*load_mqd)(struct mqd_manager *mm, void *mqd,
72 uint32_t pipe_id, uint32_t queue_id,
73 struct queue_properties *p,
74 struct mm_struct *mms);
76 int (*update_mqd)(struct mqd_manager *mm, void *mqd,
77 struct queue_properties *q);
79 int (*destroy_mqd)(struct mqd_manager *mm, void *mqd,
80 enum kfd_preempt_type type,
81 unsigned int timeout, uint32_t pipe_id,
82 uint32_t queue_id);
84 void (*uninit_mqd)(struct mqd_manager *mm, void *mqd,
85 struct kfd_mem_obj *mqd_mem_obj);
87 bool (*is_occupied)(struct mqd_manager *mm, void *mqd,
88 uint64_t queue_address, uint32_t pipe_id,
89 uint32_t queue_id);
91 int (*get_wave_state)(struct mqd_manager *mm, void *mqd,
92 void __user *ctl_stack,
93 u32 *ctl_stack_used_size,
94 u32 *save_area_used_size);
96 #if defined(CONFIG_DEBUG_FS)
97 int (*debugfs_show_mqd)(struct seq_file *m, void *data);
98 #endif
100 struct mutex mqd_mutex;
101 struct kfd_dev *dev;
104 void mqd_symmetrically_map_cu_mask(struct mqd_manager *mm,
105 const uint32_t *cu_mask, uint32_t cu_mask_count,
106 uint32_t *se_mask);
108 #endif /* KFD_MQD_MANAGER_H_ */