Commit b0fc0167 authored by Loic Poulain's avatar Loic Poulain Committed by Greg Kroah-Hartman

bus: mhi: core: Allow shared IRQ for event rings

There is no requirement for using a dedicated IRQ per event ring.
Some systems does not support multiple MSI vectors (e.g. intel
without CONFIG_IRQ_REMAP), In that case the MHI controller can
configure all the event rings to use the same interrupt (as fallback).

Allow this by removing the nr_irqs = ev_ring test and add extra check
in the irq_setup function.
Reviewed-by: default avatarManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: default avatarLoic Poulain <loic.poulain@linaro.org>
Signed-off-by: default avatarManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Link: https://lore.kernel.org/r/20200929175218.8178-17-manivannan.sadhasivam@linaro.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 21cb9b18
...@@ -162,6 +162,13 @@ int mhi_init_irq_setup(struct mhi_controller *mhi_cntrl) ...@@ -162,6 +162,13 @@ int mhi_init_irq_setup(struct mhi_controller *mhi_cntrl)
if (mhi_event->offload_ev) if (mhi_event->offload_ev)
continue; continue;
if (mhi_event->irq >= mhi_cntrl->nr_irqs) {
dev_err(dev, "irq %d not available for event ring\n",
mhi_event->irq);
ret = -EINVAL;
goto error_request;
}
ret = request_irq(mhi_cntrl->irq[mhi_event->irq], ret = request_irq(mhi_cntrl->irq[mhi_event->irq],
mhi_irq_handler, mhi_irq_handler,
IRQF_SHARED | IRQF_NO_SUSPEND, IRQF_SHARED | IRQF_NO_SUSPEND,
......
...@@ -918,7 +918,7 @@ int mhi_async_power_up(struct mhi_controller *mhi_cntrl) ...@@ -918,7 +918,7 @@ int mhi_async_power_up(struct mhi_controller *mhi_cntrl)
dev_info(dev, "Requested to power ON\n"); dev_info(dev, "Requested to power ON\n");
if (mhi_cntrl->nr_irqs < mhi_cntrl->total_ev_rings) if (mhi_cntrl->nr_irqs < 1)
return -EINVAL; return -EINVAL;
/* Supply default wake routines if not provided by controller driver */ /* Supply default wake routines if not provided by controller driver */
......
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