vdpa/ifc/base: wait for disabling before saving queue state

Some ifc hardware require synchronization between disabling a queue and
saving queue-state from LM registers. When queue is disabled from vDPA
driver, ifc device stops executing new virtio-cmds and then updates LM
registers with used/avail index. Before saving the queue-state, vDPA
driver should wait until the queue is disabled from backend.

Fixes: 5d75517beffe ("vdpa/ifc/base: access block device registers")
Cc: stable@dpdk.org

Signed-off-by: Abhishek Maheshwari <abhishek.maheshwari@intel.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
Acked-by: Andy Pei <andy.pei@intel.com>
Reviewed-by: Mandal Purna Chandra <purna.chandra.mandal@intel.com>
This commit is contained in:
Abhishek Maheshwari 2022-11-03 15:05:00 +05:30 committed by Chenbo Xia
parent 04f68bb92b
commit 518a27ef6b

View File

@ -401,6 +401,7 @@ ifcvf_hw_disable(struct ifcvf_hw *hw)
u32 i;
struct ifcvf_pci_common_cfg *cfg;
u32 ring_state;
int q_disable_try;
cfg = hw->common_cfg;
if (!cfg) {
@ -419,6 +420,20 @@ ifcvf_hw_disable(struct ifcvf_hw *hw)
continue;
}
/* Some ifc hardware require synchronization between disabling a
* queue and saving queue-state from LM registers. When queue is
* disabled from vDPA driver, ifc device stops executing new
* virtio-cmds and then updates LM registers with used/avail
* index. Before saving the queue-state, vDPA driver waits until
* the queue is disabled from backend.
*/
q_disable_try = 10;
while (q_disable_try-- && IFCVF_READ_REG16(&cfg->queue_enable))
msec_delay(10);
if (!q_disable_try)
WARNINGOUT("Failed to disable Q:%u, Saved state could be invalid\n", i);
if (hw->device_type == IFCVF_BLK)
ring_state = *(u32 *)(hw->lm_cfg +
IFCVF_LM_RING_STATE_OFFSET +