Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1334566 > unrolled thread

[git pull] stm class/intel_th: Updates for char-misc-next

Started byAlexander Shishkin <alexander.shishkin@intel.com>
First post2016-02-15 17:10 +0100
Last post2016-02-16 13:30 +0100
Articles 4 on this page of 24 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [git pull] stm class/intel_th: Updates for char-misc-next Alexander Shishkin <alexander.shishkin@intel.com> - 2016-02-15 17:10 +0100
    Re: [git pull] stm class/intel_th: Updates for char-misc-next Greg KH <gregkh@linuxfoundation.org> - 2016-02-15 17:50 +0100
      [PATCH 07/20] intel_th: msu: Release resources on read error Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
      [PATCH 10/20] intel_th: Use real device index in the node names Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
      [PATCH 08/20] intel_th: sth: Sanitize packet callback's return values Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
      [PATCH 20/20] stm class: dummy_stm: Add link callback for fault injection Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
      [PATCH 00/20] stm class/intel_th: Updates for char-misc-next Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
        [PATCH 12/20] stm class: Support devices with multiple instances Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
        [PATCH 11/20] stm class: Use driver's packet callback return value Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
        [PATCH 01/20] stm class: Use a signed return type for stm_find_master_chan Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
        [PATCH 14/20] stm class: Add heartbeat stm source device Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
        [PATCH 09/20] intel_th: Set root device's drvdata early Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
        [PATCH 18/20] stm class: Fix a race in unlinking Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
        [PATCH 13/20] stm class: dummy_stm: Create multiple devices Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
        [PATCH 19/20] stm class: Plug stm device's unlink callback Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
        [PATCH 04/20] intel_th: gth: Remove commented-out code Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
        [PATCH 03/20] intel_th: Depend on HAS_IOMEM Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
        [PATCH 15/20] stm class: Fix unlocking braino in the error path Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
        [PATCH 16/20] stm class: Guard output assignment against concurrency Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
        [PATCH 17/20] stm class: Fix unbalanced module/device refcounting Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
        [PATCH 05/20] intel_th: Update scratchpad bits according to enabled output activity Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
        [PATCH 06/20] intel_th: msu: Fix offset for wrapped block Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
        [PATCH 02/20] stm class: Fix master deallocation in device unregistering Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-15 18:20 +0100
      Re: [git pull] stm class/intel_th: Updates for char-misc-next Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-02-16 13:30 +0100

Page 2 of 2 — ← Prev page 1 [2]


#1334637 — [PATCH 05/20] intel_th: Update scratchpad bits according to enabled output activity

FromAlexander Shishkin <alexander.shishkin@linux.intel.com>
Date2016-02-15 18:20 +0100
Subject[PATCH 05/20] intel_th: Update scratchpad bits according to enabled output activity
Message-ID<r2uYz-41S-55@gated-at.bofh.it>
In reply to#1334618
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>
---
 drivers/hwtracing/intel_th/core.c     |  5 +++++
 drivers/hwtracing/intel_th/gth.c      | 14 +++++++++++-
 drivers/hwtracing/intel_th/gth.h      |  3 ---
 drivers/hwtracing/intel_th/intel_th.h | 41 +++++++++++++++++++++++++++++++++++
 4 files changed, 59 insertions(+), 4 deletions(-)

diff --git a/drivers/hwtracing/intel_th/core.c b/drivers/hwtracing/intel_th/core.c
index 165d3001c3..b8b9895da5 100644
--- a/drivers/hwtracing/intel_th/core.c
+++ b/drivers/hwtracing/intel_th/core.c
@@ -319,6 +319,7 @@ static struct intel_th_subdevice {
 	unsigned		nres;
 	unsigned		type;
 	unsigned		otype;
+	unsigned		scrpd;
 	int			id;
 } intel_th_subdevices[TH_SUBDEVICE_MAX] = {
 	{
@@ -352,6 +353,7 @@ static struct intel_th_subdevice {
 		.id	= 0,
 		.type	= INTEL_TH_OUTPUT,
 		.otype	= GTH_MSU,
+		.scrpd	= SCRPD_MEM_IS_PRIM_DEST | SCRPD_MSC0_IS_ENABLED,
 	},
 	{
 		.nres	= 2,
@@ -371,6 +373,7 @@ static struct intel_th_subdevice {
 		.id	= 1,
 		.type	= INTEL_TH_OUTPUT,
 		.otype	= GTH_MSU,
+		.scrpd	= SCRPD_MEM_IS_PRIM_DEST | SCRPD_MSC1_IS_ENABLED,
 	},
 	{
 		.nres	= 2,
@@ -403,6 +406,7 @@ static struct intel_th_subdevice {
 		.name	= "pti",
 		.type	= INTEL_TH_OUTPUT,
 		.otype	= GTH_PTI,
+		.scrpd	= SCRPD_PTI_IS_PRIM_DEST,
 	},
 	{
 		.nres	= 1,
@@ -477,6 +481,7 @@ static int intel_th_populate(struct intel_th *th, struct resource *devres,
 			thdev->dev.devt = MKDEV(th->major, i);
 			thdev->output.type = subdev->otype;
 			thdev->output.port = -1;
+			thdev->output.scratchpad = subdev->scrpd;
 		}
 
 		err = device_add(&thdev->dev);
diff --git a/drivers/hwtracing/intel_th/gth.c b/drivers/hwtracing/intel_th/gth.c
index e4c9811c1f..9beea0b542 100644
--- a/drivers/hwtracing/intel_th/gth.c
+++ b/drivers/hwtracing/intel_th/gth.c
@@ -286,6 +286,10 @@ static int intel_th_gth_reset(struct gth_device *gth)
 	if (scratchpad & SCRPD_DEBUGGER_IN_USE)
 		return -EBUSY;
 
+	/* Always save/restore STH and TU registers in S0ix entry/exit */
+	scratchpad |= SCRPD_STH_IS_ENABLED | SCRPD_TRIGGER_IS_ENABLED;
+	iowrite32(scratchpad, gth->base + REG_GTH_SCRPD0);
+
 	/* output ports */
 	for (port = 0; port < 8; port++) {
 		if (gth_output_parm_get(gth, port, TH_OUTPUT_PARM(port)) ==
@@ -488,6 +492,10 @@ static void intel_th_gth_disable(struct intel_th_device *thdev,
 	if (!count)
 		dev_dbg(&thdev->dev, "timeout waiting for GTH[%d] PLE\n",
 			output->port);
+
+	reg = ioread32(gth->base + REG_GTH_SCRPD0);
+	reg &= ~output->scratchpad;
+	iowrite32(reg, gth->base + REG_GTH_SCRPD0);
 }
 
 /**
@@ -502,7 +510,7 @@ static void intel_th_gth_enable(struct intel_th_device *thdev,
 				struct intel_th_output *output)
 {
 	struct gth_device *gth = dev_get_drvdata(&thdev->dev);
-	u32 scr = 0xfc0000;
+	u32 scr = 0xfc0000, scrpd;
 	int master;
 
 	spin_lock(&gth->gth_lock);
@@ -517,6 +525,10 @@ static void intel_th_gth_enable(struct intel_th_device *thdev,
 	output->active = true;
 	spin_unlock(&gth->gth_lock);
 
+	scrpd = ioread32(gth->base + REG_GTH_SCRPD0);
+	scrpd |= output->scratchpad;
+	iowrite32(scrpd, gth->base + REG_GTH_SCRPD0);
+
 	iowrite32(scr, gth->base + REG_GTH_SCR);
 	iowrite32(0, gth->base + REG_GTH_SCR2);
 }
diff --git a/drivers/hwtracing/intel_th/gth.h b/drivers/hwtracing/intel_th/gth.h
index 3b714b7a61..56f0d26205 100644
--- a/drivers/hwtracing/intel_th/gth.h
+++ b/drivers/hwtracing/intel_th/gth.h
@@ -57,9 +57,6 @@ enum {
 	REG_GTH_SCRPD3		= 0xec, /* ScratchPad[3] */
 };
 
-/* Externall debugger is using Intel TH */
-#define SCRPD_DEBUGGER_IN_USE	BIT(24)
-
 /* waiting for Pipeline Empty bit(s) to assert for GTH */
 #define GTH_PLE_WAITLOOP_DEPTH	10000
 
diff --git a/drivers/hwtracing/intel_th/intel_th.h b/drivers/hwtracing/intel_th/intel_th.h
index 57fd72b20f..eedd09332d 100644
--- a/drivers/hwtracing/intel_th/intel_th.h
+++ b/drivers/hwtracing/intel_th/intel_th.h
@@ -30,6 +30,7 @@ enum {
  * struct intel_th_output - descriptor INTEL_TH_OUTPUT type devices
  * @port:	output port number, assigned by the switch
  * @type:	GTH_{MSU,CTP,PTI}
+ * @scratchpad:	scratchpad bits to flag when this output is enabled
  * @multiblock:	true for multiblock output configuration
  * @active:	true when this output is enabled
  *
@@ -41,6 +42,7 @@ enum {
 struct intel_th_output {
 	int		port;
 	unsigned int	type;
+	unsigned int	scratchpad;
 	bool		multiblock;
 	bool		active;
 };
@@ -241,4 +243,43 @@ enum {
 	GTH_PTI = 4,	/* MIPI-PTI */
 };
 
+/*
+ * Scratchpad bits: tell firmware and external debuggers
+ * what we are up to.
+ */
+enum {
+	/* Memory is the primary destination */
+	SCRPD_MEM_IS_PRIM_DEST		= BIT(0),
+	/* XHCI DbC is the primary destination */
+	SCRPD_DBC_IS_PRIM_DEST		= BIT(1),
+	/* PTI is the primary destination */
+	SCRPD_PTI_IS_PRIM_DEST		= BIT(2),
+	/* BSSB is the primary destination */
+	SCRPD_BSSB_IS_PRIM_DEST		= BIT(3),
+	/* PTI is the alternate destination */
+	SCRPD_PTI_IS_ALT_DEST		= BIT(4),
+	/* BSSB is the alternate destination */
+	SCRPD_BSSB_IS_ALT_DEST		= BIT(5),
+	/* DeepSx exit occurred */
+	SCRPD_DEEPSX_EXIT		= BIT(6),
+	/* S4 exit occurred */
+	SCRPD_S4_EXIT			= BIT(7),
+	/* S5 exit occurred */
+	SCRPD_S5_EXIT			= BIT(8),
+	/* MSU controller 0/1 is enabled */
+	SCRPD_MSC0_IS_ENABLED		= BIT(9),
+	SCRPD_MSC1_IS_ENABLED		= BIT(10),
+	/* Sx exit occurred */
+	SCRPD_SX_EXIT			= BIT(11),
+	/* Trigger Unit is enabled */
+	SCRPD_TRIGGER_IS_ENABLED	= BIT(12),
+	SCRPD_ODLA_IS_ENABLED		= BIT(13),
+	SCRPD_SOCHAP_IS_ENABLED		= BIT(14),
+	SCRPD_STH_IS_ENABLED		= BIT(15),
+	SCRPD_DCIH_IS_ENABLED		= BIT(16),
+	SCRPD_VER_IS_ENABLED		= BIT(17),
+	/* External debugger is using Intel TH */
+	SCRPD_DEBUGGER_IN_USE		= BIT(24),
+};
+
 #endif
-- 
2.7.0

[toc] | [prev] | [next] | [standalone]


#1334638 — [PATCH 06/20] intel_th: msu: Fix offset for wrapped block

FromAlexander Shishkin <alexander.shishkin@linux.intel.com>
Date2016-02-15 18:20 +0100
Subject[PATCH 06/20] intel_th: msu: Fix offset for wrapped block
Message-ID<r2uYA-41S-57@gated-at.bofh.it>
In reply to#1334618
From: Laurent FERT <laurent.fert@intel.com>

Fix offset for the second pass on the wrapped block when iterating over
memory in multi-block mode, otherwise wrong part of the block will get
copied.

Signed-off-by: Laurent FERT <laurent.fert@intel.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
---
 drivers/hwtracing/intel_th/msu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwtracing/intel_th/msu.c b/drivers/hwtracing/intel_th/msu.c
index 70ca27e456..3c793bbf6a 100644
--- a/drivers/hwtracing/intel_th/msu.c
+++ b/drivers/hwtracing/intel_th/msu.c
@@ -408,7 +408,7 @@ msc_buffer_iterate(struct msc_iter *iter, size_t size, void *data,
 		 * Second time (wrap_count==1), it's just like any other block,
 		 * containing data in the range of [MSC_BDESC..data_bytes].
 		 */
-		if (iter->block == iter->start_block && iter->wrap_count) {
+		if (iter->block == iter->start_block && iter->wrap_count == 2) {
 			tocopy = DATA_IN_PAGE - data_bytes;
 			src += data_bytes;
 		}
-- 
2.7.0

[toc] | [prev] | [next] | [standalone]


#1334639 — [PATCH 02/20] stm class: Fix master deallocation in device unregistering

FromAlexander Shishkin <alexander.shishkin@linux.intel.com>
Date2016-02-15 18:20 +0100
Subject[PATCH 02/20] stm class: Fix master deallocation in device unregistering
Message-ID<r2uYA-41S-59@gated-at.bofh.it>
In reply to#1334618
From: Chunyan Zhang <zhang.chunyan@linaro.org>

The device unregister path uses wrong master index range when it tries
to free the allocated masters, it should, as does the rest of the stm
class code, use real master IDs.

This patch fixes the device unregister path to use real master IDs to
avoid memory leaks after unloading the stm driver.

Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org>
[alexander.shishkin@intel.com: re-wrote the commit message]
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
---
 drivers/hwtracing/stm/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c
index cdec240bd6..79cca94bfb 100644
--- a/drivers/hwtracing/stm/core.c
+++ b/drivers/hwtracing/stm/core.c
@@ -690,7 +690,7 @@ void stm_unregister_device(struct stm_data *stm_data)
 		stp_policy_unbind(stm->policy);
 	mutex_unlock(&stm->policy_mutex);
 
-	for (i = 0; i < stm->sw_nmasters; i++)
+	for (i = stm->data->sw_start; i <= stm->data->sw_end; i++)
 		stp_master_free(stm, i);
 
 	device_unregister(&stm->dev);
-- 
2.7.0

[toc] | [prev] | [next] | [standalone]


#1335328

FromAlexander Shishkin <alexander.shishkin@linux.intel.com>
Date2016-02-16 13:30 +0100
Message-ID<r2MVs-7Lj-9@gated-at.bofh.it>
In reply to#1334594
Greg KH <gregkh@linuxfoundation.org> writes:

> On Mon, Feb 15, 2016 at 06:08:07PM +0200, Alexander Shishkin wrote:
>> Hi Greg,
>> 
>> These are patches I have queued for the next merge window. Please
>> consider pulling.
>> 
>> The following changes since commit 1b79dff672ca09a5461cc1d46ad81c62137841c5:
>> 
>>   Merge 4.5-rc4 into char-misc-next (2016-02-14 14:25:59 -0800)
>> 
>> are available in the git repository at:
>> 
>>   https://github.com/virtuoso/linux-perf.git stm-for-greg
>
> I can't accept pull requests from github, sorry.  And that isn't even a
> signed tag, which is also something that is required.
>
> Just send these as emails and I'll take them that way for now.

Just in case, I have also pushed a signed tag to my shiny new k.org
tree with all same stuff as before, so if it's convenient for you,
consider pulling from this one.

The following changes since commit 1b79dff672ca09a5461cc1d46ad81c62137841c5:

  Merge 4.5-rc4 into char-misc-next (2016-02-14 14:25:59 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/ash/stm.git tags/stm-for-greg-20160216

for you to fetch changes up to fb756bc533ca533c2f415b74589b7172c3456b7c:

  stm class: dummy_stm: Add link callback for fault injection (2016-02-15 15:54:37 +0200)

----------------------------------------------------------------
These are:

 * fixes for races around linking stm source devices to stm devices,
   stm output assignment, module/device refcounting;
 * random trivial fixes and cleanups;
 * a new stm source "heartbeat" device;
 * better support for multiple stm devices;
 * various small improvements.

----------------------------------------------------------------
Alexander Shishkin (16):
      intel_th: Depend on HAS_IOMEM
      intel_th: gth: Remove commented-out code
      intel_th: Update scratchpad bits according to enabled output activity
      intel_th: sth: Sanitize packet callback's return values
      intel_th: Set root device's drvdata early
      intel_th: Use real device index in the node names
      stm class: Use driver's packet callback return value
      stm class: Support devices with multiple instances
      stm class: dummy_stm: Create multiple devices
      stm class: Add heartbeat stm source device
      stm class: Fix unlocking braino in the error path
      stm class: Guard output assignment against concurrency
      stm class: Fix unbalanced module/device refcounting
      stm class: Fix a race in unlinking
      stm class: Plug stm device's unlink callback
      stm class: dummy_stm: Add link callback for fault injection

Chunyan Zhang (1):
      stm class: Fix master deallocation in device unregistering

Laurent FERT (2):
      intel_th: msu: Fix offset for wrapped block
      intel_th: msu: Release resources on read error

Lucas Tanure (1):
      stm class: Use a signed return type for stm_find_master_chan

 drivers/hwtracing/intel_th/Kconfig    |   2 +-
 drivers/hwtracing/intel_th/core.c     |  30 +++++++-
 drivers/hwtracing/intel_th/gth.c      |  32 ++++----
 drivers/hwtracing/intel_th/gth.h      |   3 -
 drivers/hwtracing/intel_th/intel_th.h |  41 ++++++++++
 drivers/hwtracing/intel_th/msu.c      |   9 +--
 drivers/hwtracing/intel_th/pci.c      |   2 -
 drivers/hwtracing/intel_th/sth.c      |  11 ++-
 drivers/hwtracing/stm/Kconfig         |  11 +++
 drivers/hwtracing/stm/Makefile        |   2 +
 drivers/hwtracing/stm/core.c          | 138 ++++++++++++++++++++++++++--------
 drivers/hwtracing/stm/dummy_stm.c     |  71 ++++++++++++++---
 drivers/hwtracing/stm/heartbeat.c     | 130 ++++++++++++++++++++++++++++++++
 drivers/hwtracing/stm/policy.c        |   7 +-
 drivers/hwtracing/stm/stm.h           |   1 +
 include/linux/stm.h                   |  10 +++
 16 files changed, 420 insertions(+), 80 deletions(-)
 create mode 100644 drivers/hwtracing/stm/heartbeat.c

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | linux.kernel


csiph-web