public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexander Shishkin <alexander.shishkin@linux.intel.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>
Subject: [GIT PULL 06/22] intel_th: Communicate IRQ via resource
Date: Fri,  3 May 2019 11:44:39 +0300	[thread overview]
Message-ID: <20190503084455.23436-7-alexander.shishkin@linux.intel.com> (raw)
In-Reply-To: <20190503084455.23436-1-alexander.shishkin@linux.intel.com>

Currently, the IRQ is passed between the glue layers and the core as a
separate argument, while the MMIO resources are passed as resources.
This also limits the number of IRQs thus used to one, while the current
versions of Intel TH use a different MSI vector for each interrupt
triggering event, of which there are 7.

Change this to pass IRQ in the resources array.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
---
 drivers/hwtracing/intel_th/acpi.c     | 10 ++++------
 drivers/hwtracing/intel_th/core.c     | 23 ++++++++++++++++++-----
 drivers/hwtracing/intel_th/intel_th.h |  2 +-
 drivers/hwtracing/intel_th/pci.c      |  9 +++++++--
 4 files changed, 30 insertions(+), 14 deletions(-)

diff --git a/drivers/hwtracing/intel_th/acpi.c b/drivers/hwtracing/intel_th/acpi.c
index b528e5b113ff..87f9024e4bbb 100644
--- a/drivers/hwtracing/intel_th/acpi.c
+++ b/drivers/hwtracing/intel_th/acpi.c
@@ -40,20 +40,18 @@ static int intel_th_acpi_probe(struct platform_device *pdev)
 	struct resource resource[TH_MMIO_END];
 	const struct acpi_device_id *id;
 	struct intel_th *th;
-	int i, r, irq = -1;
+	int i, r;
 
 	id = acpi_match_device(intel_th_acpi_ids, &pdev->dev);
 	if (!id)
 		return -ENODEV;
 
 	for (i = 0, r = 0; i < pdev->num_resources && r < TH_MMIO_END; i++)
-		if (pdev->resource[i].flags & IORESOURCE_IRQ)
-			irq = pdev->resource[i].start;
-		else if (pdev->resource[i].flags & IORESOURCE_MEM)
+		if (pdev->resource[i].flags &
+		    (IORESOURCE_IRQ | IORESOURCE_MEM))
 			resource[r++] = pdev->resource[i];
 
-	th = intel_th_alloc(&pdev->dev, (void *)id->driver_data, resource, r,
-			    irq);
+	th = intel_th_alloc(&pdev->dev, (void *)id->driver_data, resource, r);
 	if (IS_ERR(th))
 		return PTR_ERR(th);
 
diff --git a/drivers/hwtracing/intel_th/core.c b/drivers/hwtracing/intel_th/core.c
index a0b8b0182daa..0205fca4c606 100644
--- a/drivers/hwtracing/intel_th/core.c
+++ b/drivers/hwtracing/intel_th/core.c
@@ -834,10 +834,10 @@ static const struct file_operations intel_th_output_fops = {
  */
 struct intel_th *
 intel_th_alloc(struct device *dev, struct intel_th_drvdata *drvdata,
-	       struct resource *devres, unsigned int ndevres, int irq)
+	       struct resource *devres, unsigned int ndevres)
 {
+	int err, r, nr_mmios = 0;
 	struct intel_th *th;
-	int err, r;
 
 	th = kzalloc(sizeof(*th), GFP_KERNEL);
 	if (!th)
@@ -855,13 +855,26 @@ intel_th_alloc(struct device *dev, struct intel_th_drvdata *drvdata,
 		err = th->major;
 		goto err_ida;
 	}
+	th->irq = -1;
 	th->dev = dev;
 	th->drvdata = drvdata;
 
 	for (r = 0; r < ndevres; r++)
-		th->resource[r] = devres[r];
-	th->num_resources = ndevres;
-	th->irq = irq;
+		switch (devres[r].flags & IORESOURCE_TYPE_BITS) {
+		case IORESOURCE_MEM:
+			th->resource[nr_mmios++] = devres[r];
+			break;
+		case IORESOURCE_IRQ:
+			if (th->irq == -1)
+				th->irq = devres[r].start;
+			break;
+		default:
+			dev_warn(dev, "Unknown resource type %lx\n",
+				 devres[r].flags);
+			break;
+		}
+
+	th->num_resources = nr_mmios;
 
 	dev_set_drvdata(dev, th);
 
diff --git a/drivers/hwtracing/intel_th/intel_th.h b/drivers/hwtracing/intel_th/intel_th.h
index 3fca86d78fdd..6c6eb87e48a0 100644
--- a/drivers/hwtracing/intel_th/intel_th.h
+++ b/drivers/hwtracing/intel_th/intel_th.h
@@ -213,7 +213,7 @@ static inline struct intel_th *to_intel_th(struct intel_th_device *thdev)
 
 struct intel_th *
 intel_th_alloc(struct device *dev, struct intel_th_drvdata *drvdata,
-	       struct resource *devres, unsigned int ndevres, int irq);
+	       struct resource *devres, unsigned int ndevres);
 void intel_th_free(struct intel_th *th);
 
 int intel_th_driver_register(struct intel_th_driver *thdrv);
diff --git a/drivers/hwtracing/intel_th/pci.c b/drivers/hwtracing/intel_th/pci.c
index fd8267bbaf2c..03d6894cd9c9 100644
--- a/drivers/hwtracing/intel_th/pci.c
+++ b/drivers/hwtracing/intel_th/pci.c
@@ -72,7 +72,7 @@ static int intel_th_pci_probe(struct pci_dev *pdev,
 			      const struct pci_device_id *id)
 {
 	struct intel_th_drvdata *drvdata = (void *)id->driver_data;
-	struct resource resource[TH_MMIO_END] = {
+	struct resource resource[TH_MMIO_END + 1] = {
 		[TH_MMIO_CONFIG]	= pdev->resource[TH_PCI_CONFIG_BAR],
 		[TH_MMIO_SW]		= pdev->resource[TH_PCI_STH_SW_BAR],
 	};
@@ -92,7 +92,12 @@ static int intel_th_pci_probe(struct pci_dev *pdev,
 		r++;
 	}
 
-	th = intel_th_alloc(&pdev->dev, drvdata, resource, r, pdev->irq);
+	if (pdev->irq > 0) {
+		resource[r].flags   = IORESOURCE_IRQ;
+		resource[r++].start = pdev->irq;
+	}
+
+	th = intel_th_alloc(&pdev->dev, drvdata, resource, r);
 	if (IS_ERR(th))
 		return PTR_ERR(th);
 
-- 
2.20.1


  parent reply	other threads:[~2019-05-03  8:47 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-03  8:44 [GIT PULL 00/22] intel_th: Updates for v5.2 Alexander Shishkin
2019-05-03  8:44 ` [GIT PULL 01/22] intel_th: msu: Fix single mode with IOMMU Alexander Shishkin
2019-05-03  8:44 ` [GIT PULL 02/22] intel_th: SPDX-ify the documentation Alexander Shishkin
2019-05-03  8:44 ` [GIT PULL 03/22] intel_th: Rework resource passing between glue layers and core Alexander Shishkin
2019-05-03  8:44 ` [GIT PULL 04/22] intel_th: Skip subdevices if their MMIO is missing Alexander Shishkin
2019-05-03  8:44 ` [GIT PULL 05/22] intel_th: Add "rtit" source device Alexander Shishkin
2019-05-03  8:44 ` Alexander Shishkin [this message]
2019-05-03  8:44 ` [GIT PULL 07/22] intel_th: pci: Use MSI interrupt signalling Alexander Shishkin
2019-05-03  8:44 ` [GIT PULL 08/22] intel_th: msu: Start handling IRQs Alexander Shishkin
2019-05-03  8:44 ` [GIT PULL 09/22] intel_th: Only report useful IRQs to subdevices Alexander Shishkin
2019-05-03  8:44 ` [GIT PULL 10/22] intel_th: msu: Replace open-coded list_{first,last,next}_entry variants Alexander Shishkin
2019-05-03  8:44 ` [GIT PULL 11/22] intel_th: msu: Switch over to scatterlist Alexander Shishkin
2019-05-03  8:44 ` [GIT PULL 12/22] intel_th: msu: Support multipage blocks Alexander Shishkin
2019-05-03 16:15   ` Greg Kroah-Hartman
2019-05-03  8:44 ` [GIT PULL 13/22] intel_th: msu: Factor out pipeline draining Alexander Shishkin
2019-05-03  8:44 ` [GIT PULL 14/22] intel_th: gth: Factor out trace start/stop Alexander Shishkin
2019-05-03  8:44 ` [GIT PULL 15/22] intel_th: Add switch triggering support Alexander Shishkin
2019-05-03  8:44 ` [GIT PULL 16/22] intel_th: msu: Correct the block wrap detection Alexander Shishkin
2019-05-03  8:44 ` [GIT PULL 17/22] intel_th: msu: Add a sysfs attribute to trigger window switch Alexander Shishkin
2019-05-03  8:44 ` [GIT PULL 18/22] intel_th: msu: Add current window tracking Alexander Shishkin
2019-05-03  8:44 ` [GIT PULL 19/22] intel_th: msu: Introduce buffer driver interface Alexander Shishkin
2019-05-03 16:19   ` Greg Kroah-Hartman
2019-05-03  8:44 ` [GIT PULL 20/22] intel_th: msu: Add a sysfs attribute showing possible modes Alexander Shishkin
2019-05-03 16:13   ` Greg Kroah-Hartman
2019-05-03  8:44 ` [GIT PULL 21/22] intel_th: msu-sink: An example msu buffer driver Alexander Shishkin
2019-05-03  8:44 ` [GIT PULL 22/22] intel_th: msu: Preserve pre-existing buffer configuration Alexander Shishkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190503084455.23436-7-alexander.shishkin@linux.intel.com \
    --to=alexander.shishkin@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox