vDPA/ifcvf: retire ifcvf_start_datapath and ifcvf_add_status
authorZhu Lingshan <lingshan.zhu@intel.com>
Fri, 26 May 2023 14:52:52 +0000 (22:52 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 27 Jun 2023 14:47:07 +0000 (10:47 -0400)
Rather than former lazy-initialization mechanism,
now the virtqueue operations and driver_features related
ops access the virtio registers directly to take
immediate actions. So ifcvf_start_datapath() should
retire.

ifcvf_add_status() is retierd because we should not change
device status by a vendor driver's decision, this driver should
only set device status which is from virito drivers
upon vdpa_ops.set_status()

Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20230526145254.39537-4-lingshan.zhu@intel.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/vdpa/ifcvf/ifcvf_base.c
drivers/vdpa/ifcvf/ifcvf_base.h
drivers/vdpa/ifcvf/ifcvf_main.c

index 546e923..79e313c 100644 (file)
@@ -178,15 +178,6 @@ void ifcvf_reset(struct ifcvf_hw *hw)
        ifcvf_get_status(hw);
 }
 
-static void ifcvf_add_status(struct ifcvf_hw *hw, u8 status)
-{
-       if (status != 0)
-               status |= ifcvf_get_status(hw);
-
-       ifcvf_set_status(hw, status);
-       ifcvf_get_status(hw);
-}
-
 u64 ifcvf_get_hw_features(struct ifcvf_hw *hw)
 {
        struct virtio_pci_common_cfg __iomem *cfg = hw->common_cfg;
@@ -387,16 +378,6 @@ static void ifcvf_hw_disable(struct ifcvf_hw *hw)
        }
 }
 
-int ifcvf_start_hw(struct ifcvf_hw *hw)
-{
-       ifcvf_add_status(hw, VIRTIO_CONFIG_S_ACKNOWLEDGE);
-       ifcvf_add_status(hw, VIRTIO_CONFIG_S_DRIVER);
-
-       ifcvf_add_status(hw, VIRTIO_CONFIG_S_DRIVER_OK);
-
-       return 0;
-}
-
 void ifcvf_stop_hw(struct ifcvf_hw *hw)
 {
        ifcvf_hw_disable(hw);
index cb19196..d34d3bc 100644 (file)
@@ -110,7 +110,6 @@ struct ifcvf_vdpa_mgmt_dev {
 };
 
 int ifcvf_init_hw(struct ifcvf_hw *hw, struct pci_dev *dev);
-int ifcvf_start_hw(struct ifcvf_hw *hw);
 void ifcvf_stop_hw(struct ifcvf_hw *hw);
 void ifcvf_notify_queue(struct ifcvf_hw *hw, u16 qid);
 void ifcvf_read_dev_config(struct ifcvf_hw *hw, u64 offset,
index 4588484..9686871 100644 (file)
@@ -346,22 +346,6 @@ static int ifcvf_request_irq(struct ifcvf_hw *vf)
        return 0;
 }
 
-static int ifcvf_start_datapath(struct ifcvf_adapter *adapter)
-{
-       struct ifcvf_hw *vf = adapter->vf;
-       u8 status;
-       int ret;
-
-       ret = ifcvf_start_hw(vf);
-       if (ret < 0) {
-               status = ifcvf_get_status(vf);
-               status |= VIRTIO_CONFIG_S_FAILED;
-               ifcvf_set_status(vf, status);
-       }
-
-       return ret;
-}
-
 static int ifcvf_stop_datapath(struct ifcvf_adapter *adapter)
 {
        struct ifcvf_hw *vf = adapter->vf;
@@ -452,13 +436,11 @@ static u8 ifcvf_vdpa_get_status(struct vdpa_device *vdpa_dev)
 
 static void ifcvf_vdpa_set_status(struct vdpa_device *vdpa_dev, u8 status)
 {
-       struct ifcvf_adapter *adapter;
        struct ifcvf_hw *vf;
        u8 status_old;
        int ret;
 
        vf  = vdpa_to_vf(vdpa_dev);
-       adapter = vdpa_to_adapter(vdpa_dev);
        status_old = ifcvf_get_status(vf);
 
        if (status_old == status)
@@ -473,11 +455,6 @@ static void ifcvf_vdpa_set_status(struct vdpa_device *vdpa_dev, u8 status)
                        ifcvf_set_status(vf, status);
                        return;
                }
-
-               if (ifcvf_start_datapath(adapter) < 0)
-                       IFCVF_ERR(adapter->pdev,
-                                 "Failed to set ifcvf vdpa  status %u\n",
-                                 status);
        }
 
        ifcvf_set_status(vf, status);