Skip to content

Commit 387b845

Browse files
committed
accel/amdxdna: skip destroy VFs cmd when no VFs were created
When unloading the driver, aie4_sriov_stop() unconditionally sends a destroy VFs firmware command even when no VFs were ever created. This causes the firmware to return an error: amdxdna: [drm] *ERROR* aie_send_mgmt_msg_wait: command opcode 0x20002 failed, status 0x1 amdxdna: [drm] *ERROR* aie4_destroy_vfs: destroy vfs op failed: -22 Fix this by checking pci_num_vf() at the top of aie4_sriov_stop() and returning early if no VFs exist. Signed-off-by: Nishad Saraf <nishads@amd.com>
1 parent a543077 commit 387b845

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/accel/amdxdna/aie4_sriov.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ int aie4_sriov_stop(struct amdxdna_dev_hdl *ndev)
4545
struct pci_dev *pdev = to_pci_dev(xdna->ddev.dev);
4646
int ret;
4747

48+
if (!pci_num_vf(pdev))
49+
return 0;
50+
4851
ret = pci_vfs_assigned(pdev);
4952
if (ret) {
5053
XDNA_ERR(xdna, "VFs are still assigned to VMs");

0 commit comments

Comments
 (0)