diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-09-15 20:52:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-09-15 20:52:52 -0400 |
commit | 02cfe977e813501ad0e524477eb5cd5b52860448 (patch) | |
tree | cb812876a469d4c74e0fbea1c9df73d386532496 /drivers | |
parent | bbe05e543bfeab1c37127f38b7e575db916fbc6c (diff) | |
parent | 47e0cd6b1dbbbff7591fe7eecc20bac5ca674351 (diff) |
Merge tag 'drm-fixes-for-v4.14-rc1' of git://people.freedesktop.org/~airlied/linux
Pull drm AMD fixes from Dave Airlie:
"Just had a single AMD fixes pull from Alex for rc1"
* tag 'drm-fixes-for-v4.14-rc1' of git://people.freedesktop.org/~airlied/linux:
drm/amdgpu: revert "fix deadlock of reservation between cs and gpu reset v2"
drm/amdgpu: remove duplicate return statement
drm/amdgpu: check memory allocation failure
drm/amd/amdgpu: fix BANK_SELECT on Vega10 (v2)
drm/amdgpu: inline amdgpu_ttm_do_bind again
drm/amdgpu: fix amdgpu_ttm_bind
drm/amdgpu: remove the GART copy hack
drm/ttm:fix wrong decoding of bo_count
drm/ttm: fix missing inc bo_count
drm/amdgpu: set sched_hw_submission higher for KIQ (v3)
drm/amdgpu: move default gart size setting into gmc modules
drm/amdgpu: refine default gart size
drm/amd/powerplay: ACG frequency added in PPTable
drm/amdgpu: discard commands of killed processes
drm/amdgpu: fix and cleanup shadow handling
drm/amdgpu: add automatic per asic settings for gart_size
drm/amdgpu/gfx8: fix spelling typo in mqd allocation
drm/amd/powerplay: unhalt mec after loading
drm/amdgpu/virtual_dce: Virtual display doesn't support disable vblank immediately
drm/amdgpu: Fix huge page updates with CPU
Diffstat (limited to 'drivers')
28 files changed, 236 insertions, 160 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index 12e71bbfd222..103635ab784c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h | |||
@@ -76,7 +76,7 @@ | |||
76 | extern int amdgpu_modeset; | 76 | extern int amdgpu_modeset; |
77 | extern int amdgpu_vram_limit; | 77 | extern int amdgpu_vram_limit; |
78 | extern int amdgpu_vis_vram_limit; | 78 | extern int amdgpu_vis_vram_limit; |
79 | extern unsigned amdgpu_gart_size; | 79 | extern int amdgpu_gart_size; |
80 | extern int amdgpu_gtt_size; | 80 | extern int amdgpu_gtt_size; |
81 | extern int amdgpu_moverate; | 81 | extern int amdgpu_moverate; |
82 | extern int amdgpu_benchmarking; | 82 | extern int amdgpu_benchmarking; |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v8.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v8.c index fb6e5dbd5a03..309f2419c6d8 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v8.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v8.c | |||
@@ -155,7 +155,6 @@ static const struct kfd2kgd_calls kfd2kgd = { | |||
155 | struct kfd2kgd_calls *amdgpu_amdkfd_gfx_8_0_get_functions(void) | 155 | struct kfd2kgd_calls *amdgpu_amdkfd_gfx_8_0_get_functions(void) |
156 | { | 156 | { |
157 | return (struct kfd2kgd_calls *)&kfd2kgd; | 157 | return (struct kfd2kgd_calls *)&kfd2kgd; |
158 | return (struct kfd2kgd_calls *)&kfd2kgd; | ||
159 | } | 158 | } |
160 | 159 | ||
161 | static inline struct amdgpu_device *get_amdgpu_device(struct kgd_dev *kgd) | 160 | static inline struct amdgpu_device *get_amdgpu_device(struct kgd_dev *kgd) |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index 269b835571eb..60d8bedb694d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | |||
@@ -1079,6 +1079,9 @@ static int amdgpu_cs_process_syncobj_out_dep(struct amdgpu_cs_parser *p, | |||
1079 | GFP_KERNEL); | 1079 | GFP_KERNEL); |
1080 | p->num_post_dep_syncobjs = 0; | 1080 | p->num_post_dep_syncobjs = 0; |
1081 | 1081 | ||
1082 | if (!p->post_dep_syncobjs) | ||
1083 | return -ENOMEM; | ||
1084 | |||
1082 | for (i = 0; i < num_deps; ++i) { | 1085 | for (i = 0; i < num_deps; ++i) { |
1083 | p->post_dep_syncobjs[i] = drm_syncobj_find(p->filp, deps[i].handle); | 1086 | p->post_dep_syncobjs[i] = drm_syncobj_find(p->filp, deps[i].handle); |
1084 | if (!p->post_dep_syncobjs[i]) | 1087 | if (!p->post_dep_syncobjs[i]) |
@@ -1150,7 +1153,6 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p, | |||
1150 | cs->out.handle = amdgpu_ctx_add_fence(p->ctx, ring, p->fence); | 1153 | cs->out.handle = amdgpu_ctx_add_fence(p->ctx, ring, p->fence); |
1151 | job->uf_sequence = cs->out.handle; | 1154 | job->uf_sequence = cs->out.handle; |
1152 | amdgpu_job_free_resources(job); | 1155 | amdgpu_job_free_resources(job); |
1153 | amdgpu_cs_parser_fini(p, 0, true); | ||
1154 | 1156 | ||
1155 | trace_amdgpu_cs_ioctl(job); | 1157 | trace_amdgpu_cs_ioctl(job); |
1156 | amd_sched_entity_push_job(&job->base); | 1158 | amd_sched_entity_push_job(&job->base); |
@@ -1208,10 +1210,7 @@ int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) | |||
1208 | goto out; | 1210 | goto out; |
1209 | 1211 | ||
1210 | r = amdgpu_cs_submit(&parser, cs); | 1212 | r = amdgpu_cs_submit(&parser, cs); |
1211 | if (r) | ||
1212 | goto out; | ||
1213 | 1213 | ||
1214 | return 0; | ||
1215 | out: | 1214 | out: |
1216 | amdgpu_cs_parser_fini(&parser, r, reserved_buffers); | 1215 | amdgpu_cs_parser_fini(&parser, r, reserved_buffers); |
1217 | return r; | 1216 | return r; |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 1a459ac63df4..e630d918fefc 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |||
@@ -1062,11 +1062,11 @@ static void amdgpu_check_arguments(struct amdgpu_device *adev) | |||
1062 | amdgpu_sched_jobs = roundup_pow_of_two(amdgpu_sched_jobs); | 1062 | amdgpu_sched_jobs = roundup_pow_of_two(amdgpu_sched_jobs); |
1063 | } | 1063 | } |
1064 | 1064 | ||
1065 | if (amdgpu_gart_size < 32) { | 1065 | if (amdgpu_gart_size != -1 && amdgpu_gart_size < 32) { |
1066 | /* gart size must be greater or equal to 32M */ | 1066 | /* gart size must be greater or equal to 32M */ |
1067 | dev_warn(adev->dev, "gart size (%d) too small\n", | 1067 | dev_warn(adev->dev, "gart size (%d) too small\n", |
1068 | amdgpu_gart_size); | 1068 | amdgpu_gart_size); |
1069 | amdgpu_gart_size = 32; | 1069 | amdgpu_gart_size = -1; |
1070 | } | 1070 | } |
1071 | 1071 | ||
1072 | if (amdgpu_gtt_size != -1 && amdgpu_gtt_size < 32) { | 1072 | if (amdgpu_gtt_size != -1 && amdgpu_gtt_size < 32) { |
@@ -2622,12 +2622,6 @@ static int amdgpu_recover_vram_from_shadow(struct amdgpu_device *adev, | |||
2622 | goto err; | 2622 | goto err; |
2623 | } | 2623 | } |
2624 | 2624 | ||
2625 | r = amdgpu_ttm_bind(&bo->shadow->tbo, &bo->shadow->tbo.mem); | ||
2626 | if (r) { | ||
2627 | DRM_ERROR("%p bind failed\n", bo->shadow); | ||
2628 | goto err; | ||
2629 | } | ||
2630 | |||
2631 | r = amdgpu_bo_restore_from_shadow(adev, ring, bo, | 2625 | r = amdgpu_bo_restore_from_shadow(adev, ring, bo, |
2632 | NULL, fence, true); | 2626 | NULL, fence, true); |
2633 | if (r) { | 2627 | if (r) { |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index e39ec981b11c..0f16986ec5bc 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | |||
@@ -76,7 +76,7 @@ | |||
76 | 76 | ||
77 | int amdgpu_vram_limit = 0; | 77 | int amdgpu_vram_limit = 0; |
78 | int amdgpu_vis_vram_limit = 0; | 78 | int amdgpu_vis_vram_limit = 0; |
79 | unsigned amdgpu_gart_size = 256; | 79 | int amdgpu_gart_size = -1; /* auto */ |
80 | int amdgpu_gtt_size = -1; /* auto */ | 80 | int amdgpu_gtt_size = -1; /* auto */ |
81 | int amdgpu_moverate = -1; /* auto */ | 81 | int amdgpu_moverate = -1; /* auto */ |
82 | int amdgpu_benchmarking = 0; | 82 | int amdgpu_benchmarking = 0; |
@@ -128,7 +128,7 @@ module_param_named(vramlimit, amdgpu_vram_limit, int, 0600); | |||
128 | MODULE_PARM_DESC(vis_vramlimit, "Restrict visible VRAM for testing, in megabytes"); | 128 | MODULE_PARM_DESC(vis_vramlimit, "Restrict visible VRAM for testing, in megabytes"); |
129 | module_param_named(vis_vramlimit, amdgpu_vis_vram_limit, int, 0444); | 129 | module_param_named(vis_vramlimit, amdgpu_vis_vram_limit, int, 0444); |
130 | 130 | ||
131 | MODULE_PARM_DESC(gartsize, "Size of PCIE/IGP gart to setup in megabytes (32, 64, etc.)"); | 131 | MODULE_PARM_DESC(gartsize, "Size of GART to setup in megabytes (32, 64, etc., -1=auto)"); |
132 | module_param_named(gartsize, amdgpu_gart_size, uint, 0600); | 132 | module_param_named(gartsize, amdgpu_gart_size, uint, 0600); |
133 | 133 | ||
134 | MODULE_PARM_DESC(gttsize, "Size of the GTT domain in megabytes (-1 = auto)"); | 134 | MODULE_PARM_DESC(gttsize, "Size of the GTT domain in megabytes (-1 = auto)"); |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c index 94c1e2e8e34c..f4370081f6e6 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c | |||
@@ -57,18 +57,6 @@ | |||
57 | */ | 57 | */ |
58 | 58 | ||
59 | /** | 59 | /** |
60 | * amdgpu_gart_set_defaults - set the default gart_size | ||
61 | * | ||
62 | * @adev: amdgpu_device pointer | ||
63 | * | ||
64 | * Set the default gart_size based on parameters and available VRAM. | ||
65 | */ | ||
66 | void amdgpu_gart_set_defaults(struct amdgpu_device *adev) | ||
67 | { | ||
68 | adev->mc.gart_size = (uint64_t)amdgpu_gart_size << 20; | ||
69 | } | ||
70 | |||
71 | /** | ||
72 | * amdgpu_gart_table_ram_alloc - allocate system ram for gart page table | 60 | * amdgpu_gart_table_ram_alloc - allocate system ram for gart page table |
73 | * | 61 | * |
74 | * @adev: amdgpu_device pointer | 62 | * @adev: amdgpu_device pointer |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.h index d4cce6936200..afbe803b1a13 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.h | |||
@@ -56,7 +56,6 @@ struct amdgpu_gart { | |||
56 | const struct amdgpu_gart_funcs *gart_funcs; | 56 | const struct amdgpu_gart_funcs *gart_funcs; |
57 | }; | 57 | }; |
58 | 58 | ||
59 | void amdgpu_gart_set_defaults(struct amdgpu_device *adev); | ||
60 | int amdgpu_gart_table_ram_alloc(struct amdgpu_device *adev); | 59 | int amdgpu_gart_table_ram_alloc(struct amdgpu_device *adev); |
61 | void amdgpu_gart_table_ram_free(struct amdgpu_device *adev); | 60 | void amdgpu_gart_table_ram_free(struct amdgpu_device *adev); |
62 | int amdgpu_gart_table_vram_alloc(struct amdgpu_device *adev); | 61 | int amdgpu_gart_table_vram_alloc(struct amdgpu_device *adev); |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c index 9e05e257729f..0d15eb7d31d7 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c | |||
@@ -108,10 +108,10 @@ bool amdgpu_gtt_mgr_is_allocated(struct ttm_mem_reg *mem) | |||
108 | * | 108 | * |
109 | * Allocate the address space for a node. | 109 | * Allocate the address space for a node. |
110 | */ | 110 | */ |
111 | int amdgpu_gtt_mgr_alloc(struct ttm_mem_type_manager *man, | 111 | static int amdgpu_gtt_mgr_alloc(struct ttm_mem_type_manager *man, |
112 | struct ttm_buffer_object *tbo, | 112 | struct ttm_buffer_object *tbo, |
113 | const struct ttm_place *place, | 113 | const struct ttm_place *place, |
114 | struct ttm_mem_reg *mem) | 114 | struct ttm_mem_reg *mem) |
115 | { | 115 | { |
116 | struct amdgpu_device *adev = amdgpu_ttm_adev(man->bdev); | 116 | struct amdgpu_device *adev = amdgpu_ttm_adev(man->bdev); |
117 | struct amdgpu_gtt_mgr *mgr = man->priv; | 117 | struct amdgpu_gtt_mgr *mgr = man->priv; |
@@ -143,12 +143,8 @@ int amdgpu_gtt_mgr_alloc(struct ttm_mem_type_manager *man, | |||
143 | fpfn, lpfn, mode); | 143 | fpfn, lpfn, mode); |
144 | spin_unlock(&mgr->lock); | 144 | spin_unlock(&mgr->lock); |
145 | 145 | ||
146 | if (!r) { | 146 | if (!r) |
147 | mem->start = node->start; | 147 | mem->start = node->start; |
148 | if (&tbo->mem == mem) | ||
149 | tbo->offset = (tbo->mem.start << PAGE_SHIFT) + | ||
150 | tbo->bdev->man[tbo->mem.mem_type].gpu_offset; | ||
151 | } | ||
152 | 148 | ||
153 | return r; | 149 | return r; |
154 | } | 150 | } |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c index 4bdd851f56d0..538e5f27d120 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | |||
@@ -221,8 +221,9 @@ int amdgpu_irq_init(struct amdgpu_device *adev) | |||
221 | 221 | ||
222 | spin_lock_init(&adev->irq.lock); | 222 | spin_lock_init(&adev->irq.lock); |
223 | 223 | ||
224 | /* Disable vblank irqs aggressively for power-saving */ | 224 | if (!adev->enable_virtual_display) |
225 | adev->ddev->vblank_disable_immediate = true; | 225 | /* Disable vblank irqs aggressively for power-saving */ |
226 | adev->ddev->vblank_disable_immediate = true; | ||
226 | 227 | ||
227 | r = drm_vblank_init(adev->ddev, adev->mode_info.num_crtc); | 228 | r = drm_vblank_init(adev->ddev, adev->mode_info.num_crtc); |
228 | if (r) { | 229 | if (r) { |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index e7e899190bef..9e495da0bb03 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | |||
@@ -91,7 +91,10 @@ static void amdgpu_ttm_placement_init(struct amdgpu_device *adev, | |||
91 | 91 | ||
92 | if (domain & AMDGPU_GEM_DOMAIN_GTT) { | 92 | if (domain & AMDGPU_GEM_DOMAIN_GTT) { |
93 | places[c].fpfn = 0; | 93 | places[c].fpfn = 0; |
94 | places[c].lpfn = 0; | 94 | if (flags & AMDGPU_GEM_CREATE_SHADOW) |
95 | places[c].lpfn = adev->mc.gart_size >> PAGE_SHIFT; | ||
96 | else | ||
97 | places[c].lpfn = 0; | ||
95 | places[c].flags = TTM_PL_FLAG_TT; | 98 | places[c].flags = TTM_PL_FLAG_TT; |
96 | if (flags & AMDGPU_GEM_CREATE_CPU_GTT_USWC) | 99 | if (flags & AMDGPU_GEM_CREATE_CPU_GTT_USWC) |
97 | places[c].flags |= TTM_PL_FLAG_WC | | 100 | places[c].flags |= TTM_PL_FLAG_WC | |
@@ -446,17 +449,16 @@ static int amdgpu_bo_create_shadow(struct amdgpu_device *adev, | |||
446 | if (bo->shadow) | 449 | if (bo->shadow) |
447 | return 0; | 450 | return 0; |
448 | 451 | ||
449 | bo->flags |= AMDGPU_GEM_CREATE_SHADOW; | 452 | memset(&placements, 0, sizeof(placements)); |
450 | memset(&placements, 0, | 453 | amdgpu_ttm_placement_init(adev, &placement, placements, |
451 | (AMDGPU_GEM_DOMAIN_MAX + 1) * sizeof(struct ttm_place)); | 454 | AMDGPU_GEM_DOMAIN_GTT, |
452 | 455 | AMDGPU_GEM_CREATE_CPU_GTT_USWC | | |
453 | amdgpu_ttm_placement_init(adev, &placement, | 456 | AMDGPU_GEM_CREATE_SHADOW); |
454 | placements, AMDGPU_GEM_DOMAIN_GTT, | ||
455 | AMDGPU_GEM_CREATE_CPU_GTT_USWC); | ||
456 | 457 | ||
457 | r = amdgpu_bo_create_restricted(adev, size, byte_align, true, | 458 | r = amdgpu_bo_create_restricted(adev, size, byte_align, true, |
458 | AMDGPU_GEM_DOMAIN_GTT, | 459 | AMDGPU_GEM_DOMAIN_GTT, |
459 | AMDGPU_GEM_CREATE_CPU_GTT_USWC, | 460 | AMDGPU_GEM_CREATE_CPU_GTT_USWC | |
461 | AMDGPU_GEM_CREATE_SHADOW, | ||
460 | NULL, &placement, | 462 | NULL, &placement, |
461 | bo->tbo.resv, | 463 | bo->tbo.resv, |
462 | 0, | 464 | 0, |
@@ -484,30 +486,28 @@ int amdgpu_bo_create(struct amdgpu_device *adev, | |||
484 | { | 486 | { |
485 | struct ttm_placement placement = {0}; | 487 | struct ttm_placement placement = {0}; |
486 | struct ttm_place placements[AMDGPU_GEM_DOMAIN_MAX + 1]; | 488 | struct ttm_place placements[AMDGPU_GEM_DOMAIN_MAX + 1]; |
489 | uint64_t parent_flags = flags & ~AMDGPU_GEM_CREATE_SHADOW; | ||
487 | int r; | 490 | int r; |
488 | 491 | ||
489 | memset(&placements, 0, | 492 | memset(&placements, 0, sizeof(placements)); |
490 | (AMDGPU_GEM_DOMAIN_MAX + 1) * sizeof(struct ttm_place)); | 493 | amdgpu_ttm_placement_init(adev, &placement, placements, |
494 | domain, parent_flags); | ||
491 | 495 | ||
492 | amdgpu_ttm_placement_init(adev, &placement, | 496 | r = amdgpu_bo_create_restricted(adev, size, byte_align, kernel, domain, |
493 | placements, domain, flags); | 497 | parent_flags, sg, &placement, resv, |
494 | 498 | init_value, bo_ptr); | |
495 | r = amdgpu_bo_create_restricted(adev, size, byte_align, kernel, | ||
496 | domain, flags, sg, &placement, | ||
497 | resv, init_value, bo_ptr); | ||
498 | if (r) | 499 | if (r) |
499 | return r; | 500 | return r; |
500 | 501 | ||
501 | if (amdgpu_need_backup(adev) && (flags & AMDGPU_GEM_CREATE_SHADOW)) { | 502 | if ((flags & AMDGPU_GEM_CREATE_SHADOW) && amdgpu_need_backup(adev)) { |
502 | if (!resv) { | 503 | if (!resv) |
503 | r = ww_mutex_lock(&(*bo_ptr)->tbo.resv->lock, NULL); | 504 | WARN_ON(reservation_object_lock((*bo_ptr)->tbo.resv, |
504 | WARN_ON(r != 0); | 505 | NULL)); |
505 | } | ||
506 | 506 | ||
507 | r = amdgpu_bo_create_shadow(adev, size, byte_align, (*bo_ptr)); | 507 | r = amdgpu_bo_create_shadow(adev, size, byte_align, (*bo_ptr)); |
508 | 508 | ||
509 | if (!resv) | 509 | if (!resv) |
510 | ww_mutex_unlock(&(*bo_ptr)->tbo.resv->lock); | 510 | reservation_object_unlock((*bo_ptr)->tbo.resv); |
511 | 511 | ||
512 | if (r) | 512 | if (r) |
513 | amdgpu_bo_unref(bo_ptr); | 513 | amdgpu_bo_unref(bo_ptr); |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c index 6c5646b48d1a..5ce65280b396 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | |||
@@ -170,6 +170,16 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring, | |||
170 | unsigned irq_type) | 170 | unsigned irq_type) |
171 | { | 171 | { |
172 | int r; | 172 | int r; |
173 | int sched_hw_submission = amdgpu_sched_hw_submission; | ||
174 | |||
175 | /* Set the hw submission limit higher for KIQ because | ||
176 | * it's used for a number of gfx/compute tasks by both | ||
177 | * KFD and KGD which may have outstanding fences and | ||
178 | * it doesn't really use the gpu scheduler anyway; | ||
179 | * KIQ tasks get submitted directly to the ring. | ||
180 | */ | ||
181 | if (ring->funcs->type == AMDGPU_RING_TYPE_KIQ) | ||
182 | sched_hw_submission = max(sched_hw_submission, 256); | ||
173 | 183 | ||
174 | if (ring->adev == NULL) { | 184 | if (ring->adev == NULL) { |
175 | if (adev->num_rings >= AMDGPU_MAX_RINGS) | 185 | if (adev->num_rings >= AMDGPU_MAX_RINGS) |
@@ -178,8 +188,7 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring, | |||
178 | ring->adev = adev; | 188 | ring->adev = adev; |
179 | ring->idx = adev->num_rings++; | 189 | ring->idx = adev->num_rings++; |
180 | adev->rings[ring->idx] = ring; | 190 | adev->rings[ring->idx] = ring; |
181 | r = amdgpu_fence_driver_init_ring(ring, | 191 | r = amdgpu_fence_driver_init_ring(ring, sched_hw_submission); |
182 | amdgpu_sched_hw_submission); | ||
183 | if (r) | 192 | if (r) |
184 | return r; | 193 | return r; |
185 | } | 194 | } |
@@ -218,8 +227,7 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring, | |||
218 | return r; | 227 | return r; |
219 | } | 228 | } |
220 | 229 | ||
221 | ring->ring_size = roundup_pow_of_two(max_dw * 4 * | 230 | ring->ring_size = roundup_pow_of_two(max_dw * 4 * sched_hw_submission); |
222 | amdgpu_sched_hw_submission); | ||
223 | 231 | ||
224 | ring->buf_mask = (ring->ring_size / 4) - 1; | 232 | ring->buf_mask = (ring->ring_size / 4) - 1; |
225 | ring->ptr_mask = ring->funcs->support_64bit_ptrs ? | 233 | ring->ptr_mask = ring->funcs->support_64bit_ptrs ? |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index 8b2c294f6f79..7ef6c28a34d9 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | |||
@@ -761,35 +761,11 @@ static void amdgpu_ttm_tt_unpin_userptr(struct ttm_tt *ttm) | |||
761 | sg_free_table(ttm->sg); | 761 | sg_free_table(ttm->sg); |
762 | } | 762 | } |
763 | 763 | ||
764 | static int amdgpu_ttm_do_bind(struct ttm_tt *ttm, struct ttm_mem_reg *mem) | ||
765 | { | ||
766 | struct amdgpu_ttm_tt *gtt = (void *)ttm; | ||
767 | uint64_t flags; | ||
768 | int r; | ||
769 | |||
770 | spin_lock(>t->adev->gtt_list_lock); | ||
771 | flags = amdgpu_ttm_tt_pte_flags(gtt->adev, ttm, mem); | ||
772 | gtt->offset = (u64)mem->start << PAGE_SHIFT; | ||
773 | r = amdgpu_gart_bind(gtt->adev, gtt->offset, ttm->num_pages, | ||
774 | ttm->pages, gtt->ttm.dma_address, flags); | ||
775 | |||
776 | if (r) { | ||
777 | DRM_ERROR("failed to bind %lu pages at 0x%08llX\n", | ||
778 | ttm->num_pages, gtt->offset); | ||
779 | goto error_gart_bind; | ||
780 | } | ||
781 | |||
782 | list_add_tail(>t->list, >t->adev->gtt_list); | ||
783 | error_gart_bind: | ||
784 | spin_unlock(>t->adev->gtt_list_lock); | ||
785 | return r; | ||
786 | |||
787 | } | ||
788 | |||
789 | static int amdgpu_ttm_backend_bind(struct ttm_tt *ttm, | 764 | static int amdgpu_ttm_backend_bind(struct ttm_tt *ttm, |
790 | struct ttm_mem_reg *bo_mem) | 765 | struct ttm_mem_reg *bo_mem) |
791 | { | 766 | { |
792 | struct amdgpu_ttm_tt *gtt = (void*)ttm; | 767 | struct amdgpu_ttm_tt *gtt = (void*)ttm; |
768 | uint64_t flags; | ||
793 | int r = 0; | 769 | int r = 0; |
794 | 770 | ||
795 | if (gtt->userptr) { | 771 | if (gtt->userptr) { |
@@ -809,9 +785,24 @@ static int amdgpu_ttm_backend_bind(struct ttm_tt *ttm, | |||
809 | bo_mem->mem_type == AMDGPU_PL_OA) | 785 | bo_mem->mem_type == AMDGPU_PL_OA) |
810 | return -EINVAL; | 786 | return -EINVAL; |
811 | 787 | ||
812 | if (amdgpu_gtt_mgr_is_allocated(bo_mem)) | 788 | if (!amdgpu_gtt_mgr_is_allocated(bo_mem)) |
813 | r = amdgpu_ttm_do_bind(ttm, bo_mem); | 789 | return 0; |
814 | 790 | ||
791 | spin_lock(>t->adev->gtt_list_lock); | ||
792 | flags = amdgpu_ttm_tt_pte_flags(gtt->adev, ttm, bo_mem); | ||
793 | gtt->offset = (u64)bo_mem->start << PAGE_SHIFT; | ||
794 | r = amdgpu_gart_bind(gtt->adev, gtt->offset, ttm->num_pages, | ||
795 | ttm->pages, gtt->ttm.dma_address, flags); | ||
796 | |||
797 | if (r) { | ||
798 | DRM_ERROR("failed to bind %lu pages at 0x%08llX\n", | ||
799 | ttm->num_pages, gtt->offset); | ||
800 | goto error_gart_bind; | ||
801 | } | ||
802 | |||
803 | list_add_tail(>t->list, >t->adev->gtt_list); | ||
804 | error_gart_bind: | ||
805 | spin_unlock(>t->adev->gtt_list_lock); | ||
815 | return r; | 806 | return r; |
816 | } | 807 | } |
817 | 808 | ||
@@ -824,20 +815,39 @@ bool amdgpu_ttm_is_bound(struct ttm_tt *ttm) | |||
824 | 815 | ||
825 | int amdgpu_ttm_bind(struct ttm_buffer_object *bo, struct ttm_mem_reg *bo_mem) | 816 | int amdgpu_ttm_bind(struct ttm_buffer_object *bo, struct ttm_mem_reg *bo_mem) |
826 | { | 817 | { |
818 | struct amdgpu_device *adev = amdgpu_ttm_adev(bo->bdev); | ||
827 | struct ttm_tt *ttm = bo->ttm; | 819 | struct ttm_tt *ttm = bo->ttm; |
820 | struct ttm_mem_reg tmp; | ||
821 | |||
822 | struct ttm_placement placement; | ||
823 | struct ttm_place placements; | ||
828 | int r; | 824 | int r; |
829 | 825 | ||
830 | if (!ttm || amdgpu_ttm_is_bound(ttm)) | 826 | if (!ttm || amdgpu_ttm_is_bound(ttm)) |
831 | return 0; | 827 | return 0; |
832 | 828 | ||
833 | r = amdgpu_gtt_mgr_alloc(&bo->bdev->man[TTM_PL_TT], bo, | 829 | tmp = bo->mem; |
834 | NULL, bo_mem); | 830 | tmp.mm_node = NULL; |
835 | if (r) { | 831 | placement.num_placement = 1; |
836 | DRM_ERROR("Failed to allocate GTT address space (%d)\n", r); | 832 | placement.placement = &placements; |
833 | placement.num_busy_placement = 1; | ||
834 | placement.busy_placement = &placements; | ||
835 | placements.fpfn = 0; | ||
836 | placements.lpfn = adev->mc.gart_size >> PAGE_SHIFT; | ||
837 | placements.flags = TTM_PL_MASK_CACHING | TTM_PL_FLAG_TT; | ||
838 | |||
839 | r = ttm_bo_mem_space(bo, &placement, &tmp, true, false); | ||
840 | if (unlikely(r)) | ||
837 | return r; | 841 | return r; |
838 | } | ||
839 | 842 | ||
840 | return amdgpu_ttm_do_bind(ttm, bo_mem); | 843 | r = ttm_bo_move_ttm(bo, true, false, &tmp); |
844 | if (unlikely(r)) | ||
845 | ttm_bo_mem_put(bo, &tmp); | ||
846 | else | ||
847 | bo->offset = (bo->mem.start << PAGE_SHIFT) + | ||
848 | bo->bdev->man[bo->mem.mem_type].gpu_offset; | ||
849 | |||
850 | return r; | ||
841 | } | 851 | } |
842 | 852 | ||
843 | int amdgpu_ttm_recover_gart(struct amdgpu_device *adev) | 853 | int amdgpu_ttm_recover_gart(struct amdgpu_device *adev) |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h index f22a4758719d..43093bffa2cf 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | |||
@@ -62,10 +62,6 @@ extern const struct ttm_mem_type_manager_func amdgpu_gtt_mgr_func; | |||
62 | extern const struct ttm_mem_type_manager_func amdgpu_vram_mgr_func; | 62 | extern const struct ttm_mem_type_manager_func amdgpu_vram_mgr_func; |
63 | 63 | ||
64 | bool amdgpu_gtt_mgr_is_allocated(struct ttm_mem_reg *mem); | 64 | bool amdgpu_gtt_mgr_is_allocated(struct ttm_mem_reg *mem); |
65 | int amdgpu_gtt_mgr_alloc(struct ttm_mem_type_manager *man, | ||
66 | struct ttm_buffer_object *tbo, | ||
67 | const struct ttm_place *place, | ||
68 | struct ttm_mem_reg *mem); | ||
69 | uint64_t amdgpu_gtt_mgr_usage(struct ttm_mem_type_manager *man); | 65 | uint64_t amdgpu_gtt_mgr_usage(struct ttm_mem_type_manager *man); |
70 | 66 | ||
71 | uint64_t amdgpu_vram_mgr_usage(struct ttm_mem_type_manager *man); | 67 | uint64_t amdgpu_vram_mgr_usage(struct ttm_mem_type_manager *man); |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index b9a5a77eedaf..bd20ff018512 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |||
@@ -165,14 +165,6 @@ static int amdgpu_vm_validate_level(struct amdgpu_vm_pt *parent, | |||
165 | unsigned i; | 165 | unsigned i; |
166 | int r; | 166 | int r; |
167 | 167 | ||
168 | if (parent->bo->shadow) { | ||
169 | struct amdgpu_bo *shadow = parent->bo->shadow; | ||
170 | |||
171 | r = amdgpu_ttm_bind(&shadow->tbo, &shadow->tbo.mem); | ||
172 | if (r) | ||
173 | return r; | ||
174 | } | ||
175 | |||
176 | if (use_cpu_for_update) { | 168 | if (use_cpu_for_update) { |
177 | r = amdgpu_bo_kmap(parent->bo, NULL); | 169 | r = amdgpu_bo_kmap(parent->bo, NULL); |
178 | if (r) | 170 | if (r) |
@@ -1277,7 +1269,7 @@ static void amdgpu_vm_handle_huge_pages(struct amdgpu_pte_update_params *p, | |||
1277 | /* In the case of a mixed PT the PDE must point to it*/ | 1269 | /* In the case of a mixed PT the PDE must point to it*/ |
1278 | if (p->adev->asic_type < CHIP_VEGA10 || | 1270 | if (p->adev->asic_type < CHIP_VEGA10 || |
1279 | nptes != AMDGPU_VM_PTE_COUNT(p->adev) || | 1271 | nptes != AMDGPU_VM_PTE_COUNT(p->adev) || |
1280 | p->func == amdgpu_vm_do_copy_ptes || | 1272 | p->src || |
1281 | !(flags & AMDGPU_PTE_VALID)) { | 1273 | !(flags & AMDGPU_PTE_VALID)) { |
1282 | 1274 | ||
1283 | dst = amdgpu_bo_gpu_offset(entry->bo); | 1275 | dst = amdgpu_bo_gpu_offset(entry->bo); |
@@ -1294,9 +1286,23 @@ static void amdgpu_vm_handle_huge_pages(struct amdgpu_pte_update_params *p, | |||
1294 | entry->addr = (dst | flags); | 1286 | entry->addr = (dst | flags); |
1295 | 1287 | ||
1296 | if (use_cpu_update) { | 1288 | if (use_cpu_update) { |
1289 | /* In case a huge page is replaced with a system | ||
1290 | * memory mapping, p->pages_addr != NULL and | ||
1291 | * amdgpu_vm_cpu_set_ptes would try to translate dst | ||
1292 | * through amdgpu_vm_map_gart. But dst is already a | ||
1293 | * GPU address (of the page table). Disable | ||
1294 | * amdgpu_vm_map_gart temporarily. | ||
1295 | */ | ||
1296 | dma_addr_t *tmp; | ||
1297 | |||
1298 | tmp = p->pages_addr; | ||
1299 | p->pages_addr = NULL; | ||
1300 | |||
1297 | pd_addr = (unsigned long)amdgpu_bo_kptr(parent->bo); | 1301 | pd_addr = (unsigned long)amdgpu_bo_kptr(parent->bo); |
1298 | pde = pd_addr + (entry - parent->entries) * 8; | 1302 | pde = pd_addr + (entry - parent->entries) * 8; |
1299 | amdgpu_vm_cpu_set_ptes(p, pde, dst, 1, 0, flags); | 1303 | amdgpu_vm_cpu_set_ptes(p, pde, dst, 1, 0, flags); |
1304 | |||
1305 | p->pages_addr = tmp; | ||
1300 | } else { | 1306 | } else { |
1301 | if (parent->bo->shadow) { | 1307 | if (parent->bo->shadow) { |
1302 | pd_addr = amdgpu_bo_gpu_offset(parent->bo->shadow); | 1308 | pd_addr = amdgpu_bo_gpu_offset(parent->bo->shadow); |
@@ -1610,7 +1616,6 @@ error_free: | |||
1610 | * | 1616 | * |
1611 | * @adev: amdgpu_device pointer | 1617 | * @adev: amdgpu_device pointer |
1612 | * @exclusive: fence we need to sync to | 1618 | * @exclusive: fence we need to sync to |
1613 | * @gtt_flags: flags as they are used for GTT | ||
1614 | * @pages_addr: DMA addresses to use for mapping | 1619 | * @pages_addr: DMA addresses to use for mapping |
1615 | * @vm: requested vm | 1620 | * @vm: requested vm |
1616 | * @mapping: mapped range and flags to use for the update | 1621 | * @mapping: mapped range and flags to use for the update |
@@ -1624,7 +1629,6 @@ error_free: | |||
1624 | */ | 1629 | */ |
1625 | static int amdgpu_vm_bo_split_mapping(struct amdgpu_device *adev, | 1630 | static int amdgpu_vm_bo_split_mapping(struct amdgpu_device *adev, |
1626 | struct dma_fence *exclusive, | 1631 | struct dma_fence *exclusive, |
1627 | uint64_t gtt_flags, | ||
1628 | dma_addr_t *pages_addr, | 1632 | dma_addr_t *pages_addr, |
1629 | struct amdgpu_vm *vm, | 1633 | struct amdgpu_vm *vm, |
1630 | struct amdgpu_bo_va_mapping *mapping, | 1634 | struct amdgpu_bo_va_mapping *mapping, |
@@ -1679,11 +1683,7 @@ static int amdgpu_vm_bo_split_mapping(struct amdgpu_device *adev, | |||
1679 | } | 1683 | } |
1680 | 1684 | ||
1681 | if (pages_addr) { | 1685 | if (pages_addr) { |
1682 | if (flags == gtt_flags) | 1686 | max_entries = min(max_entries, 16ull * 1024ull); |
1683 | src = adev->gart.table_addr + | ||
1684 | (addr >> AMDGPU_GPU_PAGE_SHIFT) * 8; | ||
1685 | else | ||
1686 | max_entries = min(max_entries, 16ull * 1024ull); | ||
1687 | addr = 0; | 1687 | addr = 0; |
1688 | } else if (flags & AMDGPU_PTE_VALID) { | 1688 | } else if (flags & AMDGPU_PTE_VALID) { |
1689 | addr += adev->vm_manager.vram_base_offset; | 1689 | addr += adev->vm_manager.vram_base_offset; |
@@ -1728,10 +1728,10 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, | |||
1728 | struct amdgpu_vm *vm = bo_va->base.vm; | 1728 | struct amdgpu_vm *vm = bo_va->base.vm; |
1729 | struct amdgpu_bo_va_mapping *mapping; | 1729 | struct amdgpu_bo_va_mapping *mapping; |
1730 | dma_addr_t *pages_addr = NULL; | 1730 | dma_addr_t *pages_addr = NULL; |
1731 | uint64_t gtt_flags, flags; | ||
1732 | struct ttm_mem_reg *mem; | 1731 | struct ttm_mem_reg *mem; |
1733 | struct drm_mm_node *nodes; | 1732 | struct drm_mm_node *nodes; |
1734 | struct dma_fence *exclusive; | 1733 | struct dma_fence *exclusive; |
1734 | uint64_t flags; | ||
1735 | int r; | 1735 | int r; |
1736 | 1736 | ||
1737 | if (clear || !bo_va->base.bo) { | 1737 | if (clear || !bo_va->base.bo) { |
@@ -1751,15 +1751,10 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, | |||
1751 | exclusive = reservation_object_get_excl(bo->tbo.resv); | 1751 | exclusive = reservation_object_get_excl(bo->tbo.resv); |
1752 | } | 1752 | } |
1753 | 1753 | ||
1754 | if (bo) { | 1754 | if (bo) |
1755 | flags = amdgpu_ttm_tt_pte_flags(adev, bo->tbo.ttm, mem); | 1755 | flags = amdgpu_ttm_tt_pte_flags(adev, bo->tbo.ttm, mem); |
1756 | gtt_flags = (amdgpu_ttm_is_bound(bo->tbo.ttm) && | 1756 | else |
1757 | adev == amdgpu_ttm_adev(bo->tbo.bdev)) ? | ||
1758 | flags : 0; | ||
1759 | } else { | ||
1760 | flags = 0x0; | 1757 | flags = 0x0; |
1761 | gtt_flags = ~0x0; | ||
1762 | } | ||
1763 | 1758 | ||
1764 | spin_lock(&vm->status_lock); | 1759 | spin_lock(&vm->status_lock); |
1765 | if (!list_empty(&bo_va->base.vm_status)) | 1760 | if (!list_empty(&bo_va->base.vm_status)) |
@@ -1767,8 +1762,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, | |||
1767 | spin_unlock(&vm->status_lock); | 1762 | spin_unlock(&vm->status_lock); |
1768 | 1763 | ||
1769 | list_for_each_entry(mapping, &bo_va->invalids, list) { | 1764 | list_for_each_entry(mapping, &bo_va->invalids, list) { |
1770 | r = amdgpu_vm_bo_split_mapping(adev, exclusive, | 1765 | r = amdgpu_vm_bo_split_mapping(adev, exclusive, pages_addr, vm, |
1771 | gtt_flags, pages_addr, vm, | ||
1772 | mapping, flags, nodes, | 1766 | mapping, flags, nodes, |
1773 | &bo_va->last_pt_update); | 1767 | &bo_va->last_pt_update); |
1774 | if (r) | 1768 | if (r) |
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c index 832e592fcd07..fc260c13b1da 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | |||
@@ -4579,9 +4579,9 @@ static int gfx_v8_0_mqd_init(struct amdgpu_ring *ring) | |||
4579 | mqd->compute_misc_reserved = 0x00000003; | 4579 | mqd->compute_misc_reserved = 0x00000003; |
4580 | if (!(adev->flags & AMD_IS_APU)) { | 4580 | if (!(adev->flags & AMD_IS_APU)) { |
4581 | mqd->dynamic_cu_mask_addr_lo = lower_32_bits(ring->mqd_gpu_addr | 4581 | mqd->dynamic_cu_mask_addr_lo = lower_32_bits(ring->mqd_gpu_addr |
4582 | + offsetof(struct vi_mqd_allocation, dyamic_cu_mask)); | 4582 | + offsetof(struct vi_mqd_allocation, dynamic_cu_mask)); |
4583 | mqd->dynamic_cu_mask_addr_hi = upper_32_bits(ring->mqd_gpu_addr | 4583 | mqd->dynamic_cu_mask_addr_hi = upper_32_bits(ring->mqd_gpu_addr |
4584 | + offsetof(struct vi_mqd_allocation, dyamic_cu_mask)); | 4584 | + offsetof(struct vi_mqd_allocation, dynamic_cu_mask)); |
4585 | } | 4585 | } |
4586 | eop_base_addr = ring->eop_gpu_addr >> 8; | 4586 | eop_base_addr = ring->eop_gpu_addr >> 8; |
4587 | mqd->cp_hqd_eop_base_addr_lo = eop_base_addr; | 4587 | mqd->cp_hqd_eop_base_addr_lo = eop_base_addr; |
@@ -4768,8 +4768,8 @@ static int gfx_v8_0_kiq_init_queue(struct amdgpu_ring *ring) | |||
4768 | mutex_unlock(&adev->srbm_mutex); | 4768 | mutex_unlock(&adev->srbm_mutex); |
4769 | } else { | 4769 | } else { |
4770 | memset((void *)mqd, 0, sizeof(struct vi_mqd_allocation)); | 4770 | memset((void *)mqd, 0, sizeof(struct vi_mqd_allocation)); |
4771 | ((struct vi_mqd_allocation *)mqd)->dyamic_cu_mask = 0xFFFFFFFF; | 4771 | ((struct vi_mqd_allocation *)mqd)->dynamic_cu_mask = 0xFFFFFFFF; |
4772 | ((struct vi_mqd_allocation *)mqd)->dyamic_rb_mask = 0xFFFFFFFF; | 4772 | ((struct vi_mqd_allocation *)mqd)->dynamic_rb_mask = 0xFFFFFFFF; |
4773 | mutex_lock(&adev->srbm_mutex); | 4773 | mutex_lock(&adev->srbm_mutex); |
4774 | vi_srbm_select(adev, ring->me, ring->pipe, ring->queue, 0); | 4774 | vi_srbm_select(adev, ring->me, ring->pipe, ring->queue, 0); |
4775 | gfx_v8_0_mqd_init(ring); | 4775 | gfx_v8_0_mqd_init(ring); |
@@ -4792,8 +4792,8 @@ static int gfx_v8_0_kcq_init_queue(struct amdgpu_ring *ring) | |||
4792 | 4792 | ||
4793 | if (!adev->gfx.in_reset && !adev->gfx.in_suspend) { | 4793 | if (!adev->gfx.in_reset && !adev->gfx.in_suspend) { |
4794 | memset((void *)mqd, 0, sizeof(struct vi_mqd_allocation)); | 4794 | memset((void *)mqd, 0, sizeof(struct vi_mqd_allocation)); |
4795 | ((struct vi_mqd_allocation *)mqd)->dyamic_cu_mask = 0xFFFFFFFF; | 4795 | ((struct vi_mqd_allocation *)mqd)->dynamic_cu_mask = 0xFFFFFFFF; |
4796 | ((struct vi_mqd_allocation *)mqd)->dyamic_rb_mask = 0xFFFFFFFF; | 4796 | ((struct vi_mqd_allocation *)mqd)->dynamic_rb_mask = 0xFFFFFFFF; |
4797 | mutex_lock(&adev->srbm_mutex); | 4797 | mutex_lock(&adev->srbm_mutex); |
4798 | vi_srbm_select(adev, ring->me, ring->pipe, ring->queue, 0); | 4798 | vi_srbm_select(adev, ring->me, ring->pipe, ring->queue, 0); |
4799 | gfx_v8_0_mqd_init(ring); | 4799 | gfx_v8_0_mqd_init(ring); |
diff --git a/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c b/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c index 4f2788b61a08..6c8040e616c4 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c | |||
@@ -124,7 +124,7 @@ static void gfxhub_v1_0_init_tlb_regs(struct amdgpu_device *adev) | |||
124 | 124 | ||
125 | static void gfxhub_v1_0_init_cache_regs(struct amdgpu_device *adev) | 125 | static void gfxhub_v1_0_init_cache_regs(struct amdgpu_device *adev) |
126 | { | 126 | { |
127 | uint32_t tmp, field; | 127 | uint32_t tmp; |
128 | 128 | ||
129 | /* Setup L2 cache */ | 129 | /* Setup L2 cache */ |
130 | tmp = RREG32_SOC15(GC, 0, mmVM_L2_CNTL); | 130 | tmp = RREG32_SOC15(GC, 0, mmVM_L2_CNTL); |
@@ -143,9 +143,8 @@ static void gfxhub_v1_0_init_cache_regs(struct amdgpu_device *adev) | |||
143 | tmp = REG_SET_FIELD(tmp, VM_L2_CNTL2, INVALIDATE_L2_CACHE, 1); | 143 | tmp = REG_SET_FIELD(tmp, VM_L2_CNTL2, INVALIDATE_L2_CACHE, 1); |
144 | WREG32_SOC15(GC, 0, mmVM_L2_CNTL2, tmp); | 144 | WREG32_SOC15(GC, 0, mmVM_L2_CNTL2, tmp); |
145 | 145 | ||
146 | field = adev->vm_manager.fragment_size; | ||
147 | tmp = mmVM_L2_CNTL3_DEFAULT; | 146 | tmp = mmVM_L2_CNTL3_DEFAULT; |
148 | tmp = REG_SET_FIELD(tmp, VM_L2_CNTL3, BANK_SELECT, field); | 147 | tmp = REG_SET_FIELD(tmp, VM_L2_CNTL3, BANK_SELECT, 9); |
149 | tmp = REG_SET_FIELD(tmp, VM_L2_CNTL3, L2_CACHE_BIGK_FRAGMENT_SIZE, 6); | 148 | tmp = REG_SET_FIELD(tmp, VM_L2_CNTL3, L2_CACHE_BIGK_FRAGMENT_SIZE, 6); |
150 | WREG32_SOC15(GC, 0, mmVM_L2_CNTL3, tmp); | 149 | WREG32_SOC15(GC, 0, mmVM_L2_CNTL3, tmp); |
151 | 150 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c index 12b0c4cd7a5a..5be9c83dfcf7 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | |||
@@ -332,7 +332,24 @@ static int gmc_v6_0_mc_init(struct amdgpu_device *adev) | |||
332 | adev->mc.real_vram_size = RREG32(mmCONFIG_MEMSIZE) * 1024ULL * 1024ULL; | 332 | adev->mc.real_vram_size = RREG32(mmCONFIG_MEMSIZE) * 1024ULL * 1024ULL; |
333 | adev->mc.visible_vram_size = adev->mc.aper_size; | 333 | adev->mc.visible_vram_size = adev->mc.aper_size; |
334 | 334 | ||
335 | amdgpu_gart_set_defaults(adev); | 335 | /* set the gart size */ |
336 | if (amdgpu_gart_size == -1) { | ||
337 | switch (adev->asic_type) { | ||
338 | case CHIP_HAINAN: /* no MM engines */ | ||
339 | default: | ||
340 | adev->mc.gart_size = 256ULL << 20; | ||
341 | break; | ||
342 | case CHIP_VERDE: /* UVD, VCE do not support GPUVM */ | ||
343 | case CHIP_TAHITI: /* UVD, VCE do not support GPUVM */ | ||
344 | case CHIP_PITCAIRN: /* UVD, VCE do not support GPUVM */ | ||
345 | case CHIP_OLAND: /* UVD, VCE do not support GPUVM */ | ||
346 | adev->mc.gart_size = 1024ULL << 20; | ||
347 | break; | ||
348 | } | ||
349 | } else { | ||
350 | adev->mc.gart_size = (u64)amdgpu_gart_size << 20; | ||
351 | } | ||
352 | |||
336 | gmc_v6_0_vram_gtt_location(adev, &adev->mc); | 353 | gmc_v6_0_vram_gtt_location(adev, &adev->mc); |
337 | 354 | ||
338 | return 0; | 355 | return 0; |
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c index e42c1ad3af5e..eace9e7182c8 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | |||
@@ -386,7 +386,27 @@ static int gmc_v7_0_mc_init(struct amdgpu_device *adev) | |||
386 | if (adev->mc.visible_vram_size > adev->mc.real_vram_size) | 386 | if (adev->mc.visible_vram_size > adev->mc.real_vram_size) |
387 | adev->mc.visible_vram_size = adev->mc.real_vram_size; | 387 | adev->mc.visible_vram_size = adev->mc.real_vram_size; |
388 | 388 | ||
389 | amdgpu_gart_set_defaults(adev); | 389 | /* set the gart size */ |
390 | if (amdgpu_gart_size == -1) { | ||
391 | switch (adev->asic_type) { | ||
392 | case CHIP_TOPAZ: /* no MM engines */ | ||
393 | default: | ||
394 | adev->mc.gart_size = 256ULL << 20; | ||
395 | break; | ||
396 | #ifdef CONFIG_DRM_AMDGPU_CIK | ||
397 | case CHIP_BONAIRE: /* UVD, VCE do not support GPUVM */ | ||
398 | case CHIP_HAWAII: /* UVD, VCE do not support GPUVM */ | ||
399 | case CHIP_KAVERI: /* UVD, VCE do not support GPUVM */ | ||
400 | case CHIP_KABINI: /* UVD, VCE do not support GPUVM */ | ||
401 | case CHIP_MULLINS: /* UVD, VCE do not support GPUVM */ | ||
402 | adev->mc.gart_size = 1024ULL << 20; | ||
403 | break; | ||
404 | #endif | ||
405 | } | ||
406 | } else { | ||
407 | adev->mc.gart_size = (u64)amdgpu_gart_size << 20; | ||
408 | } | ||
409 | |||
390 | gmc_v7_0_vram_gtt_location(adev, &adev->mc); | 410 | gmc_v7_0_vram_gtt_location(adev, &adev->mc); |
391 | 411 | ||
392 | return 0; | 412 | return 0; |
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c index 7ca2dae8237a..3b3326daf32b 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | |||
@@ -562,7 +562,26 @@ static int gmc_v8_0_mc_init(struct amdgpu_device *adev) | |||
562 | if (adev->mc.visible_vram_size > adev->mc.real_vram_size) | 562 | if (adev->mc.visible_vram_size > adev->mc.real_vram_size) |
563 | adev->mc.visible_vram_size = adev->mc.real_vram_size; | 563 | adev->mc.visible_vram_size = adev->mc.real_vram_size; |
564 | 564 | ||
565 | amdgpu_gart_set_defaults(adev); | 565 | /* set the gart size */ |
566 | if (amdgpu_gart_size == -1) { | ||
567 | switch (adev->asic_type) { | ||
568 | case CHIP_POLARIS11: /* all engines support GPUVM */ | ||
569 | case CHIP_POLARIS10: /* all engines support GPUVM */ | ||
570 | case CHIP_POLARIS12: /* all engines support GPUVM */ | ||
571 | default: | ||
572 | adev->mc.gart_size = 256ULL << 20; | ||
573 | break; | ||
574 | case CHIP_TONGA: /* UVD, VCE do not support GPUVM */ | ||
575 | case CHIP_FIJI: /* UVD, VCE do not support GPUVM */ | ||
576 | case CHIP_CARRIZO: /* UVD, VCE do not support GPUVM, DCE SG support */ | ||
577 | case CHIP_STONEY: /* UVD does not support GPUVM, DCE SG support */ | ||
578 | adev->mc.gart_size = 1024ULL << 20; | ||
579 | break; | ||
580 | } | ||
581 | } else { | ||
582 | adev->mc.gart_size = (u64)amdgpu_gart_size << 20; | ||
583 | } | ||
584 | |||
566 | gmc_v8_0_vram_gtt_location(adev, &adev->mc); | 585 | gmc_v8_0_vram_gtt_location(adev, &adev->mc); |
567 | 586 | ||
568 | return 0; | 587 | return 0; |
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c index 2769c2b3b56e..d04d0b123212 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | |||
@@ -499,7 +499,21 @@ static int gmc_v9_0_mc_init(struct amdgpu_device *adev) | |||
499 | if (adev->mc.visible_vram_size > adev->mc.real_vram_size) | 499 | if (adev->mc.visible_vram_size > adev->mc.real_vram_size) |
500 | adev->mc.visible_vram_size = adev->mc.real_vram_size; | 500 | adev->mc.visible_vram_size = adev->mc.real_vram_size; |
501 | 501 | ||
502 | amdgpu_gart_set_defaults(adev); | 502 | /* set the gart size */ |
503 | if (amdgpu_gart_size == -1) { | ||
504 | switch (adev->asic_type) { | ||
505 | case CHIP_VEGA10: /* all engines support GPUVM */ | ||
506 | default: | ||
507 | adev->mc.gart_size = 256ULL << 20; | ||
508 | break; | ||
509 | case CHIP_RAVEN: /* DCE SG support */ | ||
510 | adev->mc.gart_size = 1024ULL << 20; | ||
511 | break; | ||
512 | } | ||
513 | } else { | ||
514 | adev->mc.gart_size = (u64)amdgpu_gart_size << 20; | ||
515 | } | ||
516 | |||
503 | gmc_v9_0_vram_gtt_location(adev, &adev->mc); | 517 | gmc_v9_0_vram_gtt_location(adev, &adev->mc); |
504 | 518 | ||
505 | return 0; | 519 | return 0; |
diff --git a/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c b/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c index 4395a4f12149..74cb647da30e 100644 --- a/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c +++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c | |||
@@ -138,7 +138,7 @@ static void mmhub_v1_0_init_tlb_regs(struct amdgpu_device *adev) | |||
138 | 138 | ||
139 | static void mmhub_v1_0_init_cache_regs(struct amdgpu_device *adev) | 139 | static void mmhub_v1_0_init_cache_regs(struct amdgpu_device *adev) |
140 | { | 140 | { |
141 | uint32_t tmp, field; | 141 | uint32_t tmp; |
142 | 142 | ||
143 | /* Setup L2 cache */ | 143 | /* Setup L2 cache */ |
144 | tmp = RREG32_SOC15(MMHUB, 0, mmVM_L2_CNTL); | 144 | tmp = RREG32_SOC15(MMHUB, 0, mmVM_L2_CNTL); |
@@ -157,9 +157,8 @@ static void mmhub_v1_0_init_cache_regs(struct amdgpu_device *adev) | |||
157 | tmp = REG_SET_FIELD(tmp, VM_L2_CNTL2, INVALIDATE_L2_CACHE, 1); | 157 | tmp = REG_SET_FIELD(tmp, VM_L2_CNTL2, INVALIDATE_L2_CACHE, 1); |
158 | WREG32_SOC15(MMHUB, 0, mmVM_L2_CNTL2, tmp); | 158 | WREG32_SOC15(MMHUB, 0, mmVM_L2_CNTL2, tmp); |
159 | 159 | ||
160 | field = adev->vm_manager.fragment_size; | ||
161 | tmp = mmVM_L2_CNTL3_DEFAULT; | 160 | tmp = mmVM_L2_CNTL3_DEFAULT; |
162 | tmp = REG_SET_FIELD(tmp, VM_L2_CNTL3, BANK_SELECT, field); | 161 | tmp = REG_SET_FIELD(tmp, VM_L2_CNTL3, BANK_SELECT, 9); |
163 | tmp = REG_SET_FIELD(tmp, VM_L2_CNTL3, L2_CACHE_BIGK_FRAGMENT_SIZE, 6); | 162 | tmp = REG_SET_FIELD(tmp, VM_L2_CNTL3, L2_CACHE_BIGK_FRAGMENT_SIZE, 6); |
164 | WREG32_SOC15(MMHUB, 0, mmVM_L2_CNTL3, tmp); | 163 | WREG32_SOC15(MMHUB, 0, mmVM_L2_CNTL3, tmp); |
165 | 164 | ||
diff --git a/drivers/gpu/drm/amd/include/vi_structs.h b/drivers/gpu/drm/amd/include/vi_structs.h index ca93b5160ba6..3e606a761d0e 100644 --- a/drivers/gpu/drm/amd/include/vi_structs.h +++ b/drivers/gpu/drm/amd/include/vi_structs.h | |||
@@ -419,8 +419,8 @@ struct vi_mqd_allocation { | |||
419 | struct vi_mqd mqd; | 419 | struct vi_mqd mqd; |
420 | uint32_t wptr_poll_mem; | 420 | uint32_t wptr_poll_mem; |
421 | uint32_t rptr_report_mem; | 421 | uint32_t rptr_report_mem; |
422 | uint32_t dyamic_cu_mask; | 422 | uint32_t dynamic_cu_mask; |
423 | uint32_t dyamic_rb_mask; | 423 | uint32_t dynamic_rb_mask; |
424 | }; | 424 | }; |
425 | 425 | ||
426 | struct cz_mqd { | 426 | struct cz_mqd { |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c index 9d71a259d97d..f8f02e70b8bc 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | |||
@@ -1558,7 +1558,8 @@ static int vega10_populate_smc_link_levels(struct pp_hwmgr *hwmgr) | |||
1558 | */ | 1558 | */ |
1559 | 1559 | ||
1560 | static int vega10_populate_single_gfx_level(struct pp_hwmgr *hwmgr, | 1560 | static int vega10_populate_single_gfx_level(struct pp_hwmgr *hwmgr, |
1561 | uint32_t gfx_clock, PllSetting_t *current_gfxclk_level) | 1561 | uint32_t gfx_clock, PllSetting_t *current_gfxclk_level, |
1562 | uint32_t *acg_freq) | ||
1562 | { | 1563 | { |
1563 | struct phm_ppt_v2_information *table_info = | 1564 | struct phm_ppt_v2_information *table_info = |
1564 | (struct phm_ppt_v2_information *)(hwmgr->pptable); | 1565 | (struct phm_ppt_v2_information *)(hwmgr->pptable); |
@@ -1609,6 +1610,8 @@ static int vega10_populate_single_gfx_level(struct pp_hwmgr *hwmgr, | |||
1609 | cpu_to_le16(dividers.usPll_ss_slew_frac); | 1610 | cpu_to_le16(dividers.usPll_ss_slew_frac); |
1610 | current_gfxclk_level->Did = (uint8_t)(dividers.ulDid); | 1611 | current_gfxclk_level->Did = (uint8_t)(dividers.ulDid); |
1611 | 1612 | ||
1613 | *acg_freq = gfx_clock / 100; /* 100 Khz to Mhz conversion */ | ||
1614 | |||
1612 | return 0; | 1615 | return 0; |
1613 | } | 1616 | } |
1614 | 1617 | ||
@@ -1689,7 +1692,8 @@ static int vega10_populate_all_graphic_levels(struct pp_hwmgr *hwmgr) | |||
1689 | for (i = 0; i < dpm_table->count; i++) { | 1692 | for (i = 0; i < dpm_table->count; i++) { |
1690 | result = vega10_populate_single_gfx_level(hwmgr, | 1693 | result = vega10_populate_single_gfx_level(hwmgr, |
1691 | dpm_table->dpm_levels[i].value, | 1694 | dpm_table->dpm_levels[i].value, |
1692 | &(pp_table->GfxclkLevel[i])); | 1695 | &(pp_table->GfxclkLevel[i]), |
1696 | &(pp_table->AcgFreqTable[i])); | ||
1693 | if (result) | 1697 | if (result) |
1694 | return result; | 1698 | return result; |
1695 | } | 1699 | } |
@@ -1698,7 +1702,8 @@ static int vega10_populate_all_graphic_levels(struct pp_hwmgr *hwmgr) | |||
1698 | while (i < NUM_GFXCLK_DPM_LEVELS) { | 1702 | while (i < NUM_GFXCLK_DPM_LEVELS) { |
1699 | result = vega10_populate_single_gfx_level(hwmgr, | 1703 | result = vega10_populate_single_gfx_level(hwmgr, |
1700 | dpm_table->dpm_levels[j].value, | 1704 | dpm_table->dpm_levels[j].value, |
1701 | &(pp_table->GfxclkLevel[i])); | 1705 | &(pp_table->GfxclkLevel[i]), |
1706 | &(pp_table->AcgFreqTable[i])); | ||
1702 | if (result) | 1707 | if (result) |
1703 | return result; | 1708 | return result; |
1704 | i++; | 1709 | i++; |
diff --git a/drivers/gpu/drm/amd/powerplay/inc/smu9_driver_if.h b/drivers/gpu/drm/amd/powerplay/inc/smu9_driver_if.h index f6d6c61f796a..2818c98ff5ca 100644 --- a/drivers/gpu/drm/amd/powerplay/inc/smu9_driver_if.h +++ b/drivers/gpu/drm/amd/powerplay/inc/smu9_driver_if.h | |||
@@ -315,10 +315,12 @@ typedef struct { | |||
315 | uint8_t AcgEnable[NUM_GFXCLK_DPM_LEVELS]; | 315 | uint8_t AcgEnable[NUM_GFXCLK_DPM_LEVELS]; |
316 | GbVdroopTable_t AcgBtcGbVdroopTable; | 316 | GbVdroopTable_t AcgBtcGbVdroopTable; |
317 | QuadraticInt_t AcgAvfsGb; | 317 | QuadraticInt_t AcgAvfsGb; |
318 | uint32_t Reserved[4]; | 318 | |
319 | /* ACG Frequency Table, in Mhz */ | ||
320 | uint32_t AcgFreqTable[NUM_GFXCLK_DPM_LEVELS]; | ||
319 | 321 | ||
320 | /* Padding - ignore */ | 322 | /* Padding - ignore */ |
321 | uint32_t MmHubPadding[7]; /* SMU internal use */ | 323 | uint32_t MmHubPadding[3]; /* SMU internal use */ |
322 | 324 | ||
323 | } PPTable_t; | 325 | } PPTable_t; |
324 | 326 | ||
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c index 76347ff6d655..c49a6f22002f 100644 --- a/drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c +++ b/drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c | |||
@@ -380,7 +380,8 @@ static int smu7_populate_single_firmware_entry(struct pp_smumgr *smumgr, | |||
380 | entry->num_register_entries = 0; | 380 | entry->num_register_entries = 0; |
381 | } | 381 | } |
382 | 382 | ||
383 | if (fw_type == UCODE_ID_RLC_G) | 383 | if ((fw_type == UCODE_ID_RLC_G) |
384 | || (fw_type == UCODE_ID_CP_MEC)) | ||
384 | entry->flags = 1; | 385 | entry->flags = 1; |
385 | else | 386 | else |
386 | entry->flags = 0; | 387 | entry->flags = 0; |
diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c index 38cea6fb25a8..97c94f9683fa 100644 --- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | |||
@@ -205,17 +205,32 @@ void amd_sched_entity_fini(struct amd_gpu_scheduler *sched, | |||
205 | struct amd_sched_entity *entity) | 205 | struct amd_sched_entity *entity) |
206 | { | 206 | { |
207 | struct amd_sched_rq *rq = entity->rq; | 207 | struct amd_sched_rq *rq = entity->rq; |
208 | int r; | ||
208 | 209 | ||
209 | if (!amd_sched_entity_is_initialized(sched, entity)) | 210 | if (!amd_sched_entity_is_initialized(sched, entity)) |
210 | return; | 211 | return; |
211 | |||
212 | /** | 212 | /** |
213 | * The client will not queue more IBs during this fini, consume existing | 213 | * The client will not queue more IBs during this fini, consume existing |
214 | * queued IBs | 214 | * queued IBs or discard them on SIGKILL |
215 | */ | 215 | */ |
216 | wait_event(sched->job_scheduled, amd_sched_entity_is_idle(entity)); | 216 | if ((current->flags & PF_SIGNALED) && current->exit_code == SIGKILL) |
217 | 217 | r = -ERESTARTSYS; | |
218 | else | ||
219 | r = wait_event_killable(sched->job_scheduled, | ||
220 | amd_sched_entity_is_idle(entity)); | ||
218 | amd_sched_rq_remove_entity(rq, entity); | 221 | amd_sched_rq_remove_entity(rq, entity); |
222 | if (r) { | ||
223 | struct amd_sched_job *job; | ||
224 | |||
225 | /* Park the kernel for a moment to make sure it isn't processing | ||
226 | * our enity. | ||
227 | */ | ||
228 | kthread_park(sched->thread); | ||
229 | kthread_unpark(sched->thread); | ||
230 | while (kfifo_out(&entity->job_queue, &job, sizeof(job))) | ||
231 | sched->ops->free_job(job); | ||
232 | |||
233 | } | ||
219 | kfifo_free(&entity->job_queue); | 234 | kfifo_free(&entity->job_queue); |
220 | } | 235 | } |
221 | 236 | ||
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index cba11f13d994..180ce6296416 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c | |||
@@ -109,8 +109,8 @@ static ssize_t ttm_bo_global_show(struct kobject *kobj, | |||
109 | struct ttm_bo_global *glob = | 109 | struct ttm_bo_global *glob = |
110 | container_of(kobj, struct ttm_bo_global, kobj); | 110 | container_of(kobj, struct ttm_bo_global, kobj); |
111 | 111 | ||
112 | return snprintf(buffer, PAGE_SIZE, "%lu\n", | 112 | return snprintf(buffer, PAGE_SIZE, "%d\n", |
113 | (unsigned long) atomic_read(&glob->bo_count)); | 113 | atomic_read(&glob->bo_count)); |
114 | } | 114 | } |
115 | 115 | ||
116 | static struct attribute *ttm_bo_global_attrs[] = { | 116 | static struct attribute *ttm_bo_global_attrs[] = { |
diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c index d0459b392e5e..c934ad5b3903 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_util.c +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c | |||
@@ -469,6 +469,7 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo, | |||
469 | * TODO: Explicit member copy would probably be better here. | 469 | * TODO: Explicit member copy would probably be better here. |
470 | */ | 470 | */ |
471 | 471 | ||
472 | atomic_inc(&bo->glob->bo_count); | ||
472 | INIT_LIST_HEAD(&fbo->ddestroy); | 473 | INIT_LIST_HEAD(&fbo->ddestroy); |
473 | INIT_LIST_HEAD(&fbo->lru); | 474 | INIT_LIST_HEAD(&fbo->lru); |
474 | INIT_LIST_HEAD(&fbo->swap); | 475 | INIT_LIST_HEAD(&fbo->swap); |