u32 mali_pm_dump_state_domain(struct mali_pm_domain *domain, char *buf, u32 size) { int n = 0; n += _mali_osk_snprintf(buf + n, size - n, "\tPower domain: id %u\n", mali_pm_domain_get_id(domain)); n += _mali_osk_snprintf(buf + n, size - n, "\t\tMask: 0x%04x\n", mali_pm_domain_get_mask(domain)); n += _mali_osk_snprintf(buf + n, size - n, "\t\tUse count: %u\n", mali_pm_domain_get_use_count(domain)); n += _mali_osk_snprintf(buf + n, size - n, "\t\tCurrent power state: %s\n", (mali_pm_domain_get_mask(domain) & pd_mask_current) ? "On" : "Off"); n += _mali_osk_snprintf(buf + n, size - n, "\t\tWanted power state: %s\n", (mali_pm_domain_get_mask(domain) & pd_mask_wanted) ? "On" : "Off"); return n; }
u32 malipmm_subsystem_dump_state(char *buf, u32 size) { int len = 0; _mali_pmm_internal_state_t *pmm = GET_PMM_STATE_PTR; if( !pmm ) { len += _mali_osk_snprintf(buf + len, size + len, "PMM: Null state\n"); } else { len += _mali_osk_snprintf(buf+len, size+len, "Locks:\n PMM lock acquired: %s\n", pmm->mali_pmm_lock_acquired ? "true" : "false"); len += _mali_osk_snprintf(buf+len, size+len, "PMM state:\n Previous status: %s\n Status: %s\n Current event: %s\n Policy: %s\n Check policy: %s\n State: %s\n", pmm_trace_status[pmm->mali_last_pmm_status], pmm_trace_status[pmm->status], pmm_trace_events[pmm->mali_new_event_status], pmm_trace_policy[pmm->policy], pmm->check_policy ? "true" : "false", pmm_trace_state[pmm->state]); len += _mali_osk_snprintf(buf+len, size+len, "PMM cores:\n Cores registered: %d\n Cores powered: %d\n Cores idle: %d\n" " Cores pending down: %d\n Cores pending up: %d\n Cores ack down: %d\n Cores ack up: %d\n", pmm->cores_registered, pmm->cores_powered, pmm->cores_idle, pmm->cores_pend_down, pmm->cores_pend_up, pmm->cores_ack_down, pmm->cores_ack_up); len += _mali_osk_snprintf(buf+len, size+len, "PMM misc:\n PMU init: %s\n Messages queued: %d\n" " Waiting: %d\n No events: %d\n Missed events: %d\n Fatal power error: %s\n", pmm->pmu_initialized ? "true" : "false", _mali_osk_atomic_read(&(pmm->messages_queued)), pmm->waiting, pmm->no_events, pmm->missed, pmm->fatal_power_err ? "true" : "false"); } return len; }
u32 mali_gp_scheduler_dump_state(char *buf, u32 size) { int n = 0; n += _mali_osk_snprintf(buf + n, size - n, "GP\n"); n += _mali_osk_snprintf(buf + n, size - n, "\tQueue is %s\n", _mali_osk_list_empty(&job_queue) ? "empty" : "not empty"); n += mali_group_dump_state(slot.group, buf + n, size - n); n += _mali_osk_snprintf(buf + n, size - n, "\n"); return n; }
u32 mali_pp_dump_state(struct mali_pp_core *core, char *buf, u32 size) { int n = 0; n += _mali_osk_snprintf(buf + n, size - n, "\tPP #%d: %s\n", core->core_id, core->hw_core.description); return n; }
u32 mali_pp_scheduler_dump_state(char *buf, u32 size) { int n = 0; int i; n += _mali_osk_snprintf(buf + n, size - n, "PP:\n"); n += _mali_osk_snprintf(buf + n, size - n, "\tQueue is %s\n", _mali_osk_list_empty(&job_queue) ? "empty" : "not empty"); n += _mali_osk_snprintf(buf + n, size - n, "\n"); for (i = 0; i < num_slots; i++) { n += mali_group_dump_state(slots[i].group, buf + n, size - n); n += _mali_osk_snprintf(buf + n, size - n, "\t\tState: %d\n", slots[i].state); } return n; }
u32 mali_group_dump_state(struct mali_group *group, char *buf, u32 size) { int n = 0; n += _mali_osk_snprintf(buf + n, size - n, "Group: %p\n", group); if (group->gp_core) { n += mali_gp_dump_state(group->gp_core, buf + n, size - n); n += _mali_osk_snprintf(buf + n, size - n, "\tGP state: %d\n", group->gp_state); n += _mali_osk_snprintf(buf + n, size - n, "\tGP job: %p\n", group->gp_running_job); } if (group->pp_core) { n += mali_pp_dump_state(group->pp_core, buf + n, size - n); n += _mali_osk_snprintf(buf + n, size - n, "\tPP state: %d\n", group->pp_state); n += _mali_osk_snprintf(buf + n, size - n, "\tPP job: %p, subjob %d \n", group->pp_running_job, group->pp_running_sub_job); } return n; }
int mali_sysfs_register(struct mali_dev *device, dev_t dev, const char *mali_dev_name) { int err = 0; device->mali_class = class_create(THIS_MODULE, mali_dev_name); if (IS_ERR(device->mali_class)) { err = PTR_ERR(device->mali_class); goto init_class_err; } mali_device = device_create(device->mali_class, NULL, dev, NULL, mali_dev_name); if (IS_ERR(mali_device)) { err = PTR_ERR(mali_device); goto init_mdev_err; } mali_debugfs_dir = debugfs_create_dir(mali_dev_name, NULL); if(ERR_PTR(-ENODEV) == mali_debugfs_dir) { /* Debugfs not supported. */ mali_debugfs_dir = NULL; } else { if(NULL != mali_debugfs_dir) { /* Debugfs directory created successfully; create files now */ struct dentry *mali_power_dir; struct dentry *mali_gp_dir; struct dentry *mali_pp_dir; struct dentry *mali_l2_dir; #if MALI_INTERNAL_TIMELINE_PROFILING_ENABLED struct dentry *mali_profiling_dir; #endif mali_power_dir = debugfs_create_dir("power", mali_debugfs_dir); if (mali_power_dir != NULL) { debugfs_create_file("power_events", 0400, mali_power_dir, NULL, &power_events_fops); } mali_gp_dir = debugfs_create_dir("gp", mali_debugfs_dir); if (mali_gp_dir != NULL) { struct dentry *mali_gp_all_dir; u32 ci; struct mali_cluster *cluster; mali_gp_all_dir = debugfs_create_dir("all", mali_gp_dir); if (mali_gp_all_dir != NULL) { debugfs_create_file("counter_src0", 0400, mali_gp_all_dir, NULL, &gp_all_counter_src0_fops); debugfs_create_file("counter_src1", 0400, mali_gp_all_dir, NULL, &gp_all_counter_src1_fops); } ci = 0; cluster = mali_cluster_get_global_cluster(ci); while (NULL != cluster) { u32 gi = 0; struct mali_group *group = mali_cluster_get_group(cluster, gi); while (NULL != group) { struct mali_gp_core *gp_core = mali_group_get_gp_core(group); if (NULL != gp_core) { struct dentry *mali_gp_gpx_dir; mali_gp_gpx_dir = debugfs_create_dir("gp0", mali_gp_dir); if (NULL != mali_gp_gpx_dir) { debugfs_create_file("counter_src0", 0600, mali_gp_gpx_dir, gp_core, &gp_gpx_counter_src0_fops); debugfs_create_file("counter_src1", 0600, mali_gp_gpx_dir, gp_core, &gp_gpx_counter_src1_fops); } break; /* no need to look for any other GP cores */ } /* try next group */ gi++; group = mali_cluster_get_group(cluster, gi); } /* try next cluster */ ci++; cluster = mali_cluster_get_global_cluster(ci); } } mali_pp_dir = debugfs_create_dir("pp", mali_debugfs_dir); if (mali_pp_dir != NULL) { struct dentry *mali_pp_all_dir; u32 ci; struct mali_cluster *cluster; mali_pp_all_dir = debugfs_create_dir("all", mali_pp_dir); if (mali_pp_all_dir != NULL) { debugfs_create_file("counter_src0", 0400, mali_pp_all_dir, NULL, &pp_all_counter_src0_fops); debugfs_create_file("counter_src1", 0400, mali_pp_all_dir, NULL, &pp_all_counter_src1_fops); } ci = 0; cluster = mali_cluster_get_global_cluster(ci); while (NULL != cluster) { u32 gi = 0; struct mali_group *group = mali_cluster_get_group(cluster, gi); while (NULL != group) { struct mali_pp_core *pp_core = mali_group_get_pp_core(group); if (NULL != pp_core) { char buf[16]; struct dentry *mali_pp_ppx_dir; _mali_osk_snprintf(buf, sizeof(buf), "pp%u", mali_pp_core_get_id(pp_core)); mali_pp_ppx_dir = debugfs_create_dir(buf, mali_pp_dir); if (NULL != mali_pp_ppx_dir) { debugfs_create_file("counter_src0", 0600, mali_pp_ppx_dir, pp_core, &pp_ppx_counter_src0_fops); debugfs_create_file("counter_src1", 0600, mali_pp_ppx_dir, pp_core, &pp_ppx_counter_src1_fops); } } /* try next group */ gi++; group = mali_cluster_get_group(cluster, gi); } /* try next cluster */ ci++; cluster = mali_cluster_get_global_cluster(ci); } } mali_l2_dir = debugfs_create_dir("l2", mali_debugfs_dir); if (mali_l2_dir != NULL) { struct dentry *mali_l2_all_dir; u32 l2_id; struct mali_l2_cache_core *l2_cache; mali_l2_all_dir = debugfs_create_dir("all", mali_l2_dir); if (mali_l2_all_dir != NULL) { debugfs_create_file("counter_src0", 0400, mali_l2_all_dir, NULL, &l2_all_counter_src0_fops); debugfs_create_file("counter_src1", 0400, mali_l2_all_dir, NULL, &l2_all_counter_src1_fops); } l2_id = 0; l2_cache = mali_l2_cache_core_get_glob_l2_core(l2_id); while (NULL != l2_cache) { char buf[16]; struct dentry *mali_l2_l2x_dir; _mali_osk_snprintf(buf, sizeof(buf), "l2%u", l2_id); mali_l2_l2x_dir = debugfs_create_dir(buf, mali_l2_dir); if (NULL != mali_l2_l2x_dir) { debugfs_create_file("counter_src0", 0600, mali_l2_l2x_dir, l2_cache, &l2_l2x_counter_src0_fops); debugfs_create_file("counter_src1", 0600, mali_l2_l2x_dir, l2_cache, &l2_l2x_counter_src1_fops); } /* try next L2 */ l2_id++; l2_cache = mali_l2_cache_core_get_glob_l2_core(l2_id); } } debugfs_create_file("memory_usage", 0400, mali_debugfs_dir, NULL, &memory_usage_fops); #if MALI_INTERNAL_TIMELINE_PROFILING_ENABLED mali_profiling_dir = debugfs_create_dir("profiling", mali_debugfs_dir); if (mali_profiling_dir != NULL) { struct dentry *mali_profiling_proc_dir = debugfs_create_dir("proc", mali_profiling_dir); if (mali_profiling_proc_dir != NULL) { struct dentry *mali_profiling_proc_default_dir = debugfs_create_dir("default", mali_profiling_proc_dir); if (mali_profiling_proc_default_dir != NULL) { debugfs_create_file("enable", 0600, mali_profiling_proc_default_dir, (void*)_MALI_UK_USER_SETTING_SW_EVENTS_ENABLE, &user_settings_fops); } } debugfs_create_file("record", 0600, mali_profiling_dir, NULL, &profiling_record_fops); debugfs_create_file("events", 0400, mali_profiling_dir, NULL, &profiling_events_fops); } #endif #if MALI_STATE_TRACKING debugfs_create_file("state_dump", 0400, mali_debugfs_dir, NULL, &mali_seq_internal_state_fops); #endif if (mali_sysfs_user_settings_register()) { /* Failed to create the debugfs entries for the user settings DB. */ MALI_DEBUG_PRINT(2, ("Failed to create user setting debugfs files. Ignoring...\n")); } } } /* Success! */ return 0; /* Error handling */ init_mdev_err: class_destroy(device->mali_class); init_class_err: return err; }