summaryrefslogtreecommitdiff
path: root/drivers/gpu/arm/midgard/mali_kbase_gator_api.c
diff options
context:
space:
mode:
authorchenzhen <chenzhen@rock-chips.com>2015-08-05 17:51:30 +0800
committerchenzhen <chenzhen@rock-chips.com>2015-08-05 17:55:59 +0800
commit71d4fbd8cced98e1c99f0a95dbda8d9c8a41143e (patch)
tree5984f8f5fab6306481b960787c103ad76c7e75d8 /drivers/gpu/arm/midgard/mali_kbase_gator_api.c
parent607b4fdb2c93cf94766501cfe45728a1592c4e54 (diff)
rk3288_mali_t760_driver_r6p0-02rel0_12_x@0
Diffstat (limited to 'drivers/gpu/arm/midgard/mali_kbase_gator_api.c')
-rw-r--r--[-rwxr-xr-x]drivers/gpu/arm/midgard/mali_kbase_gator_api.c131
1 files changed, 69 insertions, 62 deletions
diff --git a/drivers/gpu/arm/midgard/mali_kbase_gator_api.c b/drivers/gpu/arm/midgard/mali_kbase_gator_api.c
index 74419b2d4628..6ef4e39c5cc8 100755..100644
--- a/drivers/gpu/arm/midgard/mali_kbase_gator_api.c
+++ b/drivers/gpu/arm/midgard/mali_kbase_gator_api.c
@@ -1,6 +1,6 @@
/*
*
- * (C) COPYRIGHT ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2014-2015 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -19,6 +19,7 @@
#include "mali_kbase_mem_linux.h"
#include "mali_kbase_gator_api.h"
#include "mali_kbase_gator_hwcnt_names.h"
+#include "mali_kbase_instr.h"
#define MALI_MAX_CORES_PER_GROUP 4
#define MALI_MAX_NUM_BLOCKS_PER_GROUP 8
@@ -28,18 +29,18 @@
struct kbase_gator_hwcnt_handles {
struct kbase_device *kbdev;
struct kbase_context *kctx;
- mali_addr64 hwcnt_gpu_va;
+ u64 hwcnt_gpu_va;
void *hwcnt_cpu_va;
struct kbase_vmap_struct hwcnt_map;
};
-const char * const *kbase_gator_hwcnt_init_names(uint32_t *total_number_of_counters)
+const char * const *kbase_gator_hwcnt_init_names(uint32_t *total_counters)
{
uint32_t gpu_id;
- const char * const *hardware_counter_names;
+ const char * const *hardware_counters;
struct kbase_device *kbdev;
- if (!total_number_of_counters)
+ if (!total_counters)
return NULL;
/* Get the first device - it doesn't matter in this case */
@@ -52,66 +53,74 @@ const char * const *kbase_gator_hwcnt_init_names(uint32_t *total_number_of_count
switch (gpu_id) {
/* If we are using a Mali-T60x device */
case GPU_ID_PI_T60X:
- hardware_counter_names = hardware_counter_names_mali_t60x;
- *total_number_of_counters = ARRAY_SIZE(hardware_counter_names_mali_t60x);
- break;
+ hardware_counters = hardware_counters_mali_t60x;
+ *total_counters = ARRAY_SIZE(hardware_counters_mali_t60x);
+ break;
/* If we are using a Mali-T62x device */
case GPU_ID_PI_T62X:
- hardware_counter_names = hardware_counter_names_mali_t62x;
- *total_number_of_counters = ARRAY_SIZE(hardware_counter_names_mali_t62x);
- break;
+ hardware_counters = hardware_counters_mali_t62x;
+ *total_counters = ARRAY_SIZE(hardware_counters_mali_t62x);
+ break;
/* If we are using a Mali-T72x device */
case GPU_ID_PI_T72X:
- hardware_counter_names = hardware_counter_names_mali_t72x;
- *total_number_of_counters = ARRAY_SIZE(hardware_counter_names_mali_t72x);
- break;
+ hardware_counters = hardware_counters_mali_t72x;
+ *total_counters = ARRAY_SIZE(hardware_counters_mali_t72x);
+ break;
/* If we are using a Mali-T76x device */
case GPU_ID_PI_T76X:
- hardware_counter_names = hardware_counter_names_mali_t76x;
- *total_number_of_counters = ARRAY_SIZE(hardware_counter_names_mali_t76x);
- break;
-#ifdef MALI_INCLUDE_TFRX
- /* If we are using a Mali-TFRX device - for now just mimic the T760 counters */
- case GPU_ID_PI_TFRX:
- hardware_counter_names = hardware_counter_names_mali_t76x;
- *total_number_of_counters = ARRAY_SIZE(hardware_counter_names_mali_t76x);
- break;
-#endif /* MALI_INCLUDE_TRFX */
- /* If we are using a Mali-T86X device - for now just mimic the T760 counters */
+ hardware_counters = hardware_counters_mali_t76x;
+ *total_counters = ARRAY_SIZE(hardware_counters_mali_t76x);
+ break;
+ /* If we are using a Mali-T82x device */
+ case GPU_ID_PI_T82X:
+ hardware_counters = hardware_counters_mali_t82x;
+ *total_counters = ARRAY_SIZE(hardware_counters_mali_t82x);
+ break;
+ /* If we are using a Mali-T83x device */
+ case GPU_ID_PI_T83X:
+ hardware_counters = hardware_counters_mali_t83x;
+ *total_counters = ARRAY_SIZE(hardware_counters_mali_t83x);
+ break;
+ /* If we are using a Mali-T86x device */
case GPU_ID_PI_T86X:
- hardware_counter_names = hardware_counter_names_mali_t76x;
- *total_number_of_counters = ARRAY_SIZE(hardware_counter_names_mali_t76x);
- break;
+ hardware_counters = hardware_counters_mali_t86x;
+ *total_counters = ARRAY_SIZE(hardware_counters_mali_t86x);
+ break;
+ /* If we are using a Mali-T88x device */
+ case GPU_ID_PI_TFRX:
+ hardware_counters = hardware_counters_mali_t88x;
+ *total_counters = ARRAY_SIZE(hardware_counters_mali_t88x);
+ break;
default:
- hardware_counter_names = NULL;
- *total_number_of_counters = 0;
- dev_err(kbdev->dev, "Unrecognized gpu ID: %u\n", gpu_id);
- break;
+ hardware_counters = NULL;
+ *total_counters = 0;
+ dev_err(kbdev->dev, "Unrecognized gpu ID: %u\n", gpu_id);
+ break;
}
/* Release the kbdev reference. */
kbase_release_device(kbdev);
/* If we return a string array take a reference on the module (or fail). */
- if (hardware_counter_names && !try_module_get(THIS_MODULE))
+ if (hardware_counters && !try_module_get(THIS_MODULE))
return NULL;
- return hardware_counter_names;
+ return hardware_counters;
}
-KBASE_EXPORT_SYMBOL(kbase_gator_hwcnt_init_names)
+KBASE_EXPORT_SYMBOL(kbase_gator_hwcnt_init_names);
void kbase_gator_hwcnt_term_names(void)
{
/* Release the module reference. */
module_put(THIS_MODULE);
}
-KBASE_EXPORT_SYMBOL(kbase_gator_hwcnt_term_names)
+KBASE_EXPORT_SYMBOL(kbase_gator_hwcnt_term_names);
struct kbase_gator_hwcnt_handles *kbase_gator_hwcnt_init(struct kbase_gator_hwcnt_info *in_out_info)
{
struct kbase_gator_hwcnt_handles *hand;
struct kbase_uk_hwcnt_setup setup;
- mali_error err;
+ int err;
uint32_t dump_size = 0, i = 0;
struct kbase_va_region *reg;
u64 flags;
@@ -172,7 +181,6 @@ struct kbase_gator_hwcnt_handles *kbase_gator_hwcnt_init(struct kbase_gator_hwcn
in_out_info->hwc_layout[i++] = TILER_BLOCK;
in_out_info->hwc_layout[i++] = MMU_L2_BLOCK;
- /* There are no implementation with L3 cache */
in_out_info->hwc_layout[i++] = RESERVED_BLOCK;
if (0 == cg)
@@ -180,17 +188,8 @@ struct kbase_gator_hwcnt_handles *kbase_gator_hwcnt_init(struct kbase_gator_hwcn
else
in_out_info->hwc_layout[i++] = RESERVED_BLOCK;
}
- /* If we are using a Mali-T76x device */
- } else if (
- (in_out_info->gpu_id == GPU_ID_PI_T76X)
-#ifdef MALI_INCLUDE_TFRX
- || (in_out_info->gpu_id == GPU_ID_PI_TFRX)
-#endif /* MALI_INCLUDE_TFRX */
- || (in_out_info->gpu_id == GPU_ID_PI_T86X)
-#ifdef MALI_INCLUDE_TGAL
- || (in_out_info->gpu_id == GPU_ID_PI_TGAL)
-#endif
- ) {
+ /* If we are using any other device */
+ } else {
uint32_t nr_l2, nr_sc, j;
uint64_t core_mask;
@@ -200,7 +199,8 @@ struct kbase_gator_hwcnt_handles *kbase_gator_hwcnt_init(struct kbase_gator_hwcn
nr_sc = hand->kbdev->gpu_props.props.coherency_info.group[0].num_cores;
- /* For Mali-T76x, the job manager and tiler sets of counters are always present */
+ /* The job manager and tiler sets of counters
+ * are always present */
in_out_info->hwc_layout = kmalloc(sizeof(enum hwc_type) * (2 + nr_sc + nr_l2), GFP_KERNEL);
if (!in_out_info->hwc_layout)
@@ -249,11 +249,8 @@ struct kbase_gator_hwcnt_handles *kbase_gator_hwcnt_init(struct kbase_gator_hwcn
setup.shader_bm = in_out_info->bitmask[2];
setup.mmu_l2_bm = in_out_info->bitmask[3];
- /* There are no implementations with L3 cache */
- setup.l3_cache_bm = 0;
-
err = kbase_instr_hwcnt_enable(hand->kctx, &setup);
- if (err != MALI_ERROR_NONE)
+ if (err)
goto free_unmap;
kbase_instr_hwcnt_clear(hand->kctx);
@@ -280,7 +277,7 @@ free_hand:
return NULL;
}
-KBASE_EXPORT_SYMBOL(kbase_gator_hwcnt_init)
+KBASE_EXPORT_SYMBOL(kbase_gator_hwcnt_init);
void kbase_gator_hwcnt_term(struct kbase_gator_hwcnt_info *in_out_info, struct kbase_gator_hwcnt_handles *opaque_handles)
{
@@ -296,20 +293,30 @@ void kbase_gator_hwcnt_term(struct kbase_gator_hwcnt_info *in_out_info, struct k
kfree(opaque_handles);
}
}
-KBASE_EXPORT_SYMBOL(kbase_gator_hwcnt_term)
+KBASE_EXPORT_SYMBOL(kbase_gator_hwcnt_term);
-uint32_t kbase_gator_instr_hwcnt_dump_complete(struct kbase_gator_hwcnt_handles *opaque_handles, uint32_t * const success)
+uint32_t kbase_gator_instr_hwcnt_dump_complete(
+ struct kbase_gator_hwcnt_handles *opaque_handles,
+ uint32_t * const success)
{
- if (opaque_handles && success)
- return (kbase_instr_hwcnt_dump_complete(opaque_handles->kctx, success) != 0);
+ bool ret_res, success_res;
+
+ if (opaque_handles && success) {
+ ret_res = kbase_instr_hwcnt_dump_complete(opaque_handles->kctx,
+ &success_res);
+ *success = (uint32_t)success_res;
+ return (uint32_t)(ret_res != 0);
+ }
return 0;
}
-KBASE_EXPORT_SYMBOL(kbase_gator_instr_hwcnt_dump_complete)
+KBASE_EXPORT_SYMBOL(kbase_gator_instr_hwcnt_dump_complete);
uint32_t kbase_gator_instr_hwcnt_dump_irq(struct kbase_gator_hwcnt_handles *opaque_handles)
{
if (opaque_handles)
- return (kbase_instr_hwcnt_dump_irq(opaque_handles->kctx) == MALI_ERROR_NONE);
+ return (kbase_instr_hwcnt_request_dump(
+ opaque_handles->kctx) == 0);
+
return 0;
}
-KBASE_EXPORT_SYMBOL(kbase_gator_instr_hwcnt_dump_irq)
+KBASE_EXPORT_SYMBOL(kbase_gator_instr_hwcnt_dump_irq);