Skip to contentSkip to conversation

drm/amdgpu: fix AGP init order

PATCH In review Alex Deucher 2 participants 2 messages Nov 7, 2023 – Nov 8, 2023

Subsystems (2)
lore
Share & tools
lore

Alex Deucher

author maintainer
#0 lore raw

PATCH 1/1 drm/amdgpu: fix AGP init order

The default AGP settings were overwriting the IP selected ones since the default was getting set after the IP ones were selected.

Fixes de59b69932e6 ("drm/amdgpu/gmc: set a default disable value for AGP")
Cc Mikhail Gavrilov <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 ---
 drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c     | 1 +
 drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c     | 1 +
 drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c      | 1 +
 drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c      | 1 +
 drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c      | 1 +
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c      | 2 ++
 7 files changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0 -3
index 0dcb6c36b02c..cef920a93924 100644
@@ -1062,9 +1062,6 @@ static const char * const amdgpu_vram_names[] = {
  */
 int amdgpu_bo_init(struct amdgpu_device *adev)
 {
-	/* set the default AGP aperture state */
-	amdgpu_gmc_set_agp_default(adev, &adev->gmc);
-
 	/* On A+A platform, VRAM can be mapped as WB */
 	if (!adev->gmc.xgmi.connected_to_cpu && !adev->gmc.is_app_apu) {
 		/* reserve PAT memory space to WC for VRAM */
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +1 -0
index d8a4fddab9c1..ef80ea0929fe 100644
@@ -672,6 +672,7 @@ static void gmc_v10_0_vram_gtt_location(struct amdgpu_device *adev,
 	/* add the xgmi offset of the physical node */
 	base += adev->gmc.xgmi.physical_node_id * adev->gmc.xgmi.node_segment_size;
 
+	amdgpu_gmc_set_agp_default(adev, mc);
 	amdgpu_gmc_vram_location(adev, &adev->gmc, base);
 	amdgpu_gmc_gart_location(adev, mc, AMDGPU_GART_PLACEMENT_BEST_FIT);
 	if (!amdgpu_sriov_vf(adev))
drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c +1 -0
index 4713a62ad586..5f794a907945 100644
@@ -637,6 +637,7 @@ static void gmc_v11_0_vram_gtt_location(struct amdgpu_device *adev,
 
 	base = adev->mmhub.funcs->get_fb_location(adev);
 
+	amdgpu_gmc_set_agp_default(adev, mc);
 	amdgpu_gmc_vram_location(adev, &adev->gmc, base);
 	amdgpu_gmc_gart_location(adev, mc, AMDGPU_GART_PLACEMENT_HIGH);
 	if (!amdgpu_sriov_vf(adev) ||
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +1 -0
index 7f66954fd302..42e103d7077d 100644
@@ -211,6 +211,7 @@ static void gmc_v6_0_vram_gtt_location(struct amdgpu_device *adev,
 
 	base <<= 24;
 
+	amdgpu_gmc_set_agp_default(adev, mc);
 	amdgpu_gmc_vram_location(adev, mc, base);
 	amdgpu_gmc_gart_location(adev, mc, AMDGPU_GART_PLACEMENT_BEST_FIT);
 }
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +1 -0
index 61ca1a82b651..efc16e580f1e 100644
@@ -239,6 +239,7 @@ static void gmc_v7_0_vram_gtt_location(struct amdgpu_device *adev,
 
 	base <<= 24;
 
+	amdgpu_gmc_set_agp_default(adev, mc);
 	amdgpu_gmc_vram_location(adev, mc, base);
 	amdgpu_gmc_gart_location(adev, mc, AMDGPU_GART_PLACEMENT_BEST_FIT);
 }
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +1 -0
index fa59749c2aef..ff4ae73d27ec 100644
@@ -413,6 +413,7 @@ static void gmc_v8_0_vram_gtt_location(struct amdgpu_device *adev,
 		base = RREG32(mmMC_VM_FB_LOCATION) & 0xFFFF;
 	base <<= 24;
 
+	amdgpu_gmc_set_agp_default(adev, mc);
 	amdgpu_gmc_vram_location(adev, mc, base);
 	amdgpu_gmc_gart_location(adev, mc, AMDGPU_GART_PLACEMENT_BEST_FIT);
 }
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +2 -0
index b66c5f7e1c56..fe52d132b629 100644
@@ -1614,6 +1614,8 @@ static void gmc_v9_0_vram_gtt_location(struct amdgpu_device *adev,
 {
 	u64 base = adev->mmhub.funcs->get_fb_location(adev);
 
+	amdgpu_gmc_set_agp_default(adev, mc);
+
 	/* add the xgmi offset of the physical node */
 	base += adev->gmc.xgmi.physical_node_id * adev->gmc.xgmi.node_segment_size;
 	if (adev->gmc.xgmi.connected_to_cpu) {
Signature · 1 line
2.41.0
Reviewed-by on v1 1/1
#1 lore raw

Am 07.11.23 um 20:14 schrieb Alex Deucher:

Quoted 8 lines

The default AGP settings were overwriting the IP selected ones since the default was getting set after the IP ones were selected.

Fixes de59b69932e6 ("drm/amdgpu/gmc: set a default disable value for AGP")
Cc Mikhail Gavrilov <[email protected]>
Quoted 97 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 ---
  drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c     | 1 +
  drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c     | 1 +
  drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c      | 1 +
  drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c      | 1 +
  drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c      | 1 +
  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c      | 2 ++
  7 files changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0 -3
index 0dcb6c36b02c..cef920a93924 100644
@@ -1062,9 +1062,6 @@ static const char * const amdgpu_vram_names[] = {
   */
  int amdgpu_bo_init(struct amdgpu_device *adev)
  {
-	/* set the default AGP aperture state */
-	amdgpu_gmc_set_agp_default(adev, &adev->gmc);
-
  	/* On A+A platform, VRAM can be mapped as WB */
  	if (!adev->gmc.xgmi.connected_to_cpu && !adev->gmc.is_app_apu) {
  		/* reserve PAT memory space to WC for VRAM */
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +1 -0
index d8a4fddab9c1..ef80ea0929fe 100644
@@ -672,6 +672,7 @@ static void gmc_v10_0_vram_gtt_location(struct amdgpu_device *adev,
  	/* add the xgmi offset of the physical node */
  	base += adev->gmc.xgmi.physical_node_id * adev->gmc.xgmi.node_segment_size;
 
+	amdgpu_gmc_set_agp_default(adev, mc);
  	amdgpu_gmc_vram_location(adev, &adev->gmc, base);
  	amdgpu_gmc_gart_location(adev, mc, AMDGPU_GART_PLACEMENT_BEST_FIT);
  	if (!amdgpu_sriov_vf(adev))
drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c +1 -0
index 4713a62ad586..5f794a907945 100644
@@ -637,6 +637,7 @@ static void gmc_v11_0_vram_gtt_location(struct amdgpu_device *adev,
 
  	base = adev->mmhub.funcs->get_fb_location(adev);
 
+	amdgpu_gmc_set_agp_default(adev, mc);
  	amdgpu_gmc_vram_location(adev, &adev->gmc, base);
  	amdgpu_gmc_gart_location(adev, mc, AMDGPU_GART_PLACEMENT_HIGH);
  	if (!amdgpu_sriov_vf(adev) ||
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +1 -0
index 7f66954fd302..42e103d7077d 100644
@@ -211,6 +211,7 @@ static void gmc_v6_0_vram_gtt_location(struct amdgpu_device *adev,
 
  	base <<= 24;
 
+	amdgpu_gmc_set_agp_default(adev, mc);
  	amdgpu_gmc_vram_location(adev, mc, base);
  	amdgpu_gmc_gart_location(adev, mc, AMDGPU_GART_PLACEMENT_BEST_FIT);
  }
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +1 -0
index 61ca1a82b651..efc16e580f1e 100644
@@ -239,6 +239,7 @@ static void gmc_v7_0_vram_gtt_location(struct amdgpu_device *adev,
 
  	base <<= 24;
 
+	amdgpu_gmc_set_agp_default(adev, mc);
  	amdgpu_gmc_vram_location(adev, mc, base);
  	amdgpu_gmc_gart_location(adev, mc, AMDGPU_GART_PLACEMENT_BEST_FIT);
  }
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +1 -0
index fa59749c2aef..ff4ae73d27ec 100644
@@ -413,6 +413,7 @@ static void gmc_v8_0_vram_gtt_location(struct amdgpu_device *adev,
  		base = RREG32(mmMC_VM_FB_LOCATION) & 0xFFFF;
  	base <<= 24;
 
+	amdgpu_gmc_set_agp_default(adev, mc);
  	amdgpu_gmc_vram_location(adev, mc, base);
  	amdgpu_gmc_gart_location(adev, mc, AMDGPU_GART_PLACEMENT_BEST_FIT);
  }
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +2 -0
index b66c5f7e1c56..fe52d132b629 100644
@@ -1614,6 +1614,8 @@ static void gmc_v9_0_vram_gtt_location(struct amdgpu_device *adev,
  {
  	u64 base = adev->mmhub.funcs->get_fb_location(adev);
 
+	amdgpu_gmc_set_agp_default(adev, mc);
+
  	/* add the xgmi offset of the physical node */
  	base += adev->gmc.xgmi.physical_node_id * adev->gmc.xgmi.node_segment_size;
  	if (adev->gmc.xgmi.connected_to_cpu) {