vdpa/octeon_ep: fix IRQ-to-ring mapping in interrupt handler

Look up the IRQ index in oct_hw->irqs instead of assuming
irq - irqs[0]. This supports non-contiguous IRQ numbers and
avoids incorrect ring indexing when irqs[0] is not the base.

Fixes: 26f8ce06af ("vdpa/octeon_ep: enable support for multiple interrupts per device")
Signed-off-by: Srujana Challa <schalla@marvell.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20260224095226.1001151-5-schalla@marvell.com>
This commit is contained in:
Srujana Challa 2026-02-24 15:22:26 +05:30 committed by Michael S. Tsirkin
parent a578656164
commit 0d21a1d637

View File

@ -77,7 +77,7 @@ static irqreturn_t octep_vdpa_dev_event_handler(int irq, void *data)
static irqreturn_t octep_vdpa_intr_handler(int irq, void *data)
{
struct octep_hw *oct_hw = data;
int i;
int i, start_ring_idx = -1;
/* Each device has multiple interrupts (nb_irqs) shared among rings
* (nr_vring). Device interrupts are mapped to the rings in a
@ -90,7 +90,16 @@ static irqreturn_t octep_vdpa_intr_handler(int irq, void *data)
* 7 -> 7, 15, 23, 31, 39, 47, 55, 63;
*/
for (i = irq - oct_hw->irqs[0]; i < oct_hw->nr_vring; i += oct_hw->nb_irqs) {
for (i = 0; i < oct_hw->nb_irqs; i++) {
if (oct_hw->irqs[i] == irq) {
start_ring_idx = i;
break;
}
}
if (start_ring_idx == -1)
return IRQ_NONE;
for (i = start_ring_idx; i < oct_hw->nr_vring; i += oct_hw->nb_irqs) {
if (ioread8(oct_hw->vqs[i].cb_notify_addr)) {
/* Acknowledge the per ring notification to the device */
iowrite8(0, oct_hw->vqs[i].cb_notify_addr);