import OT_8063_20170412 mali driver
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / misc / mediatek / gpu / mt8127 / mali / mali / include / linux / mali / mali_utgard_uk_types.h
index 817f5a7b2401e43443e421428f2ca3c3fcaac594..4d6517e37e87515f65ef90edd03eb34609db7570 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This confidential and proprietary software may be used only as
  * authorised by a licensing agreement from ARM Limited
- * (C) COPYRIGHT 2008-2013 ARM Limited
+ * (C) COPYRIGHT 2008-2015 ARM Limited
  * ALL RIGHTS RESERVED
  * The entire notice above must be reproduced on all authorised
  * copies and copies may only be made to the extent permitted
@@ -56,7 +56,6 @@ typedef enum {
        _MALI_UK_PP_SUBSYSTEM,        /**< Fragment Processor Group of U/K calls */
        _MALI_UK_GP_SUBSYSTEM,        /**< Vertex Processor Group of U/K calls */
        _MALI_UK_PROFILING_SUBSYSTEM, /**< Profiling Group of U/K calls */
-       _MALI_UK_PMM_SUBSYSTEM,       /**< Power Management Module Group of U/K calls */
        _MALI_UK_VSYNC_SUBSYSTEM,     /**< VSYNC Group of U/K calls */
 } _mali_uk_subsystem_t;
 
@@ -85,22 +84,15 @@ typedef enum {
 
        /** Memory functions */
 
-       _MALI_UK_INIT_MEM                = 0,    /**< _mali_ukk_init_mem() */
-       _MALI_UK_TERM_MEM,                       /**< _mali_ukk_term_mem() */
-       _MALI_UK_GET_BIG_BLOCK,                  /**< _mali_ukk_get_big_block() */
-       _MALI_UK_FREE_BIG_BLOCK,                 /**< _mali_ukk_free_big_block() */
-       _MALI_UK_MAP_MEM,                        /**< _mali_ukk_mem_mmap() */
-       _MALI_UK_UNMAP_MEM,                      /**< _mali_ukk_mem_munmap() */
+       _MALI_UK_ALLOC_MEM                = 0,   /**< _mali_ukk_alloc_mem() */
+       _MALI_UK_FREE_MEM,                       /**< _mali_ukk_free_mem() */
+       _MALI_UK_BIND_MEM,                       /**< _mali_ukk_mem_bind() */
+       _MALI_UK_UNBIND_MEM,                     /**< _mali_ukk_mem_unbind() */
+       _MALI_UK_COW_MEM,                        /**< _mali_ukk_mem_cow() */
+       _MALI_UK_COW_MODIFY_RANGE,               /**< _mali_ukk_mem_cow_modify_range() */
        _MALI_UK_QUERY_MMU_PAGE_TABLE_DUMP_SIZE, /**< _mali_ukk_mem_get_mmu_page_table_dump_size() */
        _MALI_UK_DUMP_MMU_PAGE_TABLE,            /**< _mali_ukk_mem_dump_mmu_page_table() */
-       _MALI_UK_ATTACH_DMA_BUF,                 /**< _mali_ukk_attach_dma_buf() */
-       _MALI_UK_RELEASE_DMA_BUF,                /**< _mali_ukk_release_dma_buf() */
        _MALI_UK_DMA_BUF_GET_SIZE,               /**< _mali_ukk_dma_buf_get_size() */
-       _MALI_UK_ATTACH_UMP_MEM,                 /**< _mali_ukk_attach_ump_mem() */
-       _MALI_UK_RELEASE_UMP_MEM,                /**< _mali_ukk_release_ump_mem() */
-       _MALI_UK_MAP_EXT_MEM,                    /**< _mali_uku_map_external_mem() */
-       _MALI_UK_UNMAP_EXT_MEM,                  /**< _mali_uku_unmap_external_mem() */
-       _MALI_UK_VA_TO_MALI_PA,                  /**< _mali_uku_va_to_mali_pa() */
        _MALI_UK_MEM_WRITE_SAFE,                 /**< _mali_uku_mem_write_safe() */
 
        /** Common functions for each core */
@@ -126,29 +118,16 @@ typedef enum {
 
        /** Profiling functions */
 
-       _MALI_UK_PROFILING_START         = 0, /**< __mali_uku_profiling_start() */
-       _MALI_UK_PROFILING_ADD_EVENT,         /**< __mali_uku_profiling_add_event() */
-       _MALI_UK_PROFILING_STOP,              /**< __mali_uku_profiling_stop() */
-       _MALI_UK_PROFILING_GET_EVENT,         /**< __mali_uku_profiling_get_event() */
-       _MALI_UK_PROFILING_CLEAR,             /**< __mali_uku_profiling_clear() */
-       _MALI_UK_PROFILING_GET_CONFIG,        /**< __mali_uku_profiling_get_config() */
+       _MALI_UK_PROFILING_ADD_EVENT     = 0, /**< __mali_uku_profiling_add_event() */
        _MALI_UK_PROFILING_REPORT_SW_COUNTERS,/**< __mali_uku_profiling_report_sw_counters() */
+       _MALI_UK_PROFILING_MEMORY_USAGE_GET,  /**< __mali_uku_profiling_memory_usage_get() */
+       _MALI_UK_PROFILING_STREAM_FD_GET, /** < __mali_uku_profiling_stream_fd_get() */
+       _MALI_UK_PROFILING_CONTROL_SET, /** < __mali_uku_profiling_control_set() */
 
        /** VSYNC reporting fuctions */
        _MALI_UK_VSYNC_EVENT_REPORT      = 0, /**< _mali_ukk_vsync_event_report() */
-
 } _mali_uk_functions;
 
-/** @brief Get the size necessary for system info
- *
- * @see _mali_ukk_get_system_info_size()
- */
-typedef struct {
-       void *ctx;                      /**< [in,out] user-kernel context (trashed on output) */
-       u32 size;                       /**< [out] size of buffer necessary to hold system information data, in bytes */
-} _mali_uk_get_system_info_size_s;
-
-
 /** @defgroup _mali_uk_getsysteminfo U/K Get System Info
  * @{ */
 
@@ -162,95 +141,6 @@ typedef struct {
  */
 typedef u32 _mali_core_version;
 
-/**
- * Enum values for the different modes the driver can be put in.
- * Normal is the default mode. The driver then uses a job queue and takes job objects from the clients.
- * Job completion is reported using the _mali_ukk_wait_for_notification call.
- * The driver blocks this io command until a job has completed or failed or a timeout occurs.
- *
- * The 'raw' mode is reserved for future expansion.
- */
-typedef enum _mali_driver_mode {
-       _MALI_DRIVER_MODE_RAW = 1,    /**< Reserved for future expansion */
-       _MALI_DRIVER_MODE_NORMAL = 2  /**< Normal mode of operation */
-} _mali_driver_mode;
-
-/** @brief List of possible cores
- *
- * add new entries to the end of this enum */
-typedef enum _mali_core_type {
-       _MALI_GP2 = 2,                /**< MaliGP2 Programmable Vertex Processor */
-       _MALI_200 = 5,                /**< Mali200 Programmable Fragment Processor */
-       _MALI_400_GP = 6,             /**< Mali400 Programmable Vertex Processor */
-       _MALI_400_PP = 7,             /**< Mali400 Programmable Fragment Processor */
-       /* insert new core here, do NOT alter the existing values */
-} _mali_core_type;
-
-
-/** @brief Capabilities of Memory Banks
- *
- * These may be used to restrict memory banks for certain uses. They may be
- * used when access is not possible (e.g. Bus does not support access to it)
- * or when access is possible but not desired (e.g. Access is slow).
- *
- * In the case of 'possible but not desired', there is no way of specifying
- * the flags as an optimization hint, so that the memory could be used as a
- * last resort.
- *
- * @see _mali_mem_info
- */
-typedef enum _mali_bus_usage {
-
-       _MALI_PP_READABLE   = (1<<0),  /** Readable by the Fragment Processor */
-       _MALI_PP_WRITEABLE  = (1<<1),  /** Writeable by the Fragment Processor */
-       _MALI_GP_READABLE   = (1<<2),  /** Readable by the Vertex Processor */
-       _MALI_GP_WRITEABLE  = (1<<3),  /** Writeable by the Vertex Processor */
-       _MALI_CPU_READABLE  = (1<<4),  /** Readable by the CPU */
-       _MALI_CPU_WRITEABLE = (1<<5),  /** Writeable by the CPU */
-       _MALI_GP_L2_ALLOC   = (1<<6),  /** GP allocate mali L2 cache lines*/
-       _MALI_MMU_READABLE  = _MALI_PP_READABLE | _MALI_GP_READABLE,   /** Readable by the MMU (including all cores behind it) */
-       _MALI_MMU_WRITEABLE = _MALI_PP_WRITEABLE | _MALI_GP_WRITEABLE, /** Writeable by the MMU (including all cores behind it) */
-} _mali_bus_usage;
-
-typedef enum mali_memory_cache_settings {
-       MALI_CACHE_STANDARD                     = 0,
-       MALI_CACHE_GP_READ_ALLOCATE     = 1,
-} mali_memory_cache_settings ;
-
-
-/** @brief Information about the Mali Memory system
- *
- * Information is stored in a linked list, which is stored entirely in the
- * buffer pointed to by the system_info member of the
- * _mali_uk_get_system_info_s arguments provided to _mali_ukk_get_system_info()
- *
- * Each element of the linked list describes a single Mali Memory bank.
- * Each allocation can only come from one bank, and will not cross multiple
- * banks.
- *
- * On Mali-MMU systems, there is only one bank, which describes the maximum
- * possible address range that could be allocated (which may be much less than
- * the available physical memory)
- *
- * The flags member describes the capabilities of the memory. It is an error
- * to attempt to build a job for a particular core (PP or GP) when the memory
- * regions used do not have the capabilities for supporting that core. This
- * would result in a job abort from the Device Driver.
- *
- * For example, it is correct to build a PP job where read-only data structures
- * are taken from a memory with _MALI_PP_READABLE set and
- * _MALI_PP_WRITEABLE clear, and a framebuffer with  _MALI_PP_WRITEABLE set and
- * _MALI_PP_READABLE clear. However, it would be incorrect to use a framebuffer
- * where _MALI_PP_WRITEABLE is clear.
- */
-typedef struct _mali_mem_info {
-       u32 size;                     /**< Size of the memory bank in bytes */
-       _mali_bus_usage flags;        /**< Capabilitiy flags of the memory */
-       u32 maximum_order_supported;  /**< log2 supported size */
-       u32 identifier;               /* mali_memory_cache_settings cache_settings; */
-       struct _mali_mem_info * next; /**< Next List Link */
-} _mali_mem_info;
-
 /** @} */ /* end group _mali_uk_core */
 
 
@@ -283,7 +173,7 @@ typedef enum _maligp_job_suspended_response_code {
 } _maligp_job_suspended_response_code;
 
 typedef struct {
-       void *ctx;                      /**< [in,out] user-kernel context (trashed on output) */
+       u64 ctx;                      /**< [in,out] user-kernel context (trashed on output) */
        u32 cookie;                     /**< [in] cookie from the _mali_uk_gp_job_suspended_s notification */
        _maligp_job_suspended_response_code code; /**< [in] abort or resume response code, see \ref _maligp_job_suspended_response_code */
        u32 arguments[2];               /**< [in] 0 when aborting a job. When resuming a job, the Mali start and end address for a new heap to resume the job with */
@@ -294,25 +184,18 @@ typedef struct {
 /** @defgroup _mali_uk_gpstartjob_s Vertex Processor Start Job
  * @{ */
 
-/** @brief Status indicating the result of starting a Vertex or Fragment processor job */
-typedef enum {
-       _MALI_UK_START_JOB_STARTED,                         /**< Job started */
-       _MALI_UK_START_JOB_NOT_STARTED_DO_REQUEUE           /**< Job could not be started at this time. Try starting the job again */
-} _mali_uk_start_job_status;
-
 /** @brief Status indicating the result of the execution of a Vertex or Fragment processor job  */
-
 typedef enum {
-       _MALI_UK_JOB_STATUS_END_SUCCESS         = 1<<(16+0),
-       _MALI_UK_JOB_STATUS_END_OOM             = 1<<(16+1),
-       _MALI_UK_JOB_STATUS_END_ABORT           = 1<<(16+2),
-       _MALI_UK_JOB_STATUS_END_TIMEOUT_SW      = 1<<(16+3),
-       _MALI_UK_JOB_STATUS_END_HANG            = 1<<(16+4),
-       _MALI_UK_JOB_STATUS_END_SEG_FAULT       = 1<<(16+5),
-       _MALI_UK_JOB_STATUS_END_ILLEGAL_JOB     = 1<<(16+6),
-       _MALI_UK_JOB_STATUS_END_UNKNOWN_ERR     = 1<<(16+7),
-       _MALI_UK_JOB_STATUS_END_SHUTDOWN        = 1<<(16+8),
-       _MALI_UK_JOB_STATUS_END_SYSTEM_UNUSABLE = 1<<(16+9)
+       _MALI_UK_JOB_STATUS_END_SUCCESS         = 1 << (16 + 0),
+       _MALI_UK_JOB_STATUS_END_OOM             = 1 << (16 + 1),
+       _MALI_UK_JOB_STATUS_END_ABORT           = 1 << (16 + 2),
+       _MALI_UK_JOB_STATUS_END_TIMEOUT_SW      = 1 << (16 + 3),
+       _MALI_UK_JOB_STATUS_END_HANG            = 1 << (16 + 4),
+       _MALI_UK_JOB_STATUS_END_SEG_FAULT       = 1 << (16 + 5),
+       _MALI_UK_JOB_STATUS_END_ILLEGAL_JOB     = 1 << (16 + 6),
+       _MALI_UK_JOB_STATUS_END_UNKNOWN_ERR     = 1 << (16 + 7),
+       _MALI_UK_JOB_STATUS_END_SHUTDOWN        = 1 << (16 + 8),
+       _MALI_UK_JOB_STATUS_END_SYSTEM_UNUSABLE = 1 << (16 + 9)
 } _mali_uk_job_status;
 
 #define MALIGP2_NUM_REGS_FRAME (6)
@@ -371,8 +254,8 @@ typedef enum {
  *
  */
 typedef struct {
-       void *ctx;                          /**< [in,out] user-kernel context (trashed on output) */
-       u32 user_job_ptr;                   /**< [in] identifier for the job in user space, a @c mali_gp_job_info* */
+       u64 ctx;                          /**< [in,out] user-kernel context (trashed on output) */
+       u64 user_job_ptr;                   /**< [in] identifier for the job in user space, a @c mali_gp_job_info* */
        u32 priority;                       /**< [in] job priority. A lower number means higher priority */
        u32 frame_registers[MALIGP2_NUM_REGS_FRAME]; /**< [in] core specific registers associated with this job */
        u32 perf_counter_flag;              /**< [in] bitmask indicating which performance counters to enable, see \ref _MALI_PERFORMANCE_COUNTER_FLAG_SRC0_ENABLE and related macro definitions */
@@ -381,7 +264,7 @@ typedef struct {
        u32 frame_builder_id;               /**< [in] id of the originating frame builder */
        u32 flush_id;                       /**< [in] flush id within the originating frame builder */
        _mali_uk_fence_t fence;             /**< [in] fence this job must wait on */
-       u32 *timeline_point_ptr;            /**< [in,out] pointer to location where point on gp timeline for this job will be written */
+       u64 timeline_point_ptr;            /**< [in,out] pointer to u32: location where point on gp timeline for this job will be written */
 } _mali_uk_gp_start_job_s;
 
 #define _MALI_PERFORMANCE_COUNTER_FLAG_SRC0_ENABLE (1<<0) /**< Enable performance counter SRC0 for a job */
@@ -391,7 +274,7 @@ typedef struct {
 /** @} */ /* end group _mali_uk_gpstartjob_s */
 
 typedef struct {
-       u32 user_job_ptr;               /**< [out] identifier for the job in user space */
+       u64 user_job_ptr;               /**< [out] identifier for the job in user space */
        _mali_uk_job_status status;     /**< [out] status of finished job */
        u32 heap_current_addr;          /**< [out] value of the GP PLB PL heap start address register */
        u32 perf_counter0;              /**< [out] value of performance counter 0 (see ARM DDI0415A) */
@@ -399,7 +282,7 @@ typedef struct {
 } _mali_uk_gp_job_finished_s;
 
 typedef struct {
-       u32 user_job_ptr;                    /**< [out] identifier for the job in user space */
+       u64 user_job_ptr;                    /**< [out] identifier for the job in user space */
        u32 cookie;                          /**< [out] identifier for the core in kernel space on which the job stalled */
 } _mali_uk_gp_job_suspended_s;
 
@@ -466,8 +349,8 @@ typedef struct {
  *
  */
 typedef struct {
-       void *ctx;                      /**< [in,out] user-kernel context (trashed on output) */
-       u32 user_job_ptr;               /**< [in] identifier for the job in user space */
+       u64 ctx;                      /**< [in,out] user-kernel context (trashed on output) */
+       u64 user_job_ptr;               /**< [in] identifier for the job in user space */
        u32 priority;                   /**< [in] job priority. A lower number means higher priority */
        u32 frame_registers[_MALI_PP_MAX_FRAME_REGISTERS];         /**< [in] core specific registers associated with first sub job, see ARM DDI0415A */
        u32 frame_registers_addr_frame[_MALI_PP_MAX_SUB_JOBS - 1]; /**< [in] ADDR_FRAME registers for sub job 1-7 */
@@ -476,7 +359,7 @@ typedef struct {
        u32 wb1_registers[_MALI_PP_MAX_WB_REGISTERS];
        u32 wb2_registers[_MALI_PP_MAX_WB_REGISTERS];
        u32 dlbu_registers[_MALI_DLBU_MAX_REGISTERS]; /**< [in] Dynamic load balancing unit registers */
-       u32 num_cores;                      /**< [in] Number of cores to set up (valid range: 1-4) */
+       u32 num_cores;                      /**< [in] Number of cores to set up (valid range: 1-8(M450) or 4(M400)) */
        u32 perf_counter_flag;              /**< [in] bitmask indicating which performance counters to enable, see \ref _MALI_PERFORMANCE_COUNTER_FLAG_SRC0_ENABLE and related macro definitions */
        u32 perf_counter_src0;              /**< [in] source id for performance counter 0 (see ARM DDI0415A, Table 3-60) */
        u32 perf_counter_src1;              /**< [in] source id for performance counter 1 (see ARM DDI0415A, Table 3-60) */
@@ -487,21 +370,21 @@ typedef struct {
        u32 tilesy;                         /**< [in] number of tiles in y direction (needed for reading the heatmap memory) */
        u32 heatmap_mem;                    /**< [in] memory address to store counter values per tile (aka heatmap) */
        u32 num_memory_cookies;             /**< [in] number of memory cookies attached to job */
-       u32 *memory_cookies;                /**< [in] memory cookies attached to job  */
+       u64 memory_cookies;               /**< [in] pointer to array of u32 memory cookies attached to job */
        _mali_uk_fence_t fence;             /**< [in] fence this job must wait on */
-       u32 *timeline_point_ptr;            /**< [in,out] pointer to location where point on pp timeline for this job will be written */
+       u64 timeline_point_ptr;           /**< [in,out] pointer to location of u32 where point on pp timeline for this job will be written */
 } _mali_uk_pp_start_job_s;
 
 typedef struct {
-       void *ctx;                          /**< [in,out] user-kernel context (trashed on output) */
-       _mali_uk_gp_start_job_s *gp_args;   /**< [in,out] GP uk arguments (see _mali_uk_gp_start_job_s) */
-       _mali_uk_pp_start_job_s *pp_args;   /**< [in,out] PP uk arguments (see _mali_uk_pp_start_job_s) */
+       u64 ctx;       /**< [in,out] user-kernel context (trashed on output) */
+       u64 gp_args;   /**< [in,out] GP uk arguments (see _mali_uk_gp_start_job_s) */
+       u64 pp_args;   /**< [in,out] PP uk arguments (see _mali_uk_pp_start_job_s) */
 } _mali_uk_pp_and_gp_start_job_s;
 
 /** @} */ /* end group _mali_uk_ppstartjob_s */
 
 typedef struct {
-       u32 user_job_ptr;                          /**< [out] identifier for the job in user space */
+       u64 user_job_ptr;                          /**< [out] identifier for the job in user space */
        _mali_uk_job_status status;                /**< [out] status of finished job */
        u32 perf_counter0[_MALI_PP_MAX_SUB_JOBS];  /**< [out] value of perfomance counter 0 (see ARM DDI0415A), one for each sub job */
        u32 perf_counter1[_MALI_PP_MAX_SUB_JOBS];  /**< [out] value of perfomance counter 1 (see ARM DDI0415A), one for each sub job */
@@ -525,7 +408,7 @@ typedef enum {
 } _mali_uk_pp_job_wbx_flag;
 
 typedef struct {
-       void *ctx;                      /**< [in,out] user-kernel context (trashed on output) */
+       u64 ctx;                      /**< [in,out] user-kernel context (trashed on output) */
        u32 fb_id;                      /**< [in] Frame builder ID of job to disable WB units for */
        u32 wb0_memory;
        u32 wb1_memory;
@@ -539,25 +422,37 @@ typedef struct {
  * @{ */
 
 typedef struct {
-       void *ctx;                          /**< [in,out] user-kernel context (trashed on output) */
-       u32 type;                           /**< [in] type of soft job */
-       u32 user_job;                       /**< [in] identifier for the job in user space */
-       u32 *job_id_ptr;                    /**< [in,out] pointer to location where job id will be written */
+       u64 ctx;                            /**< [in,out] user-kernel context (trashed on output) */
+       u64 user_job;                       /**< [in] identifier for the job in user space */
+       u64 job_id_ptr;                     /**< [in,out] pointer to location of u32 where job id will be written */
        _mali_uk_fence_t fence;             /**< [in] fence this job must wait on */
        u32 point;                          /**< [out] point on soft timeline for this job */
+       u32 type;                           /**< [in] type of soft job */
 } _mali_uk_soft_job_start_s;
 
 typedef struct {
-       u32 user_job;                       /**< [out] identifier for the job in user space */
+       u64 user_job;                       /**< [out] identifier for the job in user space */
 } _mali_uk_soft_job_activated_s;
 
 typedef struct {
-       void *ctx;                          /**< [in,out] user-kernel context (trashed on output) */
+       u64 ctx;                          /**< [in,out] user-kernel context (trashed on output) */
        u32 job_id;                         /**< [in] id for soft job */
 } _mali_uk_soft_job_signal_s;
 
 /** @} */ /* end group _mali_uk_soft_job */
 
+typedef struct {
+       u32 counter_id;
+       u32 key;
+       int enable;
+} _mali_uk_annotate_profiling_mem_counter_s;
+
+typedef struct {
+       u32 sampling_rate;
+       int enable;
+} _mali_uk_annotate_profiling_enable_s;
+
+
 /** @addtogroup _mali_uk_core U/K Core
  * @{ */
 
@@ -577,21 +472,24 @@ typedef struct {
 typedef enum {
        /** core notifications */
 
-       _MALI_NOTIFICATION_CORE_SHUTDOWN_IN_PROGRESS =  (_MALI_UK_CORE_SUBSYSTEM << 16) | 0x20,
-       _MALI_NOTIFICATION_APPLICATION_QUIT =           (_MALI_UK_CORE_SUBSYSTEM << 16) | 0x40,
-       _MALI_NOTIFICATION_SETTINGS_CHANGED =           (_MALI_UK_CORE_SUBSYSTEM << 16) | 0x80,
-       _MALI_NOTIFICATION_SOFT_ACTIVATED =             (_MALI_UK_CORE_SUBSYSTEM << 16) | 0x100,
+       _MALI_NOTIFICATION_CORE_SHUTDOWN_IN_PROGRESS = (_MALI_UK_CORE_SUBSYSTEM << 16) | 0x20,
+       _MALI_NOTIFICATION_APPLICATION_QUIT = (_MALI_UK_CORE_SUBSYSTEM << 16) | 0x40,
+       _MALI_NOTIFICATION_SETTINGS_CHANGED = (_MALI_UK_CORE_SUBSYSTEM << 16) | 0x80,
+       _MALI_NOTIFICATION_SOFT_ACTIVATED = (_MALI_UK_CORE_SUBSYSTEM << 16) | 0x100,
 
        /** Fragment Processor notifications */
 
-       _MALI_NOTIFICATION_PP_FINISHED =                (_MALI_UK_PP_SUBSYSTEM << 16) | 0x10,
-       _MALI_NOTIFICATION_PP_NUM_CORE_CHANGE =         (_MALI_UK_PP_SUBSYSTEM << 16) | 0x20,
+       _MALI_NOTIFICATION_PP_FINISHED = (_MALI_UK_PP_SUBSYSTEM << 16) | 0x10,
+       _MALI_NOTIFICATION_PP_NUM_CORE_CHANGE = (_MALI_UK_PP_SUBSYSTEM << 16) | 0x20,
 
        /** Vertex Processor notifications */
 
-       _MALI_NOTIFICATION_GP_FINISHED =                (_MALI_UK_GP_SUBSYSTEM << 16) | 0x10,
-       _MALI_NOTIFICATION_GP_STALLED =                 (_MALI_UK_GP_SUBSYSTEM << 16) | 0x20,
+       _MALI_NOTIFICATION_GP_FINISHED = (_MALI_UK_GP_SUBSYSTEM << 16) | 0x10,
+       _MALI_NOTIFICATION_GP_STALLED = (_MALI_UK_GP_SUBSYSTEM << 16) | 0x20,
 
+       /** Profiling notifications */
+       _MALI_NOTIFICATION_ANNOTATE_PROFILING_MEM_COUNTER = (_MALI_UK_PROFILING_SUBSYSTEM << 16) | 0x10,
+       _MALI_NOTIFICATION_ANNOTATE_PROFILING_ENABLE = (_MALI_UK_PROFILING_SUBSYSTEM << 16) | 0x20,
 } _mali_uk_notification_type;
 
 /** to assist in splitting up 32-bit notification value in subsystem and id value */
@@ -623,19 +521,19 @@ typedef enum {
 /* See mali_user_settings_db.c */
 extern const char *_mali_uk_user_setting_descriptions[];
 #define _MALI_UK_USER_SETTING_DESCRIPTIONS \
-{                                           \
-       "sw_events_enable",                 \
-       "colorbuffer_capture_enable",       \
-       "depthbuffer_capture_enable",       \
-       "stencilbuffer_capture_enable",     \
-       "per_tile_counters_enable",         \
-       "buffer_capture_compositor",        \
-       "buffer_capture_window",            \
-       "buffer_capture_other",             \
-       "buffer_capture_n_frames",          \
-       "buffer_capture_resize_factor",     \
-       "sw_counters_enable",               \
-};
+       {                                           \
+               "sw_events_enable",                 \
+               "colorbuffer_capture_enable",       \
+               "depthbuffer_capture_enable",       \
+               "stencilbuffer_capture_enable",     \
+               "per_tile_counters_enable",         \
+               "buffer_capture_compositor",        \
+               "buffer_capture_window",            \
+               "buffer_capture_other",             \
+               "buffer_capture_n_frames",          \
+               "buffer_capture_resize_factor",     \
+               "sw_counters_enable",               \
+       };
 
 /** @brief struct to hold the value to a particular setting as seen in the kernel space
  */
@@ -688,7 +586,7 @@ typedef struct {
  * when the polygon list builder unit has run out of memory.
  */
 typedef struct {
-       void *ctx;                       /**< [in,out] user-kernel context (trashed on output) */
+       u64 ctx;                       /**< [in,out] user-kernel context (trashed on output) */
        _mali_uk_notification_type type; /**< [out] Type of notification available */
        union {
                _mali_uk_gp_job_suspended_s gp_job_suspended;/**< [out] Notification data for _MALI_NOTIFICATION_GP_STALLED notification type */
@@ -696,6 +594,8 @@ typedef struct {
                _mali_uk_pp_job_finished_s  pp_job_finished; /**< [out] Notification data for _MALI_NOTIFICATION_PP_FINISHED notification type */
                _mali_uk_settings_changed_s setting_changed;/**< [out] Notification data for _MALI_NOTIFICAATION_SETTINGS_CHANGED notification type */
                _mali_uk_soft_job_activated_s soft_job_activated; /**< [out] Notification data for _MALI_NOTIFICATION_SOFT_ACTIVATED notification type */
+               _mali_uk_annotate_profiling_mem_counter_s profiling_mem_counter;
+               _mali_uk_annotate_profiling_enable_s profiling_enable;
        } data;
 } _mali_uk_wait_for_notification_s;
 
@@ -705,7 +605,7 @@ typedef struct {
  * This is used to send a quit message to the callback thread.
  */
 typedef struct {
-       void *ctx;                       /**< [in,out] user-kernel context (trashed on output) */
+       u64 ctx;                       /**< [in,out] user-kernel context (trashed on output) */
        _mali_uk_notification_type type; /**< [in] Type of notification to post */
 } _mali_uk_post_notification_s;
 
@@ -739,7 +639,7 @@ typedef struct {
  * The 16bit integer is stored twice in a 32bit integer
  * For example, for version 1 the value would be 0x00010001
  */
-#define _MALI_API_VERSION 401
+#define _MALI_API_VERSION 800
 #define _MALI_UK_API_VERSION _MAKE_VERSION_ID(_MALI_API_VERSION)
 
 /**
@@ -764,10 +664,31 @@ typedef u32 _mali_uk_api_version;
  * of the interface may be backwards compatible.
  */
 typedef struct {
-       void *ctx;                      /**< [in,out] user-kernel context (trashed on output) */
+       u32 ctx;                        /**< [in,out] user-kernel context (trashed on output) */
        _mali_uk_api_version version;   /**< [in,out] API version of user-side interface. */
        int compatible;                 /**< [out] @c 1 when @version is compatible, @c 0 otherwise */
 } _mali_uk_get_api_version_s;
+
+/** @brief Arguments for _mali_uk_get_api_version_v2()
+ *
+ * The user-side interface version must be written into the version member,
+ * encoded using _MAKE_VERSION_ID(). It will be compared to the API version of
+ * the kernel-side interface.
+ *
+ * On successful return, the version member will be the API version of the
+ * kernel-side interface. _MALI_UK_API_VERSION macro defines the current version
+ * of the API.
+ *
+ * The compatible member must be checked to see if the version of the user-side
+ * interface is compatible with the kernel-side interface, since future versions
+ * of the interface may be backwards compatible.
+ */
+typedef struct {
+       u64 ctx;                        /**< [in,out] user-kernel context (trashed on output) */
+       _mali_uk_api_version version;   /**< [in,out] API version of user-side interface. */
+       int compatible;                 /**< [out] @c 1 when @version is compatible, @c 0 otherwise */
+} _mali_uk_get_api_version_v2_s;
+
 /** @} */ /* end group _mali_uk_getapiversion_s */
 
 /** @defgroup _mali_uk_get_user_settings_s Get user space settings */
@@ -781,21 +702,21 @@ typedef struct {
  *
  */
 typedef struct {
-       void *ctx;                       /**< [in,out] user-kernel context (trashed on output) */
+       u64 ctx;                       /**< [in,out] user-kernel context (trashed on output) */
        u32 settings[_MALI_UK_USER_SETTING_MAX]; /**< [out] The values for all settings */
 } _mali_uk_get_user_settings_s;
 
 /** @brief struct to hold the value of a particular setting from the user space within a given context
  */
 typedef struct {
-       void *ctx;                       /**< [in,out] user-kernel context (trashed on output) */
+       u64 ctx;                       /**< [in,out] user-kernel context (trashed on output) */
        _mali_uk_user_setting_t setting; /**< [in] setting to get */
        u32 value;                       /**< [out] value of setting */
 } _mali_uk_get_user_setting_s;
 
 /** @brief Arguments for _mali_ukk_request_high_priority() */
 typedef struct {
-       void *ctx;                       /**< [in,out] user-kernel context (trashed on output) */
+       u64 ctx;                       /**< [in,out] user-kernel context (trashed on output) */
 } _mali_uk_request_high_priority_s;
 
 /** @} */ /* end group _mali_uk_core */
@@ -804,113 +725,137 @@ typedef struct {
 /** @defgroup _mali_uk_memory U/K Memory
  * @{ */
 
-/** Flag for _mali_uk_map_external_mem_s, _mali_uk_attach_ump_mem_s and _mali_uk_attach_dma_buf_s */
-#define _MALI_MAP_EXTERNAL_MAP_GUARD_PAGE (1<<0)
+#define _MALI_MEMORY_ALLOCATE_RESIZEABLE  (1<<4) /* BUFFER can trim dow/grow*/
+#define _MALI_MEMORY_ALLOCATE_NO_BIND_GPU (1<<5) /*Not map to GPU when allocate, must call bind later*/
 
 typedef struct {
-       void *ctx;                      /**< [in,out] user-kernel context (trashed on output) */
-       u32 phys_addr;                  /**< [in] physical address */
-       u32 size;                       /**< [in] size */
-       u32 mali_address;               /**< [in] mali address to map the physical memory to */
-       u32 rights;                     /**< [in] rights necessary for accessing memory */
-       u32 flags;                      /**< [in] flags, see \ref _MALI_MAP_EXTERNAL_MAP_GUARD_PAGE */
-       u32 cookie;                     /**< [out] identifier for mapped memory object in kernel space  */
-} _mali_uk_map_external_mem_s;
+       u64 ctx;                                          /**< [in,out] user-kernel context (trashed on output) */
+       u32 gpu_vaddr;                                    /**< [in] GPU virtual address */
+       u32 vsize;                                        /**< [in] vitrual size of the allocation */
+       u32 psize;                                        /**< [in] physical size of the allocation */
+       u32 flags;
+       u64 backend_handle;                               /**< [out] backend handle */
+       struct {
+               /* buffer types*/
+               /* CPU read/write info*/
+       } buffer_info;
+} _mali_uk_alloc_mem_s;
 
-typedef struct {
-       void *ctx;                      /**< [in,out] user-kernel context (trashed on output) */
-       u32 cookie;                     /**< [out] identifier for mapped memory object in kernel space  */
-} _mali_uk_unmap_external_mem_s;
 
-/** @note This is identical to _mali_uk_map_external_mem_s above, however phys_addr is replaced by memory descriptor */
 typedef struct {
-       void *ctx;                      /**< [in,out] user-kernel context (trashed on output) */
-       u32 mem_fd;                     /**< [in] Memory descriptor */
-       u32 size;                       /**< [in] size */
-       u32 mali_address;               /**< [in] mali address to map the physical memory to */
-       u32 rights;                     /**< [in] rights necessary for accessing memory */
-       u32 flags;                      /**< [in] flags, see \ref _MALI_MAP_EXTERNAL_MAP_GUARD_PAGE */
-       u32 cookie;                     /**< [out] identifier for mapped memory object in kernel space  */
-} _mali_uk_attach_dma_buf_s;
+       u64 ctx;                      /**< [in,out] user-kernel context (trashed on output) */
+       u32 gpu_vaddr;                /**< [in] use as handle to free allocation */
+       u32 free_pages_nr;      /** < [out] record the number of free pages */
+} _mali_uk_free_mem_s;
+
+
+#define _MALI_MEMORY_BIND_BACKEND_UMP             (1<<8)
+#define _MALI_MEMORY_BIND_BACKEND_DMA_BUF         (1<<9)
+#define _MALI_MEMORY_BIND_BACKEND_MALI_MEMORY     (1<<10)
+#define _MALI_MEMORY_BIND_BACKEND_EXTERNAL_MEMORY (1<<11)
+#define _MALI_MEMORY_BIND_BACKEND_EXT_COW         (1<<12)
+#define _MALI_MEMORY_BIND_BACKEND_HAVE_ALLOCATION (1<<13)
+
+
+#define _MALI_MEMORY_BIND_BACKEND_MASK (_MALI_MEMORY_BIND_BACKEND_UMP| \
+                                       _MALI_MEMORY_BIND_BACKEND_DMA_BUF |\
+                                       _MALI_MEMORY_BIND_BACKEND_MALI_MEMORY |\
+                                       _MALI_MEMORY_BIND_BACKEND_EXTERNAL_MEMORY |\
+                                       _MALI_MEMORY_BIND_BACKEND_EXT_COW |\
+                                       _MALI_MEMORY_BIND_BACKEND_HAVE_ALLOCATION)
+
+
+#define _MALI_MEMORY_GPU_READ_ALLOCATE            (1<<16)
+
 
 typedef struct {
-       void *ctx;                      /**< [in,out] user-kernel context (trashed on output) */
-       u32 mem_fd;                     /**< [in] Memory descriptor */
-       u32 size;                       /**< [out] size */
-} _mali_uk_dma_buf_get_size_s;
+       u64 ctx;                                        /**< [in,out] user-kernel context (trashed on output) */
+       u32 vaddr;                                      /**< [in] mali address to map the physical memory to */
+       u32 size;                                       /**< [in] size */
+       u32 flags;                                      /**< [in] see_MALI_MEMORY_BIND_BACKEND_* */
+       u32 padding;                                    /** padding for 32/64 struct alignment */
+       union {
+               struct {
+                       u32 secure_id;                  /**< [in] secure id */
+                       u32 rights;                     /**< [in] rights necessary for accessing memory */
+                       u32 flags;                      /**< [in] flags, see \ref _MALI_MAP_EXTERNAL_MAP_GUARD_PAGE */
+               } bind_ump;
+               struct {
+                       u32 mem_fd;                     /**< [in] Memory descriptor */
+                       u32 rights;                     /**< [in] rights necessary for accessing memory */
+                       u32 flags;                      /**< [in] flags, see \ref _MALI_MAP_EXTERNAL_MAP_GUARD_PAGE */
+               } bind_dma_buf;
+               struct {
+                       /**/
+               } bind_mali_memory;
+               struct {
+                       u32 phys_addr;                  /**< [in] physical address */
+                       u32 rights;                     /**< [in] rights necessary for accessing memory */
+                       u32 flags;                      /**< [in] flags, see \ref _MALI_MAP_EXTERNAL_MAP_GUARD_PAGE */
+               } bind_ext_memory;
+       } mem_union;
+} _mali_uk_bind_mem_s;
 
 typedef struct {
-       void *ctx;                      /**< [in,out] user-kernel context (trashed on output) */
-       u32 cookie;                     /**< [in] identifier for mapped memory object in kernel space  */
-} _mali_uk_release_dma_buf_s;
+       u64 ctx;                                        /**< [in,out] user-kernel context (trashed on output) */
+       u32 flags;                                      /**< [in] see_MALI_MEMORY_BIND_BACKEND_* */
+       u32 vaddr;                                      /**<  [in] identifier for mapped memory object in kernel space  */
+} _mali_uk_unbind_mem_s;
 
-/** @note This is identical to _mali_uk_map_external_mem_s above, however phys_addr is replaced by secure_id */
 typedef struct {
-       void *ctx;                      /**< [in,out] user-kernel context (trashed on output) */
-       u32 secure_id;                  /**< [in] secure id */
-       u32 size;                       /**< [in] size */
-       u32 mali_address;               /**< [in] mali address to map the physical memory to */
-       u32 rights;                     /**< [in] rights necessary for accessing memory */
-       u32 flags;                      /**< [in] flags, see \ref _MALI_MAP_EXTERNAL_MAP_GUARD_PAGE */
-       u32 cookie;                     /**< [out] identifier for mapped memory object in kernel space  */
-} _mali_uk_attach_ump_mem_s;
+       u64 ctx;                                        /**< [in,out] user-kernel context (trashed on output) */
+       u32 target_handle;                              /**< [in] handle of allocation need to do COW */
+       u32 target_offset;              /**< [in] offset in target allocation to do COW(for support COW  a memory allocated from memory_bank, PAGE_SIZE align)*/
+       u32 target_size;                        /**< [in] size of target allocation to do COW (for support memory bank, PAGE_SIZE align)(in byte) */
+       u32 range_start;                                /**< [in] re allocate range start offset, offset from the start of allocation (PAGE_SIZE align)*/
+       u32 range_size;                                 /**< [in] re allocate size (PAGE_SIZE align)*/
+       u32 vaddr;                                      /**< [in] mali address for the new allocaiton */
+       u32 backend_handle;                             /**< [out] backend handle */
+       u32 flags;
+} _mali_uk_cow_mem_s;
 
 typedef struct {
-       void *ctx;                      /**< [in,out] user-kernel context (trashed on output) */
-       u32 cookie;                     /**< [in] identifier for mapped memory object in kernel space  */
-} _mali_uk_release_ump_mem_s;
+       u64 ctx;                                        /**< [in,out] user-kernel context (trashed on output) */
+       u32 range_start;                                /**< [in] re allocate range start offset, offset from the start of allocation */
+       u32 size;                                       /**< [in] re allocate size*/
+       u32 vaddr;                                      /**< [in] mali address for the new allocaiton */
+       s32 change_pages_nr;            /**< [out] record the page number change for cow operation */
+} _mali_uk_cow_modify_range_s;
+
 
-/** @brief Arguments for _mali_ukk_va_to_mali_pa()
- *
- * if size is zero or not a multiple of the system's page size, it will be
- * rounded up to the next multiple of the page size. This will occur before
- * any other use of the size parameter.
- *
- * if va is not PAGE_SIZE aligned, it will be rounded down to the next page
- * boundary.
- *
- * The range (va) to ((u32)va)+(size-1) inclusive will be checked for physical
- * contiguity.
- *
- * The implementor will check that the entire physical range is allowed to be mapped
- * into user-space.
- *
- * Failure will occur if either of the above are not satisfied.
- *
- * Otherwise, the physical base address of the range is returned through pa,
- * va is updated to be page aligned, and size is updated to be a non-zero
- * multiple of the system's pagesize.
- */
 typedef struct {
-       void *ctx;                      /**< [in,out] user-kernel context (trashed on output) */
-       void *va;                       /**< [in,out] Virtual address of the start of the range */
-       u32 pa;                         /**< [out] Physical base address of the range */
-       u32 size;                       /**< [in,out] Size of the range, in bytes. */
-} _mali_uk_va_to_mali_pa_s;
+       u64 ctx;                      /**< [in,out] user-kernel context (trashed on output) */
+       u32 mem_fd;                     /**< [in] Memory descriptor */
+       u32 size;                       /**< [out] size */
+} _mali_uk_dma_buf_get_size_s;
+
+/** Flag for _mali_uk_map_external_mem_s, _mali_uk_attach_ump_mem_s and _mali_uk_attach_dma_buf_s */
+#define _MALI_MAP_EXTERNAL_MAP_GUARD_PAGE (1<<0)
+
 
 /**
  * @brief Arguments for _mali_uk[uk]_mem_write_safe()
  */
 typedef struct {
-       void *ctx;        /**< [in,out] user-kernel context (trashed on output) */
-       const void *src;  /**< [in]     Pointer to source data */
-       void *dest;       /**< [in]     Destination Mali buffer */
-       u32 size;         /**< [in,out] Number of bytes to write/copy on input, number of bytes actually written/copied on output */
+       u64 ctx;  /**< [in,out] user-kernel context (trashed on output) */
+       u64 src;  /**< [in] Pointer to source data */
+       u64 dest; /**< [in] Destination Mali buffer */
+       u32 size;   /**< [in,out] Number of bytes to write/copy on input, number of bytes actually written/copied on output */
 } _mali_uk_mem_write_safe_s;
 
 typedef struct {
-       void *ctx;                      /**< [in,out] user-kernel context (trashed on output) */
+       u64 ctx;                      /**< [in,out] user-kernel context (trashed on output) */
        u32 size;                       /**< [out] size of MMU page table information (registers + page tables) */
 } _mali_uk_query_mmu_page_table_dump_size_s;
 
 typedef struct {
-       void *ctx;                      /**< [in,out] user-kernel context (trashed on output) */
+       u64 ctx;                      /**< [in,out] user-kernel context (trashed on output) */
        u32 size;                       /**< [in] size of buffer to receive mmu page table information */
-       void *buffer;                   /**< [in,out] buffer to receive mmu page table information */
+       u64 buffer;                   /**< [in,out] buffer to receive mmu page table information */
        u32 register_writes_size;       /**< [out] size of MMU register dump */
-       u32 *register_writes;           /**< [out] pointer within buffer where MMU register dump is stored */
+       u64 register_writes;           /**< [out] pointer within buffer where MMU register dump is stored */
        u32 page_table_dump_size;       /**< [out] size of MMU page table dump */
-       u32 *page_table_dump;           /**< [out] pointer within buffer where MMU page table dump is stored */
+       u64 page_table_dump;           /**< [out] pointer within buffer where MMU page table dump is stored */
 } _mali_uk_dump_mmu_page_table_s;
 
 /** @} */ /* end group _mali_uk_memory */
@@ -926,7 +871,7 @@ typedef struct {
  * will contain the number of Fragment Processor cores in the system.
  */
 typedef struct {
-       void *ctx;                      /**< [in,out] user-kernel context (trashed on output) */
+       u64 ctx;                      /**< [in,out] user-kernel context (trashed on output) */
        u32 number_of_total_cores;      /**< [out] Total number of Fragment Processor cores in the system */
        u32 number_of_enabled_cores;    /**< [out] Number of enabled Fragment Processor cores */
 } _mali_uk_get_pp_number_of_cores_s;
@@ -938,8 +883,9 @@ typedef struct {
  * the version that all Fragment Processor cores are compatible with.
  */
 typedef struct {
-       void *ctx;                      /**< [in,out] user-kernel context (trashed on output) */
+       u64 ctx;                      /**< [in,out] user-kernel context (trashed on output) */
        _mali_core_version version;     /**< [out] version returned from core, see \ref _mali_core_version  */
+       u32 padding;
 } _mali_uk_get_pp_core_version_s;
 
 /** @} */ /* end group _mali_uk_pp */
@@ -955,7 +901,7 @@ typedef struct {
  * will contain the number of Vertex Processor cores in the system.
  */
 typedef struct {
-       void *ctx;                      /**< [in,out] user-kernel context (trashed on output) */
+       u64 ctx;                      /**< [in,out] user-kernel context (trashed on output) */
        u32 number_of_cores;            /**< [out] number of Vertex Processor cores in the system */
 } _mali_uk_get_gp_number_of_cores_s;
 
@@ -966,39 +912,24 @@ typedef struct {
  * the version that all Vertex Processor cores are compatible with.
  */
 typedef struct {
-       void *ctx;                      /**< [in,out] user-kernel context (trashed on output) */
+       u64 ctx;                      /**< [in,out] user-kernel context (trashed on output) */
        _mali_core_version version;     /**< [out] version returned from core, see \ref _mali_core_version */
 } _mali_uk_get_gp_core_version_s;
 
-typedef struct {
-       void *ctx;                      /**< [in,out] user-kernel context (trashed on output) */
-       u32 limit;                      /**< [in,out] The desired limit for number of events to record on input, actual limit on output */
-} _mali_uk_profiling_start_s;
+/** @} */ /* end group _mali_uk_gp */
 
 typedef struct {
-       void *ctx;                      /**< [in,out] user-kernel context (trashed on output) */
+       u64 ctx;                      /**< [in,out] user-kernel context (trashed on output) */
        u32 event_id;                   /**< [in] event id to register (see  enum mali_profiling_events for values) */
        u32 data[5];                    /**< [in] event specific data */
 } _mali_uk_profiling_add_event_s;
 
 typedef struct {
-       void *ctx;                      /**< [in,out] user-kernel context (trashed on output) */
-       u32 count;                      /**< [out] The number of events sampled */
-} _mali_uk_profiling_stop_s;
-
-typedef struct {
-       void *ctx;                      /**< [in,out] user-kernel context (trashed on output) */
-       u32 index;                      /**< [in] which index to get (starting at zero) */
-       u64 timestamp;                  /**< [out] timestamp of event */
-       u32 event_id;                   /**< [out] event id of event (see  enum mali_profiling_events for values) */
-       u32 data[5];                    /**< [out] event specific data */
-} _mali_uk_profiling_get_event_s;
-
-typedef struct {
-       void *ctx;                      /**< [in,out] user-kernel context (trashed on output) */
-} _mali_uk_profiling_clear_s;
-
-/** @} */ /* end group _mali_uk_gp */
+       u64 ctx;                     /**< [in,out] user-kernel context (trashed on output) */
+       u32 memory_usage;              /**< [out] total memory usage */
+       u32 vaddr;                                      /**< [in] mali address for the cow allocaiton */
+       s32 change_pages_nr;            /**< [out] record the page number change for cow operation */
+} _mali_uk_profiling_memory_usage_get_s;
 
 
 /** @addtogroup _mali_uk_memory U/K Memory
@@ -1031,14 +962,11 @@ typedef struct {
  * implementation of the U/K interface. Its value must be zero.
  */
 typedef struct {
-       void *ctx;                      /**< [in,out] user-kernel context (trashed on output) */
+       u64 ctx;                      /**< [in,out] user-kernel context (trashed on output) */
        void *mapping;                  /**< [out] Returns user-space virtual address for the mapping */
        u32 size;                       /**< [in] Size of the requested mapping */
        u32 phys_addr;                  /**< [in] Physical address - could be offset, depending on caller+callee convention */
-       u32 cookie;                     /**< [out] Returns a cookie for use in munmap calls */
-       void *uku_private;              /**< [in] User-side Private word used by U/K interface */
-       void *ukk_private;              /**< [in] Kernel-side Private word used by U/K interface */
-       mali_memory_cache_settings cache_settings; /**< [in] Option to set special cache flags, tuning L2 efficency */
+       mali_bool writeable;
 } _mali_uk_mem_mmap_s;
 
 /** @brief Arguments to _mali_ukk_mem_munmap()
@@ -1052,10 +980,9 @@ typedef struct {
  * originally obtained range, or to unmap more than was originally obtained.
  */
 typedef struct {
-       void *ctx;                      /**< [in,out] user-kernel context (trashed on output) */
+       u64 ctx;                      /**< [in,out] user-kernel context (trashed on output) */
        void *mapping;                  /**< [in] The mapping returned from mmap call */
        u32 size;                       /**< [in] The size passed to mmap call */
-       u32 cookie;                     /**< [in] Cookie from mmap call */
 } _mali_uk_mem_munmap_s;
 /** @} */ /* end group _mali_uk_memory */
 
@@ -1076,7 +1003,7 @@ typedef enum _mali_uk_vsync_event {
  *
  */
 typedef struct {
-       void *ctx;                      /**< [in,out] user-kernel context (trashed on output) */
+       u64 ctx;                      /**< [in,out] user-kernel context (trashed on output) */
        _mali_uk_vsync_event event;     /**< [in] VSYNCH event type */
 } _mali_uk_vsync_event_report_s;
 
@@ -1090,9 +1017,9 @@ typedef struct {
  * Values recorded for each of the software counters during a single renderpass.
  */
 typedef struct {
-       void *ctx;                      /**< [in,out] user-kernel context (trashed on output) */
-       u32* counters;                  /**< [in] The array of counter values */
-       u32  num_counters;              /**< [in] The number of elements in counters array */
+       u64 ctx;                      /**< [in,out] user-kernel context (trashed on output) */
+       u64 counters;                  /**< [in] The array of u32 counter values */
+       u32 num_counters;              /**< [in] The number of elements in counters array */
 } _mali_uk_sw_counters_report_s;
 
 /** @} */ /* end group _mali_uk_sw_counters_report */
@@ -1101,20 +1028,20 @@ typedef struct {
  * @{ */
 
 typedef struct {
-       void *ctx;                      /**< [in,out] user-kernel context (trashed on output) */
+       u64 ctx;                      /**< [in,out] user-kernel context (trashed on output) */
        u32 timeline;                   /**< [in] timeline id */
        u32 point;                      /**< [out] latest point on timeline */
 } _mali_uk_timeline_get_latest_point_s;
 
 typedef struct {
-       void *ctx;                      /**< [in,out] user-kernel context (trashed on output) */
+       u64 ctx;                      /**< [in,out] user-kernel context (trashed on output) */
        _mali_uk_fence_t fence;         /**< [in] fence */
        u32 timeout;                    /**< [in] timeout (0 for no wait, -1 for blocking) */
        u32 status;                     /**< [out] status of fence (1 if signaled, 0 if timeout) */
 } _mali_uk_timeline_wait_s;
 
 typedef struct {
-       void *ctx;                      /**< [in,out] user-kernel context (trashed on output) */
+       u64 ctx;                      /**< [in,out] user-kernel context (trashed on output) */
        _mali_uk_fence_t fence;         /**< [in] mali fence to create linux sync fence from */
        s32 sync_fd;                    /**< [out] file descriptor for new linux sync fence */
 } _mali_uk_timeline_create_sync_fence_s;
@@ -1125,6 +1052,19 @@ typedef struct {
 
 /** @} */ /* end group uddapi */
 
+typedef struct {
+       u64 ctx;                 /**< [in,out] user-kernel context (trashed on output) */
+       s32 stream_fd;   /**< [in] The profiling kernel base stream fd handle */
+} _mali_uk_profiling_stream_fd_get_s;
+
+typedef struct {
+       u64 ctx;        /**< [in,out] user-kernel context (trashed on output) */
+       u64 control_packet_data; /**< [in] the control packet data for control settings */
+       u32 control_packet_size;  /**< [in] The control packet size */
+       u64 response_packet_data; /** < [out] The response packet data */
+       u32 response_packet_size; /** < [in,out] The response packet data */
+} _mali_uk_profiling_control_set_s;
+
 #ifdef __cplusplus
 }
 #endif