1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 /* 3 * 4 * (C) COPYRIGHT 2022 ARM Limited. All rights reserved. 5 * 6 * This program is free software and is provided to you under the terms of the 7 * GNU General Public License version 2 as published by the Free Software 8 * Foundation, and any use by you of this program is subject to the terms 9 * of such GNU license. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, you can access it online at 18 * http://www.gnu.org/licenses/gpl-2.0.html. 19 * 20 */ 21 22 #ifndef _KBASE_CSF_MCU_SHARED_REG_H_ 23 #define _KBASE_CSF_MCU_SHARED_REG_H_ 24 25 /** 26 * kbase_csf_mcu_shared_set_group_csg_reg_active - Notify that the group is active on-slot with 27 * scheduling action. Essential runtime resources 28 * are bound with the group for it to run 29 * 30 * @kbdev: Instance of a GPU platform device that implements a CSF interface. 31 * @group: Pointer to the group that is placed into active on-slot running by the scheduler. 32 * 33 */ 34 void kbase_csf_mcu_shared_set_group_csg_reg_active(struct kbase_device *kbdev, 35 struct kbase_queue_group *group); 36 37 /** 38 * kbase_csf_mcu_shared_set_group_csg_reg_unused - Notify that the group is placed off-slot with 39 * scheduling action. Some of bound runtime 40 * resources can be reallocated for others to use 41 * 42 * @kbdev: Instance of a GPU platform device that implements a CSF interface. 43 * @group: Pointer to the group that is placed off-slot by the scheduler. 44 * 45 */ 46 void kbase_csf_mcu_shared_set_group_csg_reg_unused(struct kbase_device *kbdev, 47 struct kbase_queue_group *group); 48 49 /** 50 * kbase_csf_mcu_shared_group_update_pmode_map - Request to update the given group's protected 51 * suspend buffer pages to be mapped for supporting 52 * protected mode operations. 53 * 54 * @kbdev: Instance of a GPU platform device that implements a CSF interface. 55 * @group: Pointer to the group for attempting a protected mode suspend buffer binding/mapping. 56 * 57 * Return: 0 for success, the group has a protected suspend buffer region mapped. Otherwise an 58 * error code is returned. 59 */ 60 int kbase_csf_mcu_shared_group_update_pmode_map(struct kbase_device *kbdev, 61 struct kbase_queue_group *group); 62 63 /** 64 * kbase_csf_mcu_shared_clear_evicted_group_csg_reg - Clear any bound regions/mappings as the 65 * given group is evicted out of the runtime 66 * operations. 67 * 68 * @kbdev: Instance of a GPU platform device that implements a CSF interface. 69 * @group: Pointer to the group that has been evicted out of set of operational groups. 70 * 71 * This function will taken away any of the bindings/mappings immediately so the resources 72 * are not tied up to the given group, which has been evicted out of scheduling action for 73 * termination. 74 */ 75 void kbase_csf_mcu_shared_clear_evicted_group_csg_reg(struct kbase_device *kbdev, 76 struct kbase_queue_group *group); 77 78 /** 79 * kbase_csf_mcu_shared_add_queue - Request to add a newly activated queue for a group to be 80 * run on slot. 81 * 82 * @kbdev: Instance of a GPU platform device that implements a CSF interface. 83 * @queue: Pointer to the queue that requires some runtime resource to be bound for joining 84 * others that are already running on-slot with their bound group. 85 * 86 * Return: 0 on success, or negative on failure. 87 */ 88 int kbase_csf_mcu_shared_add_queue(struct kbase_device *kbdev, struct kbase_queue *queue); 89 90 /** 91 * kbase_csf_mcu_shared_drop_stopped_queue - Request to drop a queue after it has been stopped 92 * from its operational state from a group. 93 * 94 * @kbdev: Instance of a GPU platform device that implements a CSF interface. 95 * @queue: Pointer to the queue that has been stopped from operational state. 96 * 97 */ 98 void kbase_csf_mcu_shared_drop_stopped_queue(struct kbase_device *kbdev, struct kbase_queue *queue); 99 100 /** 101 * kbase_csf_mcu_shared_group_bind_csg_reg - Bind some required runtime resources to the given 102 * group for ready to run on-slot. 103 * 104 * @kbdev: Instance of a GPU platform device that implements a CSF interface. 105 * @group: Pointer to the queue group that requires the runtime resources. 106 * 107 * This function binds/maps the required suspend buffer pages and userio pages for the given 108 * group, readying it to run on-slot. 109 * 110 * Return: 0 on success, or negative on failure. 111 */ 112 int kbase_csf_mcu_shared_group_bind_csg_reg(struct kbase_device *kbdev, 113 struct kbase_queue_group *group); 114 115 /** 116 * kbase_csf_mcu_shared_regs_data_init - Allocate and initialize the MCU shared regions data for 117 * the given device. 118 * 119 * @kbdev: Instance of a GPU platform device that implements a CSF interface. 120 * 121 * This function allocate and initialize the MCU shared VA regions for runtime operations 122 * of the CSF scheduler. 123 * 124 * Return: 0 on success, or an error code. 125 */ 126 int kbase_csf_mcu_shared_regs_data_init(struct kbase_device *kbdev); 127 128 /** 129 * kbase_csf_mcu_shared_regs_data_term - Terminate the allocated MCU shared regions data for 130 * the given device. 131 * 132 * @kbdev: Instance of a GPU platform device that implements a CSF interface. 133 * 134 * This function terminates the MCU shared VA regions allocated for runtime operations 135 * of the CSF scheduler. 136 */ 137 void kbase_csf_mcu_shared_regs_data_term(struct kbase_device *kbdev); 138 139 #endif /* _KBASE_CSF_MCU_SHARED_REG_H_ */ 140