summaryrefslogtreecommitdiff
path: root/mali_kbase/mali_kbase_native_mgm.c
diff options
context:
space:
mode:
Diffstat (limited to 'mali_kbase/mali_kbase_native_mgm.c')
-rw-r--r--mali_kbase/mali_kbase_native_mgm.c43
1 files changed, 12 insertions, 31 deletions
diff --git a/mali_kbase/mali_kbase_native_mgm.c b/mali_kbase/mali_kbase_native_mgm.c
index 5e3d1ee..d688509 100644
--- a/mali_kbase/mali_kbase_native_mgm.c
+++ b/mali_kbase/mali_kbase_native_mgm.c
@@ -121,44 +121,20 @@ static vm_fault_t kbase_native_mgm_vmf_insert_pfn_prot(struct memory_group_manag
return vmf_insert_pfn_prot(vma, addr, pfn, pgprot);
}
-/**
- * kbase_native_mgm_update_gpu_pte - Native method to modify a GPU page table
- * entry
- *
- * @mgm_dev: The memory group manager the request is being made through.
- * @group_id: A physical memory group ID, which must be valid but is not used.
- * Its valid range is 0 .. MEMORY_GROUP_MANAGER_NR_GROUPS-1.
- * @mmu_level: The level of the MMU page table where the page is getting mapped.
- * @pte: The prepared page table entry.
- *
- * This function simply returns the @pte without modification.
- *
- * Return: A GPU page table entry to be stored in a page table.
- */
static u64 kbase_native_mgm_update_gpu_pte(struct memory_group_manager_device *mgm_dev,
unsigned int group_id, int mmu_level, u64 pte)
{
- CSTD_UNUSED(mgm_dev);
- CSTD_UNUSED(group_id);
- CSTD_UNUSED(mmu_level);
+ if (WARN_ON(group_id >= MEMORY_GROUP_MANAGER_NR_GROUPS))
+ return pte;
+
+ pte |= ((u64)group_id << PTE_PBHA_SHIFT) & PTE_PBHA_MASK;
+
+ /* Address could be translated into a different bus address here */
+ pte |= ((u64)1 << PTE_RES_BIT_MULTI_AS_SHIFT);
return pte;
}
-/**
- * kbase_native_mgm_pte_to_original_pte - Native method to undo changes done in
- * kbase_native_mgm_update_gpu_pte()
- *
- * @mgm_dev: The memory group manager the request is being made through.
- * @group_id: A physical memory group ID, which must be valid but is not used.
- * Its valid range is 0 .. MEMORY_GROUP_MANAGER_NR_GROUPS-1.
- * @mmu_level: The level of the MMU page table where the page is getting mapped.
- * @pte: The prepared page table entry.
- *
- * This function simply returns the @pte without modification.
- *
- * Return: A GPU page table entry to be stored in a page table.
- */
static u64 kbase_native_mgm_pte_to_original_pte(struct memory_group_manager_device *mgm_dev,
unsigned int group_id, int mmu_level, u64 pte)
{
@@ -166,6 +142,11 @@ static u64 kbase_native_mgm_pte_to_original_pte(struct memory_group_manager_devi
CSTD_UNUSED(group_id);
CSTD_UNUSED(mmu_level);
+ /* Undo the group ID modification */
+ pte &= ~PTE_PBHA_MASK;
+ /* Undo the bit set */
+ pte &= ~((u64)1 << PTE_RES_BIT_MULTI_AS_SHIFT);
+
return pte;
}