From 66a4c715149c6e2d829610061eee4c43d057a7f6 Mon Sep 17 00:00:00 2001 From: Skylar Chang Date: Tue, 19 Apr 2016 12:07:35 -0700 Subject: [PATCH] msm: ipa: add IPC logging to IPA RM Add IPC logging support for IPA resource Manager. IPC logging will be stored in the same log buffer as IPA IPC log. CRs-Fixed: 1005492 Change-Id: Id2f1a32ee61e894fe78d5efcd76edded19becd0b Acked-by: Ady Abraham Signed-off-by: Skylar Chang --- drivers/platform/msm/ipa/ipa_rm.c | 22 ++++++------ drivers/platform/msm/ipa/ipa_rm_i.h | 27 ++++++++++++-- drivers/platform/msm/ipa/ipa_rm_resource.c | 42 +++++++++++----------- 3 files changed, 56 insertions(+), 35 deletions(-) diff --git a/drivers/platform/msm/ipa/ipa_rm.c b/drivers/platform/msm/ipa/ipa_rm.c index 53c72b154096..d0bde0e9654b 100644 --- a/drivers/platform/msm/ipa/ipa_rm.c +++ b/drivers/platform/msm/ipa/ipa_rm.c @@ -657,7 +657,7 @@ static void ipa_rm_wq_handler(struct work_struct *work) container_of(work, struct ipa_rm_wq_work_type, work); - IPA_RM_DBG("%s cmd=%d event=%d notify_registered_only=%d\n", + IPA_RM_DBG_LOW("%s cmd=%d event=%d notify_registered_only=%d\n", ipa_rm_resource_str(ipa_rm_work->resource_name), ipa_rm_work->wq_cmd, ipa_rm_work->event, @@ -714,7 +714,7 @@ static void ipa_rm_wq_resume_handler(struct work_struct *work) container_of(work, struct ipa_rm_wq_suspend_resume_work_type, work); - IPA_RM_DBG("resume work handler: %s", + IPA_RM_DBG_LOW("resume work handler: %s", ipa_rm_resource_str(ipa_rm_work->resource_name)); if (!IPA_RM_RESORCE_IS_CONS(ipa_rm_work->resource_name)) { @@ -750,7 +750,7 @@ static void ipa_rm_wq_suspend_handler(struct work_struct *work) container_of(work, struct ipa_rm_wq_suspend_resume_work_type, work); - IPA_RM_DBG("suspend work handler: %s", + IPA_RM_DBG_LOW("suspend work handler: %s", ipa_rm_resource_str(ipa_rm_work->resource_name)); if (!IPA_RM_RESORCE_IS_CONS(ipa_rm_work->resource_name)) { @@ -947,7 +947,7 @@ static void ipa_rm_perf_profile_notify_to_ipa_work(struct work_struct *work) work); int res; - IPA_RM_DBG("calling to IPA driver. voltage %d bandwidth %d\n", + IPA_RM_DBG_LOW("calling to IPA driver. voltage %d bandwidth %d\n", notify_work->volt, notify_work->bandwidth_mbps); res = ipa_set_required_perf_profile(notify_work->volt, @@ -957,7 +957,7 @@ static void ipa_rm_perf_profile_notify_to_ipa_work(struct work_struct *work) goto bail; } - IPA_RM_DBG("IPA driver notified\n"); + IPA_RM_DBG_LOW("IPA driver notified\n"); bail: kfree(notify_work); } @@ -995,7 +995,7 @@ void ipa_rm_perf_profile_change(enum ipa_rm_resource_name resource_name) u32 sum_bw_prod = 0; u32 sum_bw_cons = 0; - IPA_RM_DBG("%s\n", ipa_rm_resource_str(resource_name)); + IPA_RM_DBG_LOW("%s\n", ipa_rm_resource_str(resource_name)); if (ipa_rm_dep_graph_get_resource(ipa_rm_ctx->dep_graph, resource_name, @@ -1021,7 +1021,7 @@ void ipa_rm_perf_profile_change(enum ipa_rm_resource_name resource_name) switch (resource->state) { case IPA_RM_GRANTED: case IPA_RM_REQUEST_IN_PROGRESS: - IPA_RM_DBG("max_bw = %d, needed_bw = %d\n", + IPA_RM_DBG_LOW("max_bw = %d, needed_bw = %d\n", resource->max_bw, resource->needed_bw); *bw_ptr = min(resource->max_bw, resource->needed_bw); ipa_rm_ctx->prof_vote.volt[resource_name] = @@ -1039,7 +1039,7 @@ void ipa_rm_perf_profile_change(enum ipa_rm_resource_name resource_name) WARN_ON(1); return; } - IPA_RM_DBG("resource bandwidth: %d voltage: %d\n", *bw_ptr, + IPA_RM_DBG_LOW("resource bandwidth: %d voltage: %d\n", *bw_ptr, resource->floor_voltage); ipa_rm_ctx->prof_vote.curr_volt = IPA_VOLTAGE_UNSPECIFIED; @@ -1057,17 +1057,17 @@ void ipa_rm_perf_profile_change(enum ipa_rm_resource_name resource_name) for (i = 0; i < IPA_RM_RESOURCE_CONS_MAX; i++) sum_bw_cons += ipa_rm_ctx->prof_vote.bw_cons[i]; - IPA_RM_DBG("all prod bandwidth: %d all cons bandwidth: %d\n", + IPA_RM_DBG_LOW("all prod bandwidth: %d all cons bandwidth: %d\n", sum_bw_prod, sum_bw_cons); ipa_rm_ctx->prof_vote.curr_bw = min(sum_bw_prod, sum_bw_cons); if (ipa_rm_ctx->prof_vote.curr_volt == old_volt && ipa_rm_ctx->prof_vote.curr_bw == old_bw) { - IPA_RM_DBG("same voting\n"); + IPA_RM_DBG_LOW("same voting\n"); return; } - IPA_RM_DBG("new voting: voltage %d bandwidth %d\n", + IPA_RM_DBG_LOW("new voting: voltage %d bandwidth %d\n", ipa_rm_ctx->prof_vote.curr_volt, ipa_rm_ctx->prof_vote.curr_bw); diff --git a/drivers/platform/msm/ipa/ipa_rm_i.h b/drivers/platform/msm/ipa/ipa_rm_i.h index 65dbff66a6dd..e0c1582e8543 100644 --- a/drivers/platform/msm/ipa/ipa_rm_i.h +++ b/drivers/platform/msm/ipa/ipa_rm_i.h @@ -16,15 +16,36 @@ #include #include #include "ipa_rm_resource.h" +#include "ipa_common_i.h" #define IPA_RM_DRV_NAME "ipa_rm" #define IPA_RM_DBG_LOW(fmt, args...) \ - pr_debug(IPA_RM_DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args) + do { \ + pr_debug(IPA_RM_DRV_NAME " %s:%d " fmt, __func__, __LINE__, \ + ## args); \ + IPA_IPC_LOGGING(ipa_get_ipc_logbuf_low(), \ + IPA_RM_DRV_NAME " %s:%d " fmt, ## args); \ + } while (0) #define IPA_RM_DBG(fmt, args...) \ - pr_debug(IPA_RM_DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args) + do { \ + pr_debug(IPA_RM_DRV_NAME " %s:%d " fmt, __func__, __LINE__, \ + ## args); \ + IPA_IPC_LOGGING(ipa_get_ipc_logbuf(), \ + IPA_RM_DRV_NAME " %s:%d " fmt, ## args); \ + IPA_IPC_LOGGING(ipa_get_ipc_logbuf_low(), \ + IPA_RM_DRV_NAME " %s:%d " fmt, ## args); \ + } while (0) + #define IPA_RM_ERR(fmt, args...) \ - pr_err(IPA_RM_DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args) + do { \ + pr_err(IPA_RM_DRV_NAME " %s:%d " fmt, __func__, __LINE__, \ + ## args); \ + IPA_IPC_LOGGING(ipa_get_ipc_logbuf(), \ + IPA_RM_DRV_NAME " %s:%d " fmt, ## args); \ + IPA_IPC_LOGGING(ipa_get_ipc_logbuf_low(), \ + IPA_RM_DRV_NAME " %s:%d " fmt, ## args); \ + } while (0) #define IPA_RM_RESOURCE_CONS_MAX \ (IPA_RM_RESOURCE_MAX - IPA_RM_RESOURCE_PROD_MAX) diff --git a/drivers/platform/msm/ipa/ipa_rm_resource.c b/drivers/platform/msm/ipa/ipa_rm_resource.c index 75424eb768f4..597598df6997 100644 --- a/drivers/platform/msm/ipa/ipa_rm_resource.c +++ b/drivers/platform/msm/ipa/ipa_rm_resource.c @@ -85,9 +85,9 @@ int ipa_rm_resource_consumer_release_work( { int driver_result; - IPA_RM_DBG("calling driver CB\n"); + IPA_RM_DBG_LOW("calling driver CB\n"); driver_result = consumer->release_resource(); - IPA_RM_DBG("driver CB returned with %d\n", driver_result); + IPA_RM_DBG_LOW("driver CB returned with %d\n", driver_result); /* * Treat IPA_RM_RELEASE_IN_PROGRESS as IPA_RM_RELEASED * for CONS which remains in RELEASE_IN_PROGRESS. @@ -120,9 +120,9 @@ int ipa_rm_resource_consumer_request_work(struct ipa_rm_resource_cons *consumer, { int driver_result; - IPA_RM_DBG("calling driver CB\n"); + IPA_RM_DBG_LOW("calling driver CB\n"); driver_result = consumer->request_resource(); - IPA_RM_DBG("driver CB returned with %d\n", driver_result); + IPA_RM_DBG_LOW("driver CB returned with %d\n", driver_result); if (driver_result == 0) { if (notify_completion) { ipa_rm_resource_consumer_handle_cb(consumer, @@ -151,7 +151,7 @@ int ipa_rm_resource_consumer_request( enum ipa_rm_resource_state prev_state; struct ipa_active_client_logging_info log_info; - IPA_RM_DBG("%s state: %d\n", + IPA_RM_DBG_LOW("%s state: %d\n", ipa_rm_resource_str(consumer->resource.name), consumer->resource.state); @@ -166,7 +166,7 @@ int ipa_rm_resource_consumer_request( ipa_rm_resource_str(consumer->resource.name)); if (prev_state == IPA_RM_RELEASE_IN_PROGRESS || ipa_inc_client_enable_clks_no_block(&log_info) != 0) { - IPA_RM_DBG("async resume work for %s\n", + IPA_RM_DBG_LOW("async resume work for %s\n", ipa_rm_resource_str(consumer->resource.name)); ipa_rm_wq_send_resume_cmd(consumer->resource.name, prev_state, @@ -198,10 +198,10 @@ int ipa_rm_resource_consumer_request( if (inc_usage_count) consumer->usage_count++; bail: - IPA_RM_DBG("%s new state: %d\n", + IPA_RM_DBG_LOW("%s new state: %d\n", ipa_rm_resource_str(consumer->resource.name), consumer->resource.state); - IPA_RM_DBG("EXIT with %d\n", result); + IPA_RM_DBG_LOW("EXIT with %d\n", result); return result; } @@ -214,7 +214,7 @@ int ipa_rm_resource_consumer_release( int result = 0; enum ipa_rm_resource_state save_state; - IPA_RM_DBG("%s state: %d\n", + IPA_RM_DBG_LOW("%s state: %d\n", ipa_rm_resource_str(consumer->resource.name), consumer->resource.state); save_state = consumer->resource.state; @@ -255,10 +255,10 @@ int ipa_rm_resource_consumer_release( goto bail; } bail: - IPA_RM_DBG("%s new state: %d\n", + IPA_RM_DBG_LOW("%s new state: %d\n", ipa_rm_resource_str(consumer->resource.name), consumer->resource.state); - IPA_RM_DBG("EXIT with %d\n", result); + IPA_RM_DBG_LOW("EXIT with %d\n", result); return result; } @@ -278,7 +278,7 @@ void ipa_rm_resource_producer_notify_clients( { struct ipa_rm_notification_info *reg_info; - IPA_RM_DBG("%s event: %d notify_registered_only: %d\n", + IPA_RM_DBG_LOW("%s event: %d notify_registered_only: %d\n", ipa_rm_resource_str(producer->resource.name), event, notify_registered_only); @@ -287,12 +287,12 @@ void ipa_rm_resource_producer_notify_clients( if (notify_registered_only && !reg_info->explicit) continue; - IPA_RM_DBG("Notifying %s event: %d\n", + IPA_RM_DBG_LOW("Notifying %s event: %d\n", ipa_rm_resource_str(producer->resource.name), event); reg_info->reg_params.notify_cb(reg_info->reg_params.user_data, event, 0); - IPA_RM_DBG("back from client CB\n"); + IPA_RM_DBG_LOW("back from client CB\n"); } } @@ -823,7 +823,7 @@ int ipa_rm_resource_producer_request(struct ipa_rm_resource_prod *producer) } unlock_and_bail: if (state != producer->resource.state) - IPA_RM_DBG("%s state changed %d->%d\n", + IPA_RM_DBG_LOW("%s state changed %d->%d\n", ipa_rm_resource_str(producer->resource.name), state, producer->resource.state); @@ -889,7 +889,7 @@ int ipa_rm_resource_producer_release(struct ipa_rm_resource_prod *producer) } bail: if (state != producer->resource.state) - IPA_RM_DBG("%s state changed %d->%d\n", + IPA_RM_DBG_LOW("%s state changed %d->%d\n", ipa_rm_resource_str(producer->resource.name), state, producer->resource.state); @@ -901,7 +901,7 @@ static void ipa_rm_resource_producer_handle_cb( struct ipa_rm_resource_prod *producer, enum ipa_rm_event event) { - IPA_RM_DBG("%s state: %d event: %d pending_request: %d\n", + IPA_RM_DBG_LOW("%s state: %d event: %d pending_request: %d\n", ipa_rm_resource_str(producer->resource.name), producer->resource.state, event, @@ -950,7 +950,7 @@ static void ipa_rm_resource_producer_handle_cb( goto unlock_and_bail; } unlock_and_bail: - IPA_RM_DBG("%s new state: %d\n", + IPA_RM_DBG_LOW("%s new state: %d\n", ipa_rm_resource_str(producer->resource.name), producer->resource.state); bail: @@ -973,7 +973,7 @@ void ipa_rm_resource_consumer_handle_cb(struct ipa_rm_resource_cons *consumer, IPA_RM_ERR("invalid params\n"); return; } - IPA_RM_DBG("%s state: %d event: %d\n", + IPA_RM_DBG_LOW("%s state: %d event: %d\n", ipa_rm_resource_str(consumer->resource.name), consumer->resource.state, event); @@ -1013,7 +1013,7 @@ void ipa_rm_resource_consumer_handle_cb(struct ipa_rm_resource_cons *consumer, return; bail: - IPA_RM_DBG("%s new state: %d\n", + IPA_RM_DBG_LOW("%s new state: %d\n", ipa_rm_resource_str(consumer->resource.name), consumer->resource.state); } @@ -1040,7 +1040,7 @@ int ipa_rm_resource_set_perf_profile(struct ipa_rm_resource *resource, } if (profile->max_supported_bandwidth_mbps == resource->max_bw) { - IPA_RM_DBG("same profile\n"); + IPA_RM_DBG_LOW("same profile\n"); return 0; }