intel_th: Only report useful IRQs to subdevices
authorAlexander Shishkin <alexander.shishkin@linux.intel.com>
Fri, 3 May 2019 08:44:42 +0000 (11:44 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 3 May 2019 16:14:30 +0000 (18:14 +0200)
The only type of IRQ triggering event that is useful to us at the moment
is the "last block" interrupt of the MSU. This interrupt can only be
enabled via "MINTCTL" register that doesn't exist in earlier version of
the Intel TH.

Enumerate the presence of MINTCTL via per-device driver data structure
and only instantiate the IRQ resource for subdevices if this capability
is present.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hwtracing/intel_th/core.c
drivers/hwtracing/intel_th/intel_th.h
drivers/hwtracing/intel_th/pci.c

index 750aa9d6f8498657697a245138e9e42336452502..390031df3edffe3d15c75e54abdf4325d1b43556 100644 (file)
@@ -639,7 +639,12 @@ intel_th_subdevice_alloc(struct intel_th *th,
                        dev_dbg(th->dev, "%s:%d @ %pR\n",
                                subdev->name, r, &res[r]);
                } else if (res[r].flags & IORESOURCE_IRQ) {
-                       res[r].start    = th->irq;
+                       /*
+                        * Only pass on the IRQ if we have useful interrupts:
+                        * the ones that can be configured via MINTCTL.
+                        */
+                       if (INTEL_TH_CAP(th, has_mintctl) && th->irq != -1)
+                               res[r].start = th->irq;
                }
        }
 
index 59038215489a69546a266dad9408ee4f008ff710..8b986ba160e4a171edbb968b2a4d59e90cc7952b 100644 (file)
@@ -44,10 +44,12 @@ struct intel_th_output {
 /**
  * struct intel_th_drvdata - describes hardware capabilities and quirks
  * @tscu_enable:       device needs SW to enable time stamping unit
+ * @has_mintctl:       device has interrupt control (MINTCTL) register
  * @host_mode_only:    device can only operate in 'host debugger' mode
  */
 struct intel_th_drvdata {
        unsigned int    tscu_enable        : 1,
+                       has_mintctl        : 1,
                        host_mode_only     : 1;
 };
 
index f5643444481befa696487fe09d25227725d91111..5808dd4c104cc5b2f924efda577928597c3c5bc7 100644 (file)
@@ -122,6 +122,7 @@ static void intel_th_pci_remove(struct pci_dev *pdev)
 
 static const struct intel_th_drvdata intel_th_2x = {
        .tscu_enable    = 1,
+       .has_mintctl    = 1,
 };
 
 static const struct pci_device_id intel_th_pci_id_table[] = {