summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRatheesh Kannoth <rkannoth@marvell.com>2026-06-09 09:34:45 +0530
committerJakub Kicinski <kuba@kernel.org>2026-06-13 16:16:58 -0700
commit6056a11b8dc4eb92d8a660870f7cbcae2398b027 (patch)
treedd988ee2df8258be6fa63b1958147a5e5a8d4ae7
parent8d2747ab8c457a0fa5d40fa412a2022567f468cf (diff)
octeontx2-af: enforce single RVU AF probe
On Octeon series SoCs, the AF is an integrated device within the SoC, and hardware resources such as NPC, NIX and related blocks are global and coordinated by the AF driver. Physical and virtual functions request those resources via AF mailbox messages, so two AF driver instances cannot both own that global state; firmware exposes only one AF PCI function at boot and any further octeontx2-af PCI probe returns -EBUSY so software matches the single-AF model. Signed-off-by: Ratheesh Kannoth <rkannoth@marvell.com> Link: https://patch.msgid.link/20260609040453.711932-2-rkannoth@marvell.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r--drivers/net/ethernet/marvell/octeontx2/af/rvu.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
index 6e907ee19164..ffba56ee8a60 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
@@ -3542,19 +3542,29 @@ static void rvu_update_module_params(struct rvu *rvu)
kpu_profile ? kpu_profile : default_pfl_name, KPU_NAME_LEN);
}
+static atomic_t device_bound = ATOMIC_INIT(0);
+
static int rvu_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{
struct device *dev = &pdev->dev;
struct rvu *rvu;
int err;
+ if (atomic_cmpxchg(&device_bound, 0, 1) != 0) {
+ dev_warn(dev, "Only one af device is supported.\n");
+ return -EBUSY;
+ }
+
rvu = devm_kzalloc(dev, sizeof(*rvu), GFP_KERNEL);
- if (!rvu)
+ if (!rvu) {
+ atomic_set(&device_bound, 0);
return -ENOMEM;
+ }
rvu->hw = devm_kzalloc(dev, sizeof(struct rvu_hwinfo), GFP_KERNEL);
if (!rvu->hw) {
devm_kfree(dev, rvu);
+ atomic_set(&device_bound, 0);
return -ENOMEM;
}
@@ -3687,6 +3697,7 @@ err_freemem:
pci_set_drvdata(pdev, NULL);
devm_kfree(&pdev->dev, rvu->hw);
devm_kfree(dev, rvu);
+ atomic_set(&device_bound, 0);
return err;
}
@@ -3716,6 +3727,7 @@ static void rvu_remove(struct pci_dev *pdev)
cn20k_free_mbox_memory(rvu);
kfree(rvu->ng_rvu);
devm_kfree(&pdev->dev, rvu);
+ atomic_set(&device_bound, 0);
}
static void rvu_shutdown(struct pci_dev *pdev)