Loading drivers/hwtracing/coresight/coresight-tmc-etf.c +14 −10 Original line number Diff line number Diff line Loading @@ -542,12 +542,14 @@ int tmc_read_prepare_etb(struct tmc_drvdata *drvdata) goto out; } if (drvdata->enable) { /* There is no point in reading a TMC in HW FIFO mode */ mode = readl_relaxed(drvdata->base + TMC_MODE); if (mode != TMC_MODE_CIRCULAR_BUFFER) { ret = -EINVAL; goto out; } } /* Don't interfere if operated from Perf */ if (drvdata->mode == CS_MODE_PERF) { Loading Loading @@ -585,12 +587,14 @@ int tmc_read_unprepare_etb(struct tmc_drvdata *drvdata) spin_lock_irqsave(&drvdata->spinlock, flags); if (drvdata->enable) { /* There is no point in reading a TMC in HW FIFO mode */ mode = readl_relaxed(drvdata->base + TMC_MODE); if (mode != TMC_MODE_CIRCULAR_BUFFER) { spin_unlock_irqrestore(&drvdata->spinlock, flags); return -EINVAL; } } /* Re-enable the TMC if need be */ if (drvdata->mode == CS_MODE_SYSFS) { Loading drivers/hwtracing/coresight/coresight-tmc-etr.c +1 −0 Original line number Diff line number Diff line Loading @@ -1082,6 +1082,7 @@ static int tmc_enable_etr_sink_sysfs(struct coresight_device *csdev) drvdata->mode = CS_MODE_SYSFS; tmc_etr_enable_hw(drvdata); drvdata->enable = true; out: spin_unlock_irqrestore(&drvdata->spinlock, flags); Loading drivers/hwtracing/coresight/coresight-tmc.c +8 −2 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2012,2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2012,2017-2018, The Linux Foundation. All rights reserved. * * Description: CoreSight Trace Memory Controller driver */ Loading Loading @@ -56,11 +56,13 @@ void tmc_flush_and_stop(struct tmc_drvdata *drvdata) void tmc_enable_hw(struct tmc_drvdata *drvdata) { drvdata->enable = true; writel_relaxed(TMC_CTL_CAPT_EN, drvdata->base + TMC_CTL); } void tmc_disable_hw(struct tmc_drvdata *drvdata) { drvdata->enable = false; writel_relaxed(0x0, drvdata->base + TMC_CTL); } Loading Loading @@ -298,16 +300,20 @@ static ssize_t buffer_size_store(struct device *dev, unsigned long val; struct tmc_drvdata *drvdata = dev_get_drvdata(dev->parent); if (drvdata->enable) { pr_err("ETR is in use, disable it to change the mem_size\n"); return -EINVAL; } /* Only permitted for TMC-ETRs */ if (drvdata->config_type != TMC_CONFIG_TYPE_ETR) return -EPERM; ret = kstrtoul(buf, 0, &val); if (ret) return ret; /* The buffer size should be page aligned */ if (val & (PAGE_SIZE - 1)) return -EINVAL; drvdata->size = val; return size; } Loading drivers/hwtracing/coresight/coresight-tmc.h +1 −0 Original line number Diff line number Diff line Loading @@ -196,6 +196,7 @@ struct tmc_drvdata { u32 etr_caps; struct coresight_csr *csr; const char *csr_name; bool enable; }; struct etr_buf_operations { Loading drivers/hwtracing/coresight/coresight.c +2 −1 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0 /* * Copyright (c) 2012, 2017, The Linux Foundation. All rights reserved. * Copyright (c) 2012, 2017-2018, The Linux Foundation. All rights reserved. */ #include <linux/kernel.h> Loading Loading @@ -150,6 +150,7 @@ static void coresight_disable_sink(struct coresight_device *csdev) if (atomic_dec_return(csdev->refcnt) == 0) { if (sink_ops(csdev)->disable) { sink_ops(csdev)->disable(csdev); csdev->enable = false; csdev->activated = false; } } Loading Loading
drivers/hwtracing/coresight/coresight-tmc-etf.c +14 −10 Original line number Diff line number Diff line Loading @@ -542,12 +542,14 @@ int tmc_read_prepare_etb(struct tmc_drvdata *drvdata) goto out; } if (drvdata->enable) { /* There is no point in reading a TMC in HW FIFO mode */ mode = readl_relaxed(drvdata->base + TMC_MODE); if (mode != TMC_MODE_CIRCULAR_BUFFER) { ret = -EINVAL; goto out; } } /* Don't interfere if operated from Perf */ if (drvdata->mode == CS_MODE_PERF) { Loading Loading @@ -585,12 +587,14 @@ int tmc_read_unprepare_etb(struct tmc_drvdata *drvdata) spin_lock_irqsave(&drvdata->spinlock, flags); if (drvdata->enable) { /* There is no point in reading a TMC in HW FIFO mode */ mode = readl_relaxed(drvdata->base + TMC_MODE); if (mode != TMC_MODE_CIRCULAR_BUFFER) { spin_unlock_irqrestore(&drvdata->spinlock, flags); return -EINVAL; } } /* Re-enable the TMC if need be */ if (drvdata->mode == CS_MODE_SYSFS) { Loading
drivers/hwtracing/coresight/coresight-tmc-etr.c +1 −0 Original line number Diff line number Diff line Loading @@ -1082,6 +1082,7 @@ static int tmc_enable_etr_sink_sysfs(struct coresight_device *csdev) drvdata->mode = CS_MODE_SYSFS; tmc_etr_enable_hw(drvdata); drvdata->enable = true; out: spin_unlock_irqrestore(&drvdata->spinlock, flags); Loading
drivers/hwtracing/coresight/coresight-tmc.c +8 −2 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2012,2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2012,2017-2018, The Linux Foundation. All rights reserved. * * Description: CoreSight Trace Memory Controller driver */ Loading Loading @@ -56,11 +56,13 @@ void tmc_flush_and_stop(struct tmc_drvdata *drvdata) void tmc_enable_hw(struct tmc_drvdata *drvdata) { drvdata->enable = true; writel_relaxed(TMC_CTL_CAPT_EN, drvdata->base + TMC_CTL); } void tmc_disable_hw(struct tmc_drvdata *drvdata) { drvdata->enable = false; writel_relaxed(0x0, drvdata->base + TMC_CTL); } Loading Loading @@ -298,16 +300,20 @@ static ssize_t buffer_size_store(struct device *dev, unsigned long val; struct tmc_drvdata *drvdata = dev_get_drvdata(dev->parent); if (drvdata->enable) { pr_err("ETR is in use, disable it to change the mem_size\n"); return -EINVAL; } /* Only permitted for TMC-ETRs */ if (drvdata->config_type != TMC_CONFIG_TYPE_ETR) return -EPERM; ret = kstrtoul(buf, 0, &val); if (ret) return ret; /* The buffer size should be page aligned */ if (val & (PAGE_SIZE - 1)) return -EINVAL; drvdata->size = val; return size; } Loading
drivers/hwtracing/coresight/coresight-tmc.h +1 −0 Original line number Diff line number Diff line Loading @@ -196,6 +196,7 @@ struct tmc_drvdata { u32 etr_caps; struct coresight_csr *csr; const char *csr_name; bool enable; }; struct etr_buf_operations { Loading
drivers/hwtracing/coresight/coresight.c +2 −1 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0 /* * Copyright (c) 2012, 2017, The Linux Foundation. All rights reserved. * Copyright (c) 2012, 2017-2018, The Linux Foundation. All rights reserved. */ #include <linux/kernel.h> Loading Loading @@ -150,6 +150,7 @@ static void coresight_disable_sink(struct coresight_device *csdev) if (atomic_dec_return(csdev->refcnt) == 0) { if (sink_ops(csdev)->disable) { sink_ops(csdev)->disable(csdev); csdev->enable = false; csdev->activated = false; } } Loading