summaryrefslogtreecommitdiff
path: root/drivers/mxc/gpu-viv
diff options
context:
space:
mode:
authorXianzhong <xianzhong.li@nxp.com>2018-10-22 19:13:15 +0800
committerJason Liu <jason.hui.liu@nxp.com>2019-02-12 10:34:44 +0800
commit20aedafda5c266b37ef751c17b2238e39f07ef0a (patch)
tree10c30b2307a02646b84d9b7d95b9a1ba4cc252da /drivers/mxc/gpu-viv
parent410845412da31323c181e3eb1e74107707e17464 (diff)
MGS-4338-2 [#imx-1223] GPU memory optimization for page fault
GPU memory initialization will cause large boot time with 40ms. If GPU memory is allocated from CMA, memset in cma kernel driver, It is not necessary to add duplicated memset in GPU kernel driver. Only GFP allocator need trigger a page fault with a simple write. Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
Diffstat (limited to 'drivers/mxc/gpu-viv')
-rw-r--r--drivers/mxc/gpu-viv/hal/os/linux/kernel/allocator/default/gc_hal_kernel_allocator_gfp.c6
-rw-r--r--drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c3
2 files changed, 6 insertions, 3 deletions
diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/allocator/default/gc_hal_kernel_allocator_gfp.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/allocator/default/gc_hal_kernel_allocator_gfp.c
index 937c7521ff0e..71a867c9302c 100644
--- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/allocator/default/gc_hal_kernel_allocator_gfp.c
+++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/allocator/default/gc_hal_kernel_allocator_gfp.c
@@ -926,6 +926,12 @@ _GFPMapKernel(
addr = vmap(pages, numPages, 0, pgprot_writecombine(PAGE_KERNEL));
+ /* Trigger a page fault. */
+ for (i = 0; i < numPages; i++)
+ {
+ *(gctINT *)(addr + PAGE_SIZE * i) = 0;
+ }
+
if (free)
{
kfree(pages);
diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c
index bc316b3c0acb..7be6e7912bc4 100644
--- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c
+++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c
@@ -1345,9 +1345,6 @@ gckOS_AllocateNonPagedMemory(
gcmkONERROR(allocator->ops->MapKernel(allocator, mdl, &addr));
- /* Trigger a page fault. */
- memset(addr, 0, numPages * PAGE_SIZE);
-
mdl->addr = addr;
if (InUserSpace)