3 * (C) COPYRIGHT 2012-2016 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.
24 #include "mali_kbase_cache_policy.h"
27 * The output flags should be a combination of the following values:
28 * KBASE_REG_CPU_CACHED: CPU cache should be enabled.
30 u32 kbase_cache_enabled(u32 flags, u32 nr_pages)
34 CSTD_UNUSED(nr_pages);
36 if (flags & BASE_MEM_CACHED_CPU)
37 cache_flags |= KBASE_REG_CPU_CACHED;
43 void kbase_sync_single_for_device(struct kbase_device *kbdev, dma_addr_t handle,
44 size_t size, enum dma_data_direction dir)
46 /* Check if kernel is using coherency with GPU */
47 #ifdef CONFIG_MALI_COH_KERN
48 if (kbdev->system_coherency == COHERENCY_ACE)
50 #endif /* CONFIG_MALI_COH_KERN */
51 dma_sync_single_for_device(kbdev->dev, handle, size, dir);
55 void kbase_sync_single_for_cpu(struct kbase_device *kbdev, dma_addr_t handle,
56 size_t size, enum dma_data_direction dir)
58 /* Check if kernel is using coherency with GPU */
59 #ifdef CONFIG_MALI_COH_KERN
60 if (kbdev->system_coherency == COHERENCY_ACE)
62 #endif /* CONFIG_MALI_COH_KERN */
63 dma_sync_single_for_cpu(kbdev->dev, handle, size, dir);