diff options
author | Dave Airlie <airlied@redhat.com> | 2017-06-15 19:54:02 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2017-06-15 19:56:53 -0400 |
commit | 04d4fb5fa63876d8e7cf67f2788aecfafc6a28a7 (patch) | |
tree | 92aec67d7b5a1359baff1a508d381234f046743e /drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | |
parent | bfda9aa15317838ddb259406027ef9911a1dffbc (diff) | |
parent | a1924005a2e9bfcc4e217b4acd0a4f2421969040 (diff) |
Merge branch 'drm-next-4.13' of git://people.freedesktop.org/~agd5f/linux into drm-next
New radeon and amdgpu features for 4.13:
- Lots of Vega10 bug fixes
- Preliminary Raven support
- KIQ support for compute rings
- MEC queue management rework from Andres
- Audio support for DCE6
- SR-IOV improvements
- Improved module parameters for controlling radeon vs amdgpu support
for SI and CIK
- Bug fixes
- General code cleanups
[airlied: dropped drmP.h header from one file was needed and build broke]
* 'drm-next-4.13' of git://people.freedesktop.org/~agd5f/linux: (362 commits)
drm/amdgpu: Fix compiler warnings
drm/amdgpu: vm_update_ptes remove code duplication
drm/amd/amdgpu: Port VCN over to new SOC15 macros
drm/amd/amdgpu: Port PSP v10.0 over to new SOC15 macros
drm/amd/amdgpu: Port PSP v3.1 over to new SOC15 macros
drm/amd/amdgpu: Port NBIO v7.0 driver over to new SOC15 macros
drm/amd/amdgpu: Port NBIO v6.1 driver over to new SOC15 macros
drm/amd/amdgpu: Port UVD 7.0 over to new SOC15 macros
drm/amd/amdgpu: Port MMHUB over to new SOC15 macros
drm/amd/amdgpu: Cleanup gfxhub read-modify-write patterns
drm/amd/amdgpu: Port GFXHUB over to new SOC15 macros
drm/amd/amdgpu: Add offset variant to SOC15 macros
drm/amd/powerplay: add avfs control for Vega10
drm/amdgpu: add virtual display support for raven
drm/amdgpu/gfx9: fix compute ring doorbell index
drm/amd/amdgpu: Rename KIQ ring to avoid spaces
drm/amd/amdgpu: gfx9 tidy ups (v2)
drm/amdgpu: add contiguous flag in ucode bo create
drm/amdgpu: fix missed gpu info firmware when cache firmware during S3
drm/amdgpu: export test ib debugfs interface
...
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index b5fa003c1341..c9b131b13ef7 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | |||
@@ -745,6 +745,7 @@ int amdgpu_ttm_bind(struct ttm_buffer_object *bo, struct ttm_mem_reg *bo_mem) | |||
745 | return r; | 745 | return r; |
746 | } | 746 | } |
747 | 747 | ||
748 | spin_lock(>t->adev->gtt_list_lock); | ||
748 | flags = amdgpu_ttm_tt_pte_flags(gtt->adev, ttm, bo_mem); | 749 | flags = amdgpu_ttm_tt_pte_flags(gtt->adev, ttm, bo_mem); |
749 | gtt->offset = (u64)bo_mem->start << PAGE_SHIFT; | 750 | gtt->offset = (u64)bo_mem->start << PAGE_SHIFT; |
750 | r = amdgpu_gart_bind(gtt->adev, gtt->offset, ttm->num_pages, | 751 | r = amdgpu_gart_bind(gtt->adev, gtt->offset, ttm->num_pages, |
@@ -753,12 +754,13 @@ int amdgpu_ttm_bind(struct ttm_buffer_object *bo, struct ttm_mem_reg *bo_mem) | |||
753 | if (r) { | 754 | if (r) { |
754 | DRM_ERROR("failed to bind %lu pages at 0x%08llX\n", | 755 | DRM_ERROR("failed to bind %lu pages at 0x%08llX\n", |
755 | ttm->num_pages, gtt->offset); | 756 | ttm->num_pages, gtt->offset); |
756 | return r; | 757 | goto error_gart_bind; |
757 | } | 758 | } |
758 | spin_lock(>t->adev->gtt_list_lock); | 759 | |
759 | list_add_tail(>t->list, >t->adev->gtt_list); | 760 | list_add_tail(>t->list, >t->adev->gtt_list); |
761 | error_gart_bind: | ||
760 | spin_unlock(>t->adev->gtt_list_lock); | 762 | spin_unlock(>t->adev->gtt_list_lock); |
761 | return 0; | 763 | return r; |
762 | } | 764 | } |
763 | 765 | ||
764 | int amdgpu_ttm_recover_gart(struct amdgpu_device *adev) | 766 | int amdgpu_ttm_recover_gart(struct amdgpu_device *adev) |
@@ -789,6 +791,7 @@ int amdgpu_ttm_recover_gart(struct amdgpu_device *adev) | |||
789 | static int amdgpu_ttm_backend_unbind(struct ttm_tt *ttm) | 791 | static int amdgpu_ttm_backend_unbind(struct ttm_tt *ttm) |
790 | { | 792 | { |
791 | struct amdgpu_ttm_tt *gtt = (void *)ttm; | 793 | struct amdgpu_ttm_tt *gtt = (void *)ttm; |
794 | int r; | ||
792 | 795 | ||
793 | if (gtt->userptr) | 796 | if (gtt->userptr) |
794 | amdgpu_ttm_tt_unpin_userptr(ttm); | 797 | amdgpu_ttm_tt_unpin_userptr(ttm); |
@@ -797,14 +800,17 @@ static int amdgpu_ttm_backend_unbind(struct ttm_tt *ttm) | |||
797 | return 0; | 800 | return 0; |
798 | 801 | ||
799 | /* unbind shouldn't be done for GDS/GWS/OA in ttm_bo_clean_mm */ | 802 | /* unbind shouldn't be done for GDS/GWS/OA in ttm_bo_clean_mm */ |
800 | if (gtt->adev->gart.ready) | ||
801 | amdgpu_gart_unbind(gtt->adev, gtt->offset, ttm->num_pages); | ||
802 | |||
803 | spin_lock(>t->adev->gtt_list_lock); | 803 | spin_lock(>t->adev->gtt_list_lock); |
804 | r = amdgpu_gart_unbind(gtt->adev, gtt->offset, ttm->num_pages); | ||
805 | if (r) { | ||
806 | DRM_ERROR("failed to unbind %lu pages at 0x%08llX\n", | ||
807 | gtt->ttm.ttm.num_pages, gtt->offset); | ||
808 | goto error_unbind; | ||
809 | } | ||
804 | list_del_init(>t->list); | 810 | list_del_init(>t->list); |
811 | error_unbind: | ||
805 | spin_unlock(>t->adev->gtt_list_lock); | 812 | spin_unlock(>t->adev->gtt_list_lock); |
806 | 813 | return r; | |
807 | return 0; | ||
808 | } | 814 | } |
809 | 815 | ||
810 | static void amdgpu_ttm_backend_destroy(struct ttm_tt *ttm) | 816 | static void amdgpu_ttm_backend_destroy(struct ttm_tt *ttm) |
@@ -1115,7 +1121,7 @@ int amdgpu_ttm_init(struct amdgpu_device *adev) | |||
1115 | /* Change the size here instead of the init above so only lpfn is affected */ | 1121 | /* Change the size here instead of the init above so only lpfn is affected */ |
1116 | amdgpu_ttm_set_active_vram_size(adev, adev->mc.visible_vram_size); | 1122 | amdgpu_ttm_set_active_vram_size(adev, adev->mc.visible_vram_size); |
1117 | 1123 | ||
1118 | r = amdgpu_bo_create(adev, 256 * 1024, PAGE_SIZE, true, | 1124 | r = amdgpu_bo_create(adev, adev->mc.stolen_size, PAGE_SIZE, true, |
1119 | AMDGPU_GEM_DOMAIN_VRAM, | 1125 | AMDGPU_GEM_DOMAIN_VRAM, |
1120 | AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED | | 1126 | AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED | |
1121 | AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS, | 1127 | AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS, |
@@ -1462,6 +1468,9 @@ static ssize_t amdgpu_ttm_vram_read(struct file *f, char __user *buf, | |||
1462 | if (size & 0x3 || *pos & 0x3) | 1468 | if (size & 0x3 || *pos & 0x3) |
1463 | return -EINVAL; | 1469 | return -EINVAL; |
1464 | 1470 | ||
1471 | if (*pos >= adev->mc.mc_vram_size) | ||
1472 | return -ENXIO; | ||
1473 | |||
1465 | while (size) { | 1474 | while (size) { |
1466 | unsigned long flags; | 1475 | unsigned long flags; |
1467 | uint32_t value; | 1476 | uint32_t value; |