aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2015-10-12 13:09:27 -0400
committerMark Brown <broonie@kernel.org>2015-10-12 13:09:27 -0400
commit79828b4fa835f73cdaf4bffa48696abdcbea9d02 (patch)
tree5e0fa7156acb75ba603022bc807df8f2fedb97a8 /drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c
parent721b51fcf91898299d96f4b72cb9434cda29dce6 (diff)
parent8c1a9d6323abf0fb1e5dad96cf3f1c783505ea5a (diff)
Merge remote-tracking branch 'asoc/fix/rt5645' into asoc-fix-rt5645
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c
index db5422e65ec5..5c8a803acedc 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c
@@ -24,6 +24,7 @@
24#include <drm/drmP.h> 24#include <drm/drmP.h>
25#include "amdgpu.h" 25#include "amdgpu.h"
26#include "amdgpu_ih.h" 26#include "amdgpu_ih.h"
27#include "amdgpu_amdkfd.h"
27 28
28/** 29/**
29 * amdgpu_ih_ring_alloc - allocate memory for the IH ring 30 * amdgpu_ih_ring_alloc - allocate memory for the IH ring
@@ -97,18 +98,12 @@ int amdgpu_ih_ring_init(struct amdgpu_device *adev, unsigned ring_size,
97 /* add 8 bytes for the rptr/wptr shadows and 98 /* add 8 bytes for the rptr/wptr shadows and
98 * add them to the end of the ring allocation. 99 * add them to the end of the ring allocation.
99 */ 100 */
100 adev->irq.ih.ring = kzalloc(adev->irq.ih.ring_size + 8, GFP_KERNEL); 101 adev->irq.ih.ring = pci_alloc_consistent(adev->pdev,
102 adev->irq.ih.ring_size + 8,
103 &adev->irq.ih.rb_dma_addr);
101 if (adev->irq.ih.ring == NULL) 104 if (adev->irq.ih.ring == NULL)
102 return -ENOMEM; 105 return -ENOMEM;
103 adev->irq.ih.rb_dma_addr = pci_map_single(adev->pdev, 106 memset((void *)adev->irq.ih.ring, 0, adev->irq.ih.ring_size + 8);
104 (void *)adev->irq.ih.ring,
105 adev->irq.ih.ring_size,
106 PCI_DMA_BIDIRECTIONAL);
107 if (pci_dma_mapping_error(adev->pdev, adev->irq.ih.rb_dma_addr)) {
108 dev_err(&adev->pdev->dev, "Failed to DMA MAP the IH RB page\n");
109 kfree((void *)adev->irq.ih.ring);
110 return -ENOMEM;
111 }
112 adev->irq.ih.wptr_offs = (adev->irq.ih.ring_size / 4) + 0; 107 adev->irq.ih.wptr_offs = (adev->irq.ih.ring_size / 4) + 0;
113 adev->irq.ih.rptr_offs = (adev->irq.ih.ring_size / 4) + 1; 108 adev->irq.ih.rptr_offs = (adev->irq.ih.ring_size / 4) + 1;
114 } 109 }
@@ -148,9 +143,9 @@ void amdgpu_ih_ring_fini(struct amdgpu_device *adev)
148 /* add 8 bytes for the rptr/wptr shadows and 143 /* add 8 bytes for the rptr/wptr shadows and
149 * add them to the end of the ring allocation. 144 * add them to the end of the ring allocation.
150 */ 145 */
151 pci_unmap_single(adev->pdev, adev->irq.ih.rb_dma_addr, 146 pci_free_consistent(adev->pdev, adev->irq.ih.ring_size + 8,
152 adev->irq.ih.ring_size + 8, PCI_DMA_BIDIRECTIONAL); 147 (void *)adev->irq.ih.ring,
153 kfree((void *)adev->irq.ih.ring); 148 adev->irq.ih.rb_dma_addr);
154 adev->irq.ih.ring = NULL; 149 adev->irq.ih.ring = NULL;
155 } 150 }
156 } else { 151 } else {
@@ -199,6 +194,14 @@ restart_ih:
199 rmb(); 194 rmb();
200 195
201 while (adev->irq.ih.rptr != wptr) { 196 while (adev->irq.ih.rptr != wptr) {
197 u32 ring_index = adev->irq.ih.rptr >> 2;
198
199 /* Before dispatching irq to IP blocks, send it to amdkfd */
200 amdgpu_amdkfd_interrupt(adev,
201 (const void *) &adev->irq.ih.ring[ring_index]);
202
203 entry.iv_entry = (const uint32_t *)
204 &adev->irq.ih.ring[ring_index];
202 amdgpu_ih_decode_iv(adev, &entry); 205 amdgpu_ih_decode_iv(adev, &entry);
203 adev->irq.ih.rptr &= adev->irq.ih.ptr_mask; 206 adev->irq.ih.rptr &= adev->irq.ih.ptr_mask;
204 207