3 * (C) COPYRIGHT 2014-2015 ARM Limited. All rights reserved.
5 * This program is free software and is provided to you under the terms of the
6 * GNU General Public License version 2 as published by the Free Software
7 * Foundation, and any use by you of this program is subject to the terms
10 * A copy of the licence is included with the program, and can also be obtained
11 * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
12 * Boston, MA 02110-1301, USA.
20 * Interface file for accessing MMU hardware functionality
24 * @page mali_kbase_mmu_hw_page MMU hardware interface
26 * @section mali_kbase_mmu_hw_intro_sec Introduction
27 * This module provides an abstraction for accessing the functionality provided
28 * by the midgard MMU and thus allows all MMU HW access to be contained within
29 * one common place and allows for different backends (implementations) to
33 #ifndef _MALI_KBASE_MMU_HW_H_
34 #define _MALI_KBASE_MMU_HW_H_
36 /* Forward declarations */
42 * @addtogroup base_kbase_api
47 * @addtogroup mali_kbase_mmu_hw MMU access APIs
51 /** @brief MMU fault type descriptor.
53 enum kbase_mmu_fault_type {
54 KBASE_MMU_FAULT_TYPE_UNKNOWN = 0,
55 KBASE_MMU_FAULT_TYPE_PAGE,
56 KBASE_MMU_FAULT_TYPE_BUS,
57 KBASE_MMU_FAULT_TYPE_PAGE_UNEXPECTED,
58 KBASE_MMU_FAULT_TYPE_BUS_UNEXPECTED
61 /** @brief Configure an address space for use.
63 * Configure the MMU using the address space details setup in the
64 * @ref kbase_context structure.
66 * @param[in] kbdev kbase device to configure.
67 * @param[in] as address space to configure.
68 * @param[in] kctx kbase context to configure.
70 void kbase_mmu_hw_configure(struct kbase_device *kbdev,
71 struct kbase_as *as, struct kbase_context *kctx);
73 /** @brief Issue an operation to the MMU.
75 * Issue an operation (MMU invalidate, MMU flush, etc) on the address space that
76 * is associated with the provided @ref kbase_context over the specified range
78 * @param[in] kbdev kbase device to issue the MMU operation on.
79 * @param[in] as address space to issue the MMU operation on.
80 * @param[in] kctx kbase context to issue the MMU operation on.
81 * @param[in] vpfn MMU Virtual Page Frame Number to start the
83 * @param[in] nr Number of pages to work on.
84 * @param[in] type Operation type (written to ASn_COMMAND).
85 * @param[in] handling_irq Is this operation being called during the handling
88 * @return Zero if the operation was successful, non-zero otherwise.
90 int kbase_mmu_hw_do_operation(struct kbase_device *kbdev, struct kbase_as *as,
91 struct kbase_context *kctx, u64 vpfn, u32 nr, u32 type,
92 unsigned int handling_irq);
94 /** @brief Clear a fault that has been previously reported by the MMU.
96 * Clear a bus error or page fault that has been reported by the MMU.
98 * @param[in] kbdev kbase device to clear the fault from.
99 * @param[in] as address space to clear the fault from.
100 * @param[in] kctx kbase context to clear the fault from or NULL.
101 * @param[in] type The type of fault that needs to be cleared.
103 void kbase_mmu_hw_clear_fault(struct kbase_device *kbdev, struct kbase_as *as,
104 struct kbase_context *kctx, enum kbase_mmu_fault_type type);
106 /** @brief Enable fault that has been previously reported by the MMU.
108 * After a page fault or bus error has been reported by the MMU these
109 * will be disabled. After these are handled this function needs to be
110 * called to enable the page fault or bus error fault again.
112 * @param[in] kbdev kbase device to again enable the fault from.
113 * @param[in] as address space to again enable the fault from.
114 * @param[in] kctx kbase context to again enable the fault from.
115 * @param[in] type The type of fault that needs to be enabled again.
117 void kbase_mmu_hw_enable_fault(struct kbase_device *kbdev, struct kbase_as *as,
118 struct kbase_context *kctx, enum kbase_mmu_fault_type type);
120 /** @} *//* end group mali_kbase_mmu_hw */
121 /** @} *//* end group base_kbase_api */
123 #endif /* _MALI_KBASE_MMU_HW_H_ */