xref: /OK3568_Linux_fs/kernel/drivers/gpu/arm/bifrost/mmu/mali_kbase_mmu_internal.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  *
4  * (C) COPYRIGHT 2019-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_MMU_INTERNAL_H_
23 #define _KBASE_MMU_INTERNAL_H_
24 
25 void kbase_mmu_get_as_setup(struct kbase_mmu_table *mmut,
26 		struct kbase_mmu_setup * const setup);
27 
28 /**
29  * kbase_mmu_report_mcu_as_fault_and_reset - Report page fault for all
30  *                                           address spaces and reset the GPU.
31  * @kbdev:   The kbase_device the fault happened on
32  * @fault:   Data relating to the fault
33  */
34 void kbase_mmu_report_mcu_as_fault_and_reset(struct kbase_device *kbdev,
35 		struct kbase_fault *fault);
36 
37 void kbase_gpu_report_bus_fault_and_kill(struct kbase_context *kctx,
38 		struct kbase_as *as, struct kbase_fault *fault);
39 
40 void kbase_mmu_report_fault_and_kill(struct kbase_context *kctx,
41 		struct kbase_as *as, const char *reason_str,
42 		struct kbase_fault *fault);
43 
44 /**
45  * kbase_mmu_switch_to_ir() - Switch to incremental rendering if possible
46  * @kctx:	kbase_context for the faulting address space.
47  * @reg:	of a growable GPU memory region in the same context.
48  *		Takes ownership of the reference if successful.
49  *
50  * Used to switch to incremental rendering if we have nearly run out of
51  * virtual address space in a growable memory region.
52  *
53  * Return: 0 if successful, otherwise a negative error code.
54  */
55 int kbase_mmu_switch_to_ir(struct kbase_context *kctx,
56 	struct kbase_va_region *reg);
57 
58 /**
59  * kbase_mmu_page_fault_worker() - Process a page fault.
60  *
61  * @data:  work_struct passed by queue_work()
62  */
63 void kbase_mmu_page_fault_worker(struct work_struct *data);
64 
65 /**
66  * kbase_mmu_bus_fault_worker() - Process a bus fault.
67  *
68  * @data:  work_struct passed by queue_work()
69  */
70 void kbase_mmu_bus_fault_worker(struct work_struct *data);
71 
72 #endif /* _KBASE_MMU_INTERNAL_H_ */
73