ifcvf/vDPA: ifcvf drives standard virtio pci devices
Subsystems (2)
PATCH 1/1 ifcvf/vDPA: ifcvf drives standard virtio pci devices
Most of ifcvf code work for standard virtio pci, except for bar4. This commit makes bar4 only effective for Intel products, thereby turning ifcvf into a standard virtio pci driver.
--- drivers/vdpa/Kconfig | 2 +- drivers/vdpa/ifcvf/ifcvf_base.c | 17 ++++++++++++----- drivers/vdpa/ifcvf/ifcvf_main.c | 5 ++++- 3 files changed, 17 insertions(+), 7 deletions(-)
drivers/vdpa/Kconfig +1 -1
@@ -44,7 +44,7 @@ config VDPA_USER in a userspace program. config IFCVF - tristate "Intel IFC VF vDPA driver" + tristate "Intel IFC VF and standard virtio-pci vDPA driver" depends on PCI_MSI help This kernel module can drive Intel IFC VF NIC to offload
drivers/vdpa/ifcvf/ifcvf_base.c +12 -5
@@ -178,7 +178,8 @@ int ifcvf_init_hw(struct ifcvf_hw *hw, struct pci_dev *pdev) hw->vring[i].irq = -EINVAL ; } - hw->lm_cfg = hw->base[IFCVF_LM_BAR ]; +if (hw->pdev->subsystem_vendor ==PCI_VENDOR_ID_INTEL ) + hw->lm_cfg = hw->base[IFCVF_LM_BAR ]; IFCVF_DBG(pdev, "PCI capability mapping: common cfg: %p, notify base: %p\n, isr cfg: %p, device cfg: %p, multiplier: %u\n",
@@ -330,18 +331,24 @@ u16 ifcvf_get_vq_state(struct ifcvf_hw *hw, u16 qid)struct ifcvf_lm_cfg __iomem *lm_cfg = hw->lm_cfg;u16 last_avail_idx; - last_avail_idx =vp_ioread16 (&lm_cfg->vq_state_region + qid *2 ); +if (lm_cfg) { + last_avail_idx =vp_ioread16 (&lm_cfg->vq_state_region + qid *2 ); +return last_avail_idx; + } -return last_avail_idx; +return -EOPNOTSUPP ; }int ifcvf_set_vq_state (struct ifcvf_hw *hw,u16 qid,u16 num) {struct ifcvf_lm_cfg __iomem *lm_cfg = hw->lm_cfg; -vp_iowrite16 (num, &lm_cfg->vq_state_region + qid *2 ); +if (lm_cfg) { +vp_iowrite16 (num, &lm_cfg->vq_state_region + qid *2 ); +return 0 ; + } -return 0 ; +return -EOPNOTSUPP ; }void ifcvf_set_vq_num (struct ifcvf_hw *hw,u16 qid,u32 num)
drivers/vdpa/ifcvf/ifcvf_main.c +4 -1
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0-only /* * Intel IFC VF NIC driver for virtio dataplane offloading +* This driver also drives standard virtio-pci hardwares * * Copyright (C) 2020 Intel Corporation. *
@@ -880,7 +881,9 @@ static struct pci_device_id ifcvf_pci_ids[] = { VIRTIO_TRANS_ID_BLOCK,PCI_VENDOR_ID_INTEL , VIRTIO_ID_BLOCK) }, - +/* standard virtio pci devices */ + { PCI_DEVICE(PCI_VENDOR_ID_REDHAT_QUMRANET, + PCI_ANY_ID) }, { 0 }, };MODULE_DEVICE_TABLE (pci, ifcvf_pci_ids);
Signature · 1 line
2.43.0
Hi Lingshan,
Quoted 22 lines
From: Zhu Lingshan <[email protected]>
Sent: Tuesday, May 14, 2024 2:57 AM
To: [email protected]; [email protected]
Cc: [email protected]; Zhu Lingshan <[email protected]>
Subject: [PATCH] ifcvf/vDPA: ifcvf drives standard virtio pci devicesMost of ifcvf code work for standard virtio pci, except for bar4. This commit makes bar4 only effective for Intel products, thereby turning ifcvf into a standard virtio pci driver.
Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/Kconfig | 2 +- drivers/vdpa/ifcvf/ifcvf_base.c | 17 ++++++++++++----- drivers/vdpa/ifcvf/ifcvf_main.c | 5 ++++- 3 files changed, 17 insertions(+), 7 deletions(-)drivers/vdpa/Kconfig index renamed from drivers/vdpa/Kconfig +0
-0
656c1cb541de..dbf09f35bcef100644
drivers/vdpa/Kconfig config VDPA_USER · line 47
Quoted 5 lines
drivers/vdpa/Kconfig +1
-1@@ -44,7 +44,7 @@ config VDPA_USER in a userspace program. config IFCVF - tristate "Intel IFC VF vDPA driver" + tristate "Intel IFC VF and standard virtio-pci vDPA driver"
The virtio specification limits the subsystem vendor and device id usage for informational purposes only. Hence this change/claim here for standard is not good.
I don't have objection to have per vendor creativity in the spec, but for that let OASIS commit to ratify the spec to use subsystem vendor and device id for non-informational purposes. And amend the spec " (for informational purposes by the driver).".
Quoted 33 lines
drivers/vdpa/Kconfig +0
-0depends on PCI_MSI help This kernel module can drive Intel IFC VF NIC to offload diff --git
a/drivers/vdpa/ifcvf/ifcvf_base.cb/drivers/vdpa/ifcvf/ifcvf_base.cindex472daa588a9d..47bc9b11c678100644drivers/vdpa/ifcvf/ifcvf_base.c +2
-1@@ -178,7 +178,8 @@ int ifcvf_init_hw(struct ifcvf_hw *hw, struct pci_dev *pdev) hw->vring[i].irq = -EINVAL ; } - hw->lm_cfg = hw->base[IFCVF_LM_BAR ]; +if (hw->pdev->subsystem_vendor ==PCI_VENDOR_ID_INTEL ) + hw->lm_cfg = hw->base[IFCVF_LM_BAR ]; IFCVF_DBG(pdev,"PCI capability mapping: common cfg: %p, notify base:
%p\n, isr cfg: %p, device cfg: %p, multiplier: %u\n", @@ -330,18 +331,24 @@ u16ifcvf_get_vq_state(struct ifcvf_hw *hw, u16 qid)drivers/vdpa/ifcvf/ifcvf_base.c +2
-1struct ifcvf_lm_cfg __iomem *lm_cfg = hw->lm_cfg;u16 last_avail_idx; - last_avail_idx =vp_ioread16 (&lm_cfg->vq_state_region + qid *2 ); +if (lm_cfg) { + last_avail_idx = vp_ioread16(&lm_cfg->vq_state_region + qid* 2);
drivers/vdpa/ifcvf/ifcvf_base.c +3
-1+return last_avail_idx; + } -return last_avail_idx; +return -EOPNOTSUPP ;
drivers/vdpa/ifcvf/ifcvf_base.c u16 ifcvf_get_vq_state(struct ifcvf_hw *hw, u16 qid) · line 349
Quoted 10 lines
drivers/vdpa/ifcvf/ifcvf_base.c +4
-1}int ifcvf_set_vq_state (struct ifcvf_hw *hw,u16 qid,u16 num) {struct ifcvf_lm_cfg __iomem *lm_cfg = hw->lm_cfg; -vp_iowrite16 (num, &lm_cfg->vq_state_region + qid *2 ); +if (lm_cfg) { +vp_iowrite16 (num, &lm_cfg->vq_state_region + qid *2 ); +return 0 ; + }
This is more than informational and requires OASIS virtio committee to add section to indicate per subsystem vendor to allow its modifications.
Quoted 31 lines
drivers/vdpa/ifcvf/ifcvf_base.c +1
-1-return 0 ; +return -EOPNOTSUPP ; } void ifcvf_set_vq_num(struct ifcvf_hw *hw, u16 qid, u32 num) diff --git
a/drivers/vdpa/ifcvf/ifcvf_main.cb/drivers/vdpa/ifcvf/ifcvf_main.cindex80d0a0460885..e89fd4d96ff1100644drivers/vdpa/ifcvf/ifcvf_main.c +4
-2@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0-only /* * Intel IFC VF NIC driver for virtio dataplane offloading +* This driver also drives standard virtio-pci hardwares * * Copyright (C) 2020 Intel Corporation. * @@ -880,7 +881,9 @@ static struct pci_device_id ifcvf_pci_ids[] = { VIRTIO_TRANS_ID_BLOCK,PCI_VENDOR_ID_INTEL , VIRTIO_ID_BLOCK) }, - +/* standard virtio pci devices */ + { PCI_DEVICE(PCI_VENDOR_ID_REDHAT_QUMRANET, + PCI_ANY_ID) }, { 0 }, };MODULE_DEVICE_TABLE (pci, ifcvf_pci_ids); --2.43.0
Quoted 26 lines · Parav Pandit
Hi Lingshan,
Quoted 24 lines
From: Zhu Lingshan <[email protected]>
Sent: Tuesday, May 14, 2024 2:57 AM
To: [email protected]; [email protected]
Cc: [email protected]; Zhu Lingshan <[email protected]>
Subject: [PATCH] ifcvf/vDPA: ifcvf drives standard virtio pci devicesMost of ifcvf code work for standard virtio pci, except for bar4. This commit makes bar4 only effective for Intel products, thereby turning ifcvf into a standard virtio pci driver.
Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/Kconfig | 2 +- drivers/vdpa/ifcvf/ifcvf_base.c | 17 ++++++++++++----- drivers/vdpa/ifcvf/ifcvf_main.c | 5 ++++- 3 files changed, 17 insertions(+), 7 deletions(-)drivers/vdpa/Kconfig index renamed from drivers/vdpa/Kconfig +0
-0
656c1cb541de..dbf09f35bcef100644drivers/vdpa/Kconfig +0
-0@@ -44,7 +44,7 @@ config VDPA_USER in a userspace program.
Quoted 8 lines
drivers/vdpa/Kconfig config VDPA_USER · line 47
Quoted 3 lines
drivers/vdpa/Kconfig +1
-1config IFCVF - tristate "Intel IFC VF vDPA driver" + tristate "Intel IFC VF and standard virtio-pci vDPA driver"The virtio specification limits the subsystem vendor and device id usage for informational purposes only. Hence this change/claim here for standard is not good.
I don't have objection to have per vendor creativity in the spec, but for that let OASIS commit to ratify the spec to use subsystem vendor and device id for non-informational purposes. And amend the spec " (for informational purposes by the driver).".
The spec says:
The PCI Subsystem Vendor ID and the PCI Subsystem Device ID MAY reflect the PCI Vendor and Device ID of the environment (for informational purposes by the driver).
I don't see how this change conflicts with the spec.
Quoted 38 lines
Quoted 38 lines
drivers/vdpa/Kconfig +0
-0depends on PCI_MSI help This kernel module can drive Intel IFC VF NIC to offload diff --git
a/drivers/vdpa/ifcvf/ifcvf_base.cb/drivers/vdpa/ifcvf/ifcvf_base.cindex472daa588a9d..47bc9b11c678100644drivers/vdpa/ifcvf/ifcvf_base.c +2
-1@@ -178,7 +178,8 @@ int ifcvf_init_hw(struct ifcvf_hw *hw, struct pci_dev *pdev) hw->vring[i].irq = -EINVAL ; } - hw->lm_cfg = hw->base[IFCVF_LM_BAR ]; +if (hw->pdev->subsystem_vendor ==PCI_VENDOR_ID_INTEL ) + hw->lm_cfg = hw->base[IFCVF_LM_BAR ]; IFCVF_DBG(pdev,"PCI capability mapping: common cfg: %p, notify base:
%p\n, isr cfg: %p, device cfg: %p, multiplier: %u\n", @@ -330,18 +331,24 @@ u16ifcvf_get_vq_state(struct ifcvf_hw *hw, u16 qid)
structifcvf_lm_cfg__iomem*lm_cfg=hw->lm_cfg;
u16last_avail_idx;drivers/vdpa/ifcvf/ifcvf_base.c +2
-1- last_avail_idx =vp_ioread16 (&lm_cfg->vq_state_region + qid *2 ); +if (lm_cfg) { + last_avail_idx = vp_ioread16(&lm_cfg->vq_state_region + qid* 2);
drivers/vdpa/ifcvf/ifcvf_base.c +3
-1+return last_avail_idx; + } -return last_avail_idx; +return -EOPNOTSUPP ; }int ifcvf_set_vq_state (struct ifcvf_hw *hw,u16 qid,u16 num) {struct ifcvf_lm_cfg __iomem *lm_cfg = hw->lm_cfg;
Quoted 7 lines
drivers/vdpa/ifcvf/ifcvf_base.c u16 ifcvf_get_vq_state(struct ifcvf_hw *hw, u16 qid) · line 349
Quoted 6 lines
drivers/vdpa/ifcvf/ifcvf_base.c +4
-1-vp_iowrite16 (num, &lm_cfg->vq_state_region + qid *2 ); +if (lm_cfg) { +vp_iowrite16 (num, &lm_cfg->vq_state_region + qid *2 ); +return 0 ; + }This is more than informational and requires OASIS virtio committee to add section to indicate per subsystem vendor to allow its modifications.
This is Intel Specific implementation.
Quoted 33 lines
Quoted 32 lines
drivers/vdpa/ifcvf/ifcvf_base.c +1
-1-return 0 ; +return -EOPNOTSUPP ; } void ifcvf_set_vq_num(struct ifcvf_hw *hw, u16 qid, u32 num) diff --git
a/drivers/vdpa/ifcvf/ifcvf_main.cb/drivers/vdpa/ifcvf/ifcvf_main.cindex80d0a0460885..e89fd4d96ff1100644drivers/vdpa/ifcvf/ifcvf_main.c +4
-2@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0-only /* * Intel IFC VF NIC driver for virtio dataplane offloading +* This driver also drives standard virtio-pci hardwares * * Copyright (C) 2020 Intel Corporation. * @@ -880,7 +881,9 @@ static struct pci_device_id ifcvf_pci_ids[] = { VIRTIO_TRANS_ID_BLOCK,PCI_VENDOR_ID_INTEL , VIRTIO_ID_BLOCK) }, - +/* standard virtio pci devices */ + { PCI_DEVICE(PCI_VENDOR_ID_REDHAT_QUMRANET, + PCI_ANY_ID) }, { 0 }, };MODULE_DEVICE_TABLE (pci, ifcvf_pci_ids); --2.43.0
Quoted 43 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, May 14, 2024 6:58 AMQuoted 27 lines · Parav Pandit
Hi Lingshan,
Quoted 25 lines
From: Zhu Lingshan <[email protected]>
Sent: Tuesday, May 14, 2024 2:57 AM
To: [email protected]; [email protected]
Cc: [email protected]; Zhu Lingshan <[email protected]>
Subject: [PATCH] ifcvf/vDPA: ifcvf drives standard virtio pci devicesMost of ifcvf code work for standard virtio pci, except for bar4. This commit makes bar4 only effective for Intel products, thereby turning ifcvf into a standard virtio pci driver.
Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/Kconfig | 2 +- drivers/vdpa/ifcvf/ifcvf_base.c | 17 ++++++++++++----- drivers/vdpa/ifcvf/ifcvf_main.c | 5 ++++- 3 files changed, 17 insertions(+), 7 deletions(-)drivers/vdpa/Kconfig index renamed from drivers/vdpa/Kconfig +0
-0
656c1cb541de..dbf09f35bcef100644drivers/vdpa/Kconfig +0
-0@@ -44,7 +44,7 @@ config VDPA_USER in a userspace program.Quoted 4 lines
drivers/vdpa/Kconfig config VDPA_USER · line 47
Quoted 3 lines
drivers/vdpa/Kconfig +1
-1config IFCVF - tristate "Intel IFC VF vDPA driver" + tristate "Intel IFC VF and standard virtio-pci vDPA driver"The virtio specification limits the subsystem vendor and device id usage for
informational purposes only.
Quoted 3 lines
Hence this change/claim here for standard is not good.
I don't have objection to have per vendor creativity in the spec, but for that
let OASIS commit to ratify the spec to use subsystem vendor and device id for non-informational purposes.
Quoted 7 lines
Quoted 1 line
And amend the spec " (for informational purposes by the driver).".
The spec says:
The PCI Subsystem Vendor ID and the PCI Subsystem Device ID MAY reflect the PCI Vendor and Device ID of the environment (for informational purposes by the driver).I don't see how this change conflicts with the spec.
It does. It is used beyond the _informational_ purposes as described in the previous email. Let vp_vdpa driver handle the standard device as Michael pointed out.
Quoted 48 lines
Quoted 41 lines
Quoted 41 lines
drivers/vdpa/Kconfig +0
-1depends on PCI_MSI help This kernel module can drive Intel IFC VF NIC to offload diff --git a/drivers/vdpa/ifcvf/ifcvf_base.c
b/drivers/vdpa/ifcvf/ifcvf_base.cindex472daa588a9d..47bc9b11c678100644drivers/vdpa/ifcvf/ifcvf_base.c +0
-0@@ -178,7 +178,8 @@ int ifcvf_init_hw(struct ifcvf_hw *hw, struct
pci_dev
*pdev)
hw->vring[i].irq =-EINVAL;
}drivers/vdpa/ifcvf/ifcvf_base.c +2
-1- hw->lm_cfg = hw->base[IFCVF_LM_BAR ]; +if (hw->pdev->subsystem_vendor ==PCI_VENDOR_ID_INTEL ) + hw->lm_cfg = hw->base[IFCVF_LM_BAR ]; IFCVF_DBG(pdev, "PCI capability mapping: common cfg: %p, notify base:%p\n, isr cfg: %p, device cfg: %p, multiplier: %u\n", @@ -330,18 +331,24 @@
u16ifcvf_get_vq_state(struct ifcvf_hw *hw, u16 qid)
structifcvf_lm_cfg__iomem*lm_cfg=hw->lm_cfg; u16last_avail_idx;drivers/vdpa/ifcvf/ifcvf_base.c +2
-1- last_avail_idx =vp_ioread16 (&lm_cfg->vq_state_region + qid *2 ); +if (lm_cfg) { + last_avail_idx = vp_ioread16(&lm_cfg->vq_state_region + qid* 2);
drivers/vdpa/ifcvf/ifcvf_base.c +3
-1+return last_avail_idx; + } -return last_avail_idx; +return -EOPNOTSUPP ; }int ifcvf_set_vq_state (struct ifcvf_hw *hw,u16 qid,u16 num) {struct ifcvf_lm_cfg __iomem *lm_cfg = hw->lm_cfg;Quoted 7 lines
drivers/vdpa/ifcvf/ifcvf_base.c u16 ifcvf_get_vq_state(struct ifcvf_hw *hw, u16 qid) · line 349
Quoted 6 lines
drivers/vdpa/ifcvf/ifcvf_base.c +4
-1-vp_iowrite16 (num, &lm_cfg->vq_state_region + qid *2 ); +if (lm_cfg) { +vp_iowrite16 (num, &lm_cfg->vq_state_region + qid *2 ); +return 0 ; + }This is more than informational and requires OASIS virtio committee to add
Quoted 2 lines
section to indicate per subsystem vendor to allow its modifications. This is Intel Specific implementation.
Sure that is fine. So keep it as _intel_ driver. No need to add "and standard" and things are just fine.
Quoted 34 lines
Quoted 34 lines
Quoted 33 lines
drivers/vdpa/ifcvf/ifcvf_base.c +1
-2-return 0 ; +return -EOPNOTSUPP ; } void ifcvf_set_vq_num(struct ifcvf_hw *hw, u16 qid, u32 num) diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c
b/drivers/vdpa/ifcvf/ifcvf_main.cindex80d0a0460885..e89fd4d96ff1100644drivers/vdpa/ifcvf/ifcvf_main.c +4
-2@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0-only /* * Intel IFC VF NIC driver for virtio dataplane offloading +* This driver also drives standard virtio-pci hardwares * * Copyright (C) 2020 Intel Corporation. * @@ -880,7 +881,9 @@ static struct pci_device_id ifcvf_pci_ids[] = { VIRTIO_TRANS_ID_BLOCK,PCI_VENDOR_ID_INTEL , VIRTIO_ID_BLOCK) }, - +/* standard virtio pci devices */ + { PCI_DEVICE(PCI_VENDOR_ID_REDHAT_QUMRANET, + PCI_ANY_ID) }, { 0 }, };MODULE_DEVICE_TABLE (pci, ifcvf_pci_ids); --2.43.0
Quoted 43 lines · Parav Pandit
Quoted 43 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, May 14, 2024 6:58 AMQuoted 27 lines · Parav Pandit
Hi Lingshan,
Quoted 25 lines
From: Zhu Lingshan <[email protected]>
Sent: Tuesday, May 14, 2024 2:57 AM
To: [email protected]; [email protected]
Cc: [email protected]; Zhu Lingshan <[email protected]>
Subject: [PATCH] ifcvf/vDPA: ifcvf drives standard virtio pci devicesMost of ifcvf code work for standard virtio pci, except for bar4. This commit makes bar4 only effective for Intel products, thereby turning ifcvf into a standard virtio pci driver.
Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/Kconfig | 2 +- drivers/vdpa/ifcvf/ifcvf_base.c | 17 ++++++++++++----- drivers/vdpa/ifcvf/ifcvf_main.c | 5 ++++- 3 files changed, 17 insertions(+), 7 deletions(-)drivers/vdpa/Kconfig index renamed from drivers/vdpa/Kconfig +0
-0
656c1cb541de..dbf09f35bcef100644drivers/vdpa/Kconfig +0
-0@@ -44,7 +44,7 @@ config VDPA_USER in a userspace program.Quoted 4 lines
drivers/vdpa/Kconfig config VDPA_USER · line 47
Quoted 3 lines
drivers/vdpa/Kconfig +1
-1config IFCVF - tristate "Intel IFC VF vDPA driver" + tristate "Intel IFC VF and standard virtio-pci vDPA driver"The virtio specification limits the subsystem vendor and device id usage for
informational purposes only.
Quoted 3 lines
Hence this change/claim here for standard is not good.
I don't have objection to have per vendor creativity in the spec, but for that
let OASIS commit to ratify the spec to use subsystem vendor and device id for non-informational purposes.
Quoted 1 line
And amend the spec " (for informational purposes by the driver).".
Quoted 8 lines
Quoted 6 lines
The spec says:
The PCI Subsystem Vendor ID and the PCI Subsystem Device ID MAY reflect the PCI Vendor and Device ID of the environment (for informational purposes by the driver).I don't see how this change conflicts with the spec.
It does. It is used beyond the _informational_ purposes as described in the previous email. Let
vp_vdpadriver handle the standard device as Michael pointed out.
Informational means the information should be used by someone or some program, and every vendor has its own sud-vendor-id.
Quoted 48 lines
Quoted 48 lines
Quoted 48 lines
Quoted 37 lines
drivers/vdpa/Kconfig +0
-1depends on PCI_MSI help This kernel module can drive Intel IFC VF NIC to offload diff --git a/drivers/vdpa/ifcvf/ifcvf_base.c
b/drivers/vdpa/ifcvf/ifcvf_base.cindex472daa588a9d..47bc9b11c678100644drivers/vdpa/ifcvf/ifcvf_base.c +0
-0@@ -178,7 +178,8 @@ int ifcvf_init_hw(struct ifcvf_hw *hw, struct
pci_dev
*pdev)hw->vring[i].irq = -EINVAL; }drivers/vdpa/ifcvf/ifcvf_base.c +2
-1- hw->lm_cfg = hw->base[IFCVF_LM_BAR ]; +if (hw->pdev->subsystem_vendor ==PCI_VENDOR_ID_INTEL ) + hw->lm_cfg = hw->base[IFCVF_LM_BAR ]; IFCVF_DBG(pdev, "PCI capability mapping: common cfg: %p, notify base:%p\n, isr cfg: %p, device cfg: %p, multiplier: %u\n", @@ -330,18 +331,24 @@
u16ifcvf_get_vq_state(struct ifcvf_hw *hw, u16 qid)struct ifcvf_lm_cfg __iomem *lm_cfg = hw->lm_cfg; u16 last_avail_idx;drivers/vdpa/ifcvf/ifcvf_base.c +2
-1- last_avail_idx =vp_ioread16 (&lm_cfg->vq_state_region + qid *2 ); +if (lm_cfg) { + last_avail_idx = vp_ioread16(&lm_cfg->vq_state_region + qid* 2);
drivers/vdpa/ifcvf/ifcvf_base.c +3
-1+return last_avail_idx; + } -return last_avail_idx; +return -EOPNOTSUPP ;drivers/vdpa/ifcvf/ifcvf_base.c u16 ifcvf_get_vq_state(struct ifcvf_hw *hw, u16 qid) · line 349
Quoted 10 lines
drivers/vdpa/ifcvf/ifcvf_base.c +4
-1}int ifcvf_set_vq_state (struct ifcvf_hw *hw,u16 qid,u16 num) {struct ifcvf_lm_cfg __iomem *lm_cfg = hw->lm_cfg; -vp_iowrite16 (num, &lm_cfg->vq_state_region + qid *2 ); +if (lm_cfg) { +vp_iowrite16 (num, &lm_cfg->vq_state_region + qid *2 ); +return 0 ; + }This is more than informational and requires OASIS virtio committee to add
Quoted 4 lines
Quoted 2 lines
section to indicate per subsystem vendor to allow its modifications. This is Intel Specific implementation.
Sure that is fine. So keep it as _intel_ driver. No need to add "and standard" and things are just fine.
bar4 is still Intel only.
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
drivers/vdpa/ifcvf/ifcvf_base.c +1
-2-return 0 ; +return -EOPNOTSUPP ; } void ifcvf_set_vq_num(struct ifcvf_hw *hw, u16 qid, u32 num) diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c
b/drivers/vdpa/ifcvf/ifcvf_main.cindex80d0a0460885..e89fd4d96ff1100644drivers/vdpa/ifcvf/ifcvf_main.c +4
-2@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0-only /* * Intel IFC VF NIC driver for virtio dataplane offloading +* This driver also drives standard virtio-pci hardwares * * Copyright (C) 2020 Intel Corporation. * @@ -880,7 +881,9 @@ static struct pci_device_id ifcvf_pci_ids[] = { VIRTIO_TRANS_ID_BLOCK,PCI_VENDOR_ID_INTEL , VIRTIO_ID_BLOCK) }, - +/* standard virtio pci devices */ + { PCI_DEVICE(PCI_VENDOR_ID_REDHAT_QUMRANET, + PCI_ANY_ID) }, { 0 }, };MODULE_DEVICE_TABLE (pci, ifcvf_pci_ids); --2.43.0
Michael S. Tsirkin
maintainerQuoted 81 lines · Zhu Lingshan
Most of ifcvf code work for standard virtio pci, except for bar4. This commit makes bar4 only effective for Intel products, thereby turning ifcvf into a standard virtio pci driver.
Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/Kconfig | 2 +- drivers/vdpa/ifcvf/ifcvf_base.c | 17 ++++++++++++----- drivers/vdpa/ifcvf/ifcvf_main.c | 5 ++++- 3 files changed, 17 insertions(+), 7 deletions(-)drivers/vdpa/Kconfig +1
-1@@ -44,7 +44,7 @@ config VDPA_USER in a userspace program. config IFCVF - tristate "Intel IFC VF vDPA driver" + tristate "Intel IFC VF and standard virtio-pci vDPA driver" depends on PCI_MSI help This kernel module can drive Intel IFC VF NIC to offloaddrivers/vdpa/ifcvf/ifcvf_base.c +12
-5@@ -178,7 +178,8 @@ int ifcvf_init_hw(struct ifcvf_hw *hw, struct pci_dev *pdev) hw->vring[i].irq = -EINVAL ; } - hw->lm_cfg = hw->base[IFCVF_LM_BAR ]; +if (hw->pdev->subsystem_vendor ==PCI_VENDOR_ID_INTEL ) + hw->lm_cfg = hw->base[IFCVF_LM_BAR ]; IFCVF_DBG(pdev, "PCI capability mapping: common cfg: %p, notify base: %p\n, isr cfg: %p, device cfg: %p, multiplier: %u\n",@@ -330,18 +331,24 @@ u16 ifcvf_get_vq_state(struct ifcvf_hw *hw, u16 qid)struct ifcvf_lm_cfg __iomem *lm_cfg = hw->lm_cfg;u16 last_avail_idx; - last_avail_idx =vp_ioread16 (&lm_cfg->vq_state_region + qid *2 ); +if (lm_cfg) { + last_avail_idx =vp_ioread16 (&lm_cfg->vq_state_region + qid *2 ); +return last_avail_idx; + } -return last_avail_idx; +return -EOPNOTSUPP ; }int ifcvf_set_vq_state (struct ifcvf_hw *hw,u16 qid,u16 num) {struct ifcvf_lm_cfg __iomem *lm_cfg = hw->lm_cfg; -vp_iowrite16 (num, &lm_cfg->vq_state_region + qid *2 ); +if (lm_cfg) { +vp_iowrite16 (num, &lm_cfg->vq_state_region + qid *2 ); +return 0 ; + } -return 0 ; +return -EOPNOTSUPP ; }void ifcvf_set_vq_num (struct ifcvf_hw *hw,u16 qid,u32 num)drivers/vdpa/ifcvf/ifcvf_main.c +1
-0@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0-only /* * Intel IFC VF NIC driver for virtio dataplane offloading +* This driver also drives standard virtio-pci hardwares * * Copyright (C) 2020 Intel Corporation. *
drivers/vdpa/ifcvf/ifcvf_main.c static struct pci_device_id ifcvf_pci_ids[] = { · line 889
Quoted 10 lines
drivers/vdpa/ifcvf/ifcvf_main.c +3
-1@@ -880,7 +881,9 @@ static struct pci_device_id ifcvf_pci_ids[] = { VIRTIO_TRANS_ID_BLOCK,PCI_VENDOR_ID_INTEL , VIRTIO_ID_BLOCK) }, - +/* standard virtio pci devices */ + { PCI_DEVICE(PCI_VENDOR_ID_REDHAT_QUMRANET, + PCI_ANY_ID) }, { 0 }, };MODULE_DEVICE_TABLE (pci, ifcvf_pci_ids);
Will make it conflict with the normal virtio driver, won't it?
What are you trying to achieve here?
Quoted 2 lines
Signature · 1 line
2.43.0
Quoted 94 lines · Michael S. Tsirkin
Quoted 81 lines · Zhu Lingshan
Most of ifcvf code work for standard virtio pci, except for bar4. This commit makes bar4 only effective for Intel products, thereby turning ifcvf into a standard virtio pci driver.
Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/Kconfig | 2 +- drivers/vdpa/ifcvf/ifcvf_base.c | 17 ++++++++++++----- drivers/vdpa/ifcvf/ifcvf_main.c | 5 ++++- 3 files changed, 17 insertions(+), 7 deletions(-)drivers/vdpa/Kconfig +1
-1@@ -44,7 +44,7 @@ config VDPA_USER in a userspace program. config IFCVF - tristate "Intel IFC VF vDPA driver" + tristate "Intel IFC VF and standard virtio-pci vDPA driver" depends on PCI_MSI help This kernel module can drive Intel IFC VF NIC to offloaddrivers/vdpa/ifcvf/ifcvf_base.c +12
-5@@ -178,7 +178,8 @@ int ifcvf_init_hw(struct ifcvf_hw *hw, struct pci_dev *pdev) hw->vring[i].irq = -EINVAL ; } - hw->lm_cfg = hw->base[IFCVF_LM_BAR ]; +if (hw->pdev->subsystem_vendor ==PCI_VENDOR_ID_INTEL ) + hw->lm_cfg = hw->base[IFCVF_LM_BAR ]; IFCVF_DBG(pdev, "PCI capability mapping: common cfg: %p, notify base: %p\n, isr cfg: %p, device cfg: %p, multiplier: %u\n",@@ -330,18 +331,24 @@ u16 ifcvf_get_vq_state(struct ifcvf_hw *hw, u16 qid)struct ifcvf_lm_cfg __iomem *lm_cfg = hw->lm_cfg;u16 last_avail_idx; - last_avail_idx =vp_ioread16 (&lm_cfg->vq_state_region + qid *2 ); +if (lm_cfg) { + last_avail_idx =vp_ioread16 (&lm_cfg->vq_state_region + qid *2 ); +return last_avail_idx; + } -return last_avail_idx; +return -EOPNOTSUPP ; }int ifcvf_set_vq_state (struct ifcvf_hw *hw,u16 qid,u16 num) {struct ifcvf_lm_cfg __iomem *lm_cfg = hw->lm_cfg; -vp_iowrite16 (num, &lm_cfg->vq_state_region + qid *2 ); +if (lm_cfg) { +vp_iowrite16 (num, &lm_cfg->vq_state_region + qid *2 ); +return 0 ; + } -return 0 ; +return -EOPNOTSUPP ; }void ifcvf_set_vq_num (struct ifcvf_hw *hw,u16 qid,u32 num)drivers/vdpa/ifcvf/ifcvf_main.c +1
-0@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0-only /* * Intel IFC VF NIC driver for virtio dataplane offloading +* This driver also drives standard virtio-pci hardwares * * Copyright (C) 2020 Intel Corporation. * drivers/vdpa/ifcvf/ifcvf_main.c static struct pci_device_id ifcvf_pci_ids[] = { · line 889
Quoted 10 lines
drivers/vdpa/ifcvf/ifcvf_main.c +3
-1@@ -880,7 +881,9 @@ static struct pci_device_id ifcvf_pci_ids[] = { VIRTIO_TRANS_ID_BLOCK,PCI_VENDOR_ID_INTEL , VIRTIO_ID_BLOCK) }, - +/* standard virtio pci devices */ + { PCI_DEVICE(PCI_VENDOR_ID_REDHAT_QUMRANET, + PCI_ANY_ID) }, { 0 }, };MODULE_DEVICE_TABLE (pci, ifcvf_pci_ids);Will make it conflict with the normal virtio driver, won't it?
Quoted 1 line
What are you trying to achieve here?
The confliction exists before, in my setup, virtio-pci driver always probe virtio-pci devices before ifcvf.
Since ifcvf drives is all standard virtio-pci except for bar4, so this patch intends to maximize the use of the ifcvf driver and allow developers without Intel hardware to also develop this driver.
Thanks
Zhu Lingshan
Quoted 5 lines
Quoted 5 lines
Signature · 2 lines
-- 2.43.0
Michael S. Tsirkin
maintainerdrivers/vdpa/ifcvf/ifcvf_main.c static struct pci_device_id ifcvf_pci_ids[] = { · line 887
Quoted 9 lines · Zhu Lingshan
drivers/vdpa/ifcvf/ifcvf_main.c +3
-1@@ -880,7 +881,9 @@ static struct pci_device_id ifcvf_pci_ids[] = { VIRTIO_TRANS_ID_BLOCK,PCI_VENDOR_ID_INTEL , VIRTIO_ID_BLOCK) }, - +/* standard virtio pci devices */ + { PCI_DEVICE(PCI_VENDOR_ID_REDHAT_QUMRANET, + PCI_ANY_ID) }, { 0 },
To summarize, I don't think ifcvf should drive standard virtio devices. If it can then it sounds more like a reason to try to reuse more code from virtio core.
Quoted 4 lines
drivers/vdpa/ifcvf/ifcvf_main.c +0
-0};MODULE_DEVICE_TABLE (pci, ifcvf_pci_ids);Signature · 1 line
2.43.0
Quoted 14 lines · Michael S. Tsirkin
drivers/vdpa/ifcvf/ifcvf_main.c static struct pci_device_id ifcvf_pci_ids[] = { · line 887
Quoted 9 lines · Zhu Lingshan
drivers/vdpa/ifcvf/ifcvf_main.c +3
-1@@ -880,7 +881,9 @@ static struct pci_device_id ifcvf_pci_ids[] = { VIRTIO_TRANS_ID_BLOCK,PCI_VENDOR_ID_INTEL , VIRTIO_ID_BLOCK) }, - +/* standard virtio pci devices */ + { PCI_DEVICE(PCI_VENDOR_ID_REDHAT_QUMRANET, + PCI_ANY_ID) }, { 0 },To summarize, I don't think ifcvf should drive standard virtio devices. If it can then it sounds more like a reason to try to reuse more code from virtio core.
Yeah, OK.
By the way, I send out a V2 of MAINTAINER patch only changing my email address to kernel.org.
Quoted 7 lines
Quoted 6 lines
drivers/vdpa/ifcvf/ifcvf_main.c +0
-0};MODULE_DEVICE_TABLE (pci, ifcvf_pci_ids);Signature · 1 line
2.43.0