Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/amd/pm: Fix mode2 reset ACK handling on aldebaran v2

aldebaran_mode2_reset() sends a mode2 reset message and waits for
an acknowledgment from the SMU.

The current ACK handling is incorrect.

The wait loop runs only when ret is -ETIME. But after a successful
async send, ret is 0. Because of this, the loop is skipped and the
code does not wait for the reset acknowledgment.

Also, the code checks for ret != 1 after calling
smu_msg_wait_response(). However, smu_msg_wait_response() returns
0 on success and negative error codes on failure. So checking
against 1 is wrong.

Return -EOPNOTSUPP when the firmware does not support this reset
message.

Fix this by setting ret to -ETIME before entering the wait loop,
checking for ret != 0 after getting the SMU response, and returning
-EOPNOTSUPP when the firmware does not support the message.

v2:
- Update ACK check to use ret != 0 instead of ret != 1, since
smu_msg_wait_response() returns 0 on success (Feifei)
- Remove unnecessary handling for ret == 0

Fixes: e42569d02acb ("drm/amd/pm: Modify mode2 msg sequence on aldebaran")
Reported-by: Dan Carpenter <error27@gmail.com>
Cc: Feifei Xu <Feifei.Xu@amd.com>
Cc: Lijo Lazar <lijo.lazar@amd.com>
Cc: Hawking Zhang <Hawking.Zhang@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Srinivasan Shanmugam and committed by
Alex Deucher
a6d561a8 e81a492d

+3 -3
+3 -3
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
··· 1846 1846 amdgpu_device_load_pci_state(adev->pdev); 1847 1847 1848 1848 dev_dbg(adev->dev, "wait for reset ack\n"); 1849 + ret = -ETIME; 1849 1850 while (ret == -ETIME && timeout) { 1850 1851 ret = smu_msg_wait_response(ctl, 0); 1851 1852 /* Wait a bit more time for getting ACK */ ··· 1856 1855 continue; 1857 1856 } 1858 1857 1859 - if (ret != 1) { 1858 + if (ret != 0) { 1860 1859 dev_err(adev->dev, "failed to send mode2 message \tparam: 0x%08x response %#x\n", 1861 1860 SMU_RESET_MODE_2, ret); 1862 1861 goto out; ··· 1866 1865 } else { 1867 1866 dev_err(adev->dev, "smu fw 0x%x does not support MSG_GfxDeviceDriverReset MSG\n", 1868 1867 smu->smc_fw_version); 1868 + ret = -EOPNOTSUPP; 1869 1869 } 1870 1870 1871 - if (ret == 1) 1872 - ret = 0; 1873 1871 out: 1874 1872 mutex_unlock(&ctl->lock); 1875 1873