public inbox for virtualization@lists.linux-foundation.org
 help / color / mirror / Atom feed
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 1/4] vdpa/octeon_ep: Fix PF->VF mailbox data address calculation
Date: Tue, 24 Feb 2026 15:22:23 +0530	[thread overview]
Message-ID: <20260224095226.1001151-2-schalla@marvell.com> (raw)
In-Reply-To: <20260224095226.1001151-1-schalla@marvell.com>

The mailbox address was computed assuming 1 ring per VF. Read the
actual rings-per-VF from OCTEP_EPF_RINFO and use it when calculating
OCTEP_PF_MBOX_DATA offsets, fixing VF initialization when rings
per VF > 1.

Fixes: 8b6c724cdab8 ("virtio: vdpa: vDPA driver for Marvell OCTEON DPU devices")
Signed-off-by: Srujana Challa <schalla@marvell.com>
---
 drivers/vdpa/octeon_ep/octep_vdpa_main.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/vdpa/octeon_ep/octep_vdpa_main.c b/drivers/vdpa/octeon_ep/octep_vdpa_main.c
index 31a02e7fd7f2..9946480ee704 100644
--- a/drivers/vdpa/octeon_ep/octep_vdpa_main.c
+++ b/drivers/vdpa/octeon_ep/octep_vdpa_main.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /* Copyright (C) 2024 Marvell. */
 
+#include <linux/bitfield.h>
 #include <linux/interrupt.h>
 #include <linux/io-64-nonatomic-lo-hi.h>
 #include <linux/module.h>
@@ -722,6 +723,8 @@ static int octep_sriov_enable(struct pci_dev *pdev, int num_vfs)
 	bool done = false;
 	int index = 0;
 	int ret, i;
+	u8 rpvf;
+	u64 val;
 
 	ret = pci_enable_sriov(pdev, num_vfs);
 	if (ret)
@@ -741,9 +744,11 @@ static int octep_sriov_enable(struct pci_dev *pdev, int num_vfs)
 		}
 	}
 
+	val = readq(addr + OCTEP_EPF_RINFO(0));
+	rpvf = FIELD_GET(GENMASK_ULL(35, 32), val);
 	if (done) {
 		for (i = 0; i < pf->enabled_vfs; i++)
-			writeq(OCTEP_DEV_READY_SIGNATURE, addr + OCTEP_PF_MBOX_DATA(i));
+			writeq(OCTEP_DEV_READY_SIGNATURE, addr + OCTEP_PF_MBOX_DATA(i * rpvf));
 	}
 
 	return num_vfs;
-- 
2.25.1


  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 ` Srujana Challa [this message]
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 ` [PATCH 4/4] vdpa/octeon_ep: fix IRQ-to-ring mapping in interrupt handler Srujana Challa

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-2-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