|
8 | 8 | */ |
9 | 9 |
|
10 | 10 | #include <linux/module.h> |
11 | | -#include <linux/msi.h> |
12 | 11 | #include <asm/pci-bridge.h> |
13 | 12 | #include <asm/pnv-pci.h> |
14 | 13 | #include <asm/opal.h> |
@@ -292,86 +291,3 @@ void pnv_cxl_disable_device(struct pci_dev *dev) |
292 | 291 | cxl_pci_disable_device(dev); |
293 | 292 | cxl_afu_put(afu); |
294 | 293 | } |
295 | | - |
296 | | -/* |
297 | | - * This is a special version of pnv_setup_msi_irqs for cards in cxl mode. This |
298 | | - * function handles setting up the IVTE entries for the XSL to use. |
299 | | - * |
300 | | - * We are currently not filling out the MSIX table, since the only currently |
301 | | - * supported adapter (CX4) uses a custom MSIX table format in cxl mode and it |
302 | | - * is up to their driver to fill that out. In the future we may fill out the |
303 | | - * MSIX table (and change the IVTE entries to be an index to the MSIX table) |
304 | | - * for adapters implementing the Full MSI-X mode described in the CAIA. |
305 | | - */ |
306 | | -int pnv_cxl_cx4_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) |
307 | | -{ |
308 | | - struct pci_controller *hose = pci_bus_to_host(pdev->bus); |
309 | | - struct pnv_phb *phb = hose->private_data; |
310 | | - struct msi_desc *entry; |
311 | | - struct cxl_context *ctx = NULL; |
312 | | - unsigned int virq; |
313 | | - int hwirq; |
314 | | - int afu_irq = 0; |
315 | | - int rc; |
316 | | - |
317 | | - if (WARN_ON(!phb) || !phb->msi_bmp.bitmap) |
318 | | - return -ENODEV; |
319 | | - |
320 | | - if (pdev->no_64bit_msi && !phb->msi32_support) |
321 | | - return -ENODEV; |
322 | | - |
323 | | - rc = cxl_cx4_setup_msi_irqs(pdev, nvec, type); |
324 | | - if (rc) |
325 | | - return rc; |
326 | | - |
327 | | - for_each_pci_msi_entry(entry, pdev) { |
328 | | - if (!entry->msi_attrib.is_64 && !phb->msi32_support) { |
329 | | - pr_warn("%s: Supports only 64-bit MSIs\n", |
330 | | - pci_name(pdev)); |
331 | | - return -ENXIO; |
332 | | - } |
333 | | - |
334 | | - hwirq = cxl_next_msi_hwirq(pdev, &ctx, &afu_irq); |
335 | | - if (WARN_ON(hwirq <= 0)) |
336 | | - return (hwirq ? hwirq : -ENOMEM); |
337 | | - |
338 | | - virq = irq_create_mapping(NULL, hwirq); |
339 | | - if (!virq) { |
340 | | - pr_warn("%s: Failed to map cxl mode MSI to linux irq\n", |
341 | | - pci_name(pdev)); |
342 | | - return -ENOMEM; |
343 | | - } |
344 | | - |
345 | | - rc = pnv_cxl_ioda_msi_setup(pdev, hwirq, virq); |
346 | | - if (rc) { |
347 | | - pr_warn("%s: Failed to setup cxl mode MSI\n", pci_name(pdev)); |
348 | | - irq_dispose_mapping(virq); |
349 | | - return rc; |
350 | | - } |
351 | | - |
352 | | - irq_set_msi_desc(virq, entry); |
353 | | - } |
354 | | - |
355 | | - return 0; |
356 | | -} |
357 | | - |
358 | | -void pnv_cxl_cx4_teardown_msi_irqs(struct pci_dev *pdev) |
359 | | -{ |
360 | | - struct pci_controller *hose = pci_bus_to_host(pdev->bus); |
361 | | - struct pnv_phb *phb = hose->private_data; |
362 | | - struct msi_desc *entry; |
363 | | - irq_hw_number_t hwirq; |
364 | | - |
365 | | - if (WARN_ON(!phb)) |
366 | | - return; |
367 | | - |
368 | | - for_each_pci_msi_entry(entry, pdev) { |
369 | | - if (!entry->irq) |
370 | | - continue; |
371 | | - hwirq = virq_to_hw(entry->irq); |
372 | | - irq_set_msi_desc(entry->irq, NULL); |
373 | | - irq_dispose_mapping(entry->irq); |
374 | | - } |
375 | | - |
376 | | - cxl_cx4_teardown_msi_irqs(pdev); |
377 | | -} |
0 commit comments