summaryrefslogtreecommitdiffstats
path: root/drivers/hwtracing/intel_th/core.c
Commit message (Collapse)AuthorAgeFilesLines
* intel_th: Fix resource handling for ACPI glue layerAlexander Shishkin2018-09-181-2/+11
| | | | | | | | | | | | | | | | The core of the driver expects the resource array from the glue layer to be indexed by even numbers, as is the case for 64-bit PCI resources. This doesn't hold true for others, ACPI in this instance, which leads to an out-of-bounds access and an ioremap() on whatever address that access fetches. This patch fixes the problem by reading resource array differently based on whether the 64-bit flag is set, which would indicate PCI glue layer. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Fixes: ebc57e399b8e ("intel_th: Add ACPI glue layer") CC: stable@vger.kernel.org # v4.17+ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* intel_th: Fix device removal logicAlexander Shishkin2018-09-181-1/+2
| | | | | | | | | | | | | | | Commit a753bfcfdb1f ("intel_th: Make the switch allocate its subdevices") brings in new subdevice addition/removal logic that's broken for "host mode": the SWITCH device has no children to begin with, which is not handled in the code. This results in a null dereference bug later down the path. This patch fixes the subdevice removal code to handle host mode correctly. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Fixes: a753bfcfdb1f ("intel_th: Make the switch allocate its subdevices") CC: stable@vger.kernel.org # v4.14+ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* intel_th: Allow forcing host mode through drvdataAlexander Shishkin2018-03-281-2/+4
| | | | | | | | Some devices can only operate in host mode, so we need means of communicating this to the core driver on per-device basis. This adds a flag to drvdata to signal host-only capability to the core. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
* intel_th: Pick up irq number from resourcesAlexander Shishkin2018-03-281-1/+8
| | | | | | | | Platform devices pass their IRQs around as resources, so as a convenience for the glue layer code, allow them pass the IRQ to the core driver in the resources array. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
* intel_th: Don't touch switch routing in host modeAlexander Shishkin2018-03-281-0/+4
| | | | | | | | When the Trace Hub is operating in Host Debugger mode, it is up to the debugger to configure master routing even for the software sources. Do not do this in the driver in this case. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
* intel_th: Use correct method of finding hubAlexander Shishkin2018-03-281-1/+1
| | | | | | | | | | | | | Since commit 8edc514b01e9 ("intel_th: Make SOURCE devices children of the root device") the hub is not the parent of SOURCE devices any more, so the new helper function should be used for that instead of always using the parent. The intel_th_set_output() path, however, still uses the old logic, leading to the hub driver structure being aliased with something else, like struct pci_driver or struct acpi_driver, and an incorrect call to an address inferred from that, potentially resulting in a crash. Fixes: 8edc514b01e9 ("intel_th: Make SOURCE devices children of the root device") Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
* intel_th: Add SPDX GPL-2.0 header to replace GPLv2 boilerplateAlexander Shishkin2018-03-281-9/+1
| | | | | | | 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>
* intel_th: Perform time resync on capture startAlexander Shishkin2017-08-251-1/+2
| | | | | | | | | | | 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>
* intel_th: Add global activate/deactivate callbacks for the glue layersAlexander Shishkin2017-08-251-4/+22
| | | | | | | A glue layer may want to install its own hooks into trace capture start and stop paths to apply workarounds. This adds optional callbacks. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
* intel_th: pci: Use drvdata for quirksAlexander Shishkin2017-08-251-2/+4
| | | | | | Allow attaching miscellaneous quirk information to devices as drvdata. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
* intel_th: Enumerate Low Power Path output port typeAlexander Shishkin2017-08-251-0/+15
| | | | | | | | | Trace Hub 2.x adds Low Power Path (LPP) output port type, which provides a low power mode trace path from sources to PTI or BSSB. This adds an output subdevice for the LPP port. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
* intel_th: Make the switch allocate its subdevicesAlexander Shishkin2017-08-251-82/+206
| | | | | | | 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>
* intel_th: Make SOURCE devices children of the root deviceAlexander Shishkin2017-08-251-3/+3
| | | | | | | | | | | The switch (GTH) does not directly interact with SOURCE type devices and may not even be present (in host mode). To reflect this and avoid inconsistencies between target and host mode, make SOURCE devices descendant directly from the root (i.e. PCI) device. Their symlinks will no longer appear under the switch device, but they can still be found under intel_th bus. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
* intel_th: Streamline the subdevice tree accessorsAlexander Shishkin2017-08-251-15/+0
| | | | | | Make to_intel_th*() accessors available from the main header file. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
* hwtracing: intel_th: use dev_groups and not dev_attrs for bus_typeGreg Kroah-Hartman2017-06-091-1/+0
| | | | | | | | | The dev_attrs field has long been "depreciated" and is finally being removed, and as this driver isn't even using it, just drop the NULL setting, it is pointless. Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* intel_th: Don't leak module refcount on failure to activateAlexander Shishkin2017-03-151-1/+3
| | | | | | | | | | | | | | Output 'activation' may fail for the reasons of the output driver, for example, if msc's buffer is not allocated. We forget, however, to drop the module reference in this case. So each attempt at activation in this case leaks a reference, preventing the module from ever unloading. This patch adds the missing module_put() in the activation error path. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: stable@vger.kernel.org # v4.8+
* intel_th: Support Host Debugger mode of operationAlexander Shishkin2016-11-181-8/+18
| | | | | | | | | | | | This patch adds a 'host_mode' module option to enable host-driven operational mode in the driver. In this mode, the driver does not perform trace configuration or enable trace capture, but still provides all the means necessary for software trace sources to write their data to the Trace Hub. This means that the debug host takes care of all the configuration and enabling and we do not interfere. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
* intel_th: Constify subdevicesAlexander Shishkin2016-11-181-1/+1
| | | | | | The subdevice array consists of immutable objects, make them const. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
* Merge tag 'stm-for-greg-20160714' of ↵Greg Kroah-Hartman2016-07-151-1/+34
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/ash/stm into char-misc-next Alexander writes: intel_th: Fixes -t://git.kernel.org/pub/scm/linux/kernel/git/ash/stm.git tags/stm-for-greg-20160714 stable These are: * a fix for a modprobe time deadlock * a new PCI ID for Kaby Lake PCH-H
| * intel_th: Fix a deadlock in modprobingAlexander Shishkin2016-07-141-1/+34
| | | | | | | | | | | | | | | | | | | | | | Driver initialization tries to request a hub (GTH) driver module from its probe callback, resulting in a deadlock. This patch solves the problem by adding a deferred work for requesting the hub module. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: <stable@vger.kernel.org> # 4.4.x-
* | intel_th: Add runtime power management handlingAlexander Shishkin2016-07-011-9/+45
|/ | | | | | | | | | | | | 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>
* intel_th: Hold output driver module reference while capture is activeAlexander Shishkin2016-04-081-0/+5
| | | | | | | | | Right now it's possible to unload the output subdevice's driver while the capture to this output is active. Prevent this by holding the output driver's module reference. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Reviewed-by: Laurent Fert <laurent.fert@intel.com>
* intel_th: Fix activating a subdevice without a driverAlexander Shishkin2016-04-081-2/+10
| | | | | | | | | If output subdevice driver is not loaded, activating it will try to call its ->activate method and crash. Fix this by explicitly checking for the driver. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Reviewed-by: Laurent Fert <laurent.fert@intel.com>
* intel_th: Allow subdevice drivers to bring in own attribute groupsAlexander Shishkin2016-04-081-0/+12
| | | | | | | | | | Some subdevices (MSU, PTI) need to register their own driver-specific attribute groups. Provide a way for those to pass their attribute groups to the core driver in their driver structure so that the core can take care of creating and removing them. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Reviewed-by: Laurent Fert <laurent.fert@intel.com>
* intel_th: Use real device index in the node namesAlexander Shishkin2016-02-201-3/+20
| | | | | | | | | | | | Most of the intel_th core supports multiple co-existing TH devices, except for output device nodes, where intel_th device id is hardcoded to be zero. Fix this by fetching the actual intel_th device id from the parent device's drvdata. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* intel_th: Set root device's drvdata earlyAlexander Shishkin2016-02-201-0/+2
| | | | | | | | | | | Already during the subdevice initialization time, devices will need to reference Intel TH controller descriptor structure. This patch moves setting the drvdata from the pci glue to intel_th core, before subdevices are populated. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* intel_th: Update scratchpad bits according to enabled output activityAlexander Shishkin2016-02-201-0/+5
| | | | | | | | | | | | | | | | 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>
* intel_th: Add driver infrastructure for Intel(R) Trace Hub devicesAlexander Shishkin2015-10-041-0/+692
Intel(R) Trace Hub (TH) is a set of hardware blocks (subdevices) that produce, switch and output trace data from multiple hardware and software sources over several types of trace output ports encoded in System Trace Protocol (MIPI STPv2) and is intended to perform full system debugging. For these subdevices, we create a bus, where they can be discovered and configured by userspace software. This patch creates this bus infrastructure, three types of devices (source, output, switch), resource allocation, some callback mechanisms to facilitate communication between the subdevices' drivers and some common sysfs attributes. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
OpenPOWER on IntegriCloud