From 863b64512242d67bf243f9b48eeb81755f2cca58 Mon Sep 17 00:00:00 2001 From: Mao Jinlong Date: Wed, 1 Jul 2020 18:47:04 +0800 Subject: [PATCH] byte-cntr: Set offset as rwp offset when sw usb mode start Set offset as rwp offset when sw usb mode start to avoid the data transfer delay issue. If use etr_buf offset as initial offset, there will be interval between rwp offset and initial offset. Then the delay will happen. Change-Id: I92b4326a4c38384f68bd0c60f3b487d80b334325 Signed-off-by: Mao Jinlong --- drivers/hwtracing/coresight/coresight-byte-cntr.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-byte-cntr.c b/drivers/hwtracing/coresight/coresight-byte-cntr.c index a928e48b7bc9..7e84578b74cd 100644 --- a/drivers/hwtracing/coresight/coresight-byte-cntr.c +++ b/drivers/hwtracing/coresight/coresight-byte-cntr.c @@ -206,7 +206,7 @@ static int usb_bypass_start(struct byte_cntr *byte_cntr_data) } atomic_set(&byte_cntr_data->usb_free_buf, USB_BUF_NUM); - byte_cntr_data->offset = tmcdrvdata->etr_buf->offset; + byte_cntr_data->offset = tmc_sg_get_rwp_offset(tmcdrvdata); byte_cntr_data->read_active = true; /* * IRQ is a '8- byte' counter and to observe interrupt at @@ -390,6 +390,7 @@ static void usb_read_work_fn(struct work_struct *work) struct qdss_request *usb_req = NULL; struct etr_buf *etr_buf = tmcdrvdata->etr_buf; size_t actual, req_size, req_sg_num, small_size = 0; + size_t actual_total = 0; char *buf; struct byte_cntr *drvdata = container_of(work, struct byte_cntr, read_work); @@ -420,6 +421,7 @@ static void usb_read_work_fn(struct work_struct *work) req_size = USB_BLK_SIZE - small_size; small_size = 0; + actual_total = 0; if (req_size > 0) { seq++; @@ -462,9 +464,10 @@ static void usb_read_work_fn(struct work_struct *work) drvdata->offset = 0; else drvdata->offset += actual; + actual_total += actual; } - usb_req->length = req_size; + usb_req->length = actual_total; drvdata->usb_req = usb_req; usb_req->num_sgs = i;