Lines Matching +full:comp +full:- +full:disable

1 // SPDX-License-Identifier: GPL-2.0
30 cmd.client_request.client_id = cpu_to_le16(pds_vfio->client_id); in pds_vfio_client_adminq_cmd()
39 if (err && err != -EAGAIN) in pds_vfio_client_adminq_cmd()
53 snprintf(devname, sizeof(devname), "%s.%d-%u", PDS_VFIO_LM_DEV_NAME, in pds_vfio_register_client_cmd()
54 pci_domain_nr(pdev->bus), in pds_vfio_register_client_cmd()
55 PCI_DEVID(pdev->bus->number, pdev->devfn)); in pds_vfio_register_client_cmd()
65 pds_vfio->client_id = ci; in pds_vfio_register_client_cmd()
80 err = pds_client_unregister(pdsc, pds_vfio->client_id); in pds_vfio_unregister_client_cmd()
82 dev_err(&pdev->dev, "unregister from DSC failed: %pe\n", in pds_vfio_unregister_client_cmd()
85 pds_vfio->client_id = 0; in pds_vfio_unregister_client_cmd()
94 .vf_id = cpu_to_le16(pds_vfio->vf_id), in pds_vfio_suspend_wait_device_cmd()
99 union pds_core_adminq_comp comp = {}; in pds_vfio_suspend_wait_device_cmd() local
108 err = pds_vfio_client_adminq_cmd(pds_vfio, &cmd, &comp, true); in pds_vfio_suspend_wait_device_cmd()
109 if (err != -EAGAIN) in pds_vfio_suspend_wait_device_cmd()
116 dev_dbg(dev, "%s: vf%u: Suspend comp received in %d msecs\n", __func__, in pds_vfio_suspend_wait_device_cmd()
117 pds_vfio->vf_id, jiffies_to_msecs(time_done - time_start)); in pds_vfio_suspend_wait_device_cmd()
121 dev_err(dev, "%s: vf%u: Suspend comp timeout\n", __func__, in pds_vfio_suspend_wait_device_cmd()
122 pds_vfio->vf_id); in pds_vfio_suspend_wait_device_cmd()
123 err = -ETIMEDOUT; in pds_vfio_suspend_wait_device_cmd()
134 .vf_id = cpu_to_le16(pds_vfio->vf_id), in pds_vfio_suspend_device_cmd()
139 union pds_core_adminq_comp comp = {}; in pds_vfio_suspend_device_cmd() local
142 dev_dbg(dev, "vf%u: Suspend device\n", pds_vfio->vf_id); in pds_vfio_suspend_device_cmd()
149 err = pds_vfio_client_adminq_cmd(pds_vfio, &cmd, &comp, true); in pds_vfio_suspend_device_cmd()
151 dev_err(dev, "vf%u: Suspend failed: %pe\n", pds_vfio->vf_id, in pds_vfio_suspend_device_cmd()
168 .vf_id = cpu_to_le16(pds_vfio->vf_id), in pds_vfio_resume_device_cmd()
173 union pds_core_adminq_comp comp = {}; in pds_vfio_resume_device_cmd() local
175 dev_dbg(dev, "vf%u: Resume device\n", pds_vfio->vf_id); in pds_vfio_resume_device_cmd()
177 return pds_vfio_client_adminq_cmd(pds_vfio, &cmd, &comp, true); in pds_vfio_resume_device_cmd()
185 .vf_id = cpu_to_le16(pds_vfio->vf_id), in pds_vfio_get_lm_state_size_cmd()
189 union pds_core_adminq_comp comp = {}; in pds_vfio_get_lm_state_size_cmd() local
192 dev_dbg(dev, "vf%u: Get migration status\n", pds_vfio->vf_id); in pds_vfio_get_lm_state_size_cmd()
194 err = pds_vfio_client_adminq_cmd(pds_vfio, &cmd, &comp, false); in pds_vfio_get_lm_state_size_cmd()
198 *size = le64_to_cpu(comp.lm_state_size.size); in pds_vfio_get_lm_state_size_cmd()
214 return -EINVAL; in pds_vfio_dma_map_lm_file()
217 err = dma_map_sgtable(dev, &lm_file->sg_table, dir, 0); in pds_vfio_dma_map_lm_file()
221 lm_file->num_sge = lm_file->sg_table.nents; in pds_vfio_dma_map_lm_file()
224 sgl_size = lm_file->num_sge * sizeof(struct pds_lm_sg_elem); in pds_vfio_dma_map_lm_file()
227 err = -ENOMEM; in pds_vfio_dma_map_lm_file()
233 for_each_sgtable_dma_sg(&lm_file->sg_table, sg, i) { in pds_vfio_dma_map_lm_file()
234 sge->addr = cpu_to_le64(sg_dma_address(sg)); in pds_vfio_dma_map_lm_file()
235 sge->len = cpu_to_le32(sg_dma_len(sg)); in pds_vfio_dma_map_lm_file()
236 dev_dbg(dev, "addr = %llx, len = %u\n", sge->addr, sge->len); in pds_vfio_dma_map_lm_file()
242 err = -EIO; in pds_vfio_dma_map_lm_file()
246 lm_file->sgl = sgl; in pds_vfio_dma_map_lm_file()
247 lm_file->sgl_addr = sgl_addr; in pds_vfio_dma_map_lm_file()
254 lm_file->num_sge = 0; in pds_vfio_dma_map_lm_file()
255 dma_unmap_sgtable(dev, &lm_file->sg_table, dir, 0); in pds_vfio_dma_map_lm_file()
267 if (lm_file->sgl) { in pds_vfio_dma_unmap_lm_file()
268 dma_unmap_single(dev, lm_file->sgl_addr, in pds_vfio_dma_unmap_lm_file()
269 lm_file->num_sge * sizeof(*lm_file->sgl), in pds_vfio_dma_unmap_lm_file()
271 kfree(lm_file->sgl); in pds_vfio_dma_unmap_lm_file()
272 lm_file->sgl = NULL; in pds_vfio_dma_unmap_lm_file()
273 lm_file->sgl_addr = DMA_MAPPING_ERROR; in pds_vfio_dma_unmap_lm_file()
274 lm_file->num_sge = 0; in pds_vfio_dma_unmap_lm_file()
278 dma_unmap_sgtable(dev, &lm_file->sg_table, dir, 0); in pds_vfio_dma_unmap_lm_file()
286 .vf_id = cpu_to_le16(pds_vfio->vf_id), in pds_vfio_get_lm_state_cmd()
290 struct device *pdsc_dev = &pci_physfn(pdev)->dev; in pds_vfio_get_lm_state_cmd()
291 union pds_core_adminq_comp comp = {}; in pds_vfio_get_lm_state_cmd() local
295 dev_dbg(&pdev->dev, "vf%u: Get migration state\n", pds_vfio->vf_id); in pds_vfio_get_lm_state_cmd()
297 lm_file = pds_vfio->save_file; in pds_vfio_get_lm_state_cmd()
301 dev_err(&pdev->dev, "failed to map save migration file: %pe\n", in pds_vfio_get_lm_state_cmd()
306 cmd.lm_save.sgl_addr = cpu_to_le64(lm_file->sgl_addr); in pds_vfio_get_lm_state_cmd()
307 cmd.lm_save.num_sge = cpu_to_le32(lm_file->num_sge); in pds_vfio_get_lm_state_cmd()
309 err = pds_vfio_client_adminq_cmd(pds_vfio, &cmd, &comp, false); in pds_vfio_get_lm_state_cmd()
311 dev_err(&pdev->dev, "failed to get migration state: %pe\n", in pds_vfio_get_lm_state_cmd()
324 .vf_id = cpu_to_le16(pds_vfio->vf_id), in pds_vfio_set_lm_state_cmd()
328 struct device *pdsc_dev = &pci_physfn(pdev)->dev; in pds_vfio_set_lm_state_cmd()
329 union pds_core_adminq_comp comp = {}; in pds_vfio_set_lm_state_cmd() local
333 dev_dbg(&pdev->dev, "vf%u: Set migration state\n", pds_vfio->vf_id); in pds_vfio_set_lm_state_cmd()
335 lm_file = pds_vfio->restore_file; in pds_vfio_set_lm_state_cmd()
339 dev_err(&pdev->dev, in pds_vfio_set_lm_state_cmd()
345 cmd.lm_restore.sgl_addr = cpu_to_le64(lm_file->sgl_addr); in pds_vfio_set_lm_state_cmd()
346 cmd.lm_restore.num_sge = cpu_to_le32(lm_file->num_sge); in pds_vfio_set_lm_state_cmd()
348 err = pds_vfio_client_adminq_cmd(pds_vfio, &cmd, &comp, false); in pds_vfio_set_lm_state_cmd()
350 dev_err(&pdev->dev, "failed to set migration state: %pe\n", in pds_vfio_set_lm_state_cmd()
364 .vf_id = cpu_to_le16(pds_vfio->vf_id), in pds_vfio_send_host_vf_lm_status_cmd()
369 union pds_core_adminq_comp comp = {}; in pds_vfio_send_host_vf_lm_status_cmd() local
372 dev_dbg(dev, "vf%u: Set host VF LM status: %u", pds_vfio->vf_id, in pds_vfio_send_host_vf_lm_status_cmd()
381 err = pds_vfio_client_adminq_cmd(pds_vfio, &cmd, &comp, false); in pds_vfio_send_host_vf_lm_status_cmd()
393 .vf_id = cpu_to_le16(pds_vfio->vf_id), in pds_vfio_dirty_status_cmd()
397 union pds_core_adminq_comp comp = {}; in pds_vfio_dirty_status_cmd() local
400 dev_dbg(dev, "vf%u: Dirty status\n", pds_vfio->vf_id); in pds_vfio_dirty_status_cmd()
405 err = pds_vfio_client_adminq_cmd(pds_vfio, &cmd, &comp, false); in pds_vfio_dirty_status_cmd()
412 if (!(le32_to_cpu(comp.lm_dirty_status.bmp_type_mask) & in pds_vfio_dirty_status_cmd()
415 return -EOPNOTSUPP; in pds_vfio_dirty_status_cmd()
418 *num_regions = comp.lm_dirty_status.num_regions; in pds_vfio_dirty_status_cmd()
419 *max_regions = comp.lm_dirty_status.max_regions; in pds_vfio_dirty_status_cmd()
434 .vf_id = cpu_to_le16(pds_vfio->vf_id), in pds_vfio_dirty_enable_cmd()
441 union pds_core_adminq_comp comp = {}; in pds_vfio_dirty_enable_cmd() local
444 err = pds_vfio_client_adminq_cmd(pds_vfio, &cmd, &comp, false); in pds_vfio_dirty_enable_cmd()
459 .vf_id = cpu_to_le16(pds_vfio->vf_id), in pds_vfio_dirty_disable_cmd()
463 union pds_core_adminq_comp comp = {}; in pds_vfio_dirty_disable_cmd() local
466 err = pds_vfio_client_adminq_cmd(pds_vfio, &cmd, &comp, false); in pds_vfio_dirty_disable_cmd()
467 if (err || comp.lm_dirty_status.num_regions != 0) { in pds_vfio_dirty_disable_cmd()
468 /* in case num_regions is still non-zero after disable */ in pds_vfio_dirty_disable_cmd()
469 err = err ? err : -EIO; in pds_vfio_dirty_disable_cmd()
471 "failed dirty tracking disable: %pe, num_regions %d\n", in pds_vfio_dirty_disable_cmd()
472 ERR_PTR(err), comp.lm_dirty_status.num_regions); in pds_vfio_dirty_disable_cmd()
486 .vf_id = cpu_to_le16(pds_vfio->vf_id), in pds_vfio_dirty_seq_ack_cmd()
494 union pds_core_adminq_comp comp = {}; in pds_vfio_dirty_seq_ack_cmd() local
502 err = pds_vfio_client_adminq_cmd(pds_vfio, &cmd, &comp, false); in pds_vfio_dirty_seq_ack_cmd()