Merge "coresight: add debug log to coresight-tmc"

This commit is contained in:
qctecmdr 2022-01-17 09:36:11 -08:00 committed by Gerrit - the friendly Code Review server
commit d955412a4a
3 changed files with 32 additions and 2 deletions

View File

@ -50,6 +50,8 @@ static irqreturn_t etr_handler(int irq, void *data)
wake_up(&byte_cntr_data->wq);
}
byte_cntr_data->total_irq++;
return IRQ_HANDLED;
}
@ -148,6 +150,8 @@ static ssize_t tmc_etr_byte_cntr_read(struct file *fp, char __user *data,
return -EFAULT;
}
byte_cntr_data->total_size += len;
if (*ppos + len >= tmcdrvdata->size)
*ppos = 0;
else
@ -203,6 +207,9 @@ EXPORT_SYMBOL(tmc_etr_byte_cntr_stop);
static int tmc_etr_byte_cntr_release(struct inode *in, struct file *fp)
{
struct byte_cntr *byte_cntr_data = fp->private_data;
struct device *dev = &byte_cntr_data->tmcdrvdata->csdev->dev;
long rwp_offset = -EINVAL;
int rc;
mutex_lock(&byte_cntr_data->byte_cntr_lock);
byte_cntr_data->read_active = false;
@ -214,6 +221,19 @@ static int tmc_etr_byte_cntr_release(struct inode *in, struct file *fp)
byte_cntr_data->irqctrl_offset, 0);
disable_irq_wake(byte_cntr_data->byte_cntr_irq);
rc = pm_runtime_get_sync(dev->parent);
if (rc < 0) {
pm_runtime_put_noidle(dev->parent);
} else {
rwp_offset = tmc_get_rwp_offset(byte_cntr_data->tmcdrvdata);
pm_runtime_put(dev->parent);
}
dev_dbg(dev, "send data total size: %lld bytes, irq_cnt: %lld, offset: %lld\n",
byte_cntr_data->total_size, byte_cntr_data->total_irq, rwp_offset);
byte_cntr_data->total_irq = 0;
mutex_unlock(&byte_cntr_data->byte_cntr_lock);
return 0;
@ -250,6 +270,7 @@ static int tmc_etr_byte_cntr_open(struct inode *in, struct file *fp)
nonseekable_open(in, fp);
byte_cntr_data->enable = true;
byte_cntr_data->read_active = true;
byte_cntr_data->total_size = 0;
mutex_unlock(&byte_cntr_data->byte_cntr_lock);
return 0;
}

View File

@ -33,6 +33,9 @@ struct byte_cntr {
const char *class_name;
int irqctrl_offset;
unsigned long offset;
uint64_t total_size;
uint64_t total_irq;
};
extern void tmc_etr_byte_cntr_start(struct byte_cntr *byte_cntr_data);

View File

@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2021, The Linux Foundation. All rights reserved.
/* Copyright (c) 2021-2022, The Linux Foundation. All rights reserved.
*
* Description: CoreSight TMC USB driver
*/
@ -81,6 +81,7 @@ static int usb_bypass_start(struct byte_cntr *byte_cntr_data)
USB_BLK_SIZE / 8);
atomic_set(&byte_cntr_data->irq_cnt, 0);
byte_cntr_data->total_size = 0;
mutex_unlock(&byte_cntr_data->usb_bypass_lock);
return 0;
@ -101,6 +102,10 @@ static void usb_bypass_stop(struct byte_cntr *byte_cntr_data)
wake_up(&byte_cntr_data->usb_wait_wq);
pr_info("coresight: stop usb bypass\n");
coresight_csr_set_byte_cntr(byte_cntr_data->csr, byte_cntr_data->irqctrl_offset, 0);
dev_dbg(&byte_cntr_data->tmcdrvdata->csdev->dev,
"write to usb data total size: %lld bytes, irq_cnt: %lld, offset: %ld\n",
byte_cntr_data->total_size, byte_cntr_data->total_irq, byte_cntr_data->offset);
byte_cntr_data->total_irq = 0;
mutex_unlock(&byte_cntr_data->usb_bypass_lock);
}
@ -170,7 +175,7 @@ static int usb_transfer_small_packet(struct byte_cntr *drvdata, size_t *small_si
"Write data failed:%d\n", ret);
goto out;
}
drvdata->total_size += usb_req->length;
atomic_dec(&drvdata->usb_free_buf);
} else {
dev_dbg(&tmcdrvdata->csdev->dev,
@ -286,6 +291,7 @@ static void usb_read_work_fn(struct work_struct *work)
continue;
return;
}
drvdata->total_size += usb_req->length;
atomic_dec(&drvdata->usb_free_buf);
} else {