Skip to contentSkip to conversation

drm/amdgpu: refine default gart size

PATCH In review Alex Deucher 3 participants 4 messages Aug 22, 2017 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/amdgpu: refine default gart size

Be more explicit and add comments explaining each case. Also s/gart/GART/ in the parameter string as per Felix' suggestion.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c | 38 +++++++++++++++++++++++++++-----
 2 files changed, 33 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -1
index 7d5b008..21116fc 100644
@@ -129,7 +129,7 @@ module_param_named(vramlimit, amdgpu_vram_limit, int, 0600);
 MODULE_PARM_DESC(vis_vramlimit, "Restrict visible VRAM for testing, in megabytes");
 module_param_named(vis_vramlimit, amdgpu_vis_vram_limit, int, 0444);
 
-MODULE_PARM_DESC(gartsize, "Size of gart to setup in megabytes (32, 64, etc., -1=auto)");
+MODULE_PARM_DESC(gartsize, "Size of GART to setup in megabytes (32, 64, etc., -1=auto)");
 module_param_named(gartsize, amdgpu_gart_size, uint, 0600);
 
 MODULE_PARM_DESC(gttsize, "Size of the GTT domain in megabytes (-1 = auto)");
drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c +32 -6
index b9b9f68..2027eb0 100644
@@ -68,13 +68,39 @@ void amdgpu_gart_set_defaults(struct amdgpu_device *adev)
 	u64 gart_size;
 
 	if (amdgpu_gart_size == -1) {
-		/* make the GART larger for chips that
-		 * dont' support VM for all rings
-		 */
-		if (adev->asic_type <= CHIP_STONEY)
-			gart_size = 1024;
-		else
+		switch (adev->asic_type) {
+#ifdef CONFIG_DRM_AMDGPU_SI
+		case CHIP_HAINAN:    /* no MM engines */
+#endif
+		case CHIP_TOPAZ:     /* no MM engines */
+		case CHIP_POLARIS11: /* all engines support GPUVM */
+		case CHIP_POLARIS10: /* all engines support GPUVM */
+		case CHIP_POLARIS12: /* all engines support GPUVM */
+		case CHIP_VEGA10:    /* all engines support GPUVM */
+		default:
 			gart_size = 256;
+			break;
+#ifdef CONFIG_DRM_AMDGPU_SI
+		case CHIP_VERDE:    /* UVD, VCE do not support GPUVM */
+		case CHIP_TAHITI:   /* UVD, VCE do not support GPUVM */
+		case CHIP_PITCAIRN: /* UVD, VCE do not support GPUVM */
+		case CHIP_OLAND:    /* UVD, VCE do not support GPUVM */
+#endif
+#ifdef CONFIG_DRM_AMDGPU_CIK
+		case CHIP_BONAIRE: /* UVD, VCE do not support GPUVM */
+		case CHIP_HAWAII:  /* UVD, VCE do not support GPUVM */
+		case CHIP_KAVERI:  /* UVD, VCE do not support GPUVM */
+		case CHIP_KABINI:  /* UVD, VCE do not support GPUVM */
+		case CHIP_MULLINS: /* UVD, VCE do not support GPUVM */
+#endif
+		case CHIP_TONGA:   /* UVD, VCE do not support GPUVM */
+		case CHIP_FIJI:    /* UVD, VCE do not support GPUVM */
+		case CHIP_CARRIZO: /* UVD, VCE do not support GPUVM, DCE SG support */
+		case CHIP_STONEY:  /* UVD does not support GPUVM, DCE SG support */
+		case CHIP_RAVEN:   /* DCE SG support */
+			gart_size = 1024;
+			break;
+		}
 	} else {
 		gart_size = amdgpu_gart_size;
 	}
Signature · 6 lines
2.5.5

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1503421776-18332-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org

#2 lore raw

PATCH 2/2 drm/amdgpu: move default gart size setting into gmc modules

Move the asic specific code into the IP modules.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c | 52 --------------------------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_gart.h |  1 -
 drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c    | 19 +++++++++++-
 drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c    | 22 +++++++++++++-
 drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c    | 21 ++++++++++++-
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c    | 16 +++++++++-
 6 files changed, 74 insertions(+), 57 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c +0 -52
index 2027eb0..f437008 100644
@@ -57,58 +57,6 @@
  */
 
 /**
- * amdgpu_gart_set_defaults - set the default gart_size
- *
- * @adev: amdgpu_device pointer
- *
- * Set the default gart_size based on parameters and available VRAM.
- */
-void amdgpu_gart_set_defaults(struct amdgpu_device *adev)
-{
-	u64 gart_size;
-
-	if (amdgpu_gart_size == -1) {
-		switch (adev->asic_type) {
-#ifdef CONFIG_DRM_AMDGPU_SI
-		case CHIP_HAINAN:    /* no MM engines */
-#endif
-		case CHIP_TOPAZ:     /* no MM engines */
-		case CHIP_POLARIS11: /* all engines support GPUVM */
-		case CHIP_POLARIS10: /* all engines support GPUVM */
-		case CHIP_POLARIS12: /* all engines support GPUVM */
-		case CHIP_VEGA10:    /* all engines support GPUVM */
-		default:
-			gart_size = 256;
-			break;
-#ifdef CONFIG_DRM_AMDGPU_SI
-		case CHIP_VERDE:    /* UVD, VCE do not support GPUVM */
-		case CHIP_TAHITI:   /* UVD, VCE do not support GPUVM */
-		case CHIP_PITCAIRN: /* UVD, VCE do not support GPUVM */
-		case CHIP_OLAND:    /* UVD, VCE do not support GPUVM */
-#endif
-#ifdef CONFIG_DRM_AMDGPU_CIK
-		case CHIP_BONAIRE: /* UVD, VCE do not support GPUVM */
-		case CHIP_HAWAII:  /* UVD, VCE do not support GPUVM */
-		case CHIP_KAVERI:  /* UVD, VCE do not support GPUVM */
-		case CHIP_KABINI:  /* UVD, VCE do not support GPUVM */
-		case CHIP_MULLINS: /* UVD, VCE do not support GPUVM */
-#endif
-		case CHIP_TONGA:   /* UVD, VCE do not support GPUVM */
-		case CHIP_FIJI:    /* UVD, VCE do not support GPUVM */
-		case CHIP_CARRIZO: /* UVD, VCE do not support GPUVM, DCE SG support */
-		case CHIP_STONEY:  /* UVD does not support GPUVM, DCE SG support */
-		case CHIP_RAVEN:   /* DCE SG support */
-			gart_size = 1024;
-			break;
-		}
-	} else {
-		gart_size = amdgpu_gart_size;
-	}
-
-	adev->mc.gart_size = gart_size << 20;
-}
-
-/**
  * amdgpu_gart_table_ram_alloc - allocate system ram for gart page table
  *
  * @adev: amdgpu_device pointer
drivers/gpu/drm/amd/amdgpu/amdgpu_gart.h +0 -1
index d4cce69..afbe803 100644
@@ -56,7 +56,6 @@ struct amdgpu_gart {
 	const struct amdgpu_gart_funcs *gart_funcs;
 };
 
-void amdgpu_gart_set_defaults(struct amdgpu_device *adev);
 int amdgpu_gart_table_ram_alloc(struct amdgpu_device *adev);
 void amdgpu_gart_table_ram_free(struct amdgpu_device *adev);
 int amdgpu_gart_table_vram_alloc(struct amdgpu_device *adev);
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +18 -1
index 6e68579..58fe8cc 100644
@@ -332,7 +332,24 @@ static int gmc_v6_0_mc_init(struct amdgpu_device *adev)
 	adev->mc.real_vram_size = RREG32(mmCONFIG_MEMSIZE) * 1024ULL * 1024ULL;
 	adev->mc.visible_vram_size = adev->mc.aper_size;
 
-	amdgpu_gart_set_defaults(adev);
+	/* set the gart size */
+	if (amdgpu_gart_size == -1) {
+		switch (adev->asic_type) {
+		case CHIP_HAINAN:    /* no MM engines */
+		default:
+			adev->mc.gart_size = 256ULL << 20;
+			break;
+		case CHIP_VERDE:    /* UVD, VCE do not support GPUVM */
+		case CHIP_TAHITI:   /* UVD, VCE do not support GPUVM */
+		case CHIP_PITCAIRN: /* UVD, VCE do not support GPUVM */
+		case CHIP_OLAND:    /* UVD, VCE do not support GPUVM */
+			adev->mc.gart_size = 1024ULL << 20;
+			break;
+		}
+	} else {
+		adev->mc.gart_size = (u64)amdgpu_gart_size << 20;
+	}
+
 	gmc_v6_0_vram_gtt_location(adev, &adev->mc);
 
 	return 0;
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +21 -1
index f6acf5a..bcd6c74 100644
@@ -386,7 +386,27 @@ static int gmc_v7_0_mc_init(struct amdgpu_device *adev)
 	if (adev->mc.visible_vram_size > adev->mc.real_vram_size)
 		adev->mc.visible_vram_size = adev->mc.real_vram_size;
 
-	amdgpu_gart_set_defaults(adev);
+	/* set the gart size */
+	if (amdgpu_gart_size == -1) {
+		switch (adev->asic_type) {
+		case CHIP_TOPAZ:     /* no MM engines */
+		default:
+			adev->mc.gart_size = 256ULL << 20;
+			break;
+#ifdef CONFIG_DRM_AMDGPU_CIK
+		case CHIP_BONAIRE: /* UVD, VCE do not support GPUVM */
+		case CHIP_HAWAII:  /* UVD, VCE do not support GPUVM */
+		case CHIP_KAVERI:  /* UVD, VCE do not support GPUVM */
+		case CHIP_KABINI:  /* UVD, VCE do not support GPUVM */
+		case CHIP_MULLINS: /* UVD, VCE do not support GPUVM */
+			adev->mc.gart_size = 1024ULL << 20;
+			break;
+#endif
+		}
+	} else {
+		adev->mc.gart_size = (u64)amdgpu_gart_size << 20;
+	}
+
 	gmc_v7_0_vram_gtt_location(adev, &adev->mc);
 
 	return 0;
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +20 -1
index cb224d5..d320118 100644
@@ -562,7 +562,26 @@ static int gmc_v8_0_mc_init(struct amdgpu_device *adev)
 	if (adev->mc.visible_vram_size > adev->mc.real_vram_size)
 		adev->mc.visible_vram_size = adev->mc.real_vram_size;
 
-	amdgpu_gart_set_defaults(adev);
+	/* set the gart size */
+	if (amdgpu_gart_size == -1) {
+		switch (adev->asic_type) {
+		case CHIP_POLARIS11: /* all engines support GPUVM */
+		case CHIP_POLARIS10: /* all engines support GPUVM */
+		case CHIP_POLARIS12: /* all engines support GPUVM */
+		default:
+			adev->mc.gart_size = 256ULL << 20;
+			break;
+		case CHIP_TONGA:   /* UVD, VCE do not support GPUVM */
+		case CHIP_FIJI:    /* UVD, VCE do not support GPUVM */
+		case CHIP_CARRIZO: /* UVD, VCE do not support GPUVM, DCE SG support */
+		case CHIP_STONEY:  /* UVD does not support GPUVM, DCE SG support */
+			adev->mc.gart_size = 1024ULL << 20;
+			break;
+		}
+	} else {
+		adev->mc.gart_size = (u64)amdgpu_gart_size << 20;
+	}
+
 	gmc_v8_0_vram_gtt_location(adev, &adev->mc);
 
 	return 0;
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +15 -1
index 2769c2b..d04d0b1 100644
@@ -499,7 +499,21 @@ static int gmc_v9_0_mc_init(struct amdgpu_device *adev)
 	if (adev->mc.visible_vram_size > adev->mc.real_vram_size)
 		adev->mc.visible_vram_size = adev->mc.real_vram_size;
 
-	amdgpu_gart_set_defaults(adev);
+	/* set the gart size */
+	if (amdgpu_gart_size == -1) {
+		switch (adev->asic_type) {
+		case CHIP_VEGA10:  /* all engines support GPUVM */
+		default:
+			adev->mc.gart_size = 256ULL << 20;
+			break;
+		case CHIP_RAVEN:   /* DCE SG support */
+			adev->mc.gart_size = 1024ULL << 20;
+			break;
+		}
+	} else {
+		adev->mc.gart_size = (u64)amdgpu_gart_size << 20;
+	}
+
 	gmc_v9_0_vram_gtt_location(adev, &adev->mc);
 
 	return 0;
Signature · 6 lines
2.5.5

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1503421776-18332-2-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org

#4 lore raw

Re: [PATCH 2/2] drm/amdgpu: move default gart size setting into gmc modules

The series is Reviewed-by: Felix Kuehling <[email protected]>

Quoted 199 lines · Alex Deucher

Move the asic specific code into the IP modules.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c | 52 --------------------------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_gart.h |  1 -
 drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c    | 19 +++++++++++-
 drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c    | 22 +++++++++++++-
 drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c    | 21 ++++++++++++-
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c    | 16 +++++++++-
 6 files changed, 74 insertions(+), 57 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c +0 -52
index 2027eb0..f437008 100644
@@ -57,58 +57,6 @@
  */
 
 /**
- * amdgpu_gart_set_defaults - set the default gart_size
- *
- * @adev: amdgpu_device pointer
- *
- * Set the default gart_size based on parameters and available VRAM.
- */
-void amdgpu_gart_set_defaults(struct amdgpu_device *adev)
-{
-	u64 gart_size;
-
-	if (amdgpu_gart_size == -1) {
-		switch (adev->asic_type) {
-#ifdef CONFIG_DRM_AMDGPU_SI
-		case CHIP_HAINAN:    /* no MM engines */
-#endif
-		case CHIP_TOPAZ:     /* no MM engines */
-		case CHIP_POLARIS11: /* all engines support GPUVM */
-		case CHIP_POLARIS10: /* all engines support GPUVM */
-		case CHIP_POLARIS12: /* all engines support GPUVM */
-		case CHIP_VEGA10:    /* all engines support GPUVM */
-		default:
-			gart_size = 256;
-			break;
-#ifdef CONFIG_DRM_AMDGPU_SI
-		case CHIP_VERDE:    /* UVD, VCE do not support GPUVM */
-		case CHIP_TAHITI:   /* UVD, VCE do not support GPUVM */
-		case CHIP_PITCAIRN: /* UVD, VCE do not support GPUVM */
-		case CHIP_OLAND:    /* UVD, VCE do not support GPUVM */
-#endif
-#ifdef CONFIG_DRM_AMDGPU_CIK
-		case CHIP_BONAIRE: /* UVD, VCE do not support GPUVM */
-		case CHIP_HAWAII:  /* UVD, VCE do not support GPUVM */
-		case CHIP_KAVERI:  /* UVD, VCE do not support GPUVM */
-		case CHIP_KABINI:  /* UVD, VCE do not support GPUVM */
-		case CHIP_MULLINS: /* UVD, VCE do not support GPUVM */
-#endif
-		case CHIP_TONGA:   /* UVD, VCE do not support GPUVM */
-		case CHIP_FIJI:    /* UVD, VCE do not support GPUVM */
-		case CHIP_CARRIZO: /* UVD, VCE do not support GPUVM, DCE SG support */
-		case CHIP_STONEY:  /* UVD does not support GPUVM, DCE SG support */
-		case CHIP_RAVEN:   /* DCE SG support */
-			gart_size = 1024;
-			break;
-		}
-	} else {
-		gart_size = amdgpu_gart_size;
-	}
-
-	adev->mc.gart_size = gart_size << 20;
-}
-
-/**
  * amdgpu_gart_table_ram_alloc - allocate system ram for gart page table
  *
  * @adev: amdgpu_device pointer
drivers/gpu/drm/amd/amdgpu/amdgpu_gart.h +0 -1
index d4cce69..afbe803 100644
@@ -56,7 +56,6 @@ struct amdgpu_gart {
 	const struct amdgpu_gart_funcs *gart_funcs;
 };
 
-void amdgpu_gart_set_defaults(struct amdgpu_device *adev);
 int amdgpu_gart_table_ram_alloc(struct amdgpu_device *adev);
 void amdgpu_gart_table_ram_free(struct amdgpu_device *adev);
 int amdgpu_gart_table_vram_alloc(struct amdgpu_device *adev);
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +18 -1
index 6e68579..58fe8cc 100644
@@ -332,7 +332,24 @@ static int gmc_v6_0_mc_init(struct amdgpu_device *adev)
 	adev->mc.real_vram_size = RREG32(mmCONFIG_MEMSIZE) * 1024ULL * 1024ULL;
 	adev->mc.visible_vram_size = adev->mc.aper_size;
 
-	amdgpu_gart_set_defaults(adev);
+	/* set the gart size */
+	if (amdgpu_gart_size == -1) {
+		switch (adev->asic_type) {
+		case CHIP_HAINAN:    /* no MM engines */
+		default:
+			adev->mc.gart_size = 256ULL << 20;
+			break;
+		case CHIP_VERDE:    /* UVD, VCE do not support GPUVM */
+		case CHIP_TAHITI:   /* UVD, VCE do not support GPUVM */
+		case CHIP_PITCAIRN: /* UVD, VCE do not support GPUVM */
+		case CHIP_OLAND:    /* UVD, VCE do not support GPUVM */
+			adev->mc.gart_size = 1024ULL << 20;
+			break;
+		}
+	} else {
+		adev->mc.gart_size = (u64)amdgpu_gart_size << 20;
+	}
+
 	gmc_v6_0_vram_gtt_location(adev, &adev->mc);
 
 	return 0;
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +21 -1
index f6acf5a..bcd6c74 100644
@@ -386,7 +386,27 @@ static int gmc_v7_0_mc_init(struct amdgpu_device *adev)
 	if (adev->mc.visible_vram_size > adev->mc.real_vram_size)
 		adev->mc.visible_vram_size = adev->mc.real_vram_size;
 
-	amdgpu_gart_set_defaults(adev);
+	/* set the gart size */
+	if (amdgpu_gart_size == -1) {
+		switch (adev->asic_type) {
+		case CHIP_TOPAZ:     /* no MM engines */
+		default:
+			adev->mc.gart_size = 256ULL << 20;
+			break;
+#ifdef CONFIG_DRM_AMDGPU_CIK
+		case CHIP_BONAIRE: /* UVD, VCE do not support GPUVM */
+		case CHIP_HAWAII:  /* UVD, VCE do not support GPUVM */
+		case CHIP_KAVERI:  /* UVD, VCE do not support GPUVM */
+		case CHIP_KABINI:  /* UVD, VCE do not support GPUVM */
+		case CHIP_MULLINS: /* UVD, VCE do not support GPUVM */
+			adev->mc.gart_size = 1024ULL << 20;
+			break;
+#endif
+		}
+	} else {
+		adev->mc.gart_size = (u64)amdgpu_gart_size << 20;
+	}
+
 	gmc_v7_0_vram_gtt_location(adev, &adev->mc);
 
 	return 0;
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +20 -1
index cb224d5..d320118 100644
@@ -562,7 +562,26 @@ static int gmc_v8_0_mc_init(struct amdgpu_device *adev)
 	if (adev->mc.visible_vram_size > adev->mc.real_vram_size)
 		adev->mc.visible_vram_size = adev->mc.real_vram_size;
 
-	amdgpu_gart_set_defaults(adev);
+	/* set the gart size */
+	if (amdgpu_gart_size == -1) {
+		switch (adev->asic_type) {
+		case CHIP_POLARIS11: /* all engines support GPUVM */
+		case CHIP_POLARIS10: /* all engines support GPUVM */
+		case CHIP_POLARIS12: /* all engines support GPUVM */
+		default:
+			adev->mc.gart_size = 256ULL << 20;
+			break;
+		case CHIP_TONGA:   /* UVD, VCE do not support GPUVM */
+		case CHIP_FIJI:    /* UVD, VCE do not support GPUVM */
+		case CHIP_CARRIZO: /* UVD, VCE do not support GPUVM, DCE SG support */
+		case CHIP_STONEY:  /* UVD does not support GPUVM, DCE SG support */
+			adev->mc.gart_size = 1024ULL << 20;
+			break;
+		}
+	} else {
+		adev->mc.gart_size = (u64)amdgpu_gart_size << 20;
+	}
+
 	gmc_v8_0_vram_gtt_location(adev, &adev->mc);
 
 	return 0;
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +8 -1
index 2769c2b..d04d0b1 100644
@@ -499,7 +499,21 @@ static int gmc_v9_0_mc_init(struct amdgpu_device *adev)
 	if (adev->mc.visible_vram_size > adev->mc.real_vram_size)
 		adev->mc.visible_vram_size = adev->mc.real_vram_size;
 
-	amdgpu_gart_set_defaults(adev);
+	/* set the gart size */
+	if (amdgpu_gart_size == -1) {
+		switch (adev->asic_type) {
+		case CHIP_VEGA10:  /* all engines support GPUVM */
+		default:
+			adev->mc.gart_size = 256ULL << 20;
+			break;
+		case CHIP_RAVEN:   /* DCE SG support */

drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static int gmc_v9_0_mc_init(struct amdgpu_device *adev) · line 519

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +7 -0
+			adev->mc.gart_size = 1024ULL << 20;
+			break;
+		}
+	} else {
+		adev->mc.gart_size = (u64)amdgpu_gart_size << 20;
+	}
+
 	gmc_v9_0_vram_gtt_location(adev, &adev->mc);
 
 	return 0;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 3a6ee35a-40bd-06f7-d999-3397bf5a0686-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#6 lore raw

Re: [PATCH 2/2] drm/amdgpu: move default gart size setting into gmc modules

Am 22.08.2017 um 20:17 schrieb Felix Kuehling:

Quoted 212 lines

The series is Reviewed-by: Felix Kuehling <[email protected]>

Quoted 208 lines · Alex Deucher

Move the asic specific code into the IP modules.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c | 52 --------------------------------
  drivers/gpu/drm/amd/amdgpu/amdgpu_gart.h |  1 -
  drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c    | 19 +++++++++++-
  drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c    | 22 +++++++++++++-
  drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c    | 21 ++++++++++++-
  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c    | 16 +++++++++-
  6 files changed, 74 insertions(+), 57 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c +0 -52
index 2027eb0..f437008 100644
@@ -57,58 +57,6 @@
   */
 
  /**
- * amdgpu_gart_set_defaults - set the default gart_size
- *
- * @adev: amdgpu_device pointer
- *
- * Set the default gart_size based on parameters and available VRAM.
- */
-void amdgpu_gart_set_defaults(struct amdgpu_device *adev)
-{
-	u64 gart_size;
-
-	if (amdgpu_gart_size == -1) {
-		switch (adev->asic_type) {
-#ifdef CONFIG_DRM_AMDGPU_SI
-		case CHIP_HAINAN:    /* no MM engines */
-#endif
-		case CHIP_TOPAZ:     /* no MM engines */
-		case CHIP_POLARIS11: /* all engines support GPUVM */
-		case CHIP_POLARIS10: /* all engines support GPUVM */
-		case CHIP_POLARIS12: /* all engines support GPUVM */
-		case CHIP_VEGA10:    /* all engines support GPUVM */
-		default:
-			gart_size = 256;
-			break;
-#ifdef CONFIG_DRM_AMDGPU_SI
-		case CHIP_VERDE:    /* UVD, VCE do not support GPUVM */
-		case CHIP_TAHITI:   /* UVD, VCE do not support GPUVM */
-		case CHIP_PITCAIRN: /* UVD, VCE do not support GPUVM */
-		case CHIP_OLAND:    /* UVD, VCE do not support GPUVM */
-#endif
-#ifdef CONFIG_DRM_AMDGPU_CIK
-		case CHIP_BONAIRE: /* UVD, VCE do not support GPUVM */
-		case CHIP_HAWAII:  /* UVD, VCE do not support GPUVM */
-		case CHIP_KAVERI:  /* UVD, VCE do not support GPUVM */
-		case CHIP_KABINI:  /* UVD, VCE do not support GPUVM */
-		case CHIP_MULLINS: /* UVD, VCE do not support GPUVM */
-#endif
-		case CHIP_TONGA:   /* UVD, VCE do not support GPUVM */
-		case CHIP_FIJI:    /* UVD, VCE do not support GPUVM */
-		case CHIP_CARRIZO: /* UVD, VCE do not support GPUVM, DCE SG support */
-		case CHIP_STONEY:  /* UVD does not support GPUVM, DCE SG support */
-		case CHIP_RAVEN:   /* DCE SG support */
-			gart_size = 1024;
-			break;
-		}
-	} else {
-		gart_size = amdgpu_gart_size;
-	}
-
-	adev->mc.gart_size = gart_size << 20;
-}
-
-/**
   * amdgpu_gart_table_ram_alloc - allocate system ram for gart page table
   *
   * @adev: amdgpu_device pointer
drivers/gpu/drm/amd/amdgpu/amdgpu_gart.h +0 -1
index d4cce69..afbe803 100644
@@ -56,7 +56,6 @@ struct amdgpu_gart {
  	const struct amdgpu_gart_funcs *gart_funcs;
  };
 
-void amdgpu_gart_set_defaults(struct amdgpu_device *adev);
  int amdgpu_gart_table_ram_alloc(struct amdgpu_device *adev);
  void amdgpu_gart_table_ram_free(struct amdgpu_device *adev);
  int amdgpu_gart_table_vram_alloc(struct amdgpu_device *adev);
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +18 -1
index 6e68579..58fe8cc 100644
@@ -332,7 +332,24 @@ static int gmc_v6_0_mc_init(struct amdgpu_device *adev)
  	adev->mc.real_vram_size = RREG32(mmCONFIG_MEMSIZE) * 1024ULL * 1024ULL;
  	adev->mc.visible_vram_size = adev->mc.aper_size;
 
-	amdgpu_gart_set_defaults(adev);
+	/* set the gart size */
+	if (amdgpu_gart_size == -1) {
+		switch (adev->asic_type) {
+		case CHIP_HAINAN:    /* no MM engines */
+		default:
+			adev->mc.gart_size = 256ULL << 20;
+			break;
+		case CHIP_VERDE:    /* UVD, VCE do not support GPUVM */
+		case CHIP_TAHITI:   /* UVD, VCE do not support GPUVM */
+		case CHIP_PITCAIRN: /* UVD, VCE do not support GPUVM */
+		case CHIP_OLAND:    /* UVD, VCE do not support GPUVM */
+			adev->mc.gart_size = 1024ULL << 20;
+			break;
+		}
+	} else {
+		adev->mc.gart_size = (u64)amdgpu_gart_size << 20;
+	}
+
  	gmc_v6_0_vram_gtt_location(adev, &adev->mc);
 
  	return 0;
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +21 -1
index f6acf5a..bcd6c74 100644
@@ -386,7 +386,27 @@ static int gmc_v7_0_mc_init(struct amdgpu_device *adev)
  	if (adev->mc.visible_vram_size > adev->mc.real_vram_size)
  		adev->mc.visible_vram_size = adev->mc.real_vram_size;
 
-	amdgpu_gart_set_defaults(adev);
+	/* set the gart size */
+	if (amdgpu_gart_size == -1) {
+		switch (adev->asic_type) {
+		case CHIP_TOPAZ:     /* no MM engines */
+		default:
+			adev->mc.gart_size = 256ULL << 20;
+			break;
+#ifdef CONFIG_DRM_AMDGPU_CIK
+		case CHIP_BONAIRE: /* UVD, VCE do not support GPUVM */
+		case CHIP_HAWAII:  /* UVD, VCE do not support GPUVM */
+		case CHIP_KAVERI:  /* UVD, VCE do not support GPUVM */
+		case CHIP_KABINI:  /* UVD, VCE do not support GPUVM */
+		case CHIP_MULLINS: /* UVD, VCE do not support GPUVM */
+			adev->mc.gart_size = 1024ULL << 20;
+			break;
+#endif
+		}
+	} else {
+		adev->mc.gart_size = (u64)amdgpu_gart_size << 20;
+	}
+
  	gmc_v7_0_vram_gtt_location(adev, &adev->mc);
 
  	return 0;
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +20 -1
index cb224d5..d320118 100644
@@ -562,7 +562,26 @@ static int gmc_v8_0_mc_init(struct amdgpu_device *adev)
  	if (adev->mc.visible_vram_size > adev->mc.real_vram_size)
  		adev->mc.visible_vram_size = adev->mc.real_vram_size;
 
-	amdgpu_gart_set_defaults(adev);
+	/* set the gart size */
+	if (amdgpu_gart_size == -1) {
+		switch (adev->asic_type) {
+		case CHIP_POLARIS11: /* all engines support GPUVM */
+		case CHIP_POLARIS10: /* all engines support GPUVM */
+		case CHIP_POLARIS12: /* all engines support GPUVM */
+		default:
+			adev->mc.gart_size = 256ULL << 20;
+			break;
+		case CHIP_TONGA:   /* UVD, VCE do not support GPUVM */
+		case CHIP_FIJI:    /* UVD, VCE do not support GPUVM */
+		case CHIP_CARRIZO: /* UVD, VCE do not support GPUVM, DCE SG support */
+		case CHIP_STONEY:  /* UVD does not support GPUVM, DCE SG support */
+			adev->mc.gart_size = 1024ULL << 20;
+			break;
+		}
+	} else {
+		adev->mc.gart_size = (u64)amdgpu_gart_size << 20;
+	}
+
  	gmc_v8_0_vram_gtt_location(adev, &adev->mc);
 
  	return 0;
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +15 -1
index 2769c2b..d04d0b1 100644
@@ -499,7 +499,21 @@ static int gmc_v9_0_mc_init(struct amdgpu_device *adev)
  	if (adev->mc.visible_vram_size > adev->mc.real_vram_size)
  		adev->mc.visible_vram_size = adev->mc.real_vram_size;
 
-	amdgpu_gart_set_defaults(adev);
+	/* set the gart size */
+	if (amdgpu_gart_size == -1) {
+		switch (adev->asic_type) {
+		case CHIP_VEGA10:  /* all engines support GPUVM */
+		default:
+			adev->mc.gart_size = 256ULL << 20;
+			break;
+		case CHIP_RAVEN:   /* DCE SG support */
+			adev->mc.gart_size = 1024ULL << 20;
+			break;
+		}
+	} else {
+		adev->mc.gart_size = (u64)amdgpu_gart_size << 20;
+	}
+
  	gmc_v9_0_vram_gtt_location(adev, &adev->mc);
 
Quoted 5 lines

drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static int gmc_v9_0_mc_init(struct amdgpu_device *adev) · line 519

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +0 -0
  	return 0;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx