diff options
author | Shawn Xiao <b49994@freescale.com> | 2015-07-27 17:23:47 +0800 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2015-09-17 09:24:07 -0500 |
commit | a0c59446bc9893a990dd069572a461a1bd52c7e0 (patch) | |
tree | bd84d14cb6084623427e925e819db9ad8a5ecae0 /drivers | |
parent | f8ede93e68cdb3845cbd8970f2606fb7659628b1 (diff) |
MGS-896 [#1818] Kernel panic when run mesa_copytex on 6qp board
After enable dynamic mmu mapping, all the address should be mapped
dynamically including the address located in static mapping region.
Since the static mapping is linear, the upper function can use the
mapped address as the physical address. However dynamic mapping break
this rule and cause some issues.
To keep the rule still work, limit dynamic mapping happens over the mmu
dynamic start address.
Date July 27, 2015
Signed-off-by: Shawn Xiao <b49994@freescale.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c index cfb682c4c97e..e0920e594893 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c +++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c @@ -1289,27 +1289,29 @@ _NeedVirtualMapping( } else #endif - if (!gckHARDWARE_IsFeatureAvailable(Kernel->hardware, gcvFEATURE_MMU)) - { - /* Convert logical address into a physical address. */ - gcmkONERROR(gckOS_UserLogicalToPhysical( - Kernel->os, Node->Virtual.logical, &phys - )); + /* Convert logical address into a physical address. */ + gcmkONERROR(gckOS_UserLogicalToPhysical( + Kernel->os, Node->Virtual.logical, &phys + )); + + gcmkSAFECASTPHYSADDRT(address, phys); - gcmkSAFECASTPHYSADDRT(address, phys); + gcmkONERROR(gckOS_GetBaseAddress(Kernel->os, &baseAddress)); - gcmkONERROR(gckOS_GetBaseAddress(Kernel->os, &baseAddress)); + gcmkASSERT(phys >= baseAddress); - gcmkASSERT(phys >= baseAddress); + /* Subtract baseAddress to get a GPU address used for programming. */ + address -= baseAddress; - /* Subtract baseAddress to get a GPU address used for programming. */ - address -= baseAddress; + /* If part of region is belong to gcvPOOL_VIRTUAL, + ** whole region has to be mapped. */ - /* If part of region is belong to gcvPOOL_VIRTUAL, - ** whole region has to be mapped. */ - gcmkSAFECASTSIZET(bytes, Node->Virtual.bytes); - end = address + bytes - 1; + gcmkSAFECASTSIZET(bytes, Node->Virtual.bytes); + end = address + bytes - 1; + + if (!gckHARDWARE_IsFeatureAvailable(Kernel->hardware, gcvFEATURE_MMU)) + { gcmkONERROR(gckHARDWARE_SplitMemory( Kernel->hardware, end, &pool, &offset )); @@ -1319,7 +1321,11 @@ _NeedVirtualMapping( else { /* TODO: Check whether physical address in flat mapping. */ - *NeedMapping = gcvTRUE; + gctUINT32 dynamicMappingStart = Kernel->mmu->dynamicMappingStart; + if( end < (dynamicMappingStart << gcdMMU_MTLB_SHIFT)) + *NeedMapping = gcvFALSE; + else + *NeedMapping = gcvTRUE; } } else |