All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/8] drm/amdgpu/gfx8: whitespace cleanup
@ 2017-03-23 15:55 Alex Deucher
       [not found] ` <1490284508-2453-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Alex Deucher @ 2017-03-23 15:55 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index 0ff776e..cc4945f 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -7085,8 +7085,8 @@ static int gfx_v8_0_compute_mqd_soft_init(struct amdgpu_device *adev)
 	ring = &adev->gfx.kiq.ring;
 	if (!ring->mqd_obj) {
 		r = amdgpu_bo_create_kernel(adev, sizeof(struct vi_mqd), PAGE_SIZE,
-						AMDGPU_GEM_DOMAIN_GTT, &ring->mqd_obj,
-						&ring->mqd_gpu_addr, &ring->mqd_ptr);
+					    AMDGPU_GEM_DOMAIN_GTT, &ring->mqd_obj,
+					    &ring->mqd_gpu_addr, &ring->mqd_ptr);
 		if (r) {
 			dev_warn(adev->dev, "failed to create ring mqd ob (%d)", r);
 			return r;
@@ -7099,13 +7099,12 @@ static int gfx_v8_0_compute_mqd_soft_init(struct amdgpu_device *adev)
 	}
 
 	/* create MQD for each KCQ */
-	for (i = 0; i < adev->gfx.num_compute_rings; i++)
-	{
+	for (i = 0; i < adev->gfx.num_compute_rings; i++) {
 		ring = &adev->gfx.compute_ring[i];
 		if (!ring->mqd_obj) {
 			r = amdgpu_bo_create_kernel(adev, sizeof(struct vi_mqd), PAGE_SIZE,
-							AMDGPU_GEM_DOMAIN_GTT, &ring->mqd_obj,
-							&ring->mqd_gpu_addr, &ring->mqd_ptr);
+						    AMDGPU_GEM_DOMAIN_GTT, &ring->mqd_obj,
+						    &ring->mqd_gpu_addr, &ring->mqd_ptr);
 			if (r) {
 				dev_warn(adev->dev, "failed to create ring mqd ob (%d)", r);
 				return r;
-- 
2.5.5

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/8] drm/amdgpu/gfx8: rename some functions
       [not found] ` <1490284508-2453-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
@ 2017-03-23 15:55   ` Alex Deucher
  2017-03-23 15:55   ` [PATCH 3/8] drm/amdgpu/gfx8: reserve mqd objects before mapping them Alex Deucher
                     ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Alex Deucher @ 2017-03-23 15:55 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher

To better match where they are used.  Called from sw_init
and sw_fini.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index cc4945f..8e30cb0 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -659,8 +659,8 @@ static u32 gfx_v8_0_get_csb_size(struct amdgpu_device *adev);
 static void gfx_v8_0_get_cu_info(struct amdgpu_device *adev);
 static void gfx_v8_0_ring_emit_ce_meta_init(struct amdgpu_ring *ring, uint64_t addr);
 static void gfx_v8_0_ring_emit_de_meta_init(struct amdgpu_ring *ring, uint64_t addr);
-static int gfx_v8_0_compute_mqd_soft_init(struct amdgpu_device *adev);
-static void gfx_v8_0_compute_mqd_soft_fini(struct amdgpu_device *adev);
+static int gfx_v8_0_compute_mqd_sw_init(struct amdgpu_device *adev);
+static void gfx_v8_0_compute_mqd_sw_fini(struct amdgpu_device *adev);
 
 static void gfx_v8_0_init_golden_registers(struct amdgpu_device *adev)
 {
@@ -2170,7 +2170,7 @@ static int gfx_v8_0_sw_init(void *handle)
 		return r;
 
 	/* create MQD for all compute queues as well as KIQ for SRIOV case */
-	r = gfx_v8_0_compute_mqd_soft_init(adev);
+	r = gfx_v8_0_compute_mqd_sw_init(adev);
 	if (r)
 		return r;
 
@@ -2216,7 +2216,7 @@ static int gfx_v8_0_sw_fini(void *handle)
 	for (i = 0; i < adev->gfx.num_compute_rings; i++)
 		amdgpu_ring_fini(&adev->gfx.compute_ring[i]);
 
-	gfx_v8_0_compute_mqd_soft_fini(adev);
+	gfx_v8_0_compute_mqd_sw_fini(adev);
 	gfx_v8_0_kiq_free_ring(&adev->gfx.kiq.ring, &adev->gfx.kiq.irq);
 	gfx_v8_0_kiq_fini(adev);
 
@@ -7076,7 +7076,7 @@ static void gfx_v8_0_ring_emit_de_meta_init(struct amdgpu_ring *ring, uint64_t c
 }
 
 /* create MQD for each compute queue */
-static int gfx_v8_0_compute_mqd_soft_init(struct amdgpu_device *adev)
+static int gfx_v8_0_compute_mqd_sw_init(struct amdgpu_device *adev)
 {
 	struct amdgpu_ring *ring = NULL;
 	int r, i;
@@ -7120,7 +7120,7 @@ static int gfx_v8_0_compute_mqd_soft_init(struct amdgpu_device *adev)
 	return 0;
 }
 
-static void gfx_v8_0_compute_mqd_soft_fini(struct amdgpu_device *adev)
+static void gfx_v8_0_compute_mqd_sw_fini(struct amdgpu_device *adev)
 {
 	struct amdgpu_ring *ring = NULL;
 	int i;
-- 
2.5.5

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/8] drm/amdgpu/gfx8: reserve mqd objects before mapping them
       [not found] ` <1490284508-2453-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
  2017-03-23 15:55   ` [PATCH 2/8] drm/amdgpu/gfx8: rename some functions Alex Deucher
@ 2017-03-23 15:55   ` Alex Deucher
  2017-03-23 15:55   ` [PATCH 4/8] drm/amdgpu/gfx8: test KIQ before compute rings Alex Deucher
                     ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Alex Deucher @ 2017-03-23 15:55 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher

It's required.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 32 +++++++++++++++++++++-----------
 1 file changed, 21 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index 8e30cb0..efe03a5 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -4936,31 +4936,40 @@ static int gfx_v8_0_kiq_resume(struct amdgpu_device *adev)
 	gfx_v8_0_cp_compute_enable(adev, true);
 
 	ring = &adev->gfx.kiq.ring;
-	if (!amdgpu_bo_kmap(ring->mqd_obj, &ring->mqd_ptr)) {
+
+	r = amdgpu_bo_reserve(ring->mqd_obj, false);
+	if (unlikely(r != 0))
+		goto done;
+
+	r = amdgpu_bo_kmap(ring->mqd_obj, &ring->mqd_ptr);
+	if (!r) {
 		r = gfx_v8_0_kiq_init_queue(ring,
 					    (struct vi_mqd *)ring->mqd_ptr,
 					    ring->mqd_gpu_addr);
 		amdgpu_bo_kunmap(ring->mqd_obj);
 		ring->mqd_ptr = NULL;
-		if (r)
-			return r;
-	} else {
-		return r;
 	}
+	amdgpu_bo_unreserve(ring->mqd_obj);
+	if (r)
+		goto done;
 
 	for (i = 0; i < adev->gfx.num_compute_rings; i++) {
 		ring = &adev->gfx.compute_ring[i];
-		if (!amdgpu_bo_kmap(ring->mqd_obj, &ring->mqd_ptr)) {
+
+		r = amdgpu_bo_reserve(ring->mqd_obj, false);
+		if (unlikely(r != 0))
+			goto done;
+		r = amdgpu_bo_kmap(ring->mqd_obj, &ring->mqd_ptr);
+		if (!r) {
 			r = gfx_v8_0_kiq_init_queue(ring,
 						    (struct vi_mqd *)ring->mqd_ptr,
 						    ring->mqd_gpu_addr);
 			amdgpu_bo_kunmap(ring->mqd_obj);
 			ring->mqd_ptr = NULL;
-			if (r)
-			return r;
-		} else {
-			return r;
 		}
+		amdgpu_bo_unreserve(ring->mqd_obj);
+		if (r)
+			goto done;
 	}
 
 	for (i = 0; i < adev->gfx.num_compute_rings; i++) {
@@ -4978,7 +4987,8 @@ static int gfx_v8_0_kiq_resume(struct amdgpu_device *adev)
 	if (r)
 		ring->ready = false;
 
-	return 0;
+done:
+	return r;
 }
 
 static int gfx_v8_0_cp_resume(struct amdgpu_device *adev)
-- 
2.5.5

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/8] drm/amdgpu/gfx8: test KIQ before compute rings
       [not found] ` <1490284508-2453-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
  2017-03-23 15:55   ` [PATCH 2/8] drm/amdgpu/gfx8: rename some functions Alex Deucher
  2017-03-23 15:55   ` [PATCH 3/8] drm/amdgpu/gfx8: reserve mqd objects before mapping them Alex Deucher
@ 2017-03-23 15:55   ` Alex Deucher
  2017-03-23 15:55   ` [PATCH 5/8] drm/amdgpu/gfx8: fold loops in kiq_resume() Alex Deucher
                     ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Alex Deucher @ 2017-03-23 15:55 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher

If KIQ isn't working, the compute rings won't work either.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index efe03a5..ecfbbd1 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -4953,6 +4953,13 @@ static int gfx_v8_0_kiq_resume(struct amdgpu_device *adev)
 	if (r)
 		goto done;
 
+	ring->ready = true;
+	r = amdgpu_ring_test_ring(ring);
+	if (r) {
+		ring->ready = false;
+		goto done;
+	}
+
 	for (i = 0; i < adev->gfx.num_compute_rings; i++) {
 		ring = &adev->gfx.compute_ring[i];
 
@@ -4981,12 +4988,6 @@ static int gfx_v8_0_kiq_resume(struct amdgpu_device *adev)
 			ring->ready = false;
 	}
 
-	ring = &adev->gfx.kiq.ring;
-	ring->ready = true;
-	r = amdgpu_ring_test_ring(ring);
-	if (r)
-		ring->ready = false;
-
 done:
 	return r;
 }
-- 
2.5.5

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 5/8] drm/amdgpu/gfx8: fold loops in kiq_resume()
       [not found] ` <1490284508-2453-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
                     ` (2 preceding siblings ...)
  2017-03-23 15:55   ` [PATCH 4/8] drm/amdgpu/gfx8: test KIQ before compute rings Alex Deucher
@ 2017-03-23 15:55   ` Alex Deucher
  2017-03-23 15:55   ` [PATCH 6/8] drm/amdgpu: reserve kiq eop object before unmapping it Alex Deucher
                     ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Alex Deucher @ 2017-03-23 15:55 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher

No need to loop through the compute queues twice.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index ecfbbd1..450f7ec 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -4977,10 +4977,6 @@ static int gfx_v8_0_kiq_resume(struct amdgpu_device *adev)
 		amdgpu_bo_unreserve(ring->mqd_obj);
 		if (r)
 			goto done;
-	}
-
-	for (i = 0; i < adev->gfx.num_compute_rings; i++) {
-		ring = &adev->gfx.compute_ring[i];
 
 		ring->ready = true;
 		r = amdgpu_ring_test_ring(ring);
-- 
2.5.5

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 6/8] drm/amdgpu: reserve kiq eop object before unmapping it
       [not found] ` <1490284508-2453-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
                     ` (3 preceding siblings ...)
  2017-03-23 15:55   ` [PATCH 5/8] drm/amdgpu/gfx8: fold loops in kiq_resume() Alex Deucher
@ 2017-03-23 15:55   ` Alex Deucher
  2017-03-23 15:55   ` [PATCH 7/8] drm/amdgpu/gfx8: reduce the functon params for mpq setup Alex Deucher
                     ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Alex Deucher @ 2017-03-23 15:55 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher

It's required.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index 450f7ec..3f710b8 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -1488,7 +1488,11 @@ static int gfx_v8_0_kiq_init(struct amdgpu_device *adev)
 
 	memset(hpd, 0, MEC_HPD_SIZE);
 
+	r = amdgpu_bo_reserve(kiq->eop_obj, false);
+	if (unlikely(r != 0))
+		dev_warn(adev->dev, "(%d) reserve kiq eop bo failed\n", r);
 	amdgpu_bo_kunmap(kiq->eop_obj);
+	amdgpu_bo_unreserve(kiq->eop_obj);
 
 	return 0;
 }
-- 
2.5.5

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 7/8] drm/amdgpu/gfx8: reduce the functon params for mpq setup
       [not found] ` <1490284508-2453-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
                     ` (4 preceding siblings ...)
  2017-03-23 15:55   ` [PATCH 6/8] drm/amdgpu: reserve kiq eop object before unmapping it Alex Deucher
@ 2017-03-23 15:55   ` Alex Deucher
  2017-03-23 15:55   ` [PATCH 8/8] drm/amdgpu/gfx8: store the eop gpu addr in the ring structure Alex Deucher
  2017-03-23 16:07   ` [PATCH 1/8] drm/amdgpu/gfx8: whitespace cleanup Christian König
  7 siblings, 0 replies; 9+ messages in thread
From: Alex Deucher @ 2017-03-23 15:55 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher

Everything we need is in the ring structure.  No need to
pass all the bits explicitly.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 32 ++++++++++++++------------------
 1 file changed, 14 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index 3f710b8..bf608c8 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -4664,12 +4664,11 @@ static void gfx_v8_0_map_queue_enable(struct amdgpu_ring *kiq_ring,
 	udelay(50);
 }
 
-static int gfx_v8_0_mqd_init(struct amdgpu_device *adev,
+static int gfx_v8_0_mqd_init(struct amdgpu_ring *ring,
 			     struct vi_mqd *mqd,
-			     uint64_t mqd_gpu_addr,
-			     uint64_t eop_gpu_addr,
-			     struct amdgpu_ring *ring)
+			     uint64_t eop_gpu_addr)
 {
+	struct amdgpu_device *adev = ring->adev;
 	uint64_t hqd_gpu_addr, wb_gpu_addr, eop_base_addr;
 	uint32_t tmp;
 
@@ -4710,8 +4709,8 @@ static int gfx_v8_0_mqd_init(struct amdgpu_device *adev,
 	mqd->cp_hqd_pq_wptr = 0;
 
 	/* set the pointer to the MQD */
-	mqd->cp_mqd_base_addr_lo = mqd_gpu_addr & 0xfffffffc;
-	mqd->cp_mqd_base_addr_hi = upper_32_bits(mqd_gpu_addr);
+	mqd->cp_mqd_base_addr_lo = ring->mqd_gpu_addr & 0xfffffffc;
+	mqd->cp_mqd_base_addr_hi = upper_32_bits(ring->mqd_gpu_addr);
 
 	/* set MQD vmid to 0 */
 	tmp = RREG32(mmCP_MQD_CONTROL);
@@ -4784,10 +4783,10 @@ static int gfx_v8_0_mqd_init(struct amdgpu_device *adev,
 	return 0;
 }
 
-static int gfx_v8_0_kiq_init_register(struct amdgpu_device *adev,
-				      struct vi_mqd *mqd,
-				      struct amdgpu_ring *ring)
+static int gfx_v8_0_kiq_init_register(struct amdgpu_ring *ring,
+				      struct vi_mqd *mqd)
 {
+	struct amdgpu_device *adev = ring->adev;
 	uint32_t tmp;
 	int j;
 
@@ -4876,8 +4875,7 @@ static int gfx_v8_0_kiq_init_register(struct amdgpu_device *adev,
 }
 
 static int gfx_v8_0_kiq_init_queue(struct amdgpu_ring *ring,
-				   struct vi_mqd *mqd,
-				   u64 mqd_gpu_addr)
+				   struct vi_mqd *mqd)
 {
 	struct amdgpu_device *adev = ring->adev;
 	struct amdgpu_kiq *kiq = &adev->gfx.kiq;
@@ -4898,9 +4896,9 @@ static int gfx_v8_0_kiq_init_queue(struct amdgpu_ring *ring,
 		memset((void *)mqd, 0, sizeof(*mqd));
 		mutex_lock(&adev->srbm_mutex);
 		vi_srbm_select(adev, ring->me, ring->pipe, ring->queue, 0);
-		gfx_v8_0_mqd_init(adev, mqd, mqd_gpu_addr, eop_gpu_addr, ring);
+		gfx_v8_0_mqd_init(ring, mqd, eop_gpu_addr);
 		if (is_kiq)
-			gfx_v8_0_kiq_init_register(adev, mqd, ring);
+			gfx_v8_0_kiq_init_register(ring, mqd);
 		vi_srbm_select(adev, 0, 0, 0, 0);
 		mutex_unlock(&adev->srbm_mutex);
 
@@ -4918,7 +4916,7 @@ static int gfx_v8_0_kiq_init_queue(struct amdgpu_ring *ring,
 		if (is_kiq) {
 		    mutex_lock(&adev->srbm_mutex);
 		    vi_srbm_select(adev, ring->me, ring->pipe, ring->queue, 0);
-		    gfx_v8_0_kiq_init_register(adev, mqd, ring);
+		    gfx_v8_0_kiq_init_register(ring, mqd);
 		    vi_srbm_select(adev, 0, 0, 0, 0);
 		    mutex_unlock(&adev->srbm_mutex);
 		}
@@ -4948,8 +4946,7 @@ static int gfx_v8_0_kiq_resume(struct amdgpu_device *adev)
 	r = amdgpu_bo_kmap(ring->mqd_obj, &ring->mqd_ptr);
 	if (!r) {
 		r = gfx_v8_0_kiq_init_queue(ring,
-					    (struct vi_mqd *)ring->mqd_ptr,
-					    ring->mqd_gpu_addr);
+					    (struct vi_mqd *)ring->mqd_ptr);
 		amdgpu_bo_kunmap(ring->mqd_obj);
 		ring->mqd_ptr = NULL;
 	}
@@ -4973,8 +4970,7 @@ static int gfx_v8_0_kiq_resume(struct amdgpu_device *adev)
 		r = amdgpu_bo_kmap(ring->mqd_obj, &ring->mqd_ptr);
 		if (!r) {
 			r = gfx_v8_0_kiq_init_queue(ring,
-						    (struct vi_mqd *)ring->mqd_ptr,
-						    ring->mqd_gpu_addr);
+						    (struct vi_mqd *)ring->mqd_ptr);
 			amdgpu_bo_kunmap(ring->mqd_obj);
 			ring->mqd_ptr = NULL;
 		}
-- 
2.5.5

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 8/8] drm/amdgpu/gfx8: store the eop gpu addr in the ring structure
       [not found] ` <1490284508-2453-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
                     ` (5 preceding siblings ...)
  2017-03-23 15:55   ` [PATCH 7/8] drm/amdgpu/gfx8: reduce the functon params for mpq setup Alex Deucher
@ 2017-03-23 15:55   ` Alex Deucher
  2017-03-23 16:07   ` [PATCH 1/8] drm/amdgpu/gfx8: whitespace cleanup Christian König
  7 siblings, 0 replies; 9+ messages in thread
From: Alex Deucher @ 2017-03-23 15:55 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher

Avoids passing around additional parameters during setup.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h |  1 +
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c    | 14 ++++++--------
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
index 9f57eda..853e87a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
@@ -168,6 +168,7 @@ struct amdgpu_ring {
 	struct amdgpu_bo	*mqd_obj;
 	uint64_t                mqd_gpu_addr;
 	void                    *mqd_ptr;
+	uint64_t                eop_gpu_addr;
 	u32			doorbell_index;
 	bool			use_doorbell;
 	unsigned		wptr_offs;
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index bf608c8..a023f27 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -1377,6 +1377,7 @@ static int gfx_v8_0_kiq_init_ring(struct amdgpu_device *adev,
 				  struct amdgpu_ring *ring,
 				  struct amdgpu_irq_src *irq)
 {
+	struct amdgpu_kiq *kiq = &adev->gfx.kiq;
 	int r = 0;
 
 	r = amdgpu_wb_get(adev, &adev->virt.reg_val_offs);
@@ -1396,6 +1397,7 @@ static int gfx_v8_0_kiq_init_ring(struct amdgpu_device *adev,
 	}
 
 	ring->queue = 0;
+	ring->eop_gpu_addr = kiq->eop_gpu_addr;
 	sprintf(ring->name, "kiq %d.%d.%d", ring->me, ring->pipe, ring->queue);
 	r = amdgpu_ring_init(adev, ring, 1024,
 			     irq, AMDGPU_CP_KIQ_IRQ_DRIVER0);
@@ -2153,6 +2155,7 @@ static int gfx_v8_0_sw_init(void *handle)
 		ring->me = 1; /* first MEC */
 		ring->pipe = i / 8;
 		ring->queue = i % 8;
+		ring->eop_gpu_addr = adev->gfx.mec.hpd_eop_gpu_addr + (i * MEC_HPD_SIZE);
 		sprintf(ring->name, "comp_%d.%d.%d", ring->me, ring->pipe, ring->queue);
 		irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP + ring->pipe;
 		/* type-2 packets are deprecated on MEC, use type-3 instead */
@@ -4665,8 +4668,7 @@ static void gfx_v8_0_map_queue_enable(struct amdgpu_ring *kiq_ring,
 }
 
 static int gfx_v8_0_mqd_init(struct amdgpu_ring *ring,
-			     struct vi_mqd *mqd,
-			     uint64_t eop_gpu_addr)
+			     struct vi_mqd *mqd)
 {
 	struct amdgpu_device *adev = ring->adev;
 	uint64_t hqd_gpu_addr, wb_gpu_addr, eop_base_addr;
@@ -4680,7 +4682,7 @@ static int gfx_v8_0_mqd_init(struct amdgpu_ring *ring,
 	mqd->compute_static_thread_mgmt_se3 = 0xffffffff;
 	mqd->compute_misc_reserved = 0x00000003;
 
-	eop_base_addr = eop_gpu_addr >> 8;
+	eop_base_addr = ring->eop_gpu_addr >> 8;
 	mqd->cp_hqd_eop_base_addr_lo = eop_base_addr;
 	mqd->cp_hqd_eop_base_addr_hi = upper_32_bits(eop_base_addr);
 
@@ -4879,16 +4881,12 @@ static int gfx_v8_0_kiq_init_queue(struct amdgpu_ring *ring,
 {
 	struct amdgpu_device *adev = ring->adev;
 	struct amdgpu_kiq *kiq = &adev->gfx.kiq;
-	uint64_t eop_gpu_addr;
 	bool is_kiq = (ring->funcs->type == AMDGPU_RING_TYPE_KIQ);
 	int mqd_idx = AMDGPU_MAX_COMPUTE_RINGS;
 
 	if (is_kiq) {
-		eop_gpu_addr = kiq->eop_gpu_addr;
 		gfx_v8_0_kiq_setting(&kiq->ring);
 	} else {
-		eop_gpu_addr = adev->gfx.mec.hpd_eop_gpu_addr +
-					ring->queue * MEC_HPD_SIZE;
 		mqd_idx = ring - &adev->gfx.compute_ring[0];
 	}
 
@@ -4896,7 +4894,7 @@ static int gfx_v8_0_kiq_init_queue(struct amdgpu_ring *ring,
 		memset((void *)mqd, 0, sizeof(*mqd));
 		mutex_lock(&adev->srbm_mutex);
 		vi_srbm_select(adev, ring->me, ring->pipe, ring->queue, 0);
-		gfx_v8_0_mqd_init(ring, mqd, eop_gpu_addr);
+		gfx_v8_0_mqd_init(ring, mqd);
 		if (is_kiq)
 			gfx_v8_0_kiq_init_register(ring, mqd);
 		vi_srbm_select(adev, 0, 0, 0, 0);
-- 
2.5.5

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/8] drm/amdgpu/gfx8: whitespace cleanup
       [not found] ` <1490284508-2453-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
                     ` (6 preceding siblings ...)
  2017-03-23 15:55   ` [PATCH 8/8] drm/amdgpu/gfx8: store the eop gpu addr in the ring structure Alex Deucher
@ 2017-03-23 16:07   ` Christian König
  7 siblings, 0 replies; 9+ messages in thread
From: Christian König @ 2017-03-23 16:07 UTC (permalink / raw)
  To: Alex Deucher, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher

Am 23.03.2017 um 16:55 schrieb Alex Deucher:
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

Reviewed-by: Christian König <christian.koenig@amd.com> for the whole set.

> ---
>   drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 11 +++++------
>   1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> index 0ff776e..cc4945f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> @@ -7085,8 +7085,8 @@ static int gfx_v8_0_compute_mqd_soft_init(struct amdgpu_device *adev)
>   	ring = &adev->gfx.kiq.ring;
>   	if (!ring->mqd_obj) {
>   		r = amdgpu_bo_create_kernel(adev, sizeof(struct vi_mqd), PAGE_SIZE,
> -						AMDGPU_GEM_DOMAIN_GTT, &ring->mqd_obj,
> -						&ring->mqd_gpu_addr, &ring->mqd_ptr);
> +					    AMDGPU_GEM_DOMAIN_GTT, &ring->mqd_obj,
> +					    &ring->mqd_gpu_addr, &ring->mqd_ptr);
>   		if (r) {
>   			dev_warn(adev->dev, "failed to create ring mqd ob (%d)", r);
>   			return r;
> @@ -7099,13 +7099,12 @@ static int gfx_v8_0_compute_mqd_soft_init(struct amdgpu_device *adev)
>   	}
>   
>   	/* create MQD for each KCQ */
> -	for (i = 0; i < adev->gfx.num_compute_rings; i++)
> -	{
> +	for (i = 0; i < adev->gfx.num_compute_rings; i++) {
>   		ring = &adev->gfx.compute_ring[i];
>   		if (!ring->mqd_obj) {
>   			r = amdgpu_bo_create_kernel(adev, sizeof(struct vi_mqd), PAGE_SIZE,
> -							AMDGPU_GEM_DOMAIN_GTT, &ring->mqd_obj,
> -							&ring->mqd_gpu_addr, &ring->mqd_ptr);
> +						    AMDGPU_GEM_DOMAIN_GTT, &ring->mqd_obj,
> +						    &ring->mqd_gpu_addr, &ring->mqd_ptr);
>   			if (r) {
>   				dev_warn(adev->dev, "failed to create ring mqd ob (%d)", r);
>   				return r;


_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-03-23 16:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-23 15:55 [PATCH 1/8] drm/amdgpu/gfx8: whitespace cleanup Alex Deucher
     [not found] ` <1490284508-2453-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
2017-03-23 15:55   ` [PATCH 2/8] drm/amdgpu/gfx8: rename some functions Alex Deucher
2017-03-23 15:55   ` [PATCH 3/8] drm/amdgpu/gfx8: reserve mqd objects before mapping them Alex Deucher
2017-03-23 15:55   ` [PATCH 4/8] drm/amdgpu/gfx8: test KIQ before compute rings Alex Deucher
2017-03-23 15:55   ` [PATCH 5/8] drm/amdgpu/gfx8: fold loops in kiq_resume() Alex Deucher
2017-03-23 15:55   ` [PATCH 6/8] drm/amdgpu: reserve kiq eop object before unmapping it Alex Deucher
2017-03-23 15:55   ` [PATCH 7/8] drm/amdgpu/gfx8: reduce the functon params for mpq setup Alex Deucher
2017-03-23 15:55   ` [PATCH 8/8] drm/amdgpu/gfx8: store the eop gpu addr in the ring structure Alex Deucher
2017-03-23 16:07   ` [PATCH 1/8] drm/amdgpu/gfx8: whitespace cleanup Christian König

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.