nvmf/vfio-user: save/restore CSTS register when doing live migration

The CSTS register in source VM was left to migrate.

Fix #2362.

Change-Id: Ieef028578d2897b27a6ff594b16801462eb1b75e
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11418
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Dong Yi <dongx.yi@intel.com>
Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Changpeng Liu 2022-02-07 16:32:33 +08:00
parent c833f6aa3e
commit 903dd88c22

View File

@ -2470,6 +2470,7 @@ vfio_user_migr_ctrlr_save_data(struct nvmf_vfio_user_ctrlr *vu_ctrlr)
regs = (struct spdk_nvme_registers *)&migr_state.bar0;
/* Save mandarory registers to bar0 */
regs->csts.raw = ctrlr->vcprop.csts.raw;
regs->cap.raw = ctrlr->vcprop.cap.raw;
regs->vs.raw = ctrlr->vcprop.vs.raw;
regs->cc.raw = ctrlr->vcprop.cc.raw;
@ -2659,6 +2660,7 @@ vfio_user_migr_ctrlr_restore(struct nvmf_vfio_user_ctrlr *vu_ctrlr)
memcpy((void *)vu_ctrlr->doorbells, doorbell_base, NVMF_VFIO_USER_DOORBELLS_SIZE);
/* restore controller registers after ADMIN queue connection */
ctrlr->vcprop.csts.raw = regs->csts.raw;
ctrlr->vcprop.cap.raw = regs->cap.raw;
ctrlr->vcprop.vs.raw = regs->vs.raw;
ctrlr->vcprop.cc.raw = regs->cc.raw;