Commit 5101ada5 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

Merge tag 'coresight-fixes-for-v6.7-rc1' of...

Merge tag 'coresight-fixes-for-v6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/coresight/linux

 into char-misc-next

Suzuki writes:

coresight: Fixes for v6.7-rc1

Here are a few fixes for the hwtracing subsystem targetting v6.7.
Includes:
 - Ultrasoc-SMB driver fixes
 - HiSilicon PTT driver fixes
 - Corsight driver fixes

Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>

* tag 'coresight-fixes-for-v6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/coresight/linux:
  coresight: ultrasoc-smb: Fix uninitialized before use buf_hw_base
  coresight: ultrasoc-smb: Config SMB buffer before register sink
  coresight: ultrasoc-smb: Fix sleep while close preempt in enable_smb
  Documentation: coresight: fix `make refcheckdocs` warning
  hwtracing: hisi_ptt: Don't try to attach a task
  hwtracing: hisi_ptt: Handle the interrupt in hardirq context
  hwtracing: hisi_ptt: Add dummy callback pmu::read()
  coresight: Fix crash when Perf and sysfs modes are used concurrently
  coresight: etm4x: Remove bogous __exit annotation for some functions
parents fcc9b50e 862c135b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -130,7 +130,7 @@ Misc:
Device Tree Bindings
--------------------

See Documentation/devicetree/bindings/arm/arm,coresight-\*.yaml for details.
See ``Documentation/devicetree/bindings/arm/arm,coresight-*.yaml`` for details.

As of this writing drivers for ITM, STMs and CTIs are not provided but are
expected to be added as the solution matures.
+2 −2
Original line number Diff line number Diff line
@@ -493,7 +493,7 @@ static void etm_event_start(struct perf_event *event, int flags)
		goto fail_end_stop;

	/* Finally enable the tracer */
	if (coresight_enable_source(csdev, CS_MODE_PERF, event))
	if (source_ops(csdev)->enable(csdev, event, CS_MODE_PERF))
		goto fail_disable_path;

	/*
@@ -587,7 +587,7 @@ static void etm_event_stop(struct perf_event *event, int mode)
		return;

	/* stop tracer */
	coresight_disable_source(csdev, event);
	source_ops(csdev)->disable(csdev, event);

	/* tell the core */
	event->hw.state = PERF_HES_STOPPED;
+3 −3
Original line number Diff line number Diff line
@@ -2224,7 +2224,7 @@ static void clear_etmdrvdata(void *info)
	per_cpu(delayed_probe, cpu) = NULL;
}

static void __exit etm4_remove_dev(struct etmv4_drvdata *drvdata)
static void etm4_remove_dev(struct etmv4_drvdata *drvdata)
{
	bool had_delayed_probe;
	/*
@@ -2253,7 +2253,7 @@ static void __exit etm4_remove_dev(struct etmv4_drvdata *drvdata)
	}
}

static void __exit etm4_remove_amba(struct amba_device *adev)
static void etm4_remove_amba(struct amba_device *adev)
{
	struct etmv4_drvdata *drvdata = dev_get_drvdata(&adev->dev);

@@ -2261,7 +2261,7 @@ static void __exit etm4_remove_amba(struct amba_device *adev)
		etm4_remove_dev(drvdata);
}

static int __exit etm4_remove_platform_dev(struct platform_device *pdev)
static int etm4_remove_platform_dev(struct platform_device *pdev)
{
	struct etmv4_drvdata *drvdata = dev_get_drvdata(&pdev->dev);

+23 −35
Original line number Diff line number Diff line
@@ -99,7 +99,7 @@ static int smb_open(struct inode *inode, struct file *file)
					struct smb_drv_data, miscdev);
	int ret = 0;

	mutex_lock(&drvdata->mutex);
	spin_lock(&drvdata->spinlock);

	if (drvdata->reading) {
		ret = -EBUSY;
@@ -115,7 +115,7 @@ static int smb_open(struct inode *inode, struct file *file)

	drvdata->reading = true;
out:
	mutex_unlock(&drvdata->mutex);
	spin_unlock(&drvdata->spinlock);

	return ret;
}
@@ -132,10 +132,8 @@ static ssize_t smb_read(struct file *file, char __user *data, size_t len,
	if (!len)
		return 0;

	mutex_lock(&drvdata->mutex);

	if (!sdb->data_size)
		goto out;
		return 0;

	to_copy = min(sdb->data_size, len);

@@ -145,20 +143,15 @@ static ssize_t smb_read(struct file *file, char __user *data, size_t len,

	if (copy_to_user(data, sdb->buf_base + sdb->buf_rdptr, to_copy)) {
		dev_dbg(dev, "Failed to copy data to user\n");
		to_copy = -EFAULT;
		goto out;
		return -EFAULT;
	}

	*ppos += to_copy;

	smb_update_read_ptr(drvdata, to_copy);

	dev_dbg(dev, "%zu bytes copied\n", to_copy);
out:
	if (!sdb->data_size)
		smb_reset_buffer(drvdata);
	mutex_unlock(&drvdata->mutex);

	dev_dbg(dev, "%zu bytes copied\n", to_copy);
	return to_copy;
}

@@ -167,9 +160,9 @@ static int smb_release(struct inode *inode, struct file *file)
	struct smb_drv_data *drvdata = container_of(file->private_data,
					struct smb_drv_data, miscdev);

	mutex_lock(&drvdata->mutex);
	spin_lock(&drvdata->spinlock);
	drvdata->reading = false;
	mutex_unlock(&drvdata->mutex);
	spin_unlock(&drvdata->spinlock);

	return 0;
}
@@ -262,7 +255,7 @@ static int smb_enable(struct coresight_device *csdev, enum cs_mode mode,
	struct smb_drv_data *drvdata = dev_get_drvdata(csdev->dev.parent);
	int ret = 0;

	mutex_lock(&drvdata->mutex);
	spin_lock(&drvdata->spinlock);

	/* Do nothing, the trace data is reading by other interface now */
	if (drvdata->reading) {
@@ -294,7 +287,7 @@ static int smb_enable(struct coresight_device *csdev, enum cs_mode mode,

	dev_dbg(&csdev->dev, "Ultrasoc SMB enabled\n");
out:
	mutex_unlock(&drvdata->mutex);
	spin_unlock(&drvdata->spinlock);

	return ret;
}
@@ -304,7 +297,7 @@ static int smb_disable(struct coresight_device *csdev)
	struct smb_drv_data *drvdata = dev_get_drvdata(csdev->dev.parent);
	int ret = 0;

	mutex_lock(&drvdata->mutex);
	spin_lock(&drvdata->spinlock);

	if (drvdata->reading) {
		ret = -EBUSY;
@@ -327,7 +320,7 @@ static int smb_disable(struct coresight_device *csdev)

	dev_dbg(&csdev->dev, "Ultrasoc SMB disabled\n");
out:
	mutex_unlock(&drvdata->mutex);
	spin_unlock(&drvdata->spinlock);

	return ret;
}
@@ -408,7 +401,7 @@ static unsigned long smb_update_buffer(struct coresight_device *csdev,
	if (!buf)
		return 0;

	mutex_lock(&drvdata->mutex);
	spin_lock(&drvdata->spinlock);

	/* Don't do anything if another tracer is using this sink. */
	if (atomic_read(&csdev->refcnt) != 1)
@@ -432,7 +425,7 @@ static unsigned long smb_update_buffer(struct coresight_device *csdev,
	if (!buf->snapshot && lost)
		perf_aux_output_flag(handle, PERF_AUX_FLAG_TRUNCATED);
out:
	mutex_unlock(&drvdata->mutex);
	spin_unlock(&drvdata->spinlock);

	return data_size;
}
@@ -484,7 +477,6 @@ static int smb_init_data_buffer(struct platform_device *pdev,
static void smb_init_hw(struct smb_drv_data *drvdata)
{
	smb_disable_hw(drvdata);
	smb_reset_buffer(drvdata);

	writel(SMB_LB_CFG_LO_DEFAULT, drvdata->base + SMB_LB_CFG_LO_REG);
	writel(SMB_LB_CFG_HI_DEFAULT, drvdata->base + SMB_LB_CFG_HI_REG);
@@ -590,37 +582,33 @@ static int smb_probe(struct platform_device *pdev)
		return ret;
	}

	mutex_init(&drvdata->mutex);
	ret = smb_config_inport(dev, true);
	if (ret)
		return ret;

	smb_reset_buffer(drvdata);
	platform_set_drvdata(pdev, drvdata);
	spin_lock_init(&drvdata->spinlock);
	drvdata->pid = -1;

	ret = smb_register_sink(pdev, drvdata);
	if (ret) {
		smb_config_inport(&pdev->dev, false);
		dev_err(dev, "Failed to register SMB sink\n");
		return ret;
	}

	ret = smb_config_inport(dev, true);
	if (ret) {
		smb_unregister_sink(drvdata);
		return ret;
	}

	platform_set_drvdata(pdev, drvdata);

	return 0;
}

static int smb_remove(struct platform_device *pdev)
{
	struct smb_drv_data *drvdata = platform_get_drvdata(pdev);
	int ret;

	ret = smb_config_inport(&pdev->dev, false);
	if (ret)
		return ret;

	smb_unregister_sink(drvdata);

	smb_config_inport(&pdev->dev, false);

	return 0;
}

+3 −3
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@
#define _ULTRASOC_SMB_H

#include <linux/miscdevice.h>
#include <linux/mutex.h>
#include <linux/spinlock.h>

/* Offset of SMB global registers */
#define SMB_GLB_CFG_REG		0x00
@@ -105,7 +105,7 @@ struct smb_data_buffer {
 * @csdev:	Component vitals needed by the framework.
 * @sdb:	Data buffer for SMB.
 * @miscdev:	Specifics to handle "/dev/xyz.smb" entry.
 * @mutex:	Control data access to one at a time.
 * @spinlock:	Control data access to one at a time.
 * @reading:	Synchronise user space access to SMB buffer.
 * @pid:	Process ID of the process being monitored by the
 *		session that is using this component.
@@ -116,7 +116,7 @@ struct smb_drv_data {
	struct coresight_device	*csdev;
	struct smb_data_buffer sdb;
	struct miscdevice miscdev;
	struct mutex mutex;
	spinlock_t spinlock;
	bool reading;
	pid_t pid;
	enum cs_mode mode;
Loading