aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-06-21 23:32:09 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-06-21 23:32:09 -0400
commit1cfea546b10c8fec218973c3f3c39ff797a3e50c (patch)
treed2aa389291efa4d5552baa2502706a8a95c30ca6 /drivers/gpu/drm/amd
parent27db64f65f1be2f2ee741a1bf20d8d13d62c167f (diff)
parentf3294568bbb19cbfc53451de192df6daae80f9b3 (diff)
Merge tag 'drm-fixes-2018-06-22' of git://anongit.freedesktop.org/drm/drm
Pull drm fixes from Dave Airlie: "Just run of the mill fixes, core: - regression fix in device unplug qxl: - regression fix for might sleep in cursor handling nouveau: - regression fix in multi-screen cursor handling amdgpu: - switch off DC by default on Kaveri and older - some minor fixes i915: - some GEM regression fixes - doublescan mode fixes sun4i: - revert fix for a regression sii8620 bridge: - misc fixes" * tag 'drm-fixes-2018-06-22' of git://anongit.freedesktop.org/drm/drm: (28 commits) drm/bridge/sii8620: fix display of packed pixel modes in MHL2 drm/amdgpu: Make amdgpu_vram_mgr_bo_invisible_size always accurate drm/amdgpu: Refactor amdgpu_vram_mgr_bo_invisible_size helper drm/amdgpu: Update pin_size values before unpinning BO drm/amdgpu:All UVD instances share one idle_work handle drm/amdgpu: Don't default to DC support for Kaveri and older drm/amdgpu: Use kvmalloc_array for allocating VRAM manager nodes array drm/amd/pp: Fix uninitialized variable drm/i915: Enable provoking vertex fix on Gen9 systems. drm/i915: Fix context ban and hang accounting for client drm/i915: Turn off g4x DP port in .post_disable() drm/i915: Disallow interlaced modes on g4x DP outputs drm/i915: Fix PIPESTAT irq ack on i965/g4x drm/i915: Allow DBLSCAN user modes with eDP/LVDS/DSI drm/i915/execlists: Avoid putting the error pointer drm/i915: Apply batch location restrictions before pinning drm/nouveau/kms/nv50-: cursors always use core channel vram ctxdma Revert "drm/sun4i: Handle DRM_BUS_FLAG_PIXDATA_*EDGE" drm/atmel-hlcdc: check stride values in the first plane drm/bridge/sii8620: fix HDMI cable connection to dongle ...
Diffstat (limited to 'drivers/gpu/drm/amd')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_device.c10
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_object.c24
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h1
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c14
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c39
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/vega10_powertune.c2
7 files changed, 65 insertions, 27 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 3317d1536f4f..6e5284e6c028 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -2158,10 +2158,18 @@ bool amdgpu_device_asic_has_dc_support(enum amd_asic_type asic_type)
2158 switch (asic_type) { 2158 switch (asic_type) {
2159#if defined(CONFIG_DRM_AMD_DC) 2159#if defined(CONFIG_DRM_AMD_DC)
2160 case CHIP_BONAIRE: 2160 case CHIP_BONAIRE:
2161 case CHIP_HAWAII:
2162 case CHIP_KAVERI: 2161 case CHIP_KAVERI:
2163 case CHIP_KABINI: 2162 case CHIP_KABINI:
2164 case CHIP_MULLINS: 2163 case CHIP_MULLINS:
2164 /*
2165 * We have systems in the wild with these ASICs that require
2166 * LVDS and VGA support which is not supported with DC.
2167 *
2168 * Fallback to the non-DC driver here by default so as not to
2169 * cause regressions.
2170 */
2171 return amdgpu_dc > 0;
2172 case CHIP_HAWAII:
2165 case CHIP_CARRIZO: 2173 case CHIP_CARRIZO:
2166 case CHIP_STONEY: 2174 case CHIP_STONEY:
2167 case CHIP_POLARIS10: 2175 case CHIP_POLARIS10:
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 5e4e1bd90383..3526efa8960e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -762,8 +762,7 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
762 domain = amdgpu_mem_type_to_domain(bo->tbo.mem.mem_type); 762 domain = amdgpu_mem_type_to_domain(bo->tbo.mem.mem_type);
763 if (domain == AMDGPU_GEM_DOMAIN_VRAM) { 763 if (domain == AMDGPU_GEM_DOMAIN_VRAM) {
764 adev->vram_pin_size += amdgpu_bo_size(bo); 764 adev->vram_pin_size += amdgpu_bo_size(bo);
765 if (bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS) 765 adev->invisible_pin_size += amdgpu_vram_mgr_bo_invisible_size(bo);
766 adev->invisible_pin_size += amdgpu_bo_size(bo);
767 } else if (domain == AMDGPU_GEM_DOMAIN_GTT) { 766 } else if (domain == AMDGPU_GEM_DOMAIN_GTT) {
768 adev->gart_pin_size += amdgpu_bo_size(bo); 767 adev->gart_pin_size += amdgpu_bo_size(bo);
769 } 768 }
@@ -790,25 +789,22 @@ int amdgpu_bo_unpin(struct amdgpu_bo *bo)
790 bo->pin_count--; 789 bo->pin_count--;
791 if (bo->pin_count) 790 if (bo->pin_count)
792 return 0; 791 return 0;
793 for (i = 0; i < bo->placement.num_placement; i++) {
794 bo->placements[i].lpfn = 0;
795 bo->placements[i].flags &= ~TTM_PL_FLAG_NO_EVICT;
796 }
797 r = ttm_bo_validate(&bo->tbo, &bo->placement, &ctx);
798 if (unlikely(r)) {
799 dev_err(adev->dev, "%p validate failed for unpin\n", bo);
800 goto error;
801 }
802 792
803 if (bo->tbo.mem.mem_type == TTM_PL_VRAM) { 793 if (bo->tbo.mem.mem_type == TTM_PL_VRAM) {
804 adev->vram_pin_size -= amdgpu_bo_size(bo); 794 adev->vram_pin_size -= amdgpu_bo_size(bo);
805 if (bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS) 795 adev->invisible_pin_size -= amdgpu_vram_mgr_bo_invisible_size(bo);
806 adev->invisible_pin_size -= amdgpu_bo_size(bo);
807 } else if (bo->tbo.mem.mem_type == TTM_PL_TT) { 796 } else if (bo->tbo.mem.mem_type == TTM_PL_TT) {
808 adev->gart_pin_size -= amdgpu_bo_size(bo); 797 adev->gart_pin_size -= amdgpu_bo_size(bo);
809 } 798 }
810 799
811error: 800 for (i = 0; i < bo->placement.num_placement; i++) {
801 bo->placements[i].lpfn = 0;
802 bo->placements[i].flags &= ~TTM_PL_FLAG_NO_EVICT;
803 }
804 r = ttm_bo_validate(&bo->tbo, &bo->placement, &ctx);
805 if (unlikely(r))
806 dev_err(adev->dev, "%p validate failed for unpin\n", bo);
807
812 return r; 808 return r;
813} 809}
814 810
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
index e969c879d87e..e5da4654b630 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
@@ -73,6 +73,7 @@ bool amdgpu_gtt_mgr_has_gart_addr(struct ttm_mem_reg *mem);
73uint64_t amdgpu_gtt_mgr_usage(struct ttm_mem_type_manager *man); 73uint64_t amdgpu_gtt_mgr_usage(struct ttm_mem_type_manager *man);
74int amdgpu_gtt_mgr_recover(struct ttm_mem_type_manager *man); 74int amdgpu_gtt_mgr_recover(struct ttm_mem_type_manager *man);
75 75
76u64 amdgpu_vram_mgr_bo_invisible_size(struct amdgpu_bo *bo);
76uint64_t amdgpu_vram_mgr_usage(struct ttm_mem_type_manager *man); 77uint64_t amdgpu_vram_mgr_usage(struct ttm_mem_type_manager *man);
77uint64_t amdgpu_vram_mgr_vis_usage(struct ttm_mem_type_manager *man); 78uint64_t amdgpu_vram_mgr_vis_usage(struct ttm_mem_type_manager *man);
78 79
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
index bcf68f80bbf0..3ff08e326838 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
@@ -130,7 +130,7 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
130 unsigned version_major, version_minor, family_id; 130 unsigned version_major, version_minor, family_id;
131 int i, j, r; 131 int i, j, r;
132 132
133 INIT_DELAYED_WORK(&adev->uvd.inst->idle_work, amdgpu_uvd_idle_work_handler); 133 INIT_DELAYED_WORK(&adev->uvd.idle_work, amdgpu_uvd_idle_work_handler);
134 134
135 switch (adev->asic_type) { 135 switch (adev->asic_type) {
136#ifdef CONFIG_DRM_AMDGPU_CIK 136#ifdef CONFIG_DRM_AMDGPU_CIK
@@ -314,12 +314,12 @@ int amdgpu_uvd_suspend(struct amdgpu_device *adev)
314 void *ptr; 314 void *ptr;
315 int i, j; 315 int i, j;
316 316
317 cancel_delayed_work_sync(&adev->uvd.idle_work);
318
317 for (j = 0; j < adev->uvd.num_uvd_inst; ++j) { 319 for (j = 0; j < adev->uvd.num_uvd_inst; ++j) {
318 if (adev->uvd.inst[j].vcpu_bo == NULL) 320 if (adev->uvd.inst[j].vcpu_bo == NULL)
319 continue; 321 continue;
320 322
321 cancel_delayed_work_sync(&adev->uvd.inst[j].idle_work);
322
323 /* only valid for physical mode */ 323 /* only valid for physical mode */
324 if (adev->asic_type < CHIP_POLARIS10) { 324 if (adev->asic_type < CHIP_POLARIS10) {
325 for (i = 0; i < adev->uvd.max_handles; ++i) 325 for (i = 0; i < adev->uvd.max_handles; ++i)
@@ -1145,7 +1145,7 @@ int amdgpu_uvd_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle,
1145static void amdgpu_uvd_idle_work_handler(struct work_struct *work) 1145static void amdgpu_uvd_idle_work_handler(struct work_struct *work)
1146{ 1146{
1147 struct amdgpu_device *adev = 1147 struct amdgpu_device *adev =
1148 container_of(work, struct amdgpu_device, uvd.inst->idle_work.work); 1148 container_of(work, struct amdgpu_device, uvd.idle_work.work);
1149 unsigned fences = 0, i, j; 1149 unsigned fences = 0, i, j;
1150 1150
1151 for (i = 0; i < adev->uvd.num_uvd_inst; ++i) { 1151 for (i = 0; i < adev->uvd.num_uvd_inst; ++i) {
@@ -1167,7 +1167,7 @@ static void amdgpu_uvd_idle_work_handler(struct work_struct *work)
1167 AMD_CG_STATE_GATE); 1167 AMD_CG_STATE_GATE);
1168 } 1168 }
1169 } else { 1169 } else {
1170 schedule_delayed_work(&adev->uvd.inst->idle_work, UVD_IDLE_TIMEOUT); 1170 schedule_delayed_work(&adev->uvd.idle_work, UVD_IDLE_TIMEOUT);
1171 } 1171 }
1172} 1172}
1173 1173
@@ -1179,7 +1179,7 @@ void amdgpu_uvd_ring_begin_use(struct amdgpu_ring *ring)
1179 if (amdgpu_sriov_vf(adev)) 1179 if (amdgpu_sriov_vf(adev))
1180 return; 1180 return;
1181 1181
1182 set_clocks = !cancel_delayed_work_sync(&adev->uvd.inst->idle_work); 1182 set_clocks = !cancel_delayed_work_sync(&adev->uvd.idle_work);
1183 if (set_clocks) { 1183 if (set_clocks) {
1184 if (adev->pm.dpm_enabled) { 1184 if (adev->pm.dpm_enabled) {
1185 amdgpu_dpm_enable_uvd(adev, true); 1185 amdgpu_dpm_enable_uvd(adev, true);
@@ -1196,7 +1196,7 @@ void amdgpu_uvd_ring_begin_use(struct amdgpu_ring *ring)
1196void amdgpu_uvd_ring_end_use(struct amdgpu_ring *ring) 1196void amdgpu_uvd_ring_end_use(struct amdgpu_ring *ring)
1197{ 1197{
1198 if (!amdgpu_sriov_vf(ring->adev)) 1198 if (!amdgpu_sriov_vf(ring->adev))
1199 schedule_delayed_work(&ring->adev->uvd.inst->idle_work, UVD_IDLE_TIMEOUT); 1199 schedule_delayed_work(&ring->adev->uvd.idle_work, UVD_IDLE_TIMEOUT);
1200} 1200}
1201 1201
1202/** 1202/**
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h
index b1579fba134c..8b23a1b00c76 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h
@@ -44,7 +44,6 @@ struct amdgpu_uvd_inst {
44 void *saved_bo; 44 void *saved_bo;
45 atomic_t handles[AMDGPU_MAX_UVD_HANDLES]; 45 atomic_t handles[AMDGPU_MAX_UVD_HANDLES];
46 struct drm_file *filp[AMDGPU_MAX_UVD_HANDLES]; 46 struct drm_file *filp[AMDGPU_MAX_UVD_HANDLES];
47 struct delayed_work idle_work;
48 struct amdgpu_ring ring; 47 struct amdgpu_ring ring;
49 struct amdgpu_ring ring_enc[AMDGPU_MAX_UVD_ENC_RINGS]; 48 struct amdgpu_ring ring_enc[AMDGPU_MAX_UVD_ENC_RINGS];
50 struct amdgpu_irq_src irq; 49 struct amdgpu_irq_src irq;
@@ -62,6 +61,7 @@ struct amdgpu_uvd {
62 bool address_64_bit; 61 bool address_64_bit;
63 bool use_ctx_buf; 62 bool use_ctx_buf;
64 struct amdgpu_uvd_inst inst[AMDGPU_MAX_UVD_INSTANCES]; 63 struct amdgpu_uvd_inst inst[AMDGPU_MAX_UVD_INSTANCES];
64 struct delayed_work idle_work;
65}; 65};
66 66
67int amdgpu_uvd_sw_init(struct amdgpu_device *adev); 67int amdgpu_uvd_sw_init(struct amdgpu_device *adev);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
index 9aca653bec07..b6333f92ba45 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
@@ -97,6 +97,38 @@ static u64 amdgpu_vram_mgr_vis_size(struct amdgpu_device *adev,
97} 97}
98 98
99/** 99/**
100 * amdgpu_vram_mgr_bo_invisible_size - CPU invisible BO size
101 *
102 * @bo: &amdgpu_bo buffer object (must be in VRAM)
103 *
104 * Returns:
105 * How much of the given &amdgpu_bo buffer object lies in CPU invisible VRAM.
106 */
107u64 amdgpu_vram_mgr_bo_invisible_size(struct amdgpu_bo *bo)
108{
109 struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
110 struct ttm_mem_reg *mem = &bo->tbo.mem;
111 struct drm_mm_node *nodes = mem->mm_node;
112 unsigned pages = mem->num_pages;
113 u64 usage = 0;
114
115 if (adev->gmc.visible_vram_size == adev->gmc.real_vram_size)
116 return 0;
117
118 if (mem->start >= adev->gmc.visible_vram_size >> PAGE_SHIFT)
119 return amdgpu_bo_size(bo);
120
121 while (nodes && pages) {
122 usage += nodes->size << PAGE_SHIFT;
123 usage -= amdgpu_vram_mgr_vis_size(adev, nodes);
124 pages -= nodes->size;
125 ++nodes;
126 }
127
128 return usage;
129}
130
131/**
100 * amdgpu_vram_mgr_new - allocate new ranges 132 * amdgpu_vram_mgr_new - allocate new ranges
101 * 133 *
102 * @man: TTM memory type manager 134 * @man: TTM memory type manager
@@ -135,7 +167,8 @@ static int amdgpu_vram_mgr_new(struct ttm_mem_type_manager *man,
135 num_nodes = DIV_ROUND_UP(mem->num_pages, pages_per_node); 167 num_nodes = DIV_ROUND_UP(mem->num_pages, pages_per_node);
136 } 168 }
137 169
138 nodes = kcalloc(num_nodes, sizeof(*nodes), GFP_KERNEL); 170 nodes = kvmalloc_array(num_nodes, sizeof(*nodes),
171 GFP_KERNEL | __GFP_ZERO);
139 if (!nodes) 172 if (!nodes)
140 return -ENOMEM; 173 return -ENOMEM;
141 174
@@ -190,7 +223,7 @@ error:
190 drm_mm_remove_node(&nodes[i]); 223 drm_mm_remove_node(&nodes[i]);
191 spin_unlock(&mgr->lock); 224 spin_unlock(&mgr->lock);
192 225
193 kfree(nodes); 226 kvfree(nodes);
194 return r == -ENOSPC ? 0 : r; 227 return r == -ENOSPC ? 0 : r;
195} 228}
196 229
@@ -229,7 +262,7 @@ static void amdgpu_vram_mgr_del(struct ttm_mem_type_manager *man,
229 atomic64_sub(usage, &mgr->usage); 262 atomic64_sub(usage, &mgr->usage);
230 atomic64_sub(vis_usage, &mgr->vis_usage); 263 atomic64_sub(vis_usage, &mgr->vis_usage);
231 264
232 kfree(mem->mm_node); 265 kvfree(mem->mm_node);
233 mem->mm_node = NULL; 266 mem->mm_node = NULL;
234} 267}
235 268
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_powertune.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_powertune.c
index dbe4b1f66784..22364875a943 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_powertune.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_powertune.c
@@ -1090,7 +1090,7 @@ static int vega10_disable_se_edc_config(struct pp_hwmgr *hwmgr)
1090static int vega10_enable_psm_gc_edc_config(struct pp_hwmgr *hwmgr) 1090static int vega10_enable_psm_gc_edc_config(struct pp_hwmgr *hwmgr)
1091{ 1091{
1092 struct amdgpu_device *adev = hwmgr->adev; 1092 struct amdgpu_device *adev = hwmgr->adev;
1093 int result; 1093 int result = 0;
1094 uint32_t num_se = 0; 1094 uint32_t num_se = 0;
1095 uint32_t count, data; 1095 uint32_t count, data;
1096 1096