2 * This confidential and proprietary software may be used only as
3 * authorised by a licensing agreement from ARM Limited
4 * (C) COPYRIGHT 2012 ARM Limited
6 * The entire notice above must be reproduced on all authorised
7 * copies and copies may only be made to the extent permitted
8 * by a licensing agreement from ARM Limited.
12 * @file mali_kbase_cache_policy.h
16 #include "mali_kbase_cache_policy.h"
19 * The output flags should be a combination of the following values:
20 * KBASE_REG_CPU_CACHED: CPU cache should be enabled
21 * KBASE_REG_GPU_CACHED: GPU cache should be enabled
23 * The input flags may contain a combination of hints:
24 * BASE_MEM_HINT_CPU_RD: region heavily read CPU side
25 * BASE_MEM_HINT_CPU_WR: region heavily written CPU side
26 * BASE_MEM_HINT_GPU_RD: region heavily read GPU side
27 * BASE_MEM_HINT_GPU_WR: region heavily written GPU side
29 u32 kbase_cache_enabled(u32 flags, u32 nr_pages)
33 CSTD_UNUSED(nr_pages);
35 /* The CPU cache should be enabled for regions heavily read and written
39 if ((flags & BASE_MEM_HINT_CPU_RD) && (flags & BASE_MEM_HINT_CPU_WR))
41 cache_flags |= KBASE_REG_CPU_CACHED;
45 /* The GPU cache should be enabled for regions heavily read and written
48 if ((flags & BASE_MEM_HINT_GPU_RD) && (flags & BASE_MEM_HINT_GPU_WR))
50 cache_flags |= KBASE_REG_GPU_CACHED;