History log of /linux-master/drivers/hwtracing/intel_th/gth.c
Revision Date Author Comments
# ab1afed7 21-Jun-2021 Alexander Shishkin <alexander.shishkin@linux.intel.com>

intel_th: Wait until port is in reset before programming it

Some devices don't drain their pipelines if we don't make sure that
the corresponding output port is in reset before programming it for
a new trace capture, resulting in bits of old trace appearing in the
new trace capture. Fix that by explicitly making sure the reset is
asserted before programming new trace capture.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Link: https://lore.kernel.org/r/20210621151246.31891-5-alexander.shishkin@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 18ffbc47 14-Apr-2021 Pavel Machek <pavel@ucw.cz>

intel_th: Consistency and off-by-one fix

Consistently use "< ... +1" in for loops.

Fix of-by-one in for_each_set_bit().

Signed-off-by: Pavel Machek <pavel@denx.de>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Link: https://lore.kernel.org/lkml/20190724095841.GA6952@amd/
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20210414171251.14672-6-alexander.shishkin@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 87c0b9c7 28-Oct-2019 Alexander Shishkin <alexander.shishkin@linux.intel.com>

intel_th: gth: Fix the window switching sequence

Commit 8116db57cf16 ("intel_th: Add switch triggering support") added
a trigger assertion of the CTS, but forgot to de-assert it at the end
of the sequence. This results in window switches randomly not happening.

Fix that by de-asserting the trigger at the end of the window switch
sequence.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Fixes: 8116db57cf16 ("intel_th: Add switch triggering support")
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191028070651.9770-2-alexander.shishkin@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 8116db57 03-May-2019 Alexander Shishkin <alexander.shishkin@linux.intel.com>

intel_th: Add switch triggering support

Add support for asserting window switch trigger when tracing to MSU output
ports. This allows for software controlled switching between windows of
the MSU buffer, which can be used for double buffering while exporting the
trace data further from the MSU.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 9958e025 03-May-2019 Alexander Shishkin <alexander.shishkin@linux.intel.com>

intel_th: gth: Factor out trace start/stop

The trace enable/disable functions of the GTH include the code that starts
and stops trace flom from the sources. This start/stop functionality will
also be used in the window switch trigger sequence.

Factor out start/stop code from the larger trace enable/disable code in
preparation for the window switch sequence.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 8d415512 03-May-2019 Alexander Shishkin <alexander.shishkin@linux.intel.com>

intel_th: msu: Factor out pipeline draining

The code that waits for the pipeline empty condition of the MSU is
currently called in the path that disables the trace. We will also
need this in the window switch trigger sequence. Therefore, factor
out this code and make it accessible to the GTH device.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 91d3f8a6 01-Mar-2019 Alexander Shishkin <alexander.shishkin@linux.intel.com>

intel_th: gth: Fix an off-by-one in output unassigning

Commit 9ed3f22223c3 ("intel_th: Don't reference unassigned outputs")
fixes a NULL dereference for all masters except the last one ("256+"),
which keeps the stale pointer after the output driver had been unassigned.

Fix the off-by-one.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Fixes: 9ed3f22223c3 ("intel_th: Don't reference unassigned outputs")
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 9ed3f222 24-Jan-2019 Alexander Shishkin <alexander.shishkin@linux.intel.com>

intel_th: Don't reference unassigned outputs

When an output port driver is removed, also remove references to it from
any masters. Failing to do this causes a NULL ptr dereference when
configuring another output port:

> BUG: unable to handle kernel NULL pointer dereference at 000000000000000d
> RIP: 0010:master_attr_store+0x9d/0x160 [intel_th_gth]
> Call Trace:
> dev_attr_store+0x1b/0x30
> sysfs_kf_write+0x3c/0x50
> kernfs_fop_write+0x125/0x1a0
> __vfs_write+0x3a/0x190
> ? __vfs_write+0x5/0x190
> ? _cond_resched+0x1a/0x50
> ? rcu_all_qs+0x5/0xb0
> ? __vfs_write+0x5/0x190
> vfs_write+0xb8/0x1b0
> ksys_write+0x55/0xc0
> __x64_sys_write+0x1a/0x20
> do_syscall_64+0x5a/0x140
> entry_SYSCALL_64_after_hwframe+0x44/0xa9

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Fixes: b27a6a3f97b9 ("intel_th: Add Global Trace Hub driver")
CC: stable@vger.kernel.org # v4.4+
Reported-by: Ammy Yi <ammy.yi@intel.com>


# 50352fa7 28-Mar-2018 Alexander Shishkin <alexander.shishkin@linux.intel.com>

intel_th: Add SPDX GPL-2.0 header to replace GPLv2 boilerplate

This adds SPDX GPL-2.0 header to the Trace Hub driver and removes the
GPLv2 boilerplate text.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>


# a0e7df33 24-Feb-2017 Alexander Shishkin <alexander.shishkin@linux.intel.com>

intel_th: Perform time resync on capture start

On some devices (TH 2.x devices at the moment), the internal time counter
is initially not synchronized to the global crystal clock, so the time
stamps it produces will not be useful. In this case, the driver needs
to force the time counter resync.

This applies the workaround to relevant devices.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>


# a753bfcf 10-Aug-2017 Alexander Shishkin <alexander.shishkin@linux.intel.com>

intel_th: Make the switch allocate its subdevices

Instead of allocating devices for every possible output subdevice,
allow the switch to allocate only the ones that it knows about.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>


# d4f5f545 19-Sep-2016 Alexander Shishkin <alexander.shishkin@linux.intel.com>

intel_th: gth: Handle host mode correctly

When detecting host debugger mode either though a module option or via
the scratchpad register, do not export any configuration or capture
related attributes to userspace and refuse attempts by the output drivers
to configure output ports.

This way, GTH can still act as a hub and ensure that the other components
that rely on its presence continue to function properly, namely the
source devices.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>


# 53c189f1 28-Jun-2016 Alexander Shishkin <alexander.shishkin@linux.intel.com>

intel_th: gth: Fix a source comment

There's a kerneldoc comment that'd been derived from another one by way
of copying-and-pasting but hadn't been subsequently amended to reflect
the purpose of the function. Fix this.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>


# 142dfeb2 22-Jun-2016 Alexander Shishkin <alexander.shishkin@linux.intel.com>

intel_th: Add runtime power management handling

Currently, an Intel TH (pci) device will be always active, because the
devices on the 'intel_th' bus don't implement runtime pm to track their
usage.

To address this, this patch adds runtime pm support to the 'intel_th'
bus and some additional bits for the hub. The 'output' type device is
in use while a capture is active; the 'source' type device (STH) relies
on its child stm class device for runtime pm tracking.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>


# 4d02ceff 15-Feb-2016 Alexander Shishkin <alexander.shishkin@linux.intel.com>

intel_th: Update scratchpad bits according to enabled output activity

Intel TH implements a scratchpad register to indicate to the firmware
and external debuggers what trace configuration is enabled so that
everybody plays nicely together. The register is a bit field and the
bit assignment convention is described in the developer's manual.

This patch enables the driver to automatically set scratchpad register
bits according to the output configuration that's enabled.

Based on work by Yann Fouassier.

Signed-off-by: Yann Fouassier <yann.fouassier@intel.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# c1a327c4 15-Feb-2016 Alexander Shishkin <alexander.shishkin@linux.intel.com>

intel_th: gth: Remove commented-out code

There's a commented-out function in the GTH driver that's a leftover
from previous versions of the driver, where we tried to inherit the
pre-existing configuration, which didn't prove to be a sound idea.

This patch removes the function. No functional changes.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 73061da0 16-Oct-2015 Dan Carpenter <dan.carpenter@oracle.com>

intel_th: Check for NULL instead of ERR_PTR

devm_ioremap() returns NULL on error, it doesn't return an ERR_PTR,
which is what the current code does. This patch corrects these
checks.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# b27a6a3f 22-Sep-2015 Alexander Shishkin <alexander.shishkin@linux.intel.com>

intel_th: Add Global Trace Hub driver

Global Trace Hub (GTH) is the central component of Intel TH architecture;
it carries out switching between the trace sources and trace outputs, can
enable/disable tracing, perform STP encoding, internal buffering, control
backpressure from outputs to sources and so on.

This property is also reflected in the software model; GTH (switch) driver
is required for the other subdevices to probe, because it matches trace
output devices against its output ports and configures them accordingly.

It also implements an interface for output ports to request trace enabling
or disabling and a few other useful things.

For userspace, it provides an attribute group "masters", which allows
configuration of per-master trace output destinations for up to master 255
and "256+" meaning "masters 256 and above". It also provides an attribute
group to discover and configure some of the parameters of its output ports,
called "outputs". Via these the user can set up data retention policy for
an individual output port or check if it is in reset state.

Signed-off-by: Laurent Fert <laurent.fert@intel.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>