From: Srujana Challa <schalla@marvell.com>
To: <virtualization@lists.linux.dev>
Cc: <mst@redhat.com>, <jasowang@redhat.com>,
<xuanzhuo@linux.alibaba.com>, <eperezma@redhat.com>,
<linmq006@gmail.com>, <phasta@kernel.org>,
<ndabilpuram@marvell.com>, <kshankar@marvell.com>,
<vattunuru@marvell.com>, <schalla@marvell.com>
Subject: [PATCH 4/4] vdpa/octeon_ep: fix IRQ-to-ring mapping in interrupt handler
Date: Tue, 24 Feb 2026 15:22:26 +0530 [thread overview]
Message-ID: <20260224095226.1001151-5-schalla@marvell.com> (raw)
In-Reply-To: <20260224095226.1001151-1-schalla@marvell.com>
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: 26f8ce06af64 ("vdpa/octeon_ep: enable support for multiple interrupts per device")
Signed-off-by: Srujana Challa <schalla@marvell.com>
---
drivers/vdpa/octeon_ep/octep_vdpa_main.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/vdpa/octeon_ep/octep_vdpa_main.c b/drivers/vdpa/octeon_ep/octep_vdpa_main.c
index 5b9d76632376..5b35993750f5 100644
--- a/drivers/vdpa/octeon_ep/octep_vdpa_main.c
+++ b/drivers/vdpa/octeon_ep/octep_vdpa_main.c
@@ -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);
--
2.25.1
prev parent reply other threads:[~2026-02-24 9:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-24 9:52 [PATCH 0/4] vdpa/octeon_ep: fixes and improvements for multi VF Srujana Challa
2026-02-24 9:52 ` [PATCH 1/4] vdpa/octeon_ep: Fix PF->VF mailbox data address calculation Srujana Challa
2026-02-24 9:52 ` [PATCH 2/4] vdpa/octeon_ep: Use 4 bytes for mailbox signature Srujana Challa
2026-02-24 9:52 ` [PATCH 3/4] vdpa/octeon_ep: Add vDPA device event handling for firmware notifications Srujana Challa
2026-02-24 9:52 ` Srujana Challa [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260224095226.1001151-5-schalla@marvell.com \
--to=schalla@marvell.com \
--cc=eperezma@redhat.com \
--cc=jasowang@redhat.com \
--cc=kshankar@marvell.com \
--cc=linmq006@gmail.com \
--cc=mst@redhat.com \
--cc=ndabilpuram@marvell.com \
--cc=phasta@kernel.org \
--cc=vattunuru@marvell.com \
--cc=virtualization@lists.linux.dev \
--cc=xuanzhuo@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox