Subject: [PATCH 1/2] drm/amdgpu: change vm_inv_engs array based on new GFXHUB/MMHUB layout

From: Yifan Zhang <[email-masked]>
Date: Thu, 4 May 2023 23:50:22 +0800

vm_inv_engs should be changd accordingly.

Signed-off-by: Yifan Zhang <[email-masked]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
index 8c8a2f37ba33..eeaa8d215801 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
@@ -539,12 +539,14 @@ void amdgpu_gmc_ras_fini(struct amdgpu_device *adev)
 int amdgpu_gmc_allocate_vm_inv_eng(struct amdgpu_device *adev)
 {
 	struct amdgpu_ring *ring;
-	unsigned vm_inv_engs[AMDGPU_MAX_VMHUBS] =
-		{GFXHUB_FREE_VM_INV_ENGS_BITMAP, MMHUB_FREE_VM_INV_ENGS_BITMAP,
-		GFXHUB_FREE_VM_INV_ENGS_BITMAP};
+	unsigned vm_inv_engs[AMDGPU_MAX_VMHUBS];
 	unsigned i;
 	unsigned vmhub, inv_eng;
 
+	vm_inv_engs[AMDGPU_GFXHUB(0)] = GFXHUB_FREE_VM_INV_ENGS_BITMAP;
+	vm_inv_engs[AMDGPU_GFXHUB(1)] = GFXHUB_FREE_VM_INV_ENGS_BITMAP;
+	vm_inv_engs[AMDGPU_MMHUB0(0)] = MMHUB_FREE_VM_INV_ENGS_BITMAP;
+
 	if (adev->enable_mes) {
 		/* reserve engine 5 for firmware */
 		for (vmhub = 0; vmhub < AMDGPU_MAX_VMHUBS; vmhub++)
-- 
2.37.3