Commit 05cb18fd authored by Michael J. Ruhl's avatar Michael J. Ruhl Committed by Doug Ledford

IB/hfi1: Update HFI to use the latest PCI API

The HFI PCI IRQ code uses an obsolete PCI API.  Update the code to use
the new PCI IRQ API and any necessary changes because of the new API.
Reviewed-by: default avatarSebastian Sanchez <sebastian.sanchez@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 avatarDoug Ledford <dledford@redhat.com>
parent c4bc6156
...@@ -12929,7 +12929,7 @@ static void clean_up_interrupts(struct hfi1_devdata *dd) ...@@ -12929,7 +12929,7 @@ static void clean_up_interrupts(struct hfi1_devdata *dd)
if (!me->arg) /* => no irq, no affinity */ if (!me->arg) /* => no irq, no affinity */
continue; continue;
hfi1_put_irq_affinity(dd, me); hfi1_put_irq_affinity(dd, me);
free_irq(me->irq, me->arg); pci_free_irq(dd->pcidev, i, me->arg);
} }
/* clean structures */ /* clean structures */
...@@ -12939,7 +12939,7 @@ static void clean_up_interrupts(struct hfi1_devdata *dd) ...@@ -12939,7 +12939,7 @@ static void clean_up_interrupts(struct hfi1_devdata *dd)
} else { } else {
/* INTx */ /* INTx */
if (dd->requested_intx_irq) { if (dd->requested_intx_irq) {
free_irq(dd->pcidev->irq, dd); pci_free_irq(dd->pcidev, 0, dd);
dd->requested_intx_irq = 0; dd->requested_intx_irq = 0;
} }
disable_intx(dd->pcidev); disable_intx(dd->pcidev);
...@@ -12998,10 +12998,8 @@ static int request_intx_irq(struct hfi1_devdata *dd) ...@@ -12998,10 +12998,8 @@ static int request_intx_irq(struct hfi1_devdata *dd)
{ {
int ret; int ret;
snprintf(dd->intx_name, sizeof(dd->intx_name), DRIVER_NAME "_%d", ret = pci_request_irq(dd->pcidev, 0, general_interrupt, NULL, dd,
dd->unit); DRIVER_NAME "_%d", dd->unit);
ret = request_irq(dd->pcidev->irq, general_interrupt,
IRQF_SHARED, dd->intx_name, dd);
if (ret) if (ret)
dd_dev_err(dd, "unable to request INTx interrupt, err %d\n", dd_dev_err(dd, "unable to request INTx interrupt, err %d\n",
ret); ret);
...@@ -13044,13 +13042,14 @@ static int request_msix_irqs(struct hfi1_devdata *dd) ...@@ -13044,13 +13042,14 @@ static int request_msix_irqs(struct hfi1_devdata *dd)
int idx; int idx;
struct hfi1_ctxtdata *rcd = NULL; struct hfi1_ctxtdata *rcd = NULL;
struct sdma_engine *sde = NULL; struct sdma_engine *sde = NULL;
char name[MAX_NAME_SIZE];
/* obtain the arguments to request_irq */ /* obtain the arguments to pci_request_irq */
if (first_general <= i && i < last_general) { if (first_general <= i && i < last_general) {
idx = i - first_general; idx = i - first_general;
handler = general_interrupt; handler = general_interrupt;
arg = dd; arg = dd;
snprintf(me->name, sizeof(me->name), snprintf(name, sizeof(name),
DRIVER_NAME "_%d", dd->unit); DRIVER_NAME "_%d", dd->unit);
err_info = "general"; err_info = "general";
me->type = IRQ_GENERAL; me->type = IRQ_GENERAL;
...@@ -13059,7 +13058,7 @@ static int request_msix_irqs(struct hfi1_devdata *dd) ...@@ -13059,7 +13058,7 @@ static int request_msix_irqs(struct hfi1_devdata *dd)
sde = &dd->per_sdma[idx]; sde = &dd->per_sdma[idx];
handler = sdma_interrupt; handler = sdma_interrupt;
arg = sde; arg = sde;
snprintf(me->name, sizeof(me->name), snprintf(name, sizeof(name),
DRIVER_NAME "_%d sdma%d", dd->unit, idx); DRIVER_NAME "_%d sdma%d", dd->unit, idx);
err_info = "sdma"; err_info = "sdma";
remap_sdma_interrupts(dd, idx, i); remap_sdma_interrupts(dd, idx, i);
...@@ -13078,7 +13077,7 @@ static int request_msix_irqs(struct hfi1_devdata *dd) ...@@ -13078,7 +13077,7 @@ static int request_msix_irqs(struct hfi1_devdata *dd)
handler = receive_context_interrupt; handler = receive_context_interrupt;
thread = receive_context_thread; thread = receive_context_thread;
arg = rcd; arg = rcd;
snprintf(me->name, sizeof(me->name), snprintf(name, sizeof(name),
DRIVER_NAME "_%d kctxt%d", DRIVER_NAME "_%d kctxt%d",
dd->unit, idx); dd->unit, idx);
err_info = "receive context"; err_info = "receive context";
...@@ -13099,18 +13098,10 @@ static int request_msix_irqs(struct hfi1_devdata *dd) ...@@ -13099,18 +13098,10 @@ static int request_msix_irqs(struct hfi1_devdata *dd)
if (!arg) if (!arg)
continue; continue;
/* make sure the name is terminated */ /* make sure the name is terminated */
me->name[sizeof(me->name) - 1] = 0; name[sizeof(name) - 1] = 0;
me->irq = pci_irq_vector(dd->pcidev, i); me->irq = pci_irq_vector(dd->pcidev, i);
/* ret = pci_request_irq(dd->pcidev, i, handler, thread, arg,
* On err return me->irq. Don't need to clear this name);
* because 'arg' has not been set, and cleanup will
* do the right thing.
*/
if (me->irq < 0)
return me->irq;
ret = request_threaded_irq(me->irq, handler, thread, 0,
me->name, arg);
if (ret) { if (ret) {
dd_dev_err(dd, dd_dev_err(dd,
"unable to allocate %s interrupt, irq %d, index %d, err %d\n", "unable to allocate %s interrupt, irq %d, index %d, err %d\n",
...@@ -13118,7 +13109,7 @@ static int request_msix_irqs(struct hfi1_devdata *dd) ...@@ -13118,7 +13109,7 @@ static int request_msix_irqs(struct hfi1_devdata *dd)
return ret; return ret;
} }
/* /*
* assign arg after request_irq call, so it will be * assign arg after pci_request_irq call, so it will be
* cleaned up * cleaned up
*/ */
me->arg = arg; me->arg = arg;
...@@ -13136,7 +13127,7 @@ void hfi1_vnic_synchronize_irq(struct hfi1_devdata *dd) ...@@ -13136,7 +13127,7 @@ void hfi1_vnic_synchronize_irq(struct hfi1_devdata *dd)
int i; int i;
if (!dd->num_msix_entries) { if (!dd->num_msix_entries) {
synchronize_irq(dd->pcidev->irq); synchronize_irq(pci_irq_vector(dd->pcidev, 0));
return; return;
} }
...@@ -13157,7 +13148,7 @@ void hfi1_reset_vnic_msix_info(struct hfi1_ctxtdata *rcd) ...@@ -13157,7 +13148,7 @@ void hfi1_reset_vnic_msix_info(struct hfi1_ctxtdata *rcd)
return; return;
hfi1_put_irq_affinity(dd, me); hfi1_put_irq_affinity(dd, me);
free_irq(me->irq, me->arg); pci_free_irq(dd->pcidev, rcd->msix_intr, me->arg);
me->arg = NULL; me->arg = NULL;
} }
...@@ -13180,28 +13171,21 @@ void hfi1_set_vnic_msix_info(struct hfi1_ctxtdata *rcd) ...@@ -13180,28 +13171,21 @@ void hfi1_set_vnic_msix_info(struct hfi1_ctxtdata *rcd)
rcd->ireg = (IS_RCVAVAIL_START + idx) / 64; rcd->ireg = (IS_RCVAVAIL_START + idx) / 64;
rcd->imask = ((u64)1) << rcd->imask = ((u64)1) <<
((IS_RCVAVAIL_START + idx) % 64); ((IS_RCVAVAIL_START + idx) % 64);
snprintf(me->name, sizeof(me->name),
DRIVER_NAME "_%d kctxt%d", dd->unit, idx);
me->name[sizeof(me->name) - 1] = 0;
me->type = IRQ_RCVCTXT; me->type = IRQ_RCVCTXT;
me->irq = pci_irq_vector(dd->pcidev, rcd->msix_intr); me->irq = pci_irq_vector(dd->pcidev, rcd->msix_intr);
if (me->irq < 0) {
dd_dev_err(dd, "vnic irq vector request (idx %d) fail %d\n",
idx, me->irq);
return;
}
remap_intr(dd, IS_RCVAVAIL_START + idx, rcd->msix_intr); remap_intr(dd, IS_RCVAVAIL_START + idx, rcd->msix_intr);
ret = request_threaded_irq(me->irq, receive_context_interrupt, ret = pci_request_irq(dd->pcidev, rcd->msix_intr,
receive_context_thread, 0, me->name, arg); receive_context_interrupt,
receive_context_thread, arg,
DRIVER_NAME "_%d kctxt%d", dd->unit, idx);
if (ret) { if (ret) {
dd_dev_err(dd, "vnic irq request (irq %d, idx %d) fail %d\n", dd_dev_err(dd, "vnic irq request (irq %d, idx %d) fail %d\n",
me->irq, idx, ret); me->irq, idx, ret);
return; return;
} }
/* /*
* assign arg after request_irq call, so it will be * assign arg after pci_request_irq call, so it will be
* cleaned up * cleaned up
*/ */
me->arg = arg; me->arg = arg;
...@@ -13210,7 +13194,7 @@ void hfi1_set_vnic_msix_info(struct hfi1_ctxtdata *rcd) ...@@ -13210,7 +13194,7 @@ void hfi1_set_vnic_msix_info(struct hfi1_ctxtdata *rcd)
if (ret) { if (ret) {
dd_dev_err(dd, dd_dev_err(dd,
"unable to pin IRQ %d\n", ret); "unable to pin IRQ %d\n", ret);
free_irq(me->irq, me->arg); pci_free_irq(dd->pcidev, rcd->msix_intr, me->arg);
} }
} }
......
...@@ -616,7 +616,6 @@ struct hfi1_msix_entry { ...@@ -616,7 +616,6 @@ struct hfi1_msix_entry {
enum irq_type type; enum irq_type type;
int irq; int irq;
void *arg; void *arg;
char name[MAX_NAME_SIZE];
cpumask_t mask; cpumask_t mask;
struct irq_affinity_notify notify; struct irq_affinity_notify notify;
}; };
...@@ -1183,7 +1182,6 @@ struct hfi1_devdata { ...@@ -1183,7 +1182,6 @@ struct hfi1_devdata {
/* INTx information */ /* INTx information */
u32 requested_intx_irq; /* did we request one? */ u32 requested_intx_irq; /* did we request one? */
char intx_name[MAX_NAME_SIZE]; /* INTx name */
/* 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];
......
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