Skip to contentSkip to conversation

vfio/pds: Send type for SUSPEND_STATUS command

PATCH Applied Brett Creeley 3 participants 3 messages Aug 21, 2023 – Aug 22, 2023

Subsystems (6)
lore
Share & tools
lore

Brett Creeley

author maintainer
#0 lore raw

PATCH 1/1 vfio/pds: Send type for SUSPEND_STATUS command

Commit bb500dbe2ac6 ("vfio/pds: Add VFIO live migration support") added live migration support for the pds-vfio-pci driver. When sending the SUSPEND command to the device, the driver sets the type of suspend (i.e. P2P or FULL). However, the driver isn't sending the type of suspend for the SUSPEND_STATUS command, which will result in failures. Fix this by also sending the suspend type in the SUSPEND_STATUS command.

Fixes bb500dbe2ac6 ("vfio/pds: Add VFIO live migration support")
---
 drivers/vfio/pci/pds/cmds.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/vfio/pci/pds/cmds.c +3 -2
index b0d88442b091..36463ccc3df9 100644
@@ -86,12 +86,13 @@ void pds_vfio_unregister_client_cmd(struct pds_vfio_pci_device *pds_vfio)
 }
 
 static int
-pds_vfio_suspend_wait_device_cmd(struct pds_vfio_pci_device *pds_vfio)
+pds_vfio_suspend_wait_device_cmd(struct pds_vfio_pci_device *pds_vfio, u8 type)
 {
 	union pds_core_adminq_cmd cmd = {
 		.lm_suspend_status = {
 			.opcode = PDS_LM_CMD_SUSPEND_STATUS,
 			.vf_id = cpu_to_le16(pds_vfio->vf_id),
+			.type = type,
 		},
 	};
 	struct device *dev = pds_vfio_to_dev(pds_vfio);
@@ -156,7 +157,7 @@ int pds_vfio_suspend_device_cmd(struct pds_vfio_pci_device *pds_vfio, u8 type)
 	 * The subsequent suspend status request(s) check if the firmware has
 	 * completed the device suspend process.
 	 */
-	return pds_vfio_suspend_wait_device_cmd(pds_vfio);
+	return pds_vfio_suspend_wait_device_cmd(pds_vfio, type);
 }
 
 int pds_vfio_resume_device_cmd(struct pds_vfio_pci_device *pds_vfio, u8 type)
Signature · 1 line
2.17.1
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Brett Creeley

Commit bb500dbe2ac6 ("vfio/pds: Add VFIO live migration support") added live migration support for the pds-vfio-pci driver. When sending the SUSPEND command to the device, the driver sets the type of suspend (i.e. P2P or FULL). However, the driver isn't sending the type of suspend for the SUSPEND_STATUS command, which will result in failures. Fix this by also sending the suspend type in the SUSPEND_STATUS command.

Fixes bb500dbe2ac6 ("vfio/pds: Add VFIO live migration support")
#2 lore raw
In reply to Brett Creeley
Quoted 8 lines · On Mon, 21 Aug 2023 11:42:15 -0700 Brett Creeley <[email protected]> wrote:

Commit bb500dbe2ac6 ("vfio/pds: Add VFIO live migration support") added live migration support for the pds-vfio-pci driver. When sending the SUSPEND command to the device, the driver sets the type of suspend (i.e. P2P or FULL). However, the driver isn't sending the type of suspend for the SUSPEND_STATUS command, which will result in failures. Fix this by also sending the suspend type in the SUSPEND_STATUS command.

Quoted 6 lines
Fixes bb500dbe2ac6 ("vfio/pds: Add VFIO live migration support")
---
 drivers/vfio/pci/pds/cmds.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Applied to vfio next branch for v6.6. Thanks,

Alex

Quoted 29 lines
drivers/vfio/pci/pds/cmds.c +3 -2
index b0d88442b091..36463ccc3df9 100644
@@ -86,12 +86,13 @@ void pds_vfio_unregister_client_cmd(struct pds_vfio_pci_device *pds_vfio)
 }
 
 static int
-pds_vfio_suspend_wait_device_cmd(struct pds_vfio_pci_device *pds_vfio)
+pds_vfio_suspend_wait_device_cmd(struct pds_vfio_pci_device *pds_vfio, u8 type)
 {
 	union pds_core_adminq_cmd cmd = {
 		.lm_suspend_status = {
 			.opcode = PDS_LM_CMD_SUSPEND_STATUS,
 			.vf_id = cpu_to_le16(pds_vfio->vf_id),
+			.type = type,
 		},
 	};
 	struct device *dev = pds_vfio_to_dev(pds_vfio);
@@ -156,7 +157,7 @@ int pds_vfio_suspend_device_cmd(struct pds_vfio_pci_device *pds_vfio, u8 type)
 	 * The subsequent suspend status request(s) check if the firmware has
 	 * completed the device suspend process.
 	 */
-	return pds_vfio_suspend_wait_device_cmd(pds_vfio);
+	return pds_vfio_suspend_wait_device_cmd(pds_vfio, type);
 }
 
 int pds_vfio_resume_device_cmd(struct pds_vfio_pci_device *pds_vfio, u8 type)