diff options
author | Christian König <christian.koenig@amd.com> | 2018-09-17 10:13:49 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2019-01-14 15:04:47 -0500 |
commit | 8bb9eb480d032418bd08d0a6a39e4eaa1dec2fb8 (patch) | |
tree | 0b83e974d2b75e4d0fc1aaa6fb3e28eb838f22ab /drivers/gpu/drm/amd/amdgpu/si_ih.c | |
parent | 73c97fa4421fa0465a0b25a0ccf62af32e4bd01e (diff) |
drm/amdgpu: add IH ring to ih_get_wptr/ih_set_rptr v2
Let's start to support multiple rings.
v2: decode IV is needed as well
Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/si_ih.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/si_ih.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/si_ih.c b/drivers/gpu/drm/amd/amdgpu/si_ih.c index 2938fb9f17cc..5cabc9687f76 100644 --- a/drivers/gpu/drm/amd/amdgpu/si_ih.c +++ b/drivers/gpu/drm/amd/amdgpu/si_ih.c | |||
@@ -100,34 +100,36 @@ static void si_ih_irq_disable(struct amdgpu_device *adev) | |||
100 | mdelay(1); | 100 | mdelay(1); |
101 | } | 101 | } |
102 | 102 | ||
103 | static u32 si_ih_get_wptr(struct amdgpu_device *adev) | 103 | static u32 si_ih_get_wptr(struct amdgpu_device *adev, |
104 | struct amdgpu_ih_ring *ih) | ||
104 | { | 105 | { |
105 | u32 wptr, tmp; | 106 | u32 wptr, tmp; |
106 | 107 | ||
107 | wptr = le32_to_cpu(adev->wb.wb[adev->irq.ih.wptr_offs]); | 108 | wptr = le32_to_cpu(adev->wb.wb[ih->wptr_offs]); |
108 | 109 | ||
109 | if (wptr & IH_RB_WPTR__RB_OVERFLOW_MASK) { | 110 | if (wptr & IH_RB_WPTR__RB_OVERFLOW_MASK) { |
110 | wptr &= ~IH_RB_WPTR__RB_OVERFLOW_MASK; | 111 | wptr &= ~IH_RB_WPTR__RB_OVERFLOW_MASK; |
111 | dev_warn(adev->dev, "IH ring buffer overflow (0x%08X, 0x%08X, 0x%08X)\n", | 112 | dev_warn(adev->dev, "IH ring buffer overflow (0x%08X, 0x%08X, 0x%08X)\n", |
112 | wptr, adev->irq.ih.rptr, (wptr + 16) & adev->irq.ih.ptr_mask); | 113 | wptr, ih->rptr, (wptr + 16) & ih->ptr_mask); |
113 | adev->irq.ih.rptr = (wptr + 16) & adev->irq.ih.ptr_mask; | 114 | ih->rptr = (wptr + 16) & ih->ptr_mask; |
114 | tmp = RREG32(IH_RB_CNTL); | 115 | tmp = RREG32(IH_RB_CNTL); |
115 | tmp |= IH_RB_CNTL__WPTR_OVERFLOW_CLEAR_MASK; | 116 | tmp |= IH_RB_CNTL__WPTR_OVERFLOW_CLEAR_MASK; |
116 | WREG32(IH_RB_CNTL, tmp); | 117 | WREG32(IH_RB_CNTL, tmp); |
117 | } | 118 | } |
118 | return (wptr & adev->irq.ih.ptr_mask); | 119 | return (wptr & ih->ptr_mask); |
119 | } | 120 | } |
120 | 121 | ||
121 | static void si_ih_decode_iv(struct amdgpu_device *adev, | 122 | static void si_ih_decode_iv(struct amdgpu_device *adev, |
122 | struct amdgpu_iv_entry *entry) | 123 | struct amdgpu_ih_ring *ih, |
124 | struct amdgpu_iv_entry *entry) | ||
123 | { | 125 | { |
124 | u32 ring_index = adev->irq.ih.rptr >> 2; | 126 | u32 ring_index = ih->rptr >> 2; |
125 | uint32_t dw[4]; | 127 | uint32_t dw[4]; |
126 | 128 | ||
127 | dw[0] = le32_to_cpu(adev->irq.ih.ring[ring_index + 0]); | 129 | dw[0] = le32_to_cpu(ih->ring[ring_index + 0]); |
128 | dw[1] = le32_to_cpu(adev->irq.ih.ring[ring_index + 1]); | 130 | dw[1] = le32_to_cpu(ih->ring[ring_index + 1]); |
129 | dw[2] = le32_to_cpu(adev->irq.ih.ring[ring_index + 2]); | 131 | dw[2] = le32_to_cpu(ih->ring[ring_index + 2]); |
130 | dw[3] = le32_to_cpu(adev->irq.ih.ring[ring_index + 3]); | 132 | dw[3] = le32_to_cpu(ih->ring[ring_index + 3]); |
131 | 133 | ||
132 | entry->client_id = AMDGPU_IRQ_CLIENTID_LEGACY; | 134 | entry->client_id = AMDGPU_IRQ_CLIENTID_LEGACY; |
133 | entry->src_id = dw[0] & 0xff; | 135 | entry->src_id = dw[0] & 0xff; |
@@ -135,12 +137,13 @@ static void si_ih_decode_iv(struct amdgpu_device *adev, | |||
135 | entry->ring_id = dw[2] & 0xff; | 137 | entry->ring_id = dw[2] & 0xff; |
136 | entry->vmid = (dw[2] >> 8) & 0xff; | 138 | entry->vmid = (dw[2] >> 8) & 0xff; |
137 | 139 | ||
138 | adev->irq.ih.rptr += 16; | 140 | ih->rptr += 16; |
139 | } | 141 | } |
140 | 142 | ||
141 | static void si_ih_set_rptr(struct amdgpu_device *adev) | 143 | static void si_ih_set_rptr(struct amdgpu_device *adev, |
144 | struct amdgpu_ih_ring *ih) | ||
142 | { | 145 | { |
143 | WREG32(IH_RB_RPTR, adev->irq.ih.rptr); | 146 | WREG32(IH_RB_RPTR, ih->rptr); |
144 | } | 147 | } |
145 | 148 | ||
146 | static int si_ih_early_init(void *handle) | 149 | static int si_ih_early_init(void *handle) |