Skip to contentSkip to conversation

Enable Scatter Gather for Picasso.

PATCH Superseded Andrey Grodzovsky 3 participants 9 messages Jul 23, 2019 – Jul 24, 2019 5 messages not in the archive

Subsystems (3)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

cover Enable Scatter Gather for Picasso.

This series enables S/G for Picasso.
First 2 patches fix a hard hang introduced by placing the display BO in GTT memory because of HW issues with cached mappings and the third patch enables S/G.

Andrey Grodzovsky (2):
drm/amdgpu: Fix hard hang for S/G display BOs. drm/amd/display: Only allow s/g when USWC flag is set.

Shirish S (1):
drm/amd: enable S/G for RAVEN chip

 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c            | 14 +++++++++++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c           |  4 +++-
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  4 ++--
 4 files changed, 17 insertions(+), 7 deletions(-)
Signature · 6 lines
2.7.4

_______________________________________________
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): 1563897851-11501-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org

#2 lore raw

PATCH 1/3 drm/amdgpu: Fix hard hang for S/G display BOs.

HW requires for caching to be unset for scanout BO mappings when the BO placement is in GTT memory. Usually the flag to unset is passed from user mode but for FB mode this was missing.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c  | 14 +++++++++++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c |  4 +++-
 2 files changed, 14 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +11 -3
index e476092..acc45125 100644
@@ -137,14 +137,14 @@ static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev,
 	mode_cmd->pitches[0] = amdgpu_align_pitch(adev, mode_cmd->width, cpp,
 						  fb_tiled);
 	domain = amdgpu_display_supported_domains(adev);
-
 	height = ALIGN(mode_cmd->height, 8);
 	size = mode_cmd->pitches[0] * height;
 	aligned_size = ALIGN(size, PAGE_SIZE);
 	ret = amdgpu_gem_object_create(adev, aligned_size, 0, domain,
 				       AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED |
-				       AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS |
-				       AMDGPU_GEM_CREATE_VRAM_CLEARED,
+				       AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS     |
+				       AMDGPU_GEM_CREATE_VRAM_CLEARED 	     |
+				       AMDGPU_GEM_CREATE_CPU_GTT_USWC,
 				       ttm_bo_type_kernel, NULL, &gobj);
 	if (ret) {
 		pr_err("failed to allocate framebuffer (%d)\n", aligned_size);
@@ -166,6 +166,14 @@ static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev,
 			dev_err(adev->dev, "FB failed to set tiling flags\n");
 	}
 
+	/*
+	 * If the AMDGPU_GEM_CREATE_CPU_GTT_USWC flag was removed during BO
+	 * creation it means that USWC is not supported for this board and
+	 * so to avoid hang caused by placement of scanout BO in GTT on certain
+	 * APUs and still light up, force the BO placement to VRAM.
+	 */
+	if (abo->flags & ~AMDGPU_GEM_CREATE_CPU_GTT_USWC)
+		domain  = AMDGPU_GEM_DOMAIN_VRAM;
 
 	ret = amdgpu_bo_pin(abo, domain);
 	if (ret) {
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +3 -1
index 2cead5a..b3b3b89 100644
@@ -743,7 +743,8 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv,
 	struct amdgpu_device *adev = dev->dev_private;
 	struct drm_gem_object *gobj;
 	uint32_t handle;
-	u64 flags = AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
+	u64 flags = AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED |
+		    AMDGPU_GEM_CREATE_CPU_GTT_USWC;
 	u32 domain;
 	int r;
 
@@ -761,6 +762,7 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv,
 	args->size = ALIGN(args->size, PAGE_SIZE);
 	domain = amdgpu_bo_get_preferred_pin_domain(adev,
 				amdgpu_display_supported_domains(adev));
+
 	r = amdgpu_gem_object_create(adev, args->size, 0, domain, flags,
 				     ttm_bo_type_device, NULL, &gobj);
 	if (r)
Signature · 6 lines
2.7.4

_______________________________________________
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): 1563897851-11501-2-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org

#4 lore raw

Re: [PATCH 1/3] drm/amdgpu: Fix hard hang for S/G display BOs.

Quoted 14 lines · Andrey Grodzovsky

HW requires for caching to be unset for scanout BO mappings when the BO placement is in GTT memory. Usually the flag to unset is passed from user mode but for FB mode this was missing.

---
[...]

drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +0 -0
@@ -166,6 +166,14 @@ static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev,
 			dev_err(adev->dev, "FB failed to set tiling flags\n");

drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev, · line 176

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +8 -0
 	}
 
+	/*
+	 * If the AMDGPU_GEM_CREATE_CPU_GTT_USWC flag was removed during BO
+	 * creation it means that USWC is not supported for this board and
+	 * so to avoid hang caused by placement of scanout BO in GTT on certain
+	 * APUs and still light up, force the BO placement to VRAM.
+	 */
+	if (abo->flags & ~AMDGPU_GEM_CREATE_CPU_GTT_USWC)
+		domain  = AMDGPU_GEM_DOMAIN_VRAM;

The comment sounds like you meant

	if (!(abo->flags & AMDGPU_GEM_CREATE_CPU_GTT_USWC))
		domain  = AMDGPU_GEM_DOMAIN_VRAM;

?

Anyway, this should be handled in amdgpu_display_supported_domains instead (e.g. by not allowing GTT if CONFIG_X86_32 is defined), otherwise the BO could still be pinned to GTT later.

drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c int amdgpu_mode_dumb_create(struct drm_file *file_priv, · line 768

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +1 -0
@@ -761,6 +762,7 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv,
 	args->size = ALIGN(args->size, PAGE_SIZE);
 	domain = amdgpu_bo_get_preferred_pin_domain(adev,
 				amdgpu_display_supported_domains(adev));
+
 	r = amdgpu_gem_object_create(adev, args->size, 0, domain, flags,
 				     ttm_bo_type_device, NULL, &gobj);
 	if (r)

Drop this hunk with only whitespace changes.

Signature · 6 lines
Earthling Michel Dänzer               |              https://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
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): d4c126b7-4fa5-19ff-6687-9a260927dc67-otUistvHUpPR7s880joybQ@public.gmane.org

#6 lore raw

Re: [PATCH 1/3] drm/amdgpu: Fix hard hang for S/G display BOs.

Quoted 27 lines · Michel Dänzer
Quoted 14 lines · Andrey Grodzovsky

HW requires for caching to be unset for scanout BO mappings when the BO placement is in GTT memory. Usually the flag to unset is passed from user mode but for FB mode this was missing.

---
[...]

drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +0 -0
@@ -166,6 +166,14 @@ static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev,
  			dev_err(adev->dev, "FB failed to set tiling flags\n");

drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev, · line 176

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +8 -0
  	}
 
+	/*
+	 * If the AMDGPU_GEM_CREATE_CPU_GTT_USWC flag was removed during BO
+	 * creation it means that USWC is not supported for this board and
+	 * so to avoid hang caused by placement of scanout BO in GTT on certain
+	 * APUs and still light up, force the BO placement to VRAM.
+	 */
+	if (abo->flags & ~AMDGPU_GEM_CREATE_CPU_GTT_USWC)
+		domain  = AMDGPU_GEM_DOMAIN_VRAM;

The comment sounds like you meant

Quoted 4 lines
	if (!(abo->flags & AMDGPU_GEM_CREATE_CPU_GTT_USWC))
		domain  = AMDGPU_GEM_DOMAIN_VRAM;

?

Yes, not sure how this happened to me...

Quoted 3 lines

Anyway, this should be handled in amdgpu_display_supported_domains instead (e.g. by not allowing GTT if CONFIG_X86_32 is defined),

We have drm_arch_can_wc_memory function to cover all the cases when USWC mapping is not allowed, why the CONFIG_X86_32 here ?

Quoted 1 line

otherwise the BO could still be pinned to GTT later.

The only other later place I know is dm_plane_helper_prepare_fb of which I take care in patch 3. What other places you have in mind ?

Andrey

Quoted 14 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c int amdgpu_mode_dumb_create(struct drm_file *file_priv, · line 768

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +1 -0
@@ -761,6 +762,7 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv,
  	args->size = ALIGN(args->size, PAGE_SIZE);
  	domain = amdgpu_bo_get_preferred_pin_domain(adev,
  				amdgpu_display_supported_domains(adev));
+
  	r = amdgpu_gem_object_create(adev, args->size, 0, domain, flags,
  				     ttm_bo_type_device, NULL, &gobj);
  	if (r)

Drop this hunk with only whitespace changes.

_______________________________________________
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): ced516f5-546d-cd49-6e0e-87d2528bde41-5C7GfCeVMHo@public.gmane.org

#8 lore raw

Re: [PATCH 1/3] drm/amdgpu: Fix hard hang for S/G display BOs.

Quoted 8 lines · Andrey
Quoted 3 lines · Michel Dänzer

Anyway, this should be handled in amdgpu_display_supported_domains instead (e.g. by not allowing GTT if CONFIG_X86_32 is defined),

We have drm_arch_can_wc_memory function to cover all the cases when USWC mapping is not allowed, why the CONFIG_X86_32 here ?

It's one case where amdgpu_bo_do_create() clears the AMDGPU_GEM_CREATE_CPU_GTT_USWC flag.

Quoted 4 lines
Quoted 1 line

otherwise the BO could still be pinned to GTT later.

The only other later place I know is dm_plane_helper_prepare_fb of which I take care in patch 3. What other places you have in mind ?

amdgpu_dma_buf_begin_cpu_access & amdgpu_mode_dumb_create. (While not handling it there probably won't cause hangs, it'd likely result in superfluous BO migrations)

But even if there were no other places right now, handling it separately would be fragile WRT future amdgpu_display_supported_domains callers getting it wrong.

Anyway, you're attempting to handle it in amdgpu_display_supported_domains in the v2 series, thanks.

Signature · 6 lines
Earthling Michel Dänzer               |              https://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#9 lore raw

PATCH 2/3 drm/amd/display: Only allow s/g when USWC flag is set.

In reply to a message not in the archive

This verifies we don't casue HW hang in case this flag is missing.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -1
index 9ef7854..2d50eea 100644
@@ -4413,7 +4413,7 @@ static int dm_plane_helper_prepare_fb(struct drm_plane *plane,
 		return r;
 	}
 
-	if (plane->type != DRM_PLANE_TYPE_CURSOR)
+	if (plane->type != DRM_PLANE_TYPE_CURSOR && (rbo->flags & AMDGPU_GEM_CREATE_CPU_GTT_USWC))
 		domain = amdgpu_display_supported_domains(adev);
 	else
 		domain = AMDGPU_GEM_DOMAIN_VRAM;
Signature · 6 lines
2.7.4

_______________________________________________
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): 1563897851-11501-3-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org

#11 lore raw

Re: [PATCH 2/3] drm/amd/display: Only allow s/g when USWC flag is set.

Quoted 15 lines · Andrey Grodzovsky

This verifies we don't casue HW hang in case this flag is missing.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
index 9ef7854..2d50eea 100644

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static int dm_plane_helper_prepare_fb(struct drm_plane *plane, · line 4419

Quoted 8 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -1
@@ -4413,7 +4413,7 @@ static int dm_plane_helper_prepare_fb(struct drm_plane *plane,
 		return r;
 	}
 
-	if (plane->type != DRM_PLANE_TYPE_CURSOR)
+	if (plane->type != DRM_PLANE_TYPE_CURSOR && (rbo->flags & AMDGPU_GEM_CREATE_CPU_GTT_USWC))
 		domain = amdgpu_display_supported_domains(adev);
 	else
 		domain = AMDGPU_GEM_DOMAIN_VRAM;

amdgpu_display_supported_domains() is used in other places as well, so this should be handled inside it instead.

Signature · 6 lines
Earthling Michel Dänzer               |              https://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#12 lore raw

PATCH 3/3 drm/amd: enable S/G for RAVEN chip

In reply to a message not in the archive

From: Shirish S <[email protected]>

enables gpu_vm_support in dm and adds
AMDGPU_GEM_DOMAIN_GTT as supported domain

Change-Id If34300beaa60be2d36170b7b5b096ec644502b20
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       | 2 +-
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +1 -1
index 767ee699..3d04730 100644
@@ -498,7 +498,7 @@ uint32_t amdgpu_display_supported_domains(struct amdgpu_device *adev)
 	uint32_t domain = AMDGPU_GEM_DOMAIN_VRAM;
 
 #if defined(CONFIG_DRM_AMD_DC)
-	if (adev->asic_type >= CHIP_CARRIZO && adev->asic_type < CHIP_RAVEN &&
+	if (adev->asic_type >= CHIP_CARRIZO && adev->asic_type <= CHIP_RAVEN &&
 	    adev->flags & AMD_IS_APU &&
 	    amdgpu_device_asic_has_dc_support(adev->asic_type))
 		domain |= AMDGPU_GEM_DOMAIN_GTT;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -1
index 2d50eea..a8224a7 100644
@@ -686,7 +686,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
 	 */
 	if (adev->flags & AMD_IS_APU &&
 	    adev->asic_type >= CHIP_CARRIZO &&
-	    adev->asic_type < CHIP_RAVEN)
+	    adev->asic_type <= CHIP_RAVEN)
 		init_data.flags.gpu_vm_support = true;
 
 	if (amdgpu_dc_feature_mask & DC_FBC_MASK)
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#13 lore raw
In reply to a message not in the archive

Series is Reviewed-by: Christian König <[email protected]>

Am 23.07.19 um 18:04 schrieb Andrey Grodzovsky:

Quoted 9 lines

This series enables S/G for Picasso.
First 2 patches fix a hard hang introduced by placing the display BO in GTT memory because of HW issues with cached mappings and the third patch enables S/G.

Andrey Grodzovsky (2):
drm/amdgpu: Fix hard hang for S/G display BOs. drm/amd/display: Only allow s/g when USWC flag is set.

Quoted 9 lines

Shirish S (1):
drm/amd: enable S/G for RAVEN chip

  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       |  2 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c            | 14 +++++++++++---
  drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c           |  4 +++-
  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  4 ++--
  4 files changed, 17 insertions(+), 7 deletions(-)

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