Commit c0abffbd authored by Alexander Usyskin's avatar Alexander Usyskin Committed by Greg Kroah-Hartman

mei: prefix client log messages with client me and host ids

define cl_dbg and cl_err macros that add me and host id
prefix for debug and error log messages so we can track
for the client context of the flow.
Signed-off-by: default avatarAlexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a9c8a17a
...@@ -187,10 +187,14 @@ int mei_io_cb_alloc_resp_buf(struct mei_cl_cb *cb, size_t length) ...@@ -187,10 +187,14 @@ int mei_io_cb_alloc_resp_buf(struct mei_cl_cb *cb, size_t length)
*/ */
int mei_cl_flush_queues(struct mei_cl *cl) int mei_cl_flush_queues(struct mei_cl *cl)
{ {
struct mei_device *dev;
if (WARN_ON(!cl || !cl->dev)) if (WARN_ON(!cl || !cl->dev))
return -EINVAL; return -EINVAL;
dev_dbg(&cl->dev->pdev->dev, "remove list entry belonging to cl\n"); dev = cl->dev;
cl_dbg(dev, cl, "remove list entry belonging to cl\n");
mei_io_list_flush(&cl->dev->read_list, cl); mei_io_list_flush(&cl->dev->read_list, cl);
mei_io_list_flush(&cl->dev->write_list, cl); mei_io_list_flush(&cl->dev->write_list, cl);
mei_io_list_flush(&cl->dev->write_waiting_list, cl); mei_io_list_flush(&cl->dev->write_waiting_list, cl);
...@@ -302,7 +306,7 @@ int mei_cl_link(struct mei_cl *cl, int id) ...@@ -302,7 +306,7 @@ int mei_cl_link(struct mei_cl *cl, int id)
cl->state = MEI_FILE_INITIALIZING; cl->state = MEI_FILE_INITIALIZING;
dev_dbg(&dev->pdev->dev, "link cl host id = %d\n", cl->host_client_id); cl_dbg(dev, cl, "link cl\n");
return 0; return 0;
} }
...@@ -328,7 +332,7 @@ int mei_cl_unlink(struct mei_cl *cl) ...@@ -328,7 +332,7 @@ int mei_cl_unlink(struct mei_cl *cl)
list_for_each_entry_safe(pos, next, &dev->file_list, link) { list_for_each_entry_safe(pos, next, &dev->file_list, link) {
if (cl->host_client_id == pos->host_client_id) { if (cl->host_client_id == pos->host_client_id) {
dev_dbg(&dev->pdev->dev, "remove host client = %d, ME client = %d\n", cl_dbg(dev, cl, "remove host client = %d, ME client = %d\n",
pos->host_client_id, pos->me_client_id); pos->host_client_id, pos->me_client_id);
list_del_init(&pos->link); list_del_init(&pos->link);
break; break;
...@@ -396,6 +400,8 @@ int mei_cl_disconnect(struct mei_cl *cl) ...@@ -396,6 +400,8 @@ int mei_cl_disconnect(struct mei_cl *cl)
dev = cl->dev; dev = cl->dev;
cl_dbg(dev, cl, "disconnecting");
if (cl->state != MEI_FILE_DISCONNECTING) if (cl->state != MEI_FILE_DISCONNECTING)
return 0; return 0;
...@@ -408,13 +414,13 @@ int mei_cl_disconnect(struct mei_cl *cl) ...@@ -408,13 +414,13 @@ int mei_cl_disconnect(struct mei_cl *cl)
dev->hbuf_is_ready = false; dev->hbuf_is_ready = false;
if (mei_hbm_cl_disconnect_req(dev, cl)) { if (mei_hbm_cl_disconnect_req(dev, cl)) {
rets = -ENODEV; rets = -ENODEV;
dev_err(&dev->pdev->dev, "failed to disconnect.\n"); cl_err(dev, cl, "failed to disconnect.\n");
goto free; goto free;
} }
mdelay(10); /* Wait for hardware disconnection ready */ mdelay(10); /* Wait for hardware disconnection ready */
list_add_tail(&cb->list, &dev->ctrl_rd_list.list); list_add_tail(&cb->list, &dev->ctrl_rd_list.list);
} else { } else {
dev_dbg(&dev->pdev->dev, "add disconnect cb to control write list\n"); cl_dbg(dev, cl, "add disconnect cb to control write list\n");
list_add_tail(&cb->list, &dev->ctrl_wr_list.list); list_add_tail(&cb->list, &dev->ctrl_wr_list.list);
} }
...@@ -427,18 +433,17 @@ int mei_cl_disconnect(struct mei_cl *cl) ...@@ -427,18 +433,17 @@ int mei_cl_disconnect(struct mei_cl *cl)
mutex_lock(&dev->device_lock); mutex_lock(&dev->device_lock);
if (MEI_FILE_DISCONNECTED == cl->state) { if (MEI_FILE_DISCONNECTED == cl->state) {
rets = 0; rets = 0;
dev_dbg(&dev->pdev->dev, "successfully disconnected from FW client.\n"); cl_dbg(dev, cl, "successfully disconnected from FW client.\n");
} else { } else {
rets = -ENODEV; rets = -ENODEV;
if (MEI_FILE_DISCONNECTED != cl->state) if (MEI_FILE_DISCONNECTED != cl->state)
dev_dbg(&dev->pdev->dev, "wrong status client disconnect.\n"); cl_err(dev, cl, "wrong status client disconnect.\n");
if (err) if (err)
dev_dbg(&dev->pdev->dev, cl_dbg(dev, cl, "wait failed disconnect err=%08x\n",
"wait failed disconnect err=%08x\n",
err); err);
dev_dbg(&dev->pdev->dev, "failed to disconnect from FW client.\n"); cl_err(dev, cl, "failed to disconnect from FW client.\n");
} }
mei_io_list_flush(&dev->ctrl_rd_list, cl); mei_io_list_flush(&dev->ctrl_rd_list, cl);
...@@ -645,13 +650,12 @@ int mei_cl_read_start(struct mei_cl *cl, size_t length) ...@@ -645,13 +650,12 @@ int mei_cl_read_start(struct mei_cl *cl, size_t length)
return -ENODEV; return -ENODEV;
if (cl->read_cb) { if (cl->read_cb) {
dev_dbg(&dev->pdev->dev, "read is pending.\n"); cl_dbg(dev, cl, "read is pending.\n");
return -EBUSY; return -EBUSY;
} }
i = mei_me_cl_by_id(dev, cl->me_client_id); i = mei_me_cl_by_id(dev, cl->me_client_id);
if (i < 0) { if (i < 0) {
dev_err(&dev->pdev->dev, "no such me client %d\n", cl_err(dev, cl, "no such me client %d\n", cl->me_client_id);
cl->me_client_id);
return -ENODEV; return -ENODEV;
} }
...@@ -670,6 +674,7 @@ int mei_cl_read_start(struct mei_cl *cl, size_t length) ...@@ -670,6 +674,7 @@ int mei_cl_read_start(struct mei_cl *cl, size_t length)
if (dev->hbuf_is_ready) { if (dev->hbuf_is_ready) {
dev->hbuf_is_ready = false; dev->hbuf_is_ready = false;
if (mei_hbm_cl_flow_control_req(dev, cl)) { if (mei_hbm_cl_flow_control_req(dev, cl)) {
cl_err(dev, cl, "flow control send failed\n");
rets = -ENODEV; rets = -ENODEV;
goto err; goto err;
} }
...@@ -720,9 +725,8 @@ int mei_cl_irq_write_complete(struct mei_cl *cl, struct mei_cl_cb *cb, ...@@ -720,9 +725,8 @@ int mei_cl_irq_write_complete(struct mei_cl *cl, struct mei_cl_cb *cb,
return 0; return 0;
} }
dev_dbg(&dev->pdev->dev, "buf: size = %d idx = %lu\n", cl_dbg(dev, cl, "buf: size = %d idx = %lu\n",
cb->request_buffer.size, cb->buf_idx); cb->request_buffer.size, cb->buf_idx);
dev_dbg(&dev->pdev->dev, MEI_HDR_FMT, MEI_HDR_PRM(&mei_hdr));
*slots -= msg_slots; *slots -= msg_slots;
if (mei_write_message(dev, &mei_hdr, if (mei_write_message(dev, &mei_hdr,
...@@ -773,7 +777,7 @@ int mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb, bool blocking) ...@@ -773,7 +777,7 @@ int mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb, bool blocking)
buf = &cb->request_buffer; buf = &cb->request_buffer;
dev_dbg(&dev->pdev->dev, "mei_cl_write %d\n", buf->size); cl_dbg(dev, cl, "mei_cl_write %d\n", buf->size);
cb->fop_type = MEI_FOP_WRITE; cb->fop_type = MEI_FOP_WRITE;
...@@ -806,9 +810,6 @@ int mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb, bool blocking) ...@@ -806,9 +810,6 @@ int mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb, bool blocking)
mei_hdr.me_addr = cl->me_client_id; mei_hdr.me_addr = cl->me_client_id;
mei_hdr.reserved = 0; mei_hdr.reserved = 0;
dev_dbg(&dev->pdev->dev, "write " MEI_HDR_FMT "\n",
MEI_HDR_PRM(&mei_hdr));
if (mei_write_message(dev, &mei_hdr, buf->data)) { if (mei_write_message(dev, &mei_hdr, buf->data)) {
rets = -EIO; rets = -EIO;
...@@ -904,11 +905,11 @@ void mei_cl_all_wakeup(struct mei_device *dev) ...@@ -904,11 +905,11 @@ void mei_cl_all_wakeup(struct mei_device *dev)
struct mei_cl *cl, *next; struct mei_cl *cl, *next;
list_for_each_entry_safe(cl, next, &dev->file_list, link) { list_for_each_entry_safe(cl, next, &dev->file_list, link) {
if (waitqueue_active(&cl->rx_wait)) { if (waitqueue_active(&cl->rx_wait)) {
dev_dbg(&dev->pdev->dev, "Waking up reading client!\n"); cl_dbg(dev, cl, "Waking up reading client!\n");
wake_up_interruptible(&cl->rx_wait); wake_up_interruptible(&cl->rx_wait);
} }
if (waitqueue_active(&cl->tx_wait)) { if (waitqueue_active(&cl->tx_wait)) {
dev_dbg(&dev->pdev->dev, "Waking up writing client!\n"); cl_dbg(dev, cl, "Waking up writing client!\n");
wake_up_interruptible(&cl->tx_wait); wake_up_interruptible(&cl->tx_wait);
} }
} }
......
...@@ -109,4 +109,13 @@ void mei_cl_all_disconnect(struct mei_device *dev); ...@@ -109,4 +109,13 @@ void mei_cl_all_disconnect(struct mei_device *dev);
void mei_cl_all_wakeup(struct mei_device *dev); void mei_cl_all_wakeup(struct mei_device *dev);
void mei_cl_all_write_clear(struct mei_device *dev); void mei_cl_all_write_clear(struct mei_device *dev);
#define MEI_CL_FMT "cl:host=%02d me=%02d "
#define MEI_CL_PRM(cl) (cl)->host_client_id, (cl)->me_client_id
#define cl_dbg(dev, cl, format, arg...) \
dev_dbg(&(dev)->pdev->dev, MEI_CL_FMT format, MEI_CL_PRM(cl), ##arg)
#define cl_err(dev, cl, format, arg...) \
dev_err(&(dev)->pdev->dev, MEI_CL_FMT format, MEI_CL_PRM(cl), ##arg)
#endif /* _MEI_CLIENT_H_ */ #endif /* _MEI_CLIENT_H_ */
...@@ -113,13 +113,13 @@ static int mei_cl_irq_read_msg(struct mei_device *dev, ...@@ -113,13 +113,13 @@ static int mei_cl_irq_read_msg(struct mei_device *dev,
if (cb->response_buffer.size == 0 || if (cb->response_buffer.size == 0 ||
cb->response_buffer.data == NULL) { cb->response_buffer.data == NULL) {
dev_err(&dev->pdev->dev, "response buffer is not allocated.\n"); cl_err(dev, cl, "response buffer is not allocated.\n");
list_del(&cb->list); list_del(&cb->list);
return -ENOMEM; return -ENOMEM;
} }
if (cb->response_buffer.size < mei_hdr->length + cb->buf_idx) { if (cb->response_buffer.size < mei_hdr->length + cb->buf_idx) {
dev_dbg(&dev->pdev->dev, "message overflow. size %d len %d idx %ld\n", cl_dbg(dev, cl, "message overflow. size %d len %d idx %ld\n",
cb->response_buffer.size, cb->response_buffer.size,
mei_hdr->length, cb->buf_idx); mei_hdr->length, cb->buf_idx);
buffer = krealloc(cb->response_buffer.data, buffer = krealloc(cb->response_buffer.data,
...@@ -127,7 +127,7 @@ static int mei_cl_irq_read_msg(struct mei_device *dev, ...@@ -127,7 +127,7 @@ static int mei_cl_irq_read_msg(struct mei_device *dev,
GFP_KERNEL); GFP_KERNEL);
if (!buffer) { if (!buffer) {
dev_err(&dev->pdev->dev, "allocation failed.\n"); cl_err(dev, cl, "allocation failed.\n");
list_del(&cb->list); list_del(&cb->list);
return -ENOMEM; return -ENOMEM;
} }
...@@ -143,9 +143,7 @@ static int mei_cl_irq_read_msg(struct mei_device *dev, ...@@ -143,9 +143,7 @@ static int mei_cl_irq_read_msg(struct mei_device *dev,
if (mei_hdr->msg_complete) { if (mei_hdr->msg_complete) {
cl->status = 0; cl->status = 0;
list_del(&cb->list); list_del(&cb->list);
dev_dbg(&dev->pdev->dev, "completed read H cl = %d, ME cl = %d, length = %lu\n", cl_dbg(dev, cl, "completed read length = %lu\n",
cl->host_client_id,
cl->me_client_id,
cb->buf_idx); cb->buf_idx);
list_add_tail(&cb->list, &complete_list->list); list_add_tail(&cb->list, &complete_list->list);
} }
...@@ -423,12 +421,12 @@ int mei_irq_write_handler(struct mei_device *dev, struct mei_cl_cb *cmpl_list) ...@@ -423,12 +421,12 @@ int mei_irq_write_handler(struct mei_device *dev, struct mei_cl_cb *cmpl_list)
if (MEI_WRITING == cl->writing_state && if (MEI_WRITING == cl->writing_state &&
cb->fop_type == MEI_FOP_WRITE && cb->fop_type == MEI_FOP_WRITE &&
cl != &dev->iamthif_cl) { cl != &dev->iamthif_cl) {
dev_dbg(&dev->pdev->dev, "MEI WRITE COMPLETE\n"); cl_dbg(dev, cl, "MEI WRITE COMPLETE\n");
cl->writing_state = MEI_WRITE_COMPLETE; cl->writing_state = MEI_WRITE_COMPLETE;
list_add_tail(&cb->list, &cmpl_list->list); list_add_tail(&cb->list, &cmpl_list->list);
} }
if (cl == &dev->iamthif_cl) { if (cl == &dev->iamthif_cl) {
dev_dbg(&dev->pdev->dev, "check iamthif flow control.\n"); cl_dbg(dev, cl, "check iamthif flow control.\n");
if (dev->iamthif_flow_control_pending) { if (dev->iamthif_flow_control_pending) {
ret = mei_amthif_irq_read(dev, &slots); ret = mei_amthif_irq_read(dev, &slots);
if (ret) if (ret)
...@@ -510,9 +508,7 @@ int mei_irq_write_handler(struct mei_device *dev, struct mei_cl_cb *cmpl_list) ...@@ -510,9 +508,7 @@ int mei_irq_write_handler(struct mei_device *dev, struct mei_cl_cb *cmpl_list)
if (cl == NULL) if (cl == NULL)
continue; continue;
if (mei_cl_flow_ctrl_creds(cl) <= 0) { if (mei_cl_flow_ctrl_creds(cl) <= 0) {
dev_dbg(&dev->pdev->dev, cl_dbg(dev, cl, "No flow control credentials, not sending.\n");
"No flow control credentials for client %d, not sending.\n",
cl->host_client_id);
continue; continue;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment