aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c3
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c59
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c5
-rw-r--r--drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c13
-rw-r--r--drivers/gpu/drm/amd/amdgpu/soc15.c6
5 files changed, 73 insertions, 13 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index 6896dec97fc7..0ed41a9d2d77 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -1686,7 +1686,8 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj,
1686 effective_mode &= ~S_IWUSR; 1686 effective_mode &= ~S_IWUSR;
1687 1687
1688 if ((adev->flags & AMD_IS_APU) && 1688 if ((adev->flags & AMD_IS_APU) &&
1689 (attr == &sensor_dev_attr_power1_cap_max.dev_attr.attr || 1689 (attr == &sensor_dev_attr_power1_average.dev_attr.attr ||
1690 attr == &sensor_dev_attr_power1_cap_max.dev_attr.attr ||
1690 attr == &sensor_dev_attr_power1_cap_min.dev_attr.attr|| 1691 attr == &sensor_dev_attr_power1_cap_min.dev_attr.attr||
1691 attr == &sensor_dev_attr_power1_cap.dev_attr.attr)) 1692 attr == &sensor_dev_attr_power1_cap.dev_attr.attr))
1692 return 0; 1693 return 0;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c
index 71913a18d142..a38e0fb4a6fe 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c
@@ -38,6 +38,7 @@
38#include "amdgpu_gem.h" 38#include "amdgpu_gem.h"
39#include <drm/amdgpu_drm.h> 39#include <drm/amdgpu_drm.h>
40#include <linux/dma-buf.h> 40#include <linux/dma-buf.h>
41#include <linux/dma-fence-array.h>
41 42
42/** 43/**
43 * amdgpu_gem_prime_get_sg_table - &drm_driver.gem_prime_get_sg_table 44 * amdgpu_gem_prime_get_sg_table - &drm_driver.gem_prime_get_sg_table
@@ -187,6 +188,48 @@ error:
187 return ERR_PTR(ret); 188 return ERR_PTR(ret);
188} 189}
189 190
191static int
192__reservation_object_make_exclusive(struct reservation_object *obj)
193{
194 struct dma_fence **fences;
195 unsigned int count;
196 int r;
197
198 if (!reservation_object_get_list(obj)) /* no shared fences to convert */
199 return 0;
200
201 r = reservation_object_get_fences_rcu(obj, NULL, &count, &fences);
202 if (r)
203 return r;
204
205 if (count == 0) {
206 /* Now that was unexpected. */
207 } else if (count == 1) {
208 reservation_object_add_excl_fence(obj, fences[0]);
209 dma_fence_put(fences[0]);
210 kfree(fences);
211 } else {
212 struct dma_fence_array *array;
213
214 array = dma_fence_array_create(count, fences,
215 dma_fence_context_alloc(1), 0,
216 false);
217 if (!array)
218 goto err_fences_put;
219
220 reservation_object_add_excl_fence(obj, &array->base);
221 dma_fence_put(&array->base);
222 }
223
224 return 0;
225
226err_fences_put:
227 while (count--)
228 dma_fence_put(fences[count]);
229 kfree(fences);
230 return -ENOMEM;
231}
232
190/** 233/**
191 * amdgpu_gem_map_attach - &dma_buf_ops.attach implementation 234 * amdgpu_gem_map_attach - &dma_buf_ops.attach implementation
192 * @dma_buf: Shared DMA buffer 235 * @dma_buf: Shared DMA buffer
@@ -218,16 +261,16 @@ static int amdgpu_gem_map_attach(struct dma_buf *dma_buf,
218 261
219 if (attach->dev->driver != adev->dev->driver) { 262 if (attach->dev->driver != adev->dev->driver) {
220 /* 263 /*
221 * Wait for all shared fences to complete before we switch to future 264 * We only create shared fences for internal use, but importers
222 * use of exclusive fence on this prime shared bo. 265 * of the dmabuf rely on exclusive fences for implicitly
266 * tracking write hazards. As any of the current fences may
267 * correspond to a write, we need to convert all existing
268 * fences on the reservation object into a single exclusive
269 * fence.
223 */ 270 */
224 r = reservation_object_wait_timeout_rcu(bo->tbo.resv, 271 r = __reservation_object_make_exclusive(bo->tbo.resv);
225 true, false, 272 if (r)
226 MAX_SCHEDULE_TIMEOUT);
227 if (unlikely(r < 0)) {
228 DRM_DEBUG_PRIME("Fence wait failed: %li\n", r);
229 goto error_unreserve; 273 goto error_unreserve;
230 }
231 } 274 }
232 275
233 /* pin buffer into GTT */ 276 /* pin buffer into GTT */
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index d2ea5ce2cefb..7c108e687683 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -3363,14 +3363,15 @@ void amdgpu_vm_get_task_info(struct amdgpu_device *adev, unsigned int pasid,
3363 struct amdgpu_task_info *task_info) 3363 struct amdgpu_task_info *task_info)
3364{ 3364{
3365 struct amdgpu_vm *vm; 3365 struct amdgpu_vm *vm;
3366 unsigned long flags;
3366 3367
3367 spin_lock(&adev->vm_manager.pasid_lock); 3368 spin_lock_irqsave(&adev->vm_manager.pasid_lock, flags);
3368 3369
3369 vm = idr_find(&adev->vm_manager.pasid_idr, pasid); 3370 vm = idr_find(&adev->vm_manager.pasid_idr, pasid);
3370 if (vm) 3371 if (vm)
3371 *task_info = vm->task_info; 3372 *task_info = vm->task_info;
3372 3373
3373 spin_unlock(&adev->vm_manager.pasid_lock); 3374 spin_unlock_irqrestore(&adev->vm_manager.pasid_lock, flags);
3374} 3375}
3375 3376
3376/** 3377/**
diff --git a/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c b/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c
index 4cd31a276dcd..186db182f924 100644
--- a/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c
+++ b/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c
@@ -93,7 +93,20 @@ static void nbio_v7_4_enable_doorbell_aperture(struct amdgpu_device *adev,
93static void nbio_v7_4_enable_doorbell_selfring_aperture(struct amdgpu_device *adev, 93static void nbio_v7_4_enable_doorbell_selfring_aperture(struct amdgpu_device *adev,
94 bool enable) 94 bool enable)
95{ 95{
96 u32 tmp = 0;
96 97
98 if (enable) {
99 tmp = REG_SET_FIELD(tmp, DOORBELL_SELFRING_GPA_APER_CNTL, DOORBELL_SELFRING_GPA_APER_EN, 1) |
100 REG_SET_FIELD(tmp, DOORBELL_SELFRING_GPA_APER_CNTL, DOORBELL_SELFRING_GPA_APER_MODE, 1) |
101 REG_SET_FIELD(tmp, DOORBELL_SELFRING_GPA_APER_CNTL, DOORBELL_SELFRING_GPA_APER_SIZE, 0);
102
103 WREG32_SOC15(NBIO, 0, mmDOORBELL_SELFRING_GPA_APER_BASE_LOW,
104 lower_32_bits(adev->doorbell.base));
105 WREG32_SOC15(NBIO, 0, mmDOORBELL_SELFRING_GPA_APER_BASE_HIGH,
106 upper_32_bits(adev->doorbell.base));
107 }
108
109 WREG32_SOC15(NBIO, 0, mmDOORBELL_SELFRING_GPA_APER_CNTL, tmp);
97} 110}
98 111
99static void nbio_v7_4_ih_doorbell_range(struct amdgpu_device *adev, 112static void nbio_v7_4_ih_doorbell_range(struct amdgpu_device *adev,
diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c
index 8849b74078d6..9b639974c70c 100644
--- a/drivers/gpu/drm/amd/amdgpu/soc15.c
+++ b/drivers/gpu/drm/amd/amdgpu/soc15.c
@@ -729,11 +729,13 @@ static int soc15_common_early_init(void *handle)
729 case CHIP_RAVEN: 729 case CHIP_RAVEN:
730 adev->asic_funcs = &soc15_asic_funcs; 730 adev->asic_funcs = &soc15_asic_funcs;
731 if (adev->rev_id >= 0x8) 731 if (adev->rev_id >= 0x8)
732 adev->external_rev_id = adev->rev_id + 0x81; 732 adev->external_rev_id = adev->rev_id + 0x79;
733 else if (adev->pdev->device == 0x15d8) 733 else if (adev->pdev->device == 0x15d8)
734 adev->external_rev_id = adev->rev_id + 0x41; 734 adev->external_rev_id = adev->rev_id + 0x41;
735 else if (adev->rev_id == 1)
736 adev->external_rev_id = adev->rev_id + 0x20;
735 else 737 else
736 adev->external_rev_id = 0x1; 738 adev->external_rev_id = adev->rev_id + 0x01;
737 739
738 if (adev->rev_id >= 0x8) { 740 if (adev->rev_id >= 0x8) {
739 adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG | 741 adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |