|
My Project
|
#include <linux/kref.h>#include "mali_base_kernel.h"#include <mali_kbase_hw.h>#include "mali_kbase_pm.h"#include "mali_kbase_defs.h"#include "mali_kbase_mem_linux.h"Go to the source code of this file.
Classes | |
| struct | kbase_cpu_mapping |
| struct | kbase_aliased |
| struct | kbase_mem_phy_alloc |
| struct | kbase_va_region |
Macros | |
| #define | KBASEP_TMEM_GROWABLE_BLOCKSIZE_PAGES_LOG2_HW_ISSUE_8316 (2) /* round to 4 pages */ |
| #define | KBASEP_TMEM_GROWABLE_BLOCKSIZE_PAGES_LOG2_HW_ISSUE_9630 (3) /* round to 8 pages */ |
| #define | KBASEP_TMEM_GROWABLE_BLOCKSIZE_PAGES_LOG2 (0) /* round to 1 page */ |
| #define | KBASEP_TMEM_GROWABLE_BLOCKSIZE_PAGES (1u << KBASEP_TMEM_GROWABLE_BLOCKSIZE_PAGES_LOG2) |
| #define | KBASEP_TMEM_GROWABLE_BLOCKSIZE_PAGES_HW_ISSUE_8316 (1u << KBASEP_TMEM_GROWABLE_BLOCKSIZE_PAGES_LOG2_HW_ISSUE_8316) |
| #define | KBASEP_TMEM_GROWABLE_BLOCKSIZE_PAGES_HW_ISSUE_9630 (1u << KBASEP_TMEM_GROWABLE_BLOCKSIZE_PAGES_LOG2_HW_ISSUE_9630) |
| #define | KBASE_MEM_PHY_ALLOC_ACCESSED_CACHED (1ul << 0) |
| Physical pages tracking object properties. | |
| #define | KBASE_MEM_PHY_ALLOC_LARGE (1ul << 1) |
| #define | KBASE_REG_FREE (1ul << 0) |
| #define | KBASE_REG_CPU_WR (1ul << 1) |
| #define | KBASE_REG_GPU_WR (1ul << 2) |
| #define | KBASE_REG_GPU_NX (1ul << 3) |
| #define | KBASE_REG_CPU_CACHED (1ul << 4) |
| #define | KBASE_REG_GPU_CACHED (1ul << 5) |
| #define | KBASE_REG_GROWABLE (1ul << 6) |
| #define | KBASE_REG_PF_GROW (1ul << 7) |
| #define | KBASE_REG_CUSTOM_VA (1ul << 8) |
| #define | KBASE_REG_SHARE_IN (1ul << 9) |
| #define | KBASE_REG_SHARE_BOTH (1ul << 10) |
| #define | KBASE_REG_ZONE_MASK (3ul << 11) |
| #define | KBASE_REG_ZONE(x) (((x) & 3) << 11) |
| #define | KBASE_REG_GPU_RD (1ul<<13) |
| #define | KBASE_REG_CPU_RD (1ul<<14) |
| #define | KBASE_REG_MEMATTR_MASK (7ul << 16) |
| #define | KBASE_REG_MEMATTR_INDEX(x) (((x) & 7) << 16) |
| #define | KBASE_REG_MEMATTR_VALUE(x) (((x) & KBASE_REG_MEMATTR_MASK) >> 16) |
| #define | KBASE_REG_SECURE (1ul << 19) |
| #define | KBASE_REG_DONT_NEED (1ul << 20) |
| #define | KBASE_REG_ZONE_SAME_VA KBASE_REG_ZONE(0) |
| #define | KBASE_REG_ZONE_EXEC KBASE_REG_ZONE(1) |
| #define | KBASE_REG_ZONE_EXEC_BASE (0x101000000ULL >> PAGE_SHIFT) |
| #define | KBASE_REG_ZONE_EXEC_SIZE ((16ULL * 1024 * 1024) >> PAGE_SHIFT) |
| #define | KBASE_REG_ZONE_CUSTOM_VA KBASE_REG_ZONE(2) |
| #define | KBASE_REG_ZONE_CUSTOM_VA_BASE (KBASE_REG_ZONE_EXEC_BASE + KBASE_REG_ZONE_EXEC_SIZE) /* Starting after KBASE_REG_ZONE_EXEC */ |
| #define | KBASE_REG_ZONE_CUSTOM_VA_SIZE (((1ULL << 44) >> PAGE_SHIFT) - KBASE_REG_ZONE_CUSTOM_VA_BASE) |
| #define | KBASE_MEM_PHY_ALLOC_LARGE_THRESHOLD ((size_t)(4*1024)) /* size above which vmalloc is used over kmalloc */ |
| #define | KBASE_MEM_POOL_MAX_SIZE_KBDEV (SZ_64M >> PAGE_SHIFT) |
| #define | KBASE_MEM_POOL_MAX_SIZE_KCTX (SZ_4M >> PAGE_SHIFT) |
Functions | |
| void | kbase_mem_kref_free (struct kref *kref) |
| int | kbase_mem_init (struct kbase_device *kbdev) |
| void | kbase_mem_halt (struct kbase_device *kbdev) |
| void | kbase_mem_term (struct kbase_device *kbdev) |
| int | kbase_mem_pool_init (struct kbase_mem_pool *pool, size_t max_size, struct kbase_device *kbdev, struct kbase_mem_pool *next_pool) |
| void | kbase_mem_pool_term (struct kbase_mem_pool *pool) |
| struct page * | kbase_mem_pool_alloc (struct kbase_mem_pool *pool) |
| void | kbase_mem_pool_free (struct kbase_mem_pool *pool, struct page *page, bool dirty) |
| int | kbase_mem_pool_alloc_pages (struct kbase_mem_pool *pool, size_t nr_pages, phys_addr_t *pages) |
| void | kbase_mem_pool_free_pages (struct kbase_mem_pool *pool, size_t nr_pages, phys_addr_t *pages, bool dirty, bool reclaimed) |
| void | kbase_mem_pool_set_max_size (struct kbase_mem_pool *pool, size_t max_size) |
| int | kbase_mem_pool_grow (struct kbase_mem_pool *pool, size_t nr_to_grow) |
| void | kbase_mem_pool_trim (struct kbase_mem_pool *pool, size_t new_size) |
| struct page * | kbase_mem_alloc_page (struct kbase_device *kbdev) |
| int | kbase_region_tracker_init (struct kbase_context *kctx) |
| int | kbase_region_tracker_init_jit (struct kbase_context *kctx, u64 jit_va_pages) |
| void | kbase_region_tracker_term (struct kbase_context *kctx) |
| struct kbase_va_region * | kbase_region_tracker_find_region_enclosing_address (struct kbase_context *kctx, u64 gpu_addr) |
| struct kbase_va_region * | kbase_region_tracker_find_region_base_address (struct kbase_context *kctx, u64 gpu_addr) |
| Check that a pointer is actually a valid region. More... | |
| struct kbase_va_region * | kbase_alloc_free_region (struct kbase_context *kctx, u64 start_pfn, size_t nr_pages, int zone) |
| Allocate a free region object. More... | |
| void | kbase_free_alloced_region (struct kbase_va_region *reg) |
| Free a region object. More... | |
| int | kbase_add_va_region (struct kbase_context *kctx, struct kbase_va_region *reg, u64 addr, size_t nr_pages, size_t align) |
| Add a VA region to the list. | |
| bool | kbase_check_alloc_flags (unsigned long flags) |
| bool | kbase_check_import_flags (unsigned long flags) |
| int | kbase_update_region_flags (struct kbase_context *kctx, struct kbase_va_region *reg, unsigned long flags) |
| void | kbase_gpu_vm_lock (struct kbase_context *kctx) |
| Acquire the per-context region list lock. | |
| void | kbase_gpu_vm_unlock (struct kbase_context *kctx) |
| Release the per-context region list lock. | |
| int | kbase_alloc_phy_pages (struct kbase_va_region *reg, size_t vsize, size_t size) |
| int | kbase_mmu_init (struct kbase_context *kctx) |
| void | kbase_mmu_term (struct kbase_context *kctx) |
| phys_addr_t | kbase_mmu_alloc_pgd (struct kbase_context *kctx) |
| void | kbase_mmu_free_pgd (struct kbase_context *kctx) |
| int | kbase_mmu_insert_pages_no_flush (struct kbase_context *kctx, u64 vpfn, phys_addr_t *phys, size_t nr, unsigned long flags) |
| int | kbase_mmu_insert_pages (struct kbase_context *kctx, u64 vpfn, phys_addr_t *phys, size_t nr, unsigned long flags) |
| int | kbase_mmu_insert_single_page (struct kbase_context *kctx, u64 vpfn, phys_addr_t phys, size_t nr, unsigned long flags) |
| int | kbase_mmu_teardown_pages (struct kbase_context *kctx, u64 vpfn, size_t nr) |
| int | kbase_mmu_update_pages (struct kbase_context *kctx, u64 vpfn, phys_addr_t *phys, size_t nr, unsigned long flags) |
| int | kbase_gpu_mmap (struct kbase_context *kctx, struct kbase_va_region *reg, u64 addr, size_t nr_pages, size_t align) |
| Register region and map it on the GPU. More... | |
| int | kbase_gpu_munmap (struct kbase_context *kctx, struct kbase_va_region *reg) |
| Remove the region from the GPU and unregister it. More... | |
| void | kbase_mmu_update (struct kbase_context *kctx) |
| void | kbase_mmu_disable (struct kbase_context *kctx) |
| void | kbase_mmu_disable_as (struct kbase_device *kbdev, int as_nr) |
| void | kbase_mmu_interrupt (struct kbase_device *kbdev, u32 irq_stat) |
| void * | kbase_mmu_dump (struct kbase_context *kctx, int nr_pages) |
| int | kbase_sync_now (struct kbase_context *kctx, struct base_syncset *syncset) |
| void | kbase_sync_single (struct kbase_context *kctx, phys_addr_t cpu_pa, phys_addr_t gpu_pa, off_t offset, size_t size, enum kbase_sync_type sync_fn) |
| void | kbase_pre_job_sync (struct kbase_context *kctx, struct base_syncset *syncsets, size_t nr) |
| void | kbase_post_job_sync (struct kbase_context *kctx, struct base_syncset *syncsets, size_t nr) |
| int | kbase_mem_free (struct kbase_context *kctx, u64 gpu_addr) |
| Free the region from the GPU and unregister it. More... | |
| int | kbase_mem_free_region (struct kbase_context *kctx, struct kbase_va_region *reg) |
| void | kbase_os_mem_map_lock (struct kbase_context *kctx) |
| void | kbase_os_mem_map_unlock (struct kbase_context *kctx) |
| void | kbasep_os_process_page_usage_update (struct kbase_context *kctx, int pages) |
| Update the memory allocation counters for the current process. More... | |
| int | kbasep_find_enclosing_cpu_mapping_offset (struct kbase_context *kctx, unsigned long uaddr, size_t size, u64 *offset) |
| enum hrtimer_restart | kbasep_as_poke_timer_callback (struct hrtimer *timer) |
| void | kbase_as_poking_timer_retain_atom (struct kbase_device *kbdev, struct kbase_context *kctx, struct kbase_jd_atom *katom) |
| void | kbase_as_poking_timer_release_atom (struct kbase_device *kbdev, struct kbase_context *kctx, struct kbase_jd_atom *katom) |
| int | kbase_alloc_phy_pages_helper (struct kbase_mem_phy_alloc *alloc, size_t nr_pages_requested) |
| Allocates physical pages. More... | |
| int | kbase_free_phy_pages_helper (struct kbase_mem_phy_alloc *alloc, size_t nr_pages_to_free) |
| Free physical pages. More... | |
| void | kbase_mmu_interrupt_process (struct kbase_device *kbdev, struct kbase_context *kctx, struct kbase_as *as) |
| Process a bus or page fault. More... | |
| void | page_fault_worker (struct work_struct *data) |
| Process a page fault. More... | |
| void | bus_fault_worker (struct work_struct *data) |
| Process a bus fault. More... | |
| void | kbase_flush_mmu_wqs (struct kbase_device *kbdev) |
| Flush MMU workqueues. More... | |
| void | kbase_sync_single_for_device (struct kbase_device *kbdev, dma_addr_t handle, size_t size, enum dma_data_direction dir) |
| void | kbase_sync_single_for_cpu (struct kbase_device *kbdev, dma_addr_t handle, size_t size, enum dma_data_direction dir) |
| int | kbase_jit_init (struct kbase_context *kctx) |
| struct kbase_va_region * | kbase_jit_allocate (struct kbase_context *kctx, struct base_jit_alloc_info *info) |
| void | kbase_jit_free (struct kbase_context *kctx, struct kbase_va_region *reg) |
| void | kbase_jit_backing_lost (struct kbase_va_region *reg) |
| bool | kbase_jit_evict (struct kbase_context *kctx) |
| void | kbase_jit_term (struct kbase_context *kctx) |
| struct kbase_mem_phy_alloc * | kbase_map_external_resource (struct kbase_context *kctx, struct kbase_va_region *reg, struct mm_struct *locked_mm) |
| void | kbase_unmap_external_resource (struct kbase_context *kctx, struct kbase_va_region *reg, struct kbase_mem_phy_alloc *alloc) |
| int | kbase_sticky_resource_init (struct kbase_context *kctx) |
| struct kbase_ctx_ext_res_meta * | kbase_sticky_resource_acquire (struct kbase_context *kctx, u64 gpu_addr) |
| bool | kbase_sticky_resource_release (struct kbase_context *kctx, struct kbase_ctx_ext_res_meta *meta, u64 gpu_addr) |
| void | kbase_sticky_resource_term (struct kbase_context *kctx) |
| int | kbase_zone_cache_update (struct kbase_mem_phy_alloc *alloc, size_t start_offset) |
| int | kbase_zone_cache_build (struct kbase_mem_phy_alloc *alloc) |
| void | kbase_zone_cache_clear (struct kbase_mem_phy_alloc *alloc) |
Base kernel memory APIs
| void bus_fault_worker | ( | struct work_struct * | data | ) |
Process a bus fault.
| [in] | data | work_struct passed by queue_work() |
| struct kbase_va_region* kbase_alloc_free_region | ( | struct kbase_context * | kctx, |
| u64 | start_pfn, | ||
| size_t | nr_pages, | ||
| int | zone | ||
| ) |
Allocate a free region object.
The allocated object is not part of any list yet, and is flagged as KBASE_REG_FREE. No mapping is allocated yet.
zone is KBASE_REG_ZONE_CUSTOM_VA, KBASE_REG_ZONE_SAME_VA, or KBASE_REG_ZONE_EXEC
| int kbase_alloc_phy_pages_helper | ( | struct kbase_mem_phy_alloc * | alloc, |
| size_t | nr_pages_requested | ||
| ) |
Allocates physical pages.
Allocates nr_pages_requested and updates the alloc object.
| [in] | alloc | allocation object to add pages to |
| [in] | nr_pages_requested | number of physical pages to allocate |
| void kbase_as_poking_timer_release_atom | ( | struct kbase_device * | kbdev, |
| struct kbase_context * | kctx, | ||
| struct kbase_jd_atom * | katom | ||
| ) |
If an atom holds a poking timer, release it and wait for it to finish
This must only be called on a context that's scheduled in, and an atom that still has a JS reference on the context
This must not be called from atomic context, since it can sleep.
| void kbase_as_poking_timer_retain_atom | ( | struct kbase_device * | kbdev, |
| struct kbase_context * | kctx, | ||
| struct kbase_jd_atom * | katom | ||
| ) |
Retain the poking timer on an atom's context (if the atom hasn't already done so), and start the timer (if it's not already started).
This must only be called on a context that's scheduled in, and an atom that's running on the GPU.
The caller must hold hwaccess_lock
This can be called safely from atomic context
| void kbase_flush_mmu_wqs | ( | struct kbase_device * | kbdev | ) |
Flush MMU workqueues.
This function will cause any outstanding page or bus faults to be processed. It should be called prior to powering off the GPU.
| [in] | kbdev | Device pointer |
| void kbase_free_alloced_region | ( | struct kbase_va_region * | reg | ) |
Free a region object.
The described region must be freed of any mapping.
If the region is not flagged as KBASE_REG_FREE, the region's alloc object will be released. It is a bug if no alloc object exists for non-free regions.
| int kbase_free_phy_pages_helper | ( | struct kbase_mem_phy_alloc * | alloc, |
| size_t | nr_pages_to_free | ||
| ) |
Free physical pages.
Frees nr_pages and updates the alloc object.
| [in] | alloc | allocation object to free pages from |
| [in] | nr_pages_to_free | number of physical pages to free |
| int kbase_gpu_mmap | ( | struct kbase_context * | kctx, |
| struct kbase_va_region * | reg, | ||
| u64 | addr, | ||
| size_t | nr_pages, | ||
| size_t | align | ||
| ) |
Register region and map it on the GPU.
Call kbase_add_va_region() and map the region on the GPU.
| int kbase_gpu_munmap | ( | struct kbase_context * | kctx, |
| struct kbase_va_region * | reg | ||
| ) |
Remove the region from the GPU and unregister it.
Must be called with context lock held.
| struct kbase_va_region* kbase_jit_allocate | ( | struct kbase_context * | kctx, |
| struct base_jit_alloc_info * | info | ||
| ) |
kbase_jit_allocate - Allocate JIT memory : kbase context : JIT allocation information
Return: JIT allocation on success or NULL on failure.
| void kbase_jit_backing_lost | ( | struct kbase_va_region * | reg | ) |
kbase_jit_backing_lost - Inform JIT that an allocation has lost backing : JIT allocation
| bool kbase_jit_evict | ( | struct kbase_context * | kctx | ) |
kbase_jit_evict - Evict a JIT allocation from the pool : kbase context
Evict the least recently used JIT allocation from the pool. This can be required if normal VA allocations are failing due to VA exhaustion.
Return: True if a JIT allocation was freed, false otherwise.
| void kbase_jit_free | ( | struct kbase_context * | kctx, |
| struct kbase_va_region * | reg | ||
| ) |
kbase_jit_free - Free a JIT allocation : kbase context : JIT allocation
Frees a JIT allocation and places it into the free pool for later reuse.
| int kbase_jit_init | ( | struct kbase_context * | kctx | ) |
kbase_jit_init - Initialize the JIT memory pool management : kbase context
Returns zero on success or negative error number on failure.
| void kbase_jit_term | ( | struct kbase_context * | kctx | ) |
kbase_jit_term - Terminate the JIT memory pool management : kbase context
| struct kbase_mem_phy_alloc* kbase_map_external_resource | ( | struct kbase_context * | kctx, |
| struct kbase_va_region * | reg, | ||
| struct mm_struct * | locked_mm | ||
| ) |
kbase_map_external_resource - Map an external resource to the GPU. : kbase context. : The region to map. : The mm_struct which has been locked for this operation. : The number of KDS resources. : Array of KDS resources. : Access bitmap for KDS. : If the KDS resource requires exclusive access.
Return: The physical allocation which backs the region on success or NULL on failure.
| int kbase_mem_free | ( | struct kbase_context * | kctx, |
| u64 | gpu_addr | ||
| ) |
Free the region from the GPU and unregister it.
This function implements the free operation on a memory segment. It will loudly fail if called with outstanding mappings.
| struct page* kbase_mem_pool_alloc | ( | struct kbase_mem_pool * | pool | ) |
kbase_mem_pool_alloc - Allocate a page from memory pool : Memory pool to allocate from
Allocations from the pool are made as follows:
Return: Pointer to allocated page, or NULL if allocation failed.
| int kbase_mem_pool_alloc_pages | ( | struct kbase_mem_pool * | pool, |
| size_t | nr_pages, | ||
| phys_addr_t * | pages | ||
| ) |
kbase_mem_pool_alloc_pages - Allocate pages from memory pool : Memory pool to allocate from : Number of pages to allocate : Pointer to array where the physical address of the allocated pages will be stored.
Like kbase_mem_pool_alloc() but optimized for allocating many pages.
Return: 0 on success, negative -errno on error
| void kbase_mem_pool_free_pages | ( | struct kbase_mem_pool * | pool, |
| size_t | nr_pages, | ||
| phys_addr_t * | pages, | ||
| bool | dirty, | ||
| bool | reclaimed | ||
| ) |
kbase_mem_pool_free_pages - Free pages to memory pool : Memory pool where pages should be freed : Number of pages to free : Pointer to array holding the physical addresses of the pages to free. : Whether any pages may be dirty in the cache. : Whether the pages where reclaimable and thus should bypass the pool and go straight to the kernel.
Like kbase_mem_pool_free() but optimized for freeing many pages.
| int kbase_mem_pool_grow | ( | struct kbase_mem_pool * | pool, |
| size_t | nr_to_grow | ||
| ) |
kbase_mem_pool_grow - Grow the pool : Memory pool to grow : Number of pages to add to the pool
Adds pages to the pool. Note that this may cause the pool to become larger than the maximum size specified.
Returns: 0 on success, -ENOMEM if unable to allocate sufficent pages
| int kbase_mem_pool_init | ( | struct kbase_mem_pool * | pool, |
| size_t | max_size, | ||
| struct kbase_device * | kbdev, | ||
| struct kbase_mem_pool * | next_pool | ||
| ) |
kbase_mem_pool_init - Create a memory pool for a kbase device : Memory pool to initialize : Maximum number of free pages the pool can hold : Kbase device where memory is used : Pointer to the next pool or NULL.
Allocations from are in whole pages. Each has a free list where pages can be quickly allocated from. The free list is initially empty and filled whenever pages are freed back to the pool. The number of free pages in the pool will in general not exceed , but the pool may in certain corner cases grow above .
If is not NULL, we will allocate from before going to the kernel allocator. Similarily pages can spill over to when is full. Pages are zeroed before they spill over to another pool, to prevent leaking information between applications.
A shrinker is registered so that Linux mm can reclaim pages from the pool as needed.
Return: 0 on success, negative -errno on error
| void kbase_mem_pool_set_max_size | ( | struct kbase_mem_pool * | pool, |
| size_t | max_size | ||
| ) |
kbase_mem_pool_set_max_size - Set maximum number of free pages in memory pool : Memory pool to inspect : Maximum number of free pages the pool can hold
If is reduced, the pool will be shrunk to adhere to the new limit. For details see kbase_mem_pool_shrink().
| void kbase_mem_pool_term | ( | struct kbase_mem_pool * | pool | ) |
kbase_mem_pool_term - Destroy a memory pool : Memory pool to destroy
Pages in the pool will spill over to (if available) or freed to the kernel.
| void kbase_mem_pool_trim | ( | struct kbase_mem_pool * | pool, |
| size_t | new_size | ||
| ) |
kbase_mem_pool_trim - Grow or shrink the pool to a new size : Memory pool to trim : New number of pages in the pool
If > , fill the pool with new pages from the kernel, but not above the max_size for the pool. If < , shrink the pool by freeing pages to the kernel.
| void kbase_mmu_disable | ( | struct kbase_context * | kctx | ) |
kbase_mmu_disable() - Disable the MMU for a previously active kbase context. : Kbase context
Disable and perform the required cache maintenance to remove the all data from provided kbase context from the GPU caches.
The caller has the following locking conditions:
| void kbase_mmu_disable_as | ( | struct kbase_device * | kbdev, |
| int | as_nr | ||
| ) |
kbase_mmu_disable_as() - Set the MMU to unmapped mode for the specified address space. : Kbase device : The address space number to set to unmapped.
This function must only be called during reset/power-up and it used to ensure the registers are in a known state.
The caller must hold kbdev->mmu_hw_mutex.
| void* kbase_mmu_dump | ( | struct kbase_context * | kctx, |
| int | nr_pages | ||
| ) |
Dump the MMU tables to a buffer
This function allocates a buffer (of nr_pages pages) to hold a dump of the MMU tables and fills it. If the buffer is too small then the return value will be NULL.
The GPU vm lock must be held when calling this function.
The buffer returned should be freed with vfree when it is no longer required.
| [in] | kctx | The kbase context to dump |
| [in] | nr_pages | The number of pages to allocate for the buffer. |
nr_pages is too small) | void kbase_mmu_interrupt_process | ( | struct kbase_device * | kbdev, |
| struct kbase_context * | kctx, | ||
| struct kbase_as * | as | ||
| ) |
Process a bus or page fault.
This function will process a fault on a specific address space
| [in] | kbdev | The kbase_device the fault happened on |
| [in] | kctx | The kbase_context for the faulting address space if one was found. |
| [in] | as | The address space that has the fault |
| void kbase_mmu_update | ( | struct kbase_context * | kctx | ) |
The caller has the following locking conditions:
| int kbase_mmu_update_pages | ( | struct kbase_context * | kctx, |
| u64 | vpfn, | ||
| phys_addr_t * | phys, | ||
| size_t | nr, | ||
| unsigned long | flags | ||
| ) |
Update the entries for specified number of pages pointed to by 'phys' at GPU PFN 'vpfn'. This call is being triggered as a response to the changes of the mem attributes
IMPORTANT: This uses kbasep_js_runpool_release_ctx() when the context is currently scheduled into the runpool, and so potentially uses a lot of locks. These locks must be taken in the correct order with respect to others already held by the caller. Refer to kbasep_js_runpool_release_ctx() for more information.
| struct kbase_va_region* kbase_region_tracker_find_region_base_address | ( | struct kbase_context * | kctx, |
| u64 | gpu_addr | ||
| ) |
Check that a pointer is actually a valid region.
Must be called with context lock held.
| int kbase_region_tracker_init | ( | struct kbase_context * | kctx | ) |
Initialize the region tracker data structure.
| struct kbase_ctx_ext_res_meta* kbase_sticky_resource_acquire | ( | struct kbase_context * | kctx, |
| u64 | gpu_addr | ||
| ) |
kbase_sticky_resource_acquire - Acquire a reference on a sticky resource. : kbase context. : The GPU address of the external resource.
Return: The metadata object which represents the binding between the external resource and the kbase context on success or NULL on failure.
| int kbase_sticky_resource_init | ( | struct kbase_context * | kctx | ) |
kbase_sticky_resource_init - Initialize sticky resource management. : kbase context
Returns zero on success or negative error number on failure.
| bool kbase_sticky_resource_release | ( | struct kbase_context * | kctx, |
| struct kbase_ctx_ext_res_meta * | meta, | ||
| u64 | gpu_addr | ||
| ) |
kbase_sticky_resource_release - Release a reference on a sticky resource. : kbase context. : Binding metadata. : GPU address of the external resource.
If meta is NULL then gpu_addr will be used to scan the metadata list and find the matching metadata (if any), otherwise the provided meta will be used and gpu_addr will be ignored.
Return: True if the release found the metadata and the reference was dropped.
| void kbase_sticky_resource_term | ( | struct kbase_context * | kctx | ) |
kbase_sticky_resource_term - Terminate sticky resource management. : kbase context
| void kbase_unmap_external_resource | ( | struct kbase_context * | kctx, |
| struct kbase_va_region * | reg, | ||
| struct kbase_mem_phy_alloc * | alloc | ||
| ) |
kbase_unmap_external_resource - Unmap an external resource from the GPU. : kbase context. : The region to unmap or NULL if it has already been released. : The physical allocation being unmapped.
| int kbase_update_region_flags | ( | struct kbase_context * | kctx, |
| struct kbase_va_region * | reg, | ||
| unsigned long | flags | ||
| ) |
kbase_update_region_flags - Convert user space flags to kernel region flags
: kbase context : The region to update the flags on : The flags passed from user space
The user space flag BASE_MEM_COHERENT_SYSTEM_REQUIRED will be rejected and this function will fail if the system does not support system coherency.
Return: 0 if successful, -EINVAL if the flags are not supported
| int kbase_zone_cache_build | ( | struct kbase_mem_phy_alloc * | alloc | ) |
kbase_zone_cache_build - Build the memory zone cache. : The physical memory allocation to build the cache for.
Create a new zone cache for the provided physical memory allocation if one doesn't already exist, if one does exist then just return.
Return: Zero if the zone cache was created, negative error code on error.
| void kbase_zone_cache_clear | ( | struct kbase_mem_phy_alloc * | alloc | ) |
kbase_zone_cache_clear - Clear the memory zone cache. : The physical memory allocation to clear the cache on.
| int kbase_zone_cache_update | ( | struct kbase_mem_phy_alloc * | alloc, |
| size_t | start_offset | ||
| ) |
kbase_zone_cache_update - Update the memory zone cache after new pages have been added. : The physical memory allocation to build the cache for. : Offset to where the new pages start.
Updates an existing memory zone cache, updating the counters for the various zones. If the memory allocation doesn't already have a zone cache assume that one isn't created and thus don't do anything.
Return: Zero cache was updated, negative error code on error.
| int kbasep_find_enclosing_cpu_mapping_offset | ( | struct kbase_context * | kctx, |
| unsigned long | uaddr, | ||
| size_t | size, | ||
| u64 * | offset | ||
| ) |
kbasep_find_enclosing_cpu_mapping_offset() - Find the offset of the CPU mapping of a memory allocation containing a given address range
Searches for a CPU mapping of any part of any region that fully encloses the CPU virtual address range specified by and . Returns a failure indication if only part of the address range lies within a CPU mapping.
: The kernel base context used for the allocation. : Start of the CPU virtual address range. : Size of the CPU virtual address range (in bytes). : The offset from the start of the allocation to the specified CPU virtual address.
Return: 0 if offset was obtained successfully. Error code otherwise.
| void kbasep_os_process_page_usage_update | ( | struct kbase_context * | kctx, |
| int | pages | ||
| ) |
Update the memory allocation counters for the current process.
OS specific call to updates the current memory allocation counters for the current process with the supplied delta.
| [in] | kctx | The kbase context |
| [in] | pages | The desired delta to apply to the memory usage counters. |
| void page_fault_worker | ( | struct work_struct * | data | ) |
Process a page fault.
| [in] | data | work_struct passed by queue_work() |
1.8.13