Skip to content

Commit fc5bf78

Browse files
committed
Merge tag 'coresight-fixes-v6.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/coresight/linux into char-misc-linus
Suzuki writes: coresight: Fixes for v6.6 Couple of fixes for the CoreSight self-hosted tracing targeting v6.6. Includes : - Fix runtime warnings while reusing the TMC-ETR buffer - Fix (disable) warning when a large buffer is allocated in the flat mode. * tag 'coresight-fixes-v6.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/coresight/linux: coresight: tmc-etr: Disable warnings for allocation failures coresight: Fix run time warnings while reusing ETR buffer
2 parents 5d164a0 + e502801 commit fc5bf78

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

drivers/hwtracing/coresight/coresight-tmc-etr.c

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,8 @@ static int tmc_etr_alloc_flat_buf(struct tmc_drvdata *drvdata,
610610

611611
flat_buf->vaddr = dma_alloc_noncoherent(real_dev, etr_buf->size,
612612
&flat_buf->daddr,
613-
DMA_FROM_DEVICE, GFP_KERNEL);
613+
DMA_FROM_DEVICE,
614+
GFP_KERNEL | __GFP_NOWARN);
614615
if (!flat_buf->vaddr) {
615616
kfree(flat_buf);
616617
return -ENOMEM;
@@ -1173,16 +1174,6 @@ static struct etr_buf *tmc_etr_get_sysfs_buffer(struct coresight_device *csdev)
11731174
goto out;
11741175
}
11751176

1176-
/*
1177-
* In sysFS mode we can have multiple writers per sink. Since this
1178-
* sink is already enabled no memory is needed and the HW need not be
1179-
* touched, even if the buffer size has changed.
1180-
*/
1181-
if (drvdata->mode == CS_MODE_SYSFS) {
1182-
atomic_inc(&csdev->refcnt);
1183-
goto out;
1184-
}
1185-
11861177
/*
11871178
* If we don't have a buffer or it doesn't match the requested size,
11881179
* use the buffer allocated above. Otherwise reuse the existing buffer.
@@ -1204,7 +1195,7 @@ static struct etr_buf *tmc_etr_get_sysfs_buffer(struct coresight_device *csdev)
12041195

12051196
static int tmc_enable_etr_sink_sysfs(struct coresight_device *csdev)
12061197
{
1207-
int ret;
1198+
int ret = 0;
12081199
unsigned long flags;
12091200
struct tmc_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
12101201
struct etr_buf *sysfs_buf = tmc_etr_get_sysfs_buffer(csdev);
@@ -1213,12 +1204,24 @@ static int tmc_enable_etr_sink_sysfs(struct coresight_device *csdev)
12131204
return PTR_ERR(sysfs_buf);
12141205

12151206
spin_lock_irqsave(&drvdata->spinlock, flags);
1207+
1208+
/*
1209+
* In sysFS mode we can have multiple writers per sink. Since this
1210+
* sink is already enabled no memory is needed and the HW need not be
1211+
* touched, even if the buffer size has changed.
1212+
*/
1213+
if (drvdata->mode == CS_MODE_SYSFS) {
1214+
atomic_inc(&csdev->refcnt);
1215+
goto out;
1216+
}
1217+
12161218
ret = tmc_etr_enable_hw(drvdata, sysfs_buf);
12171219
if (!ret) {
12181220
drvdata->mode = CS_MODE_SYSFS;
12191221
atomic_inc(&csdev->refcnt);
12201222
}
12211223

1224+
out:
12221225
spin_unlock_irqrestore(&drvdata->spinlock, flags);
12231226

12241227
if (!ret)

0 commit comments

Comments
 (0)