Skip to contentSkip to conversation

idpf: add support for IDPF PCI programming interface

PATCH In review Pavan Kumar Linga 5 participants 6 messages Sep 3, 2025 – Sep 26, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 idpf: add support for IDPF PCI programming interface

At present IDPF supports only 0x1452 and 0x145C as PF and VF device IDs on our current generation hardware. Future hardware exposes a new set of device IDs for each generation. To avoid adding a new device ID for each generation and to make the driver forward and backward compatible, make use of the IDPF PCI programming interface to load the driver.

Write and read the VF_ARQBAL mailbox register to find if the current device is a PF or a VF.

PCI SIG allocated a new programming interface for the IDPF compliant ethernet network controller devices. It can be found at:
https://members.pcisig.com/wg/PCI-SIG/document/20113
with the document titled as 'PCI Code and ID Assignment Revision 1.16' or any latest revisions.

Tested this patch by doing a simple driver load/unload on Intel IPU E2000 hardware which supports 0x1452 and 0x145C device IDs and new hardware which supports the IDPF PCI programming interface.

---
v4:
- add testing info
- use resource_size_t instead of long
- add error statement for ioremap failure

v3:
- reworked logic to avoid gotos

v2:
- replace *u8 with *bool in idpf_is_vf_device function parameter
- use ~0 instead of 0xffffff in PCI_DEVICE_CLASS parameter

---
 drivers/net/ethernet/intel/idpf/idpf.h        |  1 +
 drivers/net/ethernet/intel/idpf/idpf_main.c   | 73 ++++++++++++++-----
 drivers/net/ethernet/intel/idpf/idpf_vf_dev.c | 40 ++++++++++
 3 files changed, 97 insertions(+), 17 deletions(-)
drivers/net/ethernet/intel/idpf/idpf.h +1 -0
index c56abf8b4c92..4a16e481faf7 100644
@@ -1041,6 +1041,7 @@ void idpf_mbx_task(struct work_struct *work);
 void idpf_vc_event_task(struct work_struct *work);
 void idpf_dev_ops_init(struct idpf_adapter *adapter);
 void idpf_vf_dev_ops_init(struct idpf_adapter *adapter);
+int idpf_is_vf_device(struct pci_dev *pdev, bool *is_vf);
 int idpf_intr_req(struct idpf_adapter *adapter);
 void idpf_intr_rel(struct idpf_adapter *adapter);
 u16 idpf_get_max_tx_hdr_size(struct idpf_adapter *adapter);
drivers/net/ethernet/intel/idpf/idpf_main.c +56 -17

112 lines not on this page · raw message

drivers/net/ethernet/intel/idpf/idpf_vf_dev.c +40 -0
index 7527b967e2e7..4774b933ae50 100644
@@ -7,6 +7,46 @@
 
 #define IDPF_VF_ITR_IDX_SPACING		0x40
 
+#define IDPF_VF_TEST_VAL		0xFEED0000
+
+/**
+ * idpf_is_vf_device - Helper to find if it is a VF device
+ * @pdev: PCI device information struct
+ * @is_vf: used to update VF device status
+ *
+ * Return: %0 on success, -%errno on failure.
+ */
+int idpf_is_vf_device(struct pci_dev *pdev, bool *is_vf)
+{
+	struct resource mbx_region;
+	resource_size_t mbx_start;
+	void __iomem *mbx_addr;
+	resource_size_t len;
+
+	resource_set_range(&mbx_region,	VF_BASE, IDPF_VF_MBX_REGION_SZ);
+
+	mbx_start = pci_resource_start(pdev, 0) + mbx_region.start;
+	len = resource_size(&mbx_region);
+
+	mbx_addr = ioremap(mbx_start, len);
+	if (!mbx_addr) {
+		pci_err(pdev, "Failed to allocate BAR0 mbx region\n");
+
+		return -EIO;
+	}
+
+	writel(IDPF_VF_TEST_VAL, mbx_addr + VF_ARQBAL - VF_BASE);
+
+	/* Force memory write to complete before reading it back */
+	wmb();
+
+	*is_vf = readl(mbx_addr + VF_ARQBAL - VF_BASE) == IDPF_VF_TEST_VAL;
+
+	iounmap(mbx_addr);
+
+	return 0;
+}
+
 /**
  * idpf_vf_ctlq_reg_init - initialize default mailbox registers
  * @adapter: adapter structure
Signature · 1 line
2.43.0
reviewer
#1 lore raw
Quoted 15 lines · Pavan Kumar Linga

At present IDPF supports only 0x1452 and 0x145C as PF and VF device IDs on our current generation hardware. Future hardware exposes a new set of device IDs for each generation. To avoid adding a new device ID for each generation and to make the driver forward and backward compatible, make use of the IDPF PCI programming interface to load the driver.

Write and read the VF_ARQBAL mailbox register to find if the current device is a PF or a VF.

PCI SIG allocated a new programming interface for the IDPF compliant ethernet network controller devices. It can be found at:
https://members.pcisig.com/wg/PCI-SIG/document/20113
with the document titled as 'PCI Code and ID Assignment Revision 1.16' or any latest revisions.

Quoted 8 lines

Tested this patch by doing a simple driver load/unload on Intel IPU E2000 hardware which supports 0x1452 and 0x145C device IDs and new hardware which supports the IDPF PCI programming interface.

Hi Pavan,

Should this be targeted at iwl, where it applies cleanly, rather than net-next, where it does not.

If the later, I think that a rebase and repost is appropriate.

...

#2 lore raw
Quoted 25 lines · Simon Horman
Quoted 15 lines · Pavan Kumar Linga

At present IDPF supports only 0x1452 and 0x145C as PF and VF device IDs on our current generation hardware. Future hardware exposes a new set of device IDs for each generation. To avoid adding a new device ID for each generation and to make the driver forward and backward compatible, make use of the IDPF PCI programming interface to load the driver.

Write and read the VF_ARQBAL mailbox register to find if the current device is a PF or a VF.

PCI SIG allocated a new programming interface for the IDPF compliant ethernet network controller devices. It can be found at:
https://members.pcisig.com/wg/PCI-SIG/document/20113
with the document titled as 'PCI Code and ID Assignment Revision 1.16' or any latest revisions.

Quoted 8 lines

Tested this patch by doing a simple driver load/unload on Intel IPU E2000 hardware which supports 0x1452 and 0x145C device IDs and new hardware which supports the IDPF PCI programming interface.

Quoted 8 lines

Hi Pavan,

Should this be targeted at iwl, where it applies cleanly, rather than net-next, where it does not.

If the later, I think that a rebase and repost is appropriate.

...

My bad. It is targeted for iwl-next, but I marked it as net-next.

Please let me know if you want me to correct the target and send a new revision.

Thanks,
Pavan

#3 lore raw
Quoted 47 lines

-----Original Message-----
From: Linga, Pavan Kumar <[email protected]>
Sent: 4 September, 2025 20:05
To: Simon Horman <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Sridhar Samudrala <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH net-next v4] idpf: add support for IDPF PCI programming interface

Quoted 6 lines · Simon Horman
Quoted 5 lines · Pavan Kumar Linga

At present IDPF supports only 0x1452 and 0x145C as PF and VF device IDs on our current generation hardware. Future hardware exposes a new set of device IDs for each generation. To avoid adding a new device ID for each generation and to make the driver forward and backward compatible, make use of the IDPF PCI programming interface to load the

driver.

Quoted 19 lines
Quoted 10 lines

Write and read the VF_ARQBAL mailbox register to find if the current device is a PF or a VF.

PCI SIG allocated a new programming interface for the IDPF compliant ethernet network controller devices. It can be found at:
https://members.pcisig.com/wg/PCI-SIG/document/20113
with the document titled as 'PCI Code and ID Assignment Revision 1.16' or any latest revisions.

Quoted 8 lines

Tested this patch by doing a simple driver load/unload on Intel IPU E2000 hardware which supports 0x1452 and 0x145C device IDs and new hardware which supports the IDPF PCI programming interface.

Quoted 8 lines

Hi Pavan,

Should this be targeted at iwl, where it applies cleanly, rather than net-next, where it does not.

If the later, I think that a rebase and repost is appropriate.

...

Quoted 7 lines

My bad. It is targeted for iwl-next, but I marked it as net-next.

Please let me know if you want me to correct the target and send a new revision.

Thanks,
Pavan

#4 lore raw
In reply to Pavan Kumar Linga

From: Pavan Kumar Linga <[email protected]>
Date: Tue, 2 Sep 2025 20:58:52 -0700

Quoted 180 lines

At present IDPF supports only 0x1452 and 0x145C as PF and VF device IDs on our current generation hardware. Future hardware exposes a new set of device IDs for each generation. To avoid adding a new device ID for each generation and to make the driver forward and backward compatible, make use of the IDPF PCI programming interface to load the driver.

Write and read the VF_ARQBAL mailbox register to find if the current device is a PF or a VF.

PCI SIG allocated a new programming interface for the IDPF compliant ethernet network controller devices. It can be found at:
https://members.pcisig.com/wg/PCI-SIG/document/20113
with the document titled as 'PCI Code and ID Assignment Revision 1.16' or any latest revisions.

Tested this patch by doing a simple driver load/unload on Intel IPU E2000 hardware which supports 0x1452 and 0x145C device IDs and new hardware which supports the IDPF PCI programming interface.

---
v4:
- add testing info
- use resource_size_t instead of long
- add error statement for ioremap failure

v3:
- reworked logic to avoid gotos

v2:
- replace *u8 with *bool in idpf_is_vf_device function parameter
- use ~0 instead of 0xffffff in PCI_DEVICE_CLASS parameter

---
 drivers/net/ethernet/intel/idpf/idpf.h        |  1 +
 drivers/net/ethernet/intel/idpf/idpf_main.c   | 73 ++++++++++++++-----
 drivers/net/ethernet/intel/idpf/idpf_vf_dev.c | 40 ++++++++++
 3 files changed, 97 insertions(+), 17 deletions(-)
drivers/net/ethernet/intel/idpf/idpf.h +1 -0
index c56abf8b4c92..4a16e481faf7 100644
@@ -1041,6 +1041,7 @@ void idpf_mbx_task(struct work_struct *work);
 void idpf_vc_event_task(struct work_struct *work);
 void idpf_dev_ops_init(struct idpf_adapter *adapter);
 void idpf_vf_dev_ops_init(struct idpf_adapter *adapter);
+int idpf_is_vf_device(struct pci_dev *pdev, bool *is_vf);
 int idpf_intr_req(struct idpf_adapter *adapter);
 void idpf_intr_rel(struct idpf_adapter *adapter);
 u16 idpf_get_max_tx_hdr_size(struct idpf_adapter *adapter);
drivers/net/ethernet/intel/idpf/idpf_main.c +56 -17
index 8c46481d2e1f..493604d50143 100644
@@ -7,11 +7,57 @@
 
 #define DRV_SUMMARY	"Intel(R) Infrastructure Data Path Function Linux Driver"
 
+#define IDPF_NETWORK_ETHERNET_PROGIF				0x01
+#define IDPF_CLASS_NETWORK_ETHERNET_PROGIF			\
+	(PCI_CLASS_NETWORK_ETHERNET << 8 | IDPF_NETWORK_ETHERNET_PROGIF)
+
 MODULE_DESCRIPTION(DRV_SUMMARY);
 MODULE_IMPORT_NS("LIBETH");
 MODULE_IMPORT_NS("LIBETH_XDP");
 MODULE_LICENSE("GPL");
 
+/**
+ * idpf_dev_init - Initialize device specific parameters
+ * @adapter: adapter to initialize
+ * @ent: entry in idpf_pci_tbl
+ *
+ * Return: %0 on success, -%errno on failure.
+ */
+static int idpf_dev_init(struct idpf_adapter *adapter,
+			 const struct pci_device_id *ent)
+{
+	bool is_vf = false;
+	int err;
+
+	if (ent->class == IDPF_CLASS_NETWORK_ETHERNET_PROGIF) {
+		err = idpf_is_vf_device(adapter->pdev, &is_vf);
+		if (err)
+			return err;
+		if (is_vf) {
+			idpf_vf_dev_ops_init(adapter);
+			adapter->crc_enable = true;
+		} else {
+			idpf_dev_ops_init(adapter);
+		}
+
+		return 0;
+	}
+
+	switch (ent->device) {
+	case IDPF_DEV_ID_PF:
+		idpf_dev_ops_init(adapter);
+		break;
+	case IDPF_DEV_ID_VF:
+		idpf_vf_dev_ops_init(adapter);
+		adapter->crc_enable = true;
+		break;
+	default:
+		return -ENODEV;
+	}
+
+	return 0;
+}
+
 /**
  * idpf_remove - Device removal routine
  * @pdev: PCI device information struct
@@ -165,21 +211,6 @@ static int idpf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	adapter->req_tx_splitq = true;
 	adapter->req_rx_splitq = true;
 
-	switch (ent->device) {
-	case IDPF_DEV_ID_PF:
-		idpf_dev_ops_init(adapter);
-		break;
-	case IDPF_DEV_ID_VF:
-		idpf_vf_dev_ops_init(adapter);
-		adapter->crc_enable = true;
-		break;
-	default:
-		err = -ENODEV;
-		dev_err(&pdev->dev, "Unexpected dev ID 0x%x in idpf probe\n",
-			ent->device);
-		goto err_free;
-	}
-
 	adapter->pdev = pdev;
 	err = pcim_enable_device(pdev);
 	if (err)
@@ -259,11 +290,18 @@ static int idpf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	/* setup msglvl */
 	adapter->msg_enable = netif_msg_init(-1, IDPF_AVAIL_NETIF_M);
 
+	err = idpf_dev_init(adapter, ent);
+	if (err) {
+		dev_err(&pdev->dev, "Unexpected dev ID 0x%x in idpf probe\n",
+			ent->device);
+		goto destroy_vc_event_wq;
+	}
+
 	err = idpf_cfg_hw(adapter);
 	if (err) {
 		dev_err(dev, "Failed to configure HW structure for adapter: %d\n",
 			err);
-		goto err_cfg_hw;
+		goto destroy_vc_event_wq;
 	}
 
 	mutex_init(&adapter->vport_ctrl_lock);
@@ -284,7 +322,7 @@ static int idpf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	return 0;
 
-err_cfg_hw:
+destroy_vc_event_wq:
 	destroy_workqueue(adapter->vc_event_wq);
 err_vc_event_wq_alloc:
 	destroy_workqueue(adapter->stats_wq);
@@ -304,6 +342,7 @@ static int idpf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 static const struct pci_device_id idpf_pci_tbl[] = {
 	{ PCI_VDEVICE(INTEL, IDPF_DEV_ID_PF)},
 	{ PCI_VDEVICE(INTEL, IDPF_DEV_ID_VF)},
+	{ PCI_DEVICE_CLASS(IDPF_CLASS_NETWORK_ETHERNET_PROGIF, ~0)},
 	{ /* Sentinel */ }
 };
 MODULE_DEVICE_TABLE(pci, idpf_pci_tbl);
drivers/net/ethernet/intel/idpf/idpf_vf_dev.c +0 -0
index 7527b967e2e7..4774b933ae50 100644

drivers/net/ethernet/intel/idpf/idpf_vf_dev.c line 10

Quoted 4 lines
drivers/net/ethernet/intel/idpf/idpf_vf_dev.c +1 -0
@@ -7,6 +7,46 @@
 
 #define IDPF_VF_ITR_IDX_SPACING		0x40
 
+#define IDPF_VF_TEST_VAL		0xFEED0000

0xfeed0000U

Quoted 6 lines
drivers/net/ethernet/intel/idpf/idpf_vf_dev.c +6 -0
+
+/**
+ * idpf_is_vf_device - Helper to find if it is a VF device
+ * @pdev: PCI device information struct
+ * @is_vf: used to update VF device status
+ *

drivers/net/ethernet/intel/idpf/idpf_vf_dev.c line 26

Quoted 10 lines
drivers/net/ethernet/intel/idpf/idpf_vf_dev.c +10 -0
+ * Return: %0 on success, -%errno on failure.
+ */
+int idpf_is_vf_device(struct pci_dev *pdev, bool *is_vf)
+{
+	struct resource mbx_region;
+	resource_size_t mbx_start;
+	void __iomem *mbx_addr;
+	resource_size_t len;
+
+	resource_set_range(&mbx_region,	VF_BASE, IDPF_VF_MBX_REGION_SZ);

Why use struct resource at all here. You have start and len already. Encapsulating them in a resource only complicates the code.

	mbx_addr = ioremap(pci_resource_start(pdev, 0) + VF_BASE,
			   IDPF_VF_MBX_REGION_SZ);

drivers/net/ethernet/intel/idpf/idpf_vf_dev.c line 35

Quoted 9 lines
drivers/net/ethernet/intel/idpf/idpf_vf_dev.c +9 -0
+
+	mbx_start = pci_resource_start(pdev, 0) + mbx_region.start;
+	len = resource_size(&mbx_region);
+
+	mbx_addr = ioremap(mbx_start, len);
+	if (!mbx_addr) {
+		pci_err(pdev, "Failed to allocate BAR0 mbx region\n");
+
+		return -EIO;

I'd remove this newline.

drivers/net/ethernet/intel/idpf/idpf_vf_dev.c line 41

Quoted 6 lines
drivers/net/ethernet/intel/idpf/idpf_vf_dev.c +6 -0
+	}
+
+	writel(IDPF_VF_TEST_VAL, mbx_addr + VF_ARQBAL - VF_BASE);
+
+	/* Force memory write to complete before reading it back */
+	wmb();

Make sure you know what you are doing. writel() is not writel_relaxed(), it already has a barrier inside.

drivers/net/ethernet/intel/idpf/idpf_vf_dev.c line 43

Quoted 2 lines
drivers/net/ethernet/intel/idpf/idpf_vf_dev.c +2 -0
+
+	*is_vf = readl(mbx_addr + VF_ARQBAL - VF_BASE) == IDPF_VF_TEST_VAL;

Maybe put this mbx_addr + VF_ARQBAL - VF_BASE in a variable to not spell it out two times...

Also weird logic. You don't map the whole BAR, you map only a piece of it. Ok. But going this route, you need to read only one register. Why not then

	addr = ioremap(pci_resource_start(pdev, 0) + VF_ARQBAL, 4);

	writel(IDPF_VF_TEST_VAL, addr);
	is_vf = readl(addr) == IDPF_VF_TEST_VAL;

?

drivers/net/ethernet/intel/idpf/idpf_vf_dev.c line 48

Quoted 5 lines
drivers/net/ethernet/intel/idpf/idpf_vf_dev.c +5 -0
+
+	iounmap(mbx_addr);
+
+	return 0;
+}

Instead of returning only either 0 or -EIO and passing the result via a pointer to bool, you could instead just return either:

* IDPF_DEV_ID_PF
* IDPF_DEV_ID_VF
* -EIO

drivers/net/ethernet/intel/idpf/idpf_vf_dev.c line 52

Quoted 4 lines
drivers/net/ethernet/intel/idpf/idpf_vf_dev.c +1 -0
+
 /**
  * idpf_vf_ctlq_reg_init - initialize default mailbox registers
  * @adapter: adapter structure

Thanks,
Olek

#5 lore raw
Quoted 184 lines · Aleksander

From: Pavan Kumar Linga <[email protected]>
Date: Tue, 2 Sep 2025 20:58:52 -0700

Quoted 181 lines

At present IDPF supports only 0x1452 and 0x145C as PF and VF device IDs on our current generation hardware. Future hardware exposes a new set of device IDs for each generation. To avoid adding a new device ID for each generation and to make the driver forward and backward compatible, make use of the IDPF PCI programming interface to load the driver.

Write and read the VF_ARQBAL mailbox register to find if the current device is a PF or a VF.

PCI SIG allocated a new programming interface for the IDPF compliant ethernet network controller devices. It can be found at:
https://members.pcisig.com/wg/PCI-SIG/document/20113
with the document titled as 'PCI Code and ID Assignment Revision 1.16' or any latest revisions.

Tested this patch by doing a simple driver load/unload on Intel IPU E2000 hardware which supports 0x1452 and 0x145C device IDs and new hardware which supports the IDPF PCI programming interface.

---
v4:
- add testing info
- use resource_size_t instead of long
- add error statement for ioremap failure

v3:
- reworked logic to avoid gotos

v2:
- replace *u8 with *bool in idpf_is_vf_device function parameter
- use ~0 instead of 0xffffff in PCI_DEVICE_CLASS parameter

---
  drivers/net/ethernet/intel/idpf/idpf.h        |  1 +
  drivers/net/ethernet/intel/idpf/idpf_main.c   | 73 ++++++++++++++-----
  drivers/net/ethernet/intel/idpf/idpf_vf_dev.c | 40 ++++++++++
  3 files changed, 97 insertions(+), 17 deletions(-)
drivers/net/ethernet/intel/idpf/idpf.h +1 -0
index c56abf8b4c92..4a16e481faf7 100644
@@ -1041,6 +1041,7 @@ void idpf_mbx_task(struct work_struct *work);
  void idpf_vc_event_task(struct work_struct *work);
  void idpf_dev_ops_init(struct idpf_adapter *adapter);
  void idpf_vf_dev_ops_init(struct idpf_adapter *adapter);
+int idpf_is_vf_device(struct pci_dev *pdev, bool *is_vf);
  int idpf_intr_req(struct idpf_adapter *adapter);
  void idpf_intr_rel(struct idpf_adapter *adapter);
  u16 idpf_get_max_tx_hdr_size(struct idpf_adapter *adapter);
drivers/net/ethernet/intel/idpf/idpf_main.c +56 -17
index 8c46481d2e1f..493604d50143 100644
@@ -7,11 +7,57 @@
 
  #define DRV_SUMMARY	"Intel(R) Infrastructure Data Path Function Linux Driver"
 
+#define IDPF_NETWORK_ETHERNET_PROGIF				0x01
+#define IDPF_CLASS_NETWORK_ETHERNET_PROGIF			\
+	(PCI_CLASS_NETWORK_ETHERNET << 8 | IDPF_NETWORK_ETHERNET_PROGIF)
+
  MODULE_DESCRIPTION(DRV_SUMMARY);
  MODULE_IMPORT_NS("LIBETH");
  MODULE_IMPORT_NS("LIBETH_XDP");
  MODULE_LICENSE("GPL");
 
+/**
+ * idpf_dev_init - Initialize device specific parameters
+ * @adapter: adapter to initialize
+ * @ent: entry in idpf_pci_tbl
+ *
+ * Return: %0 on success, -%errno on failure.
+ */
+static int idpf_dev_init(struct idpf_adapter *adapter,
+			 const struct pci_device_id *ent)
+{
+	bool is_vf = false;
+	int err;
+
+	if (ent->class == IDPF_CLASS_NETWORK_ETHERNET_PROGIF) {
+		err = idpf_is_vf_device(adapter->pdev, &is_vf);
+		if (err)
+			return err;
+		if (is_vf) {
+			idpf_vf_dev_ops_init(adapter);
+			adapter->crc_enable = true;
+		} else {
+			idpf_dev_ops_init(adapter);
+		}
+
+		return 0;
+	}
+
+	switch (ent->device) {
+	case IDPF_DEV_ID_PF:
+		idpf_dev_ops_init(adapter);
+		break;
+	case IDPF_DEV_ID_VF:
+		idpf_vf_dev_ops_init(adapter);
+		adapter->crc_enable = true;
+		break;
+	default:
+		return -ENODEV;
+	}
+
+	return 0;
+}
+
  /**
   * idpf_remove - Device removal routine
   * @pdev: PCI device information struct
@@ -165,21 +211,6 @@ static int idpf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
  	adapter->req_tx_splitq = true;
  	adapter->req_rx_splitq = true;
 
-	switch (ent->device) {
-	case IDPF_DEV_ID_PF:
-		idpf_dev_ops_init(adapter);
-		break;
-	case IDPF_DEV_ID_VF:
-		idpf_vf_dev_ops_init(adapter);
-		adapter->crc_enable = true;
-		break;
-	default:
-		err = -ENODEV;
-		dev_err(&pdev->dev, "Unexpected dev ID 0x%x in idpf probe\n",
-			ent->device);
-		goto err_free;
-	}
-
  	adapter->pdev = pdev;
  	err = pcim_enable_device(pdev);
  	if (err)
@@ -259,11 +290,18 @@ static int idpf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
  	/* setup msglvl */
  	adapter->msg_enable = netif_msg_init(-1, IDPF_AVAIL_NETIF_M);
 
+	err = idpf_dev_init(adapter, ent);
+	if (err) {
+		dev_err(&pdev->dev, "Unexpected dev ID 0x%x in idpf probe\n",
+			ent->device);
+		goto destroy_vc_event_wq;
+	}
+
  	err = idpf_cfg_hw(adapter);
  	if (err) {
  		dev_err(dev, "Failed to configure HW structure for adapter: %d\n",
  			err);
-		goto err_cfg_hw;
+		goto destroy_vc_event_wq;
  	}
 
  	mutex_init(&adapter->vport_ctrl_lock);
@@ -284,7 +322,7 @@ static int idpf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
  	return 0;
 
-err_cfg_hw:
+destroy_vc_event_wq:
  	destroy_workqueue(adapter->vc_event_wq);
  err_vc_event_wq_alloc:
  	destroy_workqueue(adapter->stats_wq);
@@ -304,6 +342,7 @@ static int idpf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
  static const struct pci_device_id idpf_pci_tbl[] = {
  	{ PCI_VDEVICE(INTEL, IDPF_DEV_ID_PF)},
  	{ PCI_VDEVICE(INTEL, IDPF_DEV_ID_VF)},
+	{ PCI_DEVICE_CLASS(IDPF_CLASS_NETWORK_ETHERNET_PROGIF, ~0)},
  	{ /* Sentinel */ }
  };
  MODULE_DEVICE_TABLE(pci, idpf_pci_tbl);
drivers/net/ethernet/intel/idpf/idpf_vf_dev.c +0 -0
index 7527b967e2e7..4774b933ae50 100644
@@ -7,6 +7,46 @@
 
Quoted 5 lines

drivers/net/ethernet/intel/idpf/idpf_vf_dev.c line 10

Quoted 3 lines
drivers/net/ethernet/intel/idpf/idpf_vf_dev.c +1 -0
  #define IDPF_VF_ITR_IDX_SPACING		0x40
 
+#define IDPF_VF_TEST_VAL		0xFEED0000

0xfeed0000U

Will fix

Quoted 24 lines
Quoted 7 lines
drivers/net/ethernet/intel/idpf/idpf_vf_dev.c +6 -0
+
+/**
+ * idpf_is_vf_device - Helper to find if it is a VF device
+ * @pdev: PCI device information struct
+ * @is_vf: used to update VF device status
+ *

drivers/net/ethernet/intel/idpf/idpf_vf_dev.c line 26

Quoted 10 lines
drivers/net/ethernet/intel/idpf/idpf_vf_dev.c +10 -0
+ * Return: %0 on success, -%errno on failure.
+ */
+int idpf_is_vf_device(struct pci_dev *pdev, bool *is_vf)
+{
+	struct resource mbx_region;
+	resource_size_t mbx_start;
+	void __iomem *mbx_addr;
+	resource_size_t len;
+
+	resource_set_range(&mbx_region,	VF_BASE, IDPF_VF_MBX_REGION_SZ);

Why use struct resource at all here. You have start and len already. Encapsulating them in a resource only complicates the code.

	mbx_addr = ioremap(pci_resource_start(pdev, 0) + VF_BASE,
			   IDPF_VF_MBX_REGION_SZ);
Quoted 11 lines

drivers/net/ethernet/intel/idpf/idpf_vf_dev.c line 35

Quoted 9 lines
drivers/net/ethernet/intel/idpf/idpf_vf_dev.c +9 -0
+
+	mbx_start = pci_resource_start(pdev, 0) + mbx_region.start;
+	len = resource_size(&mbx_region);
+
+	mbx_addr = ioremap(mbx_start, len);
+	if (!mbx_addr) {
+		pci_err(pdev, "Failed to allocate BAR0 mbx region\n");
+
+		return -EIO;

I'd remove this newline.

Will fix

Quoted 21 lines

drivers/net/ethernet/intel/idpf/idpf_vf_dev.c line 41

Quoted 7 lines
drivers/net/ethernet/intel/idpf/idpf_vf_dev.c +6 -0
+	}
+
+	writel(IDPF_VF_TEST_VAL, mbx_addr + VF_ARQBAL - VF_BASE);
+
+	/* Force memory write to complete before reading it back */
+	wmb();

Make sure you know what you are doing. writel() is not writel_relaxed(), it already has a barrier inside.

drivers/net/ethernet/intel/idpf/idpf_vf_dev.c line 43

Quoted 2 lines
drivers/net/ethernet/intel/idpf/idpf_vf_dev.c +2 -0
+
+	*is_vf = readl(mbx_addr + VF_ARQBAL - VF_BASE) == IDPF_VF_TEST_VAL;

Maybe put this mbx_addr + VF_ARQBAL - VF_BASE in a variable to not spell it out two times...

Also weird logic. You don't map the whole BAR, you map only a piece of it. Ok. But going this route, you need to read only one register. Why not then

Quoted 6 lines
	addr = ioremap(pci_resource_start(pdev, 0) + VF_ARQBAL, 4);

	writel(IDPF_VF_TEST_VAL, addr);
	is_vf = readl(addr) == IDPF_VF_TEST_VAL;

?

I like this approach, will fix it

Quoted 10 lines

drivers/net/ethernet/intel/idpf/idpf_vf_dev.c line 48

Quoted 6 lines
drivers/net/ethernet/intel/idpf/idpf_vf_dev.c +5 -0
+
+	iounmap(mbx_addr);
+
+	return 0;
+}

Instead of returning only either 0 or -EIO and passing the result via a pointer to bool, you could instead just return either:

Quoted 3 lines

* IDPF_DEV_ID_PF
* IDPF_DEV_ID_VF
* -EIO

Will fix it

Quoted 8 lines

drivers/net/ethernet/intel/idpf/idpf_vf_dev.c line 52

Quoted 5 lines
drivers/net/ethernet/intel/idpf/idpf_vf_dev.c +1 -0
+
  /**
   * idpf_vf_ctlq_reg_init - initialize default mailbox registers
   * @adapter: adapter structure

Thanks,
Olek