Re: [RFC PATCH 4/5] nvme-vfio: check if the hardware supports live migration

Keith Busch
2022-12-06T13:48:23Z

On Tue, Dec 06, 2022 at 01:58:15PM +0800, Lei Rao wrote:
> +static bool nvmevf_check_migration(struct pci_dev *pdev)
> +{
> + struct nvme_command c = { };
> + struct nvme_id_ctrl *id;
> + u8 live_mig_support;
> + int ret;
> +
> + c.identify.opcode = nvme_admin_identify;
> + c.identify.cns = NVME_ID_CNS_CTRL;
> +
> + id = kmalloc(sizeof(struct nvme_id_ctrl), GFP_KERNEL);
> + if (!id)
> + return false;
> +
> + ret = nvme_submit_vf_cmd(pdev, &c, NULL, id, sizeof(struct nvme_id_ctrl));
> + if (ret) {
> + dev_warn(&pdev->dev, "Get identify ctrl failed (ret=0x%x)\n", ret);
> + goto out;
> + }
> +
> + live_mig_support = id->vs[0];

Considering this is a vendor specific region, it seems rather presumptuous to
assume this byte means "live migration supported".