Skip to contentSkip to conversation

drm/amdgpu:reduce wb to 512 slot

PATCH In review Monk Liu 3 participants 10 messages Oct 18, 2017 – Oct 19, 2017 4 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Monk Liu

author
#0 lore raw

PATCH 1/6 drm/amdgpu:reduce wb to 512 slot

with current WB usage we only use 57 slots, so 512 is extreamly sufficient, and reduce to 512 can make WB fit into one page.

Change-Id I4261630731f132b9bec91b0037e914030b5c031f
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -1
index 7ecfc53..4697ba2 100644
@@ -1155,7 +1155,7 @@ static inline void amdgpu_set_ib_value(struct amdgpu_cs_parser *p,
 /*
  * Writeback
  */
-#define AMDGPU_MAX_WB 1024	/* Reserve at most 1024 WB slots for amdgpu-owned rings. */
+#define AMDGPU_MAX_WB 512	/* Reserve at most 512 WB slots for amdgpu-owned rings. */
 
 struct amdgpu_wb {
 	struct amdgpu_bo	*wb_obj;
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): 1508316505-8506-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org

author
#2 lore raw

PATCH 2/6 drm/amdgpu:fix regression on KIQ enable

previously a path moves ucode_init_bo to amdgpu_device_init but this cause regression:

the regression that MEC enabling will fail after gpu reset, the reason is after gpu reset (at least from VF FLR) the firmware buf that MEC use is somehow changed by PSP hw, so without calling this ucode_init_bo again in psp_hw_init() the MEC ucode won't get upload succesfully thus lead to MEC fail.

now add back the ucode_init_bo in psp hw_init to fix that problem

Change-Id Ica5085db0d332dfaa76d2fb89a1e0ed1e94ffbfa
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +2 -0
index f1035a6..f1ccc659 100644
@@ -412,6 +412,8 @@ static int psp_hw_init(void *handle)
 
 	mutex_lock(&adev->firmware.mutex);
 
+	amdgpu_ucode_init_bo(adev);
+
 	ret = psp_load_fw(adev);
 	if (ret) {
 		DRM_ERROR("PSP firmware loading failed\n");
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#3 lore raw

PATCH 3/6 drm/amdgpu/sriov:now must reinit psp

In reply to a message not in the archive

otherwise after VF FLR the KIQ cannot work

Change-Id Icb18e794b5e4dccfd70c811c138c7102df874203
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
index 57addfe..b05536c 100644
@@ -1964,6 +1964,7 @@ static int amdgpu_sriov_reinit_late(struct amdgpu_device *adev)
 
 	static enum amd_ip_block_type ip_order[] = {
 		AMD_IP_BLOCK_TYPE_SMC,
+		AMD_IP_BLOCK_TYPE_PSP,
 		AMD_IP_BLOCK_TYPE_DCE,
 		AMD_IP_BLOCK_TYPE_GFX,
 		AMD_IP_BLOCK_TYPE_SDMA,
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): 1508316505-8506-3-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#5 lore raw

Re: [PATCH 3/6] drm/amdgpu/sriov:now must reinit psp

Quoted 4 lines · Monk Liu

otherwise after VF FLR the KIQ cannot work

Change-Id Icb18e794b5e4dccfd70c811c138c7102df874203
Quoted 19 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
index 57addfe..b05536c 100644
@@ -1964,6 +1964,7 @@ static int amdgpu_sriov_reinit_late(struct amdgpu_device *adev)
 
        static enum amd_ip_block_type ip_order[] = {
                AMD_IP_BLOCK_TYPE_SMC,
+               AMD_IP_BLOCK_TYPE_PSP,
                AMD_IP_BLOCK_TYPE_DCE,
                AMD_IP_BLOCK_TYPE_GFX,
                AMD_IP_BLOCK_TYPE_SDMA,
--

2.7.4

Quoted 4 lines

_______________________________________________
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

author
#6 lore raw

PATCH 4/6 drm/amdgpu:fix duplicated setting job's vram_lost

In reply to a message not in the archive
Change-Id I7a29e1533fb3deb476bc0f3dba0f8b2e25baf8c1
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c  | 1 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +0 -1
index 52dd78e..32cf83e 100644
@@ -172,7 +172,6 @@ static int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data)
 	if (ret)
 		goto free_all_kdata;
 
-	p->job->vram_lost_counter = atomic_read(&p->adev->vram_lost_counter);
 	if (p->ctx->vram_lost_counter != p->job->vram_lost_counter) {
 		ret = -ECANCELED;
 		goto free_all_kdata;
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +1 -1
index a835788..0cfc68d 100644
@@ -61,11 +61,11 @@ int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs,
 	(*job)->vm = vm;
 	(*job)->ibs = (void *)&(*job)[1];
 	(*job)->num_ibs = num_ibs;
-	(*job)->vram_lost_counter = atomic_read(&adev->vram_lost_counter);
 
 	amdgpu_sync_create(&(*job)->sync);
 	amdgpu_sync_create(&(*job)->dep_sync);
 	amdgpu_sync_create(&(*job)->sched_sync);
+	(*job)->vram_lost_counter = atomic_read(&adev->vram_lost_counter);
 
 	return 0;
 }
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): 1508316505-8506-4-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#8 lore raw

Re: [PATCH 4/6] drm/amdgpu:fix duplicated setting job's vram_lost

Am 18.10.2017 um 10:48 schrieb Monk Liu:

Quoted 2 lines
Change-Id I7a29e1533fb3deb476bc0f3dba0f8b2e25baf8c1
Quoted 24 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c  | 1 -
  drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 2 +-
  2 files changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +0 -1
index 52dd78e..32cf83e 100644
@@ -172,7 +172,6 @@ static int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data)
  	if (ret)
  		goto free_all_kdata;
 
-	p->job->vram_lost_counter = atomic_read(&p->adev->vram_lost_counter);
  	if (p->ctx->vram_lost_counter != p->job->vram_lost_counter) {
  		ret = -ECANCELED;
  		goto free_all_kdata;
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +0 -0
index a835788..0cfc68d 100644
@@ -61,11 +61,11 @@ int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs,
  	(*job)->vm = vm;
  	(*job)->ibs = (void *)&(*job)[1];

drivers/gpu/drm/amd/amdgpu/amdgpu_job.c int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs, · line 71

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +1 -1
  	(*job)->num_ibs = num_ibs;
-	(*job)->vram_lost_counter = atomic_read(&adev->vram_lost_counter);
 
  	amdgpu_sync_create(&(*job)->sync);
  	amdgpu_sync_create(&(*job)->dep_sync);
  	amdgpu_sync_create(&(*job)->sched_sync);
+	(*job)->vram_lost_counter = atomic_read(&adev->vram_lost_counter);
 
  	return 0;
  }

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

author
#9 lore raw

PATCH 5/6 drm/amdgpu:fix vf_error_put

In reply to a message not in the archive

it should not work on non-SR-IOV case

Change-Id Icf34f88a0642e4b04c857a07b72df3bb772075d6
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c   | 7 +++----
 drivers/gpu/drm/amd/amdgpu/amdgpu_vf_error.c | 7 ++++++-
 2 files changed, 9 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -4
index b05536c..fec60bc9 100644
@@ -2057,6 +2057,9 @@ static void amdgpu_device_detect_sriov_bios(struct amdgpu_device *adev)
 		if (amdgpu_atombios_has_gpu_virtualization_table(adev))
 			adev->virt.caps |= AMDGPU_SRIOV_CAPS_SRIOV_VBIOS;
 	}
+
+	if (!(adev->virt.caps & AMDGPU_SRIOV_CAPS_SRIOV_VBIOS))
+		amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_NO_VBIOS, 0, 0);
 }
 
 bool amdgpu_device_asic_has_dc_support(enum amd_asic_type asic_type)
@@ -2268,7 +2271,6 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 	if (amdgpu_vpost_needed(adev)) {
 		if (!adev->bios) {
 			dev_err(adev->dev, "no vBIOS found\n");
-			amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_NO_VBIOS, 0, 0);
 			r = -EINVAL;
 			goto failed;
 		}
@@ -2276,7 +2278,6 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 		r = amdgpu_atom_asic_init(adev->mode_info.atom_context);
 		if (r) {
 			dev_err(adev->dev, "gpu post error!\n");
-			amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_GPU_POST_ERROR, 0, 0);
 			goto failed;
 		}
 	} else {
@@ -3101,7 +3102,6 @@ int amdgpu_gpu_reset(struct amdgpu_device *adev)
 		}
 	} else {
 		dev_err(adev->dev, "asic resume failed (%d).\n", r);
-		amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_ASIC_RESUME_FAIL, 0, r);
 		for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
 			if (adev->rings[i] && adev->rings[i]->sched.thread) {
 				kthread_unpark(adev->rings[i]->sched.thread);
@@ -3119,7 +3119,6 @@ int amdgpu_gpu_reset(struct amdgpu_device *adev)
 	if (r) {
 		/* bad news, how to tell it to userspace ? */
 		dev_info(adev->dev, "GPU reset failed\n");
-		amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_GPU_RESET_FAIL, 0, r);
 	}
 	else {
 		dev_info(adev->dev, "GPU reset successed!\n");
drivers/gpu/drm/amd/amdgpu/amdgpu_vf_error.c +6 -1
index 746b813..7f70979 100644
@@ -31,7 +31,12 @@ void amdgpu_vf_error_put(struct amdgpu_device *adev,
 			 uint64_t error_data)
 {
 	int index;
-	uint16_t error_code = AMDGIM_ERROR_CODE(AMDGIM_ERROR_CATEGORY_VF, sub_error_code);
+	uint16_t error_code;
+
+	if (!amdgpu_sriov_vf(adev))
+		return;
+
+	error_code = AMDGIM_ERROR_CODE(AMDGIM_ERROR_CATEGORY_VF, sub_error_code);
 
 	mutex_lock(&adev->virt.vf_errors.lock);
 	index = adev->virt.vf_errors.write_count % AMDGPU_VF_ERROR_ENTRY_SIZE;
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#10 lore raw

PATCH 6/6 drm/amdgpu:don't check soft_reset for sriov

In reply to a message not in the archive
Change-Id Iafe294aea66ae0c140af062ec78321c22a74e615
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -0
index fec60bc9..ee3846c 100644
@@ -2699,6 +2699,9 @@ static bool amdgpu_check_soft_reset(struct amdgpu_device *adev)
 	int i;
 	bool asic_hang = false;
 
+	if (amdgpu_sriov_vf(adev))
+		return true;
+
 	for (i = 0; i < adev->num_ip_blocks; i++) {
 		if (!adev->ip_blocks[i].status.valid)
 			continue;
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): 1508316505-8506-6-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org

#12 lore raw

Re: [PATCH 6/6] drm/amdgpu:don't check soft_reset for sriov

Am 18.10.2017 um 10:48 schrieb Monk Liu:

Quoted 2 lines
Change-Id Iafe294aea66ae0c140af062ec78321c22a74e615

#1 and #4 in this series have my rb.

Can't say much about the rest, but feel free to add my Acked-by to them.

Regards,
Christian.

Quoted 9 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 +++
  1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
index fec60bc9..ee3846c 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static bool amdgpu_check_soft_reset(struct amdgpu_device *adev) · line 2707

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -0
@@ -2699,6 +2699,9 @@ static bool amdgpu_check_soft_reset(struct amdgpu_device *adev)
  	int i;
  	bool asic_hang = false;
 
+	if (amdgpu_sriov_vf(adev))
+		return true;
+
  	for (i = 0; i < adev->num_ip_blocks; i++) {
  		if (!adev->ip_blocks[i].status.valid)
  			continue;

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

Reviewed-by
#13 lore raw
In reply to a message not in the archive

Am 18.10.2017 um 10:48 schrieb Monk Liu:

Quoted 6 lines

with current WB usage we only use 57 slots, so 512 is extreamly sufficient, and reduce to 512 can make WB fit into one page.

Change-Id I4261630731f132b9bec91b0037e914030b5c031f
Quoted 9 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -0
index 7ecfc53..4697ba2 100644

drivers/gpu/drm/amd/amdgpu/amdgpu.h static inline void amdgpu_set_ib_value(struct amdgpu_cs_parser *p, · line 1161

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -1
@@ -1155,7 +1155,7 @@ static inline void amdgpu_set_ib_value(struct amdgpu_cs_parser *p,
  /*
   * Writeback
   */
-#define AMDGPU_MAX_WB 1024	/* Reserve at most 1024 WB slots for amdgpu-owned rings. */
+#define AMDGPU_MAX_WB 512	/* Reserve at most 512 WB slots for amdgpu-owned rings. */
 
  struct amdgpu_wb {
  	struct amdgpu_bo	*wb_obj;

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