All of lore.kernel.org
 help / color / mirror / Atom feed
* [GIT PULL 0/3] intel_th: Fixes for v4.19
@ 2018-09-18 13:10 Alexander Shishkin
  2018-09-18 13:10 ` [GIT PULL 1/3] intel_th: Fix device removal logic Alexander Shishkin
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Alexander Shishkin @ 2018-09-18 13:10 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Alexander Shishkin

Hi Greg,

Here are fixes that I'd like to get into v4.19. Both bugfixes are
backportable. Individual patches follow. Please consider pulling
or applying.

The following changes since commit 5b394b2ddf0347bef56e50c69a58773c94343ff3:

  Linux 4.19-rc1 (2018-08-26 14:11:59 -0700)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/ash/stm.git tags/intel_th-fixes-for-greg-20180918

for you to fetch changes up to 7f97d5f35010ae88d004ae64dc00e6e27638e2c9:

  intel_th: pci: Add Ice Lake PCH support (2018-09-18 15:48:08 +0300)

----------------------------------------------------------------
intel_th: Fixes for v4.19

These are:
  * a fix for ACPI glue layer
  * a fix for host mode (also applicable to ACPI)
  * a new PCI ID.

The fixes are both backportable.

----------------------------------------------------------------
Alexander Shishkin (3):
      intel_th: Fix device removal logic
      intel_th: Fix resource handling for ACPI glue layer
      intel_th: pci: Add Ice Lake PCH support

 drivers/hwtracing/intel_th/core.c | 16 +++++++++++++---
 drivers/hwtracing/intel_th/pci.c  |  5 +++++
 2 files changed, 18 insertions(+), 3 deletions(-)

-- 
2.18.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [GIT PULL 1/3] intel_th: Fix device removal logic
  2018-09-18 13:10 [GIT PULL 0/3] intel_th: Fixes for v4.19 Alexander Shishkin
@ 2018-09-18 13:10 ` Alexander Shishkin
  2018-09-18 13:10 ` [GIT PULL 2/3] intel_th: Fix resource handling for ACPI glue layer Alexander Shishkin
  2018-09-18 13:10 ` [GIT PULL 3/3] intel_th: pci: Add Ice Lake PCH support Alexander Shishkin
  2 siblings, 0 replies; 4+ messages in thread
From: Alexander Shishkin @ 2018-09-18 13:10 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Alexander Shishkin, stable

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+
---
 drivers/hwtracing/intel_th/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/hwtracing/intel_th/core.c b/drivers/hwtracing/intel_th/core.c
index da962aa2cef5..4e70ecee2103 100644
--- a/drivers/hwtracing/intel_th/core.c
+++ b/drivers/hwtracing/intel_th/core.c
@@ -139,7 +139,8 @@ static int intel_th_remove(struct device *dev)
 			th->thdev[i] = NULL;
 		}
 
-		th->num_thdevs = lowest;
+		if (lowest >= 0)
+			th->num_thdevs = lowest;
 	}
 
 	if (thdrv->attr_group)
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [GIT PULL 2/3] intel_th: Fix resource handling for ACPI glue layer
  2018-09-18 13:10 [GIT PULL 0/3] intel_th: Fixes for v4.19 Alexander Shishkin
  2018-09-18 13:10 ` [GIT PULL 1/3] intel_th: Fix device removal logic Alexander Shishkin
@ 2018-09-18 13:10 ` Alexander Shishkin
  2018-09-18 13:10 ` [GIT PULL 3/3] intel_th: pci: Add Ice Lake PCH support Alexander Shishkin
  2 siblings, 0 replies; 4+ messages in thread
From: Alexander Shishkin @ 2018-09-18 13:10 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Alexander Shishkin, stable

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+
---
 drivers/hwtracing/intel_th/core.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/hwtracing/intel_th/core.c b/drivers/hwtracing/intel_th/core.c
index 4e70ecee2103..fc6b7f8b62fb 100644
--- a/drivers/hwtracing/intel_th/core.c
+++ b/drivers/hwtracing/intel_th/core.c
@@ -488,7 +488,7 @@ static const struct intel_th_subdevice {
 				.flags	= IORESOURCE_MEM,
 			},
 			{
-				.start	= TH_MMIO_SW,
+				.start	= 1, /* use resource[1] */
 				.end	= 0,
 				.flags	= IORESOURCE_MEM,
 			},
@@ -581,6 +581,7 @@ intel_th_subdevice_alloc(struct intel_th *th,
 	struct intel_th_device *thdev;
 	struct resource res[3];
 	unsigned int req = 0;
+	bool is64bit = false;
 	int r, err;
 
 	thdev = intel_th_device_alloc(th, subdev->type, subdev->name,
@@ -590,12 +591,18 @@ intel_th_subdevice_alloc(struct intel_th *th,
 
 	thdev->drvdata = th->drvdata;
 
+	for (r = 0; r < th->num_resources; r++)
+		if (th->resource[r].flags & IORESOURCE_MEM_64) {
+			is64bit = true;
+			break;
+		}
+
 	memcpy(res, subdev->res,
 	       sizeof(struct resource) * subdev->nres);
 
 	for (r = 0; r < subdev->nres; r++) {
 		struct resource *devres = th->resource;
-		int bar = TH_MMIO_CONFIG;
+		int bar = 0; /* cut subdevices' MMIO from resource[0] */
 
 		/*
 		 * Take .end == 0 to mean 'take the whole bar',
@@ -604,6 +611,8 @@ intel_th_subdevice_alloc(struct intel_th *th,
 		 */
 		if (!res[r].end && res[r].flags == IORESOURCE_MEM) {
 			bar = res[r].start;
+			if (is64bit)
+				bar *= 2;
 			res[r].start = 0;
 			res[r].end = resource_size(&devres[bar]) - 1;
 		}
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [GIT PULL 3/3] intel_th: pci: Add Ice Lake PCH support
  2018-09-18 13:10 [GIT PULL 0/3] intel_th: Fixes for v4.19 Alexander Shishkin
  2018-09-18 13:10 ` [GIT PULL 1/3] intel_th: Fix device removal logic Alexander Shishkin
  2018-09-18 13:10 ` [GIT PULL 2/3] intel_th: Fix resource handling for ACPI glue layer Alexander Shishkin
@ 2018-09-18 13:10 ` Alexander Shishkin
  2 siblings, 0 replies; 4+ messages in thread
From: Alexander Shishkin @ 2018-09-18 13:10 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Alexander Shishkin

This adds Intel(R) Trace Hub PCI ID for Ice Lake PCH.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
---
 drivers/hwtracing/intel_th/pci.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/hwtracing/intel_th/pci.c b/drivers/hwtracing/intel_th/pci.c
index c2e55e5d97f6..1cf6290d6435 100644
--- a/drivers/hwtracing/intel_th/pci.c
+++ b/drivers/hwtracing/intel_th/pci.c
@@ -160,6 +160,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = {
 		PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x18e1),
 		.driver_data = (kernel_ulong_t)&intel_th_2x,
 	},
+	{
+		/* Ice Lake PCH */
+		PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x34a6),
+		.driver_data = (kernel_ulong_t)&intel_th_2x,
+	},
 	{ 0 },
 };
 
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-09-18 13:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-18 13:10 [GIT PULL 0/3] intel_th: Fixes for v4.19 Alexander Shishkin
2018-09-18 13:10 ` [GIT PULL 1/3] intel_th: Fix device removal logic Alexander Shishkin
2018-09-18 13:10 ` [GIT PULL 2/3] intel_th: Fix resource handling for ACPI glue layer Alexander Shishkin
2018-09-18 13:10 ` [GIT PULL 3/3] intel_th: pci: Add Ice Lake PCH support Alexander Shishkin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.