Commit 70324739 authored by Michael J. Ruhl's avatar Michael J. Ruhl Committed by Jason Gunthorpe

IB/hfi1: Remove INTx support and simplify MSIx usage

The INTx IRQ support does not work for all HF1 IRQ handlers
(specifically the receive data IRQs).

Remove all supporting code for the INTx IRQ.

If the requested MSIx vector request is unsuccessful, do not allow the
driver to continue.
Reviewed-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
Reviewed-by: default avatarKamenee Arumugam <kamenee.arumugam@intel.com>
Reviewed-by: default avatarSadanand Warrier <sadanand.warrier@intel.com>
Signed-off-by: default avatarMichael J. Ruhl <michael.j.ruhl@intel.com>
Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 071e4fec
...@@ -8260,9 +8260,14 @@ static void is_interrupt(struct hfi1_devdata *dd, unsigned int source) ...@@ -8260,9 +8260,14 @@ static void is_interrupt(struct hfi1_devdata *dd, unsigned int source)
dd_dev_err(dd, "invalid interrupt source %u\n", source); dd_dev_err(dd, "invalid interrupt source %u\n", source);
} }
/* /**
* General interrupt handler. This is able to correctly handle * gerneral_interrupt() - General interrupt handler
* all interrupts in case INTx is used. * @irq: MSIx IRQ vector
* @data: hfi1 devdata
*
* This is able to correctly handle all non-threaded interrupts. Receive
* context DATA IRQs are threaded and are not supported by this handler.
*
*/ */
static irqreturn_t general_interrupt(int irq, void *data) static irqreturn_t general_interrupt(int irq, void *data)
{ {
...@@ -13030,48 +13035,30 @@ static void clear_all_interrupts(struct hfi1_devdata *dd) ...@@ -13030,48 +13035,30 @@ static void clear_all_interrupts(struct hfi1_devdata *dd)
write_csr(dd, DC_DC8051_ERR_CLR, ~(u64)0); write_csr(dd, DC_DC8051_ERR_CLR, ~(u64)0);
} }
/* Move to pcie.c? */
static void disable_intx(struct pci_dev *pdev)
{
pci_intx(pdev, 0);
}
/** /**
* hfi1_clean_up_interrupts() - Free all IRQ resources * hfi1_clean_up_interrupts() - Free all IRQ resources
* @dd: valid device data data structure * @dd: valid device data data structure
* *
* Free the MSI or INTx IRQs and assoicated PCI resources, * Free the MSIx and assoicated PCI resources, if they have been allocated.
* if they have been allocated.
*/ */
void hfi1_clean_up_interrupts(struct hfi1_devdata *dd) void hfi1_clean_up_interrupts(struct hfi1_devdata *dd)
{ {
int i; int i;
struct hfi1_msix_entry *me = dd->msix_entries;
/* remove irqs - must happen before disabling/turning off */ /* remove irqs - must happen before disabling/turning off */
if (dd->num_msix_entries) { for (i = 0; i < dd->num_msix_entries; i++, me++) {
/* MSI-X */ if (!me->arg) /* => no irq, no affinity */
struct hfi1_msix_entry *me = dd->msix_entries; continue;
hfi1_put_irq_affinity(dd, me);
for (i = 0; i < dd->num_msix_entries; i++, me++) { pci_free_irq(dd->pcidev, i, me->arg);
if (!me->arg) /* => no irq, no affinity */
continue;
hfi1_put_irq_affinity(dd, me);
pci_free_irq(dd->pcidev, i, me->arg);
}
/* clean structures */
kfree(dd->msix_entries);
dd->msix_entries = NULL;
dd->num_msix_entries = 0;
} else {
/* INTx */
if (dd->requested_intx_irq) {
pci_free_irq(dd->pcidev, 0, dd);
dd->requested_intx_irq = 0;
}
disable_intx(dd->pcidev);
} }
/* clean structures */
kfree(dd->msix_entries);
dd->msix_entries = NULL;
dd->num_msix_entries = 0;
pci_free_irq_vectors(dd->pcidev); pci_free_irq_vectors(dd->pcidev);
} }
...@@ -13121,20 +13108,6 @@ static void remap_sdma_interrupts(struct hfi1_devdata *dd, ...@@ -13121,20 +13108,6 @@ static void remap_sdma_interrupts(struct hfi1_devdata *dd,
msix_intr); msix_intr);
} }
static int request_intx_irq(struct hfi1_devdata *dd)
{
int ret;
ret = pci_request_irq(dd->pcidev, 0, general_interrupt, NULL, dd,
DRIVER_NAME "_%d", dd->unit);
if (ret)
dd_dev_err(dd, "unable to request INTx interrupt, err %d\n",
ret);
else
dd->requested_intx_irq = 1;
return ret;
}
static int request_msix_irqs(struct hfi1_devdata *dd) static int request_msix_irqs(struct hfi1_devdata *dd)
{ {
int first_general, last_general; int first_general, last_general;
...@@ -13253,11 +13226,6 @@ void hfi1_vnic_synchronize_irq(struct hfi1_devdata *dd) ...@@ -13253,11 +13226,6 @@ void hfi1_vnic_synchronize_irq(struct hfi1_devdata *dd)
{ {
int i; int i;
if (!dd->num_msix_entries) {
synchronize_irq(pci_irq_vector(dd->pcidev, 0));
return;
}
for (i = 0; i < dd->vnic.num_ctxt; i++) { for (i = 0; i < dd->vnic.num_ctxt; i++) {
struct hfi1_ctxtdata *rcd = dd->vnic.ctxt[i]; struct hfi1_ctxtdata *rcd = dd->vnic.ctxt[i];
struct hfi1_msix_entry *me = &dd->msix_entries[rcd->msix_intr]; struct hfi1_msix_entry *me = &dd->msix_entries[rcd->msix_intr];
...@@ -13346,7 +13314,6 @@ static int set_up_interrupts(struct hfi1_devdata *dd) ...@@ -13346,7 +13314,6 @@ static int set_up_interrupts(struct hfi1_devdata *dd)
{ {
u32 total; u32 total;
int ret, request; int ret, request;
int single_interrupt = 0; /* we expect to have all the interrupts */
/* /*
* Interrupt count: * Interrupt count:
...@@ -13363,17 +13330,6 @@ static int set_up_interrupts(struct hfi1_devdata *dd) ...@@ -13363,17 +13330,6 @@ static int set_up_interrupts(struct hfi1_devdata *dd)
if (request < 0) { if (request < 0) {
ret = request; ret = request;
goto fail; goto fail;
} else if (request == 0) {
/* using INTx */
/* dd->num_msix_entries already zero */
single_interrupt = 1;
dd_dev_err(dd, "MSI-X failed, using INTx interrupts\n");
} else if (request < total) {
/* using MSI-X, with reduced interrupts */
dd_dev_err(dd, "reduced interrupt found, wanted %u, got %u\n",
total, request);
ret = -EINVAL;
goto fail;
} else { } else {
dd->msix_entries = kcalloc(total, sizeof(*dd->msix_entries), dd->msix_entries = kcalloc(total, sizeof(*dd->msix_entries),
GFP_KERNEL); GFP_KERNEL);
...@@ -13394,10 +13350,7 @@ static int set_up_interrupts(struct hfi1_devdata *dd) ...@@ -13394,10 +13350,7 @@ static int set_up_interrupts(struct hfi1_devdata *dd)
/* reset general handler mask, chip MSI-X mappings */ /* reset general handler mask, chip MSI-X mappings */
reset_interrupts(dd); reset_interrupts(dd);
if (single_interrupt) ret = request_msix_irqs(dd);
ret = request_intx_irq(dd);
else
ret = request_msix_irqs(dd);
if (ret) if (ret)
goto fail; goto fail;
......
...@@ -1210,9 +1210,6 @@ struct hfi1_devdata { ...@@ -1210,9 +1210,6 @@ struct hfi1_devdata {
u32 num_msix_entries; u32 num_msix_entries;
u32 first_dyn_msix_idx; u32 first_dyn_msix_idx;
/* INTx information */
u32 requested_intx_irq; /* did we request one? */
/* general interrupt: mask of handled interrupts */ /* general interrupt: mask of handled interrupts */
u64 gi_mask[CCE_NUM_INT_CSRS]; u64 gi_mask[CCE_NUM_INT_CSRS];
......
...@@ -347,15 +347,13 @@ int pcie_speeds(struct hfi1_devdata *dd) ...@@ -347,15 +347,13 @@ int pcie_speeds(struct hfi1_devdata *dd)
/* /*
* Returns: * Returns:
* - actual number of interrupts allocated or * - actual number of interrupts allocated or
* - 0 if fell back to INTx.
* - error * - error
*/ */
int request_msix(struct hfi1_devdata *dd, u32 msireq) int request_msix(struct hfi1_devdata *dd, u32 msireq)
{ {
int nvec; int nvec;
nvec = pci_alloc_irq_vectors(dd->pcidev, 1, msireq, nvec = pci_alloc_irq_vectors(dd->pcidev, msireq, msireq, PCI_IRQ_MSIX);
PCI_IRQ_MSIX | PCI_IRQ_LEGACY);
if (nvec < 0) { if (nvec < 0) {
dd_dev_err(dd, "pci_alloc_irq_vectors() failed: %d\n", nvec); dd_dev_err(dd, "pci_alloc_irq_vectors() failed: %d\n", nvec);
return nvec; return nvec;
...@@ -363,10 +361,6 @@ int request_msix(struct hfi1_devdata *dd, u32 msireq) ...@@ -363,10 +361,6 @@ int request_msix(struct hfi1_devdata *dd, u32 msireq)
tune_pcie_caps(dd); tune_pcie_caps(dd);
/* check for legacy IRQ */
if (nvec == 1 && !dd->pcidev->msix_enabled)
return 0;
return nvec; return nvec;
} }
......
/* /*
* Copyright(c) 2017 Intel Corporation. * Copyright(c) 2017 - 2018 Intel Corporation.
* *
* This file is provided under a dual BSD/GPLv2 license. When using or * This file is provided under a dual BSD/GPLv2 license. When using or
* redistributing this file, you may do so under either license. * redistributing this file, you may do so under either license.
...@@ -120,8 +120,7 @@ static int allocate_vnic_ctxt(struct hfi1_devdata *dd, ...@@ -120,8 +120,7 @@ static int allocate_vnic_ctxt(struct hfi1_devdata *dd,
uctxt->seq_cnt = 1; uctxt->seq_cnt = 1;
uctxt->is_vnic = true; uctxt->is_vnic = true;
if (dd->num_msix_entries) hfi1_set_vnic_msix_info(uctxt);
hfi1_set_vnic_msix_info(uctxt);
hfi1_stats.sps_ctxts++; hfi1_stats.sps_ctxts++;
dd_dev_dbg(dd, "created vnic context %d\n", uctxt->ctxt); dd_dev_dbg(dd, "created vnic context %d\n", uctxt->ctxt);
...@@ -136,8 +135,7 @@ static void deallocate_vnic_ctxt(struct hfi1_devdata *dd, ...@@ -136,8 +135,7 @@ static void deallocate_vnic_ctxt(struct hfi1_devdata *dd,
dd_dev_dbg(dd, "closing vnic context %d\n", uctxt->ctxt); dd_dev_dbg(dd, "closing vnic context %d\n", uctxt->ctxt);
flush_wc(); flush_wc();
if (dd->num_msix_entries) hfi1_reset_vnic_msix_info(uctxt);
hfi1_reset_vnic_msix_info(uctxt);
/* /*
* Disable receive context and interrupt available, reset all * Disable receive context and interrupt available, reset all
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment