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 <adya@qti.qualcomm.com>
Signed-off-by: Skylar Chang <chiaweic@codeaurora.org>
This commit is contained in:
Skylar Chang 2016-04-19 12:07:35 -07:00 committed by Kyle Yan
parent 1741862c69
commit 66a4c71514
3 changed files with 56 additions and 35 deletions

View file

@ -657,7 +657,7 @@ static void ipa_rm_wq_handler(struct work_struct *work)
container_of(work, container_of(work,
struct ipa_rm_wq_work_type, struct ipa_rm_wq_work_type,
work); 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_resource_str(ipa_rm_work->resource_name),
ipa_rm_work->wq_cmd, ipa_rm_work->wq_cmd,
ipa_rm_work->event, ipa_rm_work->event,
@ -714,7 +714,7 @@ static void ipa_rm_wq_resume_handler(struct work_struct *work)
container_of(work, container_of(work,
struct ipa_rm_wq_suspend_resume_work_type, struct ipa_rm_wq_suspend_resume_work_type,
work); 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)); ipa_rm_resource_str(ipa_rm_work->resource_name));
if (!IPA_RM_RESORCE_IS_CONS(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, container_of(work,
struct ipa_rm_wq_suspend_resume_work_type, struct ipa_rm_wq_suspend_resume_work_type,
work); 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)); ipa_rm_resource_str(ipa_rm_work->resource_name));
if (!IPA_RM_RESORCE_IS_CONS(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); work);
int res; 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); notify_work->volt, notify_work->bandwidth_mbps);
res = ipa_set_required_perf_profile(notify_work->volt, 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; goto bail;
} }
IPA_RM_DBG("IPA driver notified\n"); IPA_RM_DBG_LOW("IPA driver notified\n");
bail: bail:
kfree(notify_work); 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_prod = 0;
u32 sum_bw_cons = 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, if (ipa_rm_dep_graph_get_resource(ipa_rm_ctx->dep_graph,
resource_name, resource_name,
@ -1021,7 +1021,7 @@ void ipa_rm_perf_profile_change(enum ipa_rm_resource_name resource_name)
switch (resource->state) { switch (resource->state) {
case IPA_RM_GRANTED: case IPA_RM_GRANTED:
case IPA_RM_REQUEST_IN_PROGRESS: 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); resource->max_bw, resource->needed_bw);
*bw_ptr = min(resource->max_bw, resource->needed_bw); *bw_ptr = min(resource->max_bw, resource->needed_bw);
ipa_rm_ctx->prof_vote.volt[resource_name] = 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); WARN_ON(1);
return; 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); resource->floor_voltage);
ipa_rm_ctx->prof_vote.curr_volt = IPA_VOLTAGE_UNSPECIFIED; 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++) for (i = 0; i < IPA_RM_RESOURCE_CONS_MAX; i++)
sum_bw_cons += ipa_rm_ctx->prof_vote.bw_cons[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); sum_bw_prod, sum_bw_cons);
ipa_rm_ctx->prof_vote.curr_bw = min(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 && if (ipa_rm_ctx->prof_vote.curr_volt == old_volt &&
ipa_rm_ctx->prof_vote.curr_bw == old_bw) { ipa_rm_ctx->prof_vote.curr_bw == old_bw) {
IPA_RM_DBG("same voting\n"); IPA_RM_DBG_LOW("same voting\n");
return; 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_volt,
ipa_rm_ctx->prof_vote.curr_bw); ipa_rm_ctx->prof_vote.curr_bw);

View file

@ -16,15 +16,36 @@
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/ipa.h> #include <linux/ipa.h>
#include "ipa_rm_resource.h" #include "ipa_rm_resource.h"
#include "ipa_common_i.h"
#define IPA_RM_DRV_NAME "ipa_rm" #define IPA_RM_DRV_NAME "ipa_rm"
#define IPA_RM_DBG_LOW(fmt, args...) \ #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...) \ #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...) \ #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 \ #define IPA_RM_RESOURCE_CONS_MAX \
(IPA_RM_RESOURCE_MAX - IPA_RM_RESOURCE_PROD_MAX) (IPA_RM_RESOURCE_MAX - IPA_RM_RESOURCE_PROD_MAX)

View file

@ -85,9 +85,9 @@ int ipa_rm_resource_consumer_release_work(
{ {
int driver_result; int driver_result;
IPA_RM_DBG("calling driver CB\n"); IPA_RM_DBG_LOW("calling driver CB\n");
driver_result = consumer->release_resource(); 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 * Treat IPA_RM_RELEASE_IN_PROGRESS as IPA_RM_RELEASED
* for CONS which remains in RELEASE_IN_PROGRESS. * 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; int driver_result;
IPA_RM_DBG("calling driver CB\n"); IPA_RM_DBG_LOW("calling driver CB\n");
driver_result = consumer->request_resource(); 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 (driver_result == 0) {
if (notify_completion) { if (notify_completion) {
ipa_rm_resource_consumer_handle_cb(consumer, ipa_rm_resource_consumer_handle_cb(consumer,
@ -151,7 +151,7 @@ int ipa_rm_resource_consumer_request(
enum ipa_rm_resource_state prev_state; enum ipa_rm_resource_state prev_state;
struct ipa_active_client_logging_info log_info; 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), ipa_rm_resource_str(consumer->resource.name),
consumer->resource.state); consumer->resource.state);
@ -166,7 +166,7 @@ int ipa_rm_resource_consumer_request(
ipa_rm_resource_str(consumer->resource.name)); ipa_rm_resource_str(consumer->resource.name));
if (prev_state == IPA_RM_RELEASE_IN_PROGRESS || if (prev_state == IPA_RM_RELEASE_IN_PROGRESS ||
ipa_inc_client_enable_clks_no_block(&log_info) != 0) { 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_resource_str(consumer->resource.name));
ipa_rm_wq_send_resume_cmd(consumer->resource.name, ipa_rm_wq_send_resume_cmd(consumer->resource.name,
prev_state, prev_state,
@ -198,10 +198,10 @@ int ipa_rm_resource_consumer_request(
if (inc_usage_count) if (inc_usage_count)
consumer->usage_count++; consumer->usage_count++;
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), ipa_rm_resource_str(consumer->resource.name),
consumer->resource.state); consumer->resource.state);
IPA_RM_DBG("EXIT with %d\n", result); IPA_RM_DBG_LOW("EXIT with %d\n", result);
return result; return result;
} }
@ -214,7 +214,7 @@ int ipa_rm_resource_consumer_release(
int result = 0; int result = 0;
enum ipa_rm_resource_state save_state; 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), ipa_rm_resource_str(consumer->resource.name),
consumer->resource.state); consumer->resource.state);
save_state = consumer->resource.state; save_state = consumer->resource.state;
@ -255,10 +255,10 @@ int ipa_rm_resource_consumer_release(
goto bail; goto bail;
} }
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), ipa_rm_resource_str(consumer->resource.name),
consumer->resource.state); consumer->resource.state);
IPA_RM_DBG("EXIT with %d\n", result); IPA_RM_DBG_LOW("EXIT with %d\n", result);
return result; return result;
} }
@ -278,7 +278,7 @@ void ipa_rm_resource_producer_notify_clients(
{ {
struct ipa_rm_notification_info *reg_info; 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), ipa_rm_resource_str(producer->resource.name),
event, event,
notify_registered_only); notify_registered_only);
@ -287,12 +287,12 @@ void ipa_rm_resource_producer_notify_clients(
if (notify_registered_only && !reg_info->explicit) if (notify_registered_only && !reg_info->explicit)
continue; 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); ipa_rm_resource_str(producer->resource.name), event);
reg_info->reg_params.notify_cb(reg_info->reg_params.user_data, reg_info->reg_params.notify_cb(reg_info->reg_params.user_data,
event, event,
0); 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: unlock_and_bail:
if (state != producer->resource.state) 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), ipa_rm_resource_str(producer->resource.name),
state, state,
producer->resource.state); producer->resource.state);
@ -889,7 +889,7 @@ int ipa_rm_resource_producer_release(struct ipa_rm_resource_prod *producer)
} }
bail: bail:
if (state != producer->resource.state) 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), ipa_rm_resource_str(producer->resource.name),
state, state,
producer->resource.state); producer->resource.state);
@ -901,7 +901,7 @@ static void ipa_rm_resource_producer_handle_cb(
struct ipa_rm_resource_prod *producer, struct ipa_rm_resource_prod *producer,
enum ipa_rm_event event) 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), ipa_rm_resource_str(producer->resource.name),
producer->resource.state, producer->resource.state,
event, event,
@ -950,7 +950,7 @@ static void ipa_rm_resource_producer_handle_cb(
goto unlock_and_bail; goto unlock_and_bail;
} }
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), ipa_rm_resource_str(producer->resource.name),
producer->resource.state); producer->resource.state);
bail: bail:
@ -973,7 +973,7 @@ void ipa_rm_resource_consumer_handle_cb(struct ipa_rm_resource_cons *consumer,
IPA_RM_ERR("invalid params\n"); IPA_RM_ERR("invalid params\n");
return; 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), ipa_rm_resource_str(consumer->resource.name),
consumer->resource.state, consumer->resource.state,
event); event);
@ -1013,7 +1013,7 @@ void ipa_rm_resource_consumer_handle_cb(struct ipa_rm_resource_cons *consumer,
return; return;
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), ipa_rm_resource_str(consumer->resource.name),
consumer->resource.state); 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) { if (profile->max_supported_bandwidth_mbps == resource->max_bw) {
IPA_RM_DBG("same profile\n"); IPA_RM_DBG_LOW("same profile\n");
return 0; return 0;
} }