[PATCH] drm/amdgpu: Fix logic to fetch supported NPS modes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Correct the logic to find supported NPS modes from firmware.

Signed-off-by: Lijo Lazar <lijo.lazar@xxxxxxx>
Reported-by: Ava Zhang <niandong.zhang@xxxxxxx>

Fixes: cdb41537812f ("drm/amdgpu: Use firmware supported NPS modes")
---
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
index ccb31e724b55..49630f838d45 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -1607,9 +1607,8 @@ static void gmc_v9_0_init_nps_details(struct amdgpu_device *adev)
 
 	/* Mode detected by hardware and supported modes available */
 	if ((mode != UNKNOWN_MEMORY_PARTITION_MODE) && supp_modes) {
-		for (i = AMDGPU_NPS1_PARTITION_MODE;
-		     supp_modes && i <= AMDGPU_NPS8_PARTITION_MODE; i++) {
-			if (supp_modes & BIT(i - 1))
+		while (i = ffs(supp_modes)) {
+			if (AMDGPU_ALL_NPS_MASK & BIT(i))
 				adev->gmc.supported_nps_modes |= BIT(i);
 			supp_modes &= supp_modes - 1;
 		}
-- 
2.25.1




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux