AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tom St Denis <tstdenis82-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Tom St Denis <tom.stdenis-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH 1/7] drm/amd/amdgpu: Tidy up SI DMA code
Date: Tue,  6 Sep 2016 12:18:38 -0400	[thread overview]
Message-ID: <20160906161844.21370-2-tom.stdenis@amd.com> (raw)
In-Reply-To: <20160906161844.21370-1-tom.stdenis-5C7GfCeVMHo@public.gmane.org>

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/si_dma.c | 35 +++++------------------------------
 1 file changed, 5 insertions(+), 30 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/si_dma.c b/drivers/gpu/drm/amd/amdgpu/si_dma.c
index 377f4ae9e777..2abdaa681797 100644
--- a/drivers/gpu/drm/amd/amdgpu/si_dma.c
+++ b/drivers/gpu/drm/amd/amdgpu/si_dma.c
@@ -39,16 +39,11 @@ static void si_dma_set_irq_funcs(struct amdgpu_device *adev);
 
 static uint32_t si_dma_ring_get_rptr(struct amdgpu_ring *ring)
 {
-	u32 rptr;
-
-	rptr = ring->adev->wb.wb[ring->rptr_offs/4];
-
-	return rptr;
+	return ring->adev->wb.wb[ring->rptr_offs>>2];
 }
 
 static uint32_t si_dma_ring_get_wptr(struct amdgpu_ring *ring)
 {
-
 	struct amdgpu_device *adev = ring->adev;
 	u32 me = (ring == &adev->sdma.instance[0].ring) ? 0 : 1;
 
@@ -188,7 +183,6 @@ static int si_dma_start(struct amdgpu_device *adev)
 
 		ring->wptr = 0;
 		WREG32(DMA_RB_WPTR + sdma_offsets[i], ring->wptr << 2);
-
 		WREG32(DMA_RB_CNTL + sdma_offsets[i], rb_cntl | DMA_RB_ENABLE);
 
 		ring->ready = true;
@@ -476,11 +470,10 @@ static void si_dma_ring_emit_vm_flush(struct amdgpu_ring *ring,
 				      unsigned vm_id, uint64_t pd_addr)
 {
 	amdgpu_ring_write(ring, DMA_PACKET(DMA_PACKET_SRBM_WRITE, 0, 0, 0, 0));
-	if (vm_id < 8) {
+	if (vm_id < 8)
 		amdgpu_ring_write(ring, (0xf << 16) | (VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + vm_id));
-	} else {
+	else
 		amdgpu_ring_write(ring, (0xf << 16) | (VM_CONTEXT8_PAGE_TABLE_BASE_ADDR + (vm_id - 8)));
-	}
 	amdgpu_ring_write(ring, pd_addr >> 12);
 
 	/* bits 0-7 are the VM contexts0-7 */
@@ -558,14 +551,9 @@ static int si_dma_sw_fini(void *handle)
 
 static int si_dma_hw_init(void *handle)
 {
-	int r;
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
-	r = si_dma_start(adev);
-	if (r)
-		return r;
-
-	return r;
+	return si_dma_start(adev);
 }
 
 static int si_dma_hw_fini(void *handle)
@@ -605,13 +593,10 @@ static bool si_dma_is_idle(void *handle)
 static int si_dma_wait_for_idle(void *handle)
 {
 	unsigned i;
-	u32 tmp;
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
 	for (i = 0; i < adev->usec_timeout; i++) {
-		tmp = RREG32(SRBM_STATUS2) & (DMA_BUSY_MASK | DMA1_BUSY_MASK);
-
-		if (!tmp)
+		if (si_dma_is_idle(handle))
 			return 0;
 		udelay(1);
 	}
@@ -674,11 +659,6 @@ static int si_dma_process_trap_irq(struct amdgpu_device *adev,
 				      struct amdgpu_irq_src *source,
 				      struct amdgpu_iv_entry *entry)
 {
-	u8 instance_id, queue_id;
-
-	instance_id = (entry->ring_id & 0x3) >> 0;
-	queue_id = (entry->ring_id & 0xc) >> 2;
-
 	amdgpu_fence_process(&adev->sdma.instance[0].ring);
 
 	return 0;
@@ -688,11 +668,6 @@ static int si_dma_process_trap_irq_1(struct amdgpu_device *adev,
 				      struct amdgpu_irq_src *source,
 				      struct amdgpu_iv_entry *entry)
 {
-	u8 instance_id, queue_id;
-
-	instance_id = (entry->ring_id & 0x3) >> 0;
-	queue_id = (entry->ring_id & 0xc) >> 2;
-
 	amdgpu_fence_process(&adev->sdma.instance[1].ring);
 
 	return 0;
-- 
2.9.3

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

  parent reply	other threads:[~2016-09-06 16:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-06 16:18 Various tidy'ups with SI DMA/DPM/SMC/IH code Tom St Denis
     [not found] ` <20160906161844.21370-1-tom.stdenis-5C7GfCeVMHo@public.gmane.org>
2016-09-06 16:18   ` Tom St Denis [this message]
2016-09-06 16:18   ` [PATCH 2/7] drm/amd/amdgpu: Allow calling si_dpm_fini at any point Tom St Denis
2016-09-06 16:18   ` [PATCH 3/7] drm/amd/amdgpu: Clean up SI DPM table assignments Tom St Denis
2016-09-06 16:18   ` [PATCH 4/7] drm/amd/amdgpu: Correct whitespace in SI DPM code Tom St Denis
2016-09-06 16:18   ` [PATCH 5/7] drm/amd/amdgpu: Tidy up SI IH code Tom St Denis
2016-09-06 16:18   ` [PATCH 6/7] drm/amd/amdgpu: Tidy up SI SMC code Tom St Denis
2016-09-06 16:18   ` [PATCH 7/7] drm/amd/amdgpu: Comment out currently unused SI DPM struct Tom St Denis
     [not found]     ` <20160906161844.21370-8-tom.stdenis-5C7GfCeVMHo@public.gmane.org>
2016-09-07 14:45       ` Deucher, Alexander
     [not found]         ` <MWHPR12MB16946A5F5069CA4CAE4ABA7BF7F80-Gy0DoCVfaSW4WA4dJ5YXGAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-09-07 14:49           ` StDenis, Tom
     [not found]             ` <CY4PR12MB1768FBB1CC469E0C27182B9FF7F80-rpdhrqHFk06yjjPBNVDk/QdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-09-08  1:51               ` Michel Dänzer
2016-09-07  2:19   ` Various tidy'ups with SI DMA/DPM/SMC/IH code Edward O'Callaghan
2016-09-07 12:38   ` Huang Rui
2016-09-07 14:46   ` Deucher, Alexander

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160906161844.21370-2-tom.stdenis@amd.com \
    --to=tstdenis82-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=tom.stdenis-5C7GfCeVMHo@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox