From: Hawking Zhang <[email protected]>

gmc v12_1 currently derives the number of mmhub vmhubs
from the aid_mask when populating vmhubs_mask. This
breaks when mmhub is represented by mid and mmhub
inst_mask does not match the aid_mask.

Iterate over adev->mmhub.inst_mask instead so vmhubs_mask
reflects the discovered mmhub instances.

Signed-off-by: Hawking Zhang <[email protected]>
Reviewed-by: Mangesh Gadre <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c 
b/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c
index 2c7e3eae7b237..8ad0c1d0f9877 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c
@@ -845,7 +845,7 @@ static int gmc_v12_0_sw_init(struct amdgpu_ip_block 
*ip_block)
        case IP_VERSION(12, 1, 0):
                bitmap_set(adev->vmhubs_mask, AMDGPU_GFXHUB(0),
                                NUM_XCC(adev->gfx.xcc_mask));
-               for (i = 0; i < hweight32(adev->aid_mask); i++)
+               for_each_inst(i, adev->mmhub.inst_mask)
                        set_bit(AMDGPU_MMHUB0(i), adev->vmhubs_mask);
                /*
                 * To fulfill 5-level page support,
-- 
2.55.0

Reply via email to