Skip to content

Commit 0cfd733

Browse files
deecempe
authored andcommitted
Revert "cxl: Add support for interrupts on the Mellanox CX4"
Remove abandonned capi support for the Mellanox CX4. This reverts commit a2f67d5. Signed-off-by: Alastair D'Silva <alastair@d-silva.org> Acked-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent c582815 commit 0cfd733

8 files changed

Lines changed: 0 additions & 202 deletions

File tree

‎arch/powerpc/platforms/powernv/pci-cxl.c‎

Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
*/
99

1010
#include <linux/module.h>
11-
#include <linux/msi.h>
1211
#include <asm/pci-bridge.h>
1312
#include <asm/pnv-pci.h>
1413
#include <asm/opal.h>
@@ -292,86 +291,3 @@ void pnv_cxl_disable_device(struct pci_dev *dev)
292291
cxl_pci_disable_device(dev);
293292
cxl_afu_put(afu);
294293
}
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-
}

‎arch/powerpc/platforms/powernv/pci-ioda.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3847,10 +3847,6 @@ static const struct pci_controller_ops pnv_npu_ocapi_ioda_controller_ops = {
38473847
const struct pci_controller_ops pnv_cxl_cx4_ioda_controller_ops = {
38483848
.dma_dev_setup = pnv_pci_dma_dev_setup,
38493849
.dma_bus_setup = pnv_pci_dma_bus_setup,
3850-
#ifdef CONFIG_PCI_MSI
3851-
.setup_msi_irqs = pnv_cxl_cx4_setup_msi_irqs,
3852-
.teardown_msi_irqs = pnv_cxl_cx4_teardown_msi_irqs,
3853-
#endif
38543850
.enable_device_hook = pnv_cxl_enable_device_hook,
38553851
.disable_device = pnv_cxl_disable_device,
38563852
.release_device = pnv_pci_release_device,

‎arch/powerpc/platforms/powernv/pci.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,6 @@ extern int pnv_npu2_init(struct pnv_phb *phb);
265265
/* cxl functions */
266266
extern bool pnv_cxl_enable_device_hook(struct pci_dev *dev);
267267
extern void pnv_cxl_disable_device(struct pci_dev *dev);
268-
extern int pnv_cxl_cx4_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type);
269-
extern void pnv_cxl_cx4_teardown_msi_irqs(struct pci_dev *pdev);
270268

271269

272270
/* phb ops (cxl switches these when enabling the kernel api on the phb) */

‎drivers/misc/cxl/api.c‎

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include <linux/slab.h>
1212
#include <linux/file.h>
1313
#include <misc/cxl.h>
14-
#include <linux/msi.h>
1514
#include <linux/module.h>
1615
#include <linux/mount.h>
1716
#include <linux/sched/mm.h>
@@ -595,73 +594,3 @@ int cxl_get_max_irqs_per_process(struct pci_dev *dev)
595594
return afu->irqs_max;
596595
}
597596
EXPORT_SYMBOL_GPL(cxl_get_max_irqs_per_process);
598-
599-
/*
600-
* This is a special interrupt allocation routine called from the PHB's MSI
601-
* setup function. When capi interrupts are allocated in this manner they must
602-
* still be associated with a running context, but since the MSI APIs have no
603-
* way to specify this we use the default context associated with the device.
604-
*
605-
* The Mellanox CX4 has a hardware limitation that restricts the maximum AFU
606-
* interrupt number, so in order to overcome this their driver informs us of
607-
* the restriction by setting the maximum interrupts per context, and we
608-
* allocate additional contexts as necessary so that we can keep the AFU
609-
* interrupt number within the supported range.
610-
*/
611-
int _cxl_cx4_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
612-
{
613-
struct cxl_context *ctx, *new_ctx, *default_ctx;
614-
int remaining;
615-
int rc;
616-
617-
ctx = default_ctx = cxl_get_context(pdev);
618-
if (WARN_ON(!default_ctx))
619-
return -ENODEV;
620-
621-
remaining = nvec;
622-
while (remaining > 0) {
623-
rc = cxl_allocate_afu_irqs(ctx, min(remaining, ctx->afu->irqs_max));
624-
if (rc) {
625-
pr_warn("%s: Failed to find enough free MSIs\n", pci_name(pdev));
626-
return rc;
627-
}
628-
remaining -= ctx->afu->irqs_max;
629-
630-
if (ctx != default_ctx && default_ctx->status == STARTED) {
631-
WARN_ON(cxl_start_context(ctx,
632-
be64_to_cpu(default_ctx->elem->common.wed),
633-
NULL));
634-
}
635-
636-
if (remaining > 0) {
637-
new_ctx = cxl_dev_context_init(pdev);
638-
if (IS_ERR(new_ctx)) {
639-
pr_warn("%s: Failed to allocate enough contexts for MSIs\n", pci_name(pdev));
640-
return -ENOSPC;
641-
}
642-
list_add(&new_ctx->extra_irq_contexts, &ctx->extra_irq_contexts);
643-
ctx = new_ctx;
644-
}
645-
}
646-
647-
return 0;
648-
}
649-
/* Exported via cxl_base */
650-
651-
void _cxl_cx4_teardown_msi_irqs(struct pci_dev *pdev)
652-
{
653-
struct cxl_context *ctx, *pos, *tmp;
654-
655-
ctx = cxl_get_context(pdev);
656-
if (WARN_ON(!ctx))
657-
return;
658-
659-
cxl_free_afu_irqs(ctx);
660-
list_for_each_entry_safe(pos, tmp, &ctx->extra_irq_contexts, extra_irq_contexts) {
661-
cxl_stop_context(pos);
662-
cxl_free_afu_irqs(pos);
663-
list_del(&pos->extra_irq_contexts);
664-
cxl_release_context(pos);
665-
}
666-
}
667-
/* Exported via cxl_base */

‎drivers/misc/cxl/base.c‎

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -158,37 +158,6 @@ int cxl_next_msi_hwirq(struct pci_dev *pdev, struct cxl_context **ctx, int *afu_
158158
}
159159
EXPORT_SYMBOL_GPL(cxl_next_msi_hwirq);
160160

161-
int cxl_cx4_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
162-
{
163-
int ret;
164-
struct cxl_calls *calls;
165-
166-
calls = cxl_calls_get();
167-
if (!calls)
168-
return false;
169-
170-
ret = calls->cxl_cx4_setup_msi_irqs(pdev, nvec, type);
171-
172-
cxl_calls_put(calls);
173-
174-
return ret;
175-
}
176-
EXPORT_SYMBOL_GPL(cxl_cx4_setup_msi_irqs);
177-
178-
void cxl_cx4_teardown_msi_irqs(struct pci_dev *pdev)
179-
{
180-
struct cxl_calls *calls;
181-
182-
calls = cxl_calls_get();
183-
if (!calls)
184-
return;
185-
186-
calls->cxl_cx4_teardown_msi_irqs(pdev);
187-
188-
cxl_calls_put(calls);
189-
}
190-
EXPORT_SYMBOL_GPL(cxl_cx4_teardown_msi_irqs);
191-
192161
static int __init cxl_base_init(void)
193162
{
194163
struct device_node *np;

‎drivers/misc/cxl/cxl.h‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -879,16 +879,12 @@ ssize_t cxl_pci_afu_read_err_buffer(struct cxl_afu *afu, char *buf,
879879
bool _cxl_pci_associate_default_context(struct pci_dev *dev, struct cxl_afu *afu);
880880
void _cxl_pci_disable_device(struct pci_dev *dev);
881881
int _cxl_next_msi_hwirq(struct pci_dev *pdev, struct cxl_context **ctx, int *afu_irq);
882-
int _cxl_cx4_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type);
883-
void _cxl_cx4_teardown_msi_irqs(struct pci_dev *pdev);
884882

885883
struct cxl_calls {
886884
void (*cxl_slbia)(struct mm_struct *mm);
887885
bool (*cxl_pci_associate_default_context)(struct pci_dev *dev, struct cxl_afu *afu);
888886
void (*cxl_pci_disable_device)(struct pci_dev *dev);
889887
int (*cxl_next_msi_hwirq)(struct pci_dev *pdev, struct cxl_context **ctx, int *afu_irq);
890-
int (*cxl_cx4_setup_msi_irqs)(struct pci_dev *pdev, int nvec, int type);
891-
void (*cxl_cx4_teardown_msi_irqs)(struct pci_dev *pdev);
892888

893889
struct module *owner;
894890
};

‎drivers/misc/cxl/main.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,6 @@ static struct cxl_calls cxl_calls = {
107107
.cxl_pci_associate_default_context = _cxl_pci_associate_default_context,
108108
.cxl_pci_disable_device = _cxl_pci_disable_device,
109109
.cxl_next_msi_hwirq = _cxl_next_msi_hwirq,
110-
.cxl_cx4_setup_msi_irqs = _cxl_cx4_setup_msi_irqs,
111-
.cxl_cx4_teardown_msi_irqs = _cxl_cx4_teardown_msi_irqs,
112110
.owner = THIS_MODULE,
113111
};
114112

‎include/misc/cxl-base.h‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ void cxl_afu_put(struct cxl_afu *afu);
4343
void cxl_slbia(struct mm_struct *mm);
4444
bool cxl_pci_associate_default_context(struct pci_dev *dev, struct cxl_afu *afu);
4545
void cxl_pci_disable_device(struct pci_dev *dev);
46-
int cxl_cx4_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type);
47-
void cxl_cx4_teardown_msi_irqs(struct pci_dev *pdev);
4846

4947
#else /* CONFIG_CXL_BASE */
5048

@@ -54,8 +52,6 @@ static inline void cxl_afu_put(struct cxl_afu *afu) {}
5452
static inline void cxl_slbia(struct mm_struct *mm) {}
5553
static inline bool cxl_pci_associate_default_context(struct pci_dev *dev, struct cxl_afu *afu) { return false; }
5654
static inline void cxl_pci_disable_device(struct pci_dev *dev) {}
57-
static inline int cxl_cx4_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) { return -ENODEV; }
58-
static inline void cxl_cx4_teardown_msi_irqs(struct pci_dev *pdev) {}
5955

6056
#endif /* CONFIG_CXL_BASE */
6157

0 commit comments

Comments
 (0)