Skip to content

Commit f065870

Browse files
spandruvadarafaeljw
authored andcommitted
thermal: int340x: processor_thermal: Use non MSI interrupts by default
There are issues in using MSI interrupts for processor thermal device. The support is not consistent across generations. But the legacy PCI interrupts work on all current generations. Hence always use legacy PCI interrupts by default, instead of MSI. Add a module param to use of MSI, so that MSI can be still used. Signed-off-by: Srinivas Pandruvada <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent dd28a3c commit f065870

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515

1616
#define DRV_NAME "proc_thermal_pci"
1717

18+
static bool use_msi;
19+
module_param(use_msi, bool, 0644);
20+
MODULE_PARM_DESC(use_msi,
21+
"Use PCI MSI based interrupts for processor thermal device.");
22+
1823
struct proc_thermal_pci {
1924
struct pci_dev *pdev;
2025
struct proc_thermal_device *proc_priv;
@@ -203,6 +208,7 @@ static int proc_thermal_pci_probe(struct pci_dev *pdev, const struct pci_device_
203208
struct proc_thermal_device *proc_priv;
204209
struct proc_thermal_pci *pci_info;
205210
int irq_flag = 0, irq, ret;
211+
bool msi_irq = false;
206212

207213
proc_priv = devm_kzalloc(&pdev->dev, sizeof(*proc_priv), GFP_KERNEL);
208214
if (!proc_priv)
@@ -248,16 +254,21 @@ static int proc_thermal_pci_probe(struct pci_dev *pdev, const struct pci_device_
248254
goto err_ret_mmio;
249255
}
250256

251-
/* request and enable interrupt */
252-
ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES);
253-
if (ret < 0) {
254-
dev_err(&pdev->dev, "Failed to allocate vectors!\n");
255-
goto err_ret_tzone;
256-
}
257-
if (!pdev->msi_enabled && !pdev->msix_enabled)
257+
if (use_msi && (pdev->msi_enabled || pdev->msix_enabled)) {
258+
/* request and enable interrupt */
259+
ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES);
260+
if (ret < 0) {
261+
dev_err(&pdev->dev, "Failed to allocate vectors!\n");
262+
goto err_ret_tzone;
263+
}
264+
265+
irq = pci_irq_vector(pdev, 0);
266+
msi_irq = true;
267+
} else {
258268
irq_flag = IRQF_SHARED;
269+
irq = pdev->irq;
270+
}
259271

260-
irq = pci_irq_vector(pdev, 0);
261272
ret = devm_request_threaded_irq(&pdev->dev, irq,
262273
proc_thermal_irq_handler, NULL,
263274
irq_flag, KBUILD_MODNAME, pci_info);
@@ -273,7 +284,8 @@ static int proc_thermal_pci_probe(struct pci_dev *pdev, const struct pci_device_
273284
return 0;
274285

275286
err_free_vectors:
276-
pci_free_irq_vectors(pdev);
287+
if (msi_irq)
288+
pci_free_irq_vectors(pdev);
277289
err_ret_tzone:
278290
thermal_zone_device_unregister(pci_info->tzone);
279291
err_ret_mmio:

0 commit comments

Comments
 (0)