Skip to content

Commit fdce296

Browse files
committed
Merge tag 'drm-next-2021-02-26' of git://anongit.freedesktop.org/drm/drm
Pull more drm updates from Dave Airlie: "This is mostly fixes but I missed msm-next pull last week. It's been in drm-next. Otherwise it's a selection of i915, amdgpu and misc fixes, one TTM memory leak, nothing really major stands out otherwise. core: - vblank fence timing improvements dma-buf: - improve error handling ttm: - memory leak fix msm: - a6xx speedbin support - a508, a509, a512 support - various a5xx fixes - various dpu fixes - qseed3lite support for sm8250 - dsi fix for msm8994 - mdp5 fix for framerate bug with cmd mode panels - a6xx GMU OOB race fixes that were showing up in CI - various addition and removal of semicolons - gem submit fix for legacy userspace relocs path amdgpu: - clang warning fix - S0ix platform shutdown/poweroff fix - misc display fixes i915: - color format fix - -Wuninitialised reenabled - GVT ww locking, cmd parser fixes atyfb: - fix build rockchip: - AFBC modifier fix" * tag 'drm-next-2021-02-26' of git://anongit.freedesktop.org/drm/drm: (60 commits) drm/panel: kd35t133: allow using non-continuous dsi clock drm/rockchip: Require the YTR modifier for AFBC drm/ttm: Fix a memory leak drm/drm_vblank: set the dma-fence timestamp during send_vblank_event dma-fence: allow signaling drivers to set fence timestamp dma-buf: heaps: Rework heap allocation hooks to return struct dma_buf instead of fd dma-buf: system_heap: Make sure to return an error if we abort drm/amd/display: Fix system hang after multiple hotplugs (v3) drm/amdgpu: fix shutdown and poweroff process failed with s0ix drm/i915: Nuke INTEL_OUTPUT_FORMAT_INVALID drm/i915: Enable -Wuninitialized drm/amd/display: Remove Assert from dcn10_get_dig_frontend drm/amd/display: Add vupdate_no_lock interrupts for DCN2.1 Revert "drm/amd/display: reuse current context instead of recreating one" drm/amd/pm/swsmu: Avoid using structure_size uninitialized in smu_cmn_init_soft_gpu_metrics fbdev: atyfb: add stubs for aty_{ld,st}_lcd() drm/i915/gvt: Introduce per object locking in GVT scheduler. drm/i915/gvt: Purge dev_priv->gt drm/i915/gvt: Parse default state to update reg whitelist dt-bindings: dp-connector: Drop maxItems from -supply ...
2 parents 5ad3dba + d153e8c commit fdce296

68 files changed

Lines changed: 1223 additions & 423 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Documentation/devicetree/bindings/display/connector/dp-connector.yaml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ properties:
2626

2727
dp-pwr-supply:
2828
description: Power supply for the DP_PWR pin
29-
maxItems: 1
3029

3130
port:
3231
$ref: /schemas/graph.yaml#/properties/port

‎drivers/dma-buf/dma-fence.c‎

Lines changed: 63 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -312,22 +312,25 @@ void __dma_fence_might_wait(void)
312312

313313

314314
/**
315-
* dma_fence_signal_locked - signal completion of a fence
315+
* dma_fence_signal_timestamp_locked - signal completion of a fence
316316
* @fence: the fence to signal
317+
* @timestamp: fence signal timestamp in kernel's CLOCK_MONOTONIC time domain
317318
*
318319
* Signal completion for software callbacks on a fence, this will unblock
319320
* dma_fence_wait() calls and run all the callbacks added with
320321
* dma_fence_add_callback(). Can be called multiple times, but since a fence
321322
* can only go from the unsignaled to the signaled state and not back, it will
322-
* only be effective the first time.
323+
* only be effective the first time. Set the timestamp provided as the fence
324+
* signal timestamp.
323325
*
324-
* Unlike dma_fence_signal(), this function must be called with &dma_fence.lock
325-
* held.
326+
* Unlike dma_fence_signal_timestamp(), this function must be called with
327+
* &dma_fence.lock held.
326328
*
327329
* Returns 0 on success and a negative error value when @fence has been
328330
* signalled already.
329331
*/
330-
int dma_fence_signal_locked(struct dma_fence *fence)
332+
int dma_fence_signal_timestamp_locked(struct dma_fence *fence,
333+
ktime_t timestamp)
331334
{
332335
struct dma_fence_cb *cur, *tmp;
333336
struct list_head cb_list;
@@ -341,7 +344,7 @@ int dma_fence_signal_locked(struct dma_fence *fence)
341344
/* Stash the cb_list before replacing it with the timestamp */
342345
list_replace(&fence->cb_list, &cb_list);
343346

344-
fence->timestamp = ktime_get();
347+
fence->timestamp = timestamp;
345348
set_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags);
346349
trace_dma_fence_signaled(fence);
347350

@@ -352,6 +355,59 @@ int dma_fence_signal_locked(struct dma_fence *fence)
352355

353356
return 0;
354357
}
358+
EXPORT_SYMBOL(dma_fence_signal_timestamp_locked);
359+
360+
/**
361+
* dma_fence_signal_timestamp - signal completion of a fence
362+
* @fence: the fence to signal
363+
* @timestamp: fence signal timestamp in kernel's CLOCK_MONOTONIC time domain
364+
*
365+
* Signal completion for software callbacks on a fence, this will unblock
366+
* dma_fence_wait() calls and run all the callbacks added with
367+
* dma_fence_add_callback(). Can be called multiple times, but since a fence
368+
* can only go from the unsignaled to the signaled state and not back, it will
369+
* only be effective the first time. Set the timestamp provided as the fence
370+
* signal timestamp.
371+
*
372+
* Returns 0 on success and a negative error value when @fence has been
373+
* signalled already.
374+
*/
375+
int dma_fence_signal_timestamp(struct dma_fence *fence, ktime_t timestamp)
376+
{
377+
unsigned long flags;
378+
int ret;
379+
380+
if (!fence)
381+
return -EINVAL;
382+
383+
spin_lock_irqsave(fence->lock, flags);
384+
ret = dma_fence_signal_timestamp_locked(fence, timestamp);
385+
spin_unlock_irqrestore(fence->lock, flags);
386+
387+
return ret;
388+
}
389+
EXPORT_SYMBOL(dma_fence_signal_timestamp);
390+
391+
/**
392+
* dma_fence_signal_locked - signal completion of a fence
393+
* @fence: the fence to signal
394+
*
395+
* Signal completion for software callbacks on a fence, this will unblock
396+
* dma_fence_wait() calls and run all the callbacks added with
397+
* dma_fence_add_callback(). Can be called multiple times, but since a fence
398+
* can only go from the unsignaled to the signaled state and not back, it will
399+
* only be effective the first time.
400+
*
401+
* Unlike dma_fence_signal(), this function must be called with &dma_fence.lock
402+
* held.
403+
*
404+
* Returns 0 on success and a negative error value when @fence has been
405+
* signalled already.
406+
*/
407+
int dma_fence_signal_locked(struct dma_fence *fence)
408+
{
409+
return dma_fence_signal_timestamp_locked(fence, ktime_get());
410+
}
355411
EXPORT_SYMBOL(dma_fence_signal_locked);
356412

357413
/**
@@ -379,7 +435,7 @@ int dma_fence_signal(struct dma_fence *fence)
379435
tmp = dma_fence_begin_signalling();
380436

381437
spin_lock_irqsave(fence->lock, flags);
382-
ret = dma_fence_signal_locked(fence);
438+
ret = dma_fence_signal_timestamp_locked(fence, ktime_get());
383439
spin_unlock_irqrestore(fence->lock, flags);
384440

385441
dma_fence_end_signalling(tmp);

‎drivers/dma-buf/dma-heap.c‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ static int dma_heap_buffer_alloc(struct dma_heap *heap, size_t len,
5252
unsigned int fd_flags,
5353
unsigned int heap_flags)
5454
{
55+
struct dma_buf *dmabuf;
56+
int fd;
57+
5558
/*
5659
* Allocations from all heaps have to begin
5760
* and end on page boundaries.
@@ -60,7 +63,16 @@ static int dma_heap_buffer_alloc(struct dma_heap *heap, size_t len,
6063
if (!len)
6164
return -EINVAL;
6265

63-
return heap->ops->allocate(heap, len, fd_flags, heap_flags);
66+
dmabuf = heap->ops->allocate(heap, len, fd_flags, heap_flags);
67+
if (IS_ERR(dmabuf))
68+
return PTR_ERR(dmabuf);
69+
70+
fd = dma_buf_fd(dmabuf, fd_flags);
71+
if (fd < 0) {
72+
dma_buf_put(dmabuf);
73+
/* just return, as put will call release and that will free */
74+
}
75+
return fd;
6476
}
6577

6678
static int dma_heap_open(struct inode *inode, struct file *file)

‎drivers/dma-buf/heaps/cma_heap.c‎

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -271,10 +271,10 @@ static const struct dma_buf_ops cma_heap_buf_ops = {
271271
.release = cma_heap_dma_buf_release,
272272
};
273273

274-
static int cma_heap_allocate(struct dma_heap *heap,
275-
unsigned long len,
276-
unsigned long fd_flags,
277-
unsigned long heap_flags)
274+
static struct dma_buf *cma_heap_allocate(struct dma_heap *heap,
275+
unsigned long len,
276+
unsigned long fd_flags,
277+
unsigned long heap_flags)
278278
{
279279
struct cma_heap *cma_heap = dma_heap_get_drvdata(heap);
280280
struct cma_heap_buffer *buffer;
@@ -289,7 +289,7 @@ static int cma_heap_allocate(struct dma_heap *heap,
289289

290290
buffer = kzalloc(sizeof(*buffer), GFP_KERNEL);
291291
if (!buffer)
292-
return -ENOMEM;
292+
return ERR_PTR(-ENOMEM);
293293

294294
INIT_LIST_HEAD(&buffer->attachments);
295295
mutex_init(&buffer->lock);
@@ -348,15 +348,7 @@ static int cma_heap_allocate(struct dma_heap *heap,
348348
ret = PTR_ERR(dmabuf);
349349
goto free_pages;
350350
}
351-
352-
ret = dma_buf_fd(dmabuf, fd_flags);
353-
if (ret < 0) {
354-
dma_buf_put(dmabuf);
355-
/* just return, as put will call release and that will free */
356-
return ret;
357-
}
358-
359-
return ret;
351+
return dmabuf;
360352

361353
free_pages:
362354
kfree(buffer->pages);
@@ -365,7 +357,7 @@ static int cma_heap_allocate(struct dma_heap *heap,
365357
free_buffer:
366358
kfree(buffer);
367359

368-
return ret;
360+
return ERR_PTR(ret);
369361
}
370362

371363
static const struct dma_heap_ops cma_heap_ops = {

‎drivers/dma-buf/heaps/system_heap.c‎

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -331,10 +331,10 @@ static struct page *alloc_largest_available(unsigned long size,
331331
return NULL;
332332
}
333333

334-
static int system_heap_allocate(struct dma_heap *heap,
335-
unsigned long len,
336-
unsigned long fd_flags,
337-
unsigned long heap_flags)
334+
static struct dma_buf *system_heap_allocate(struct dma_heap *heap,
335+
unsigned long len,
336+
unsigned long fd_flags,
337+
unsigned long heap_flags)
338338
{
339339
struct system_heap_buffer *buffer;
340340
DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
@@ -349,7 +349,7 @@ static int system_heap_allocate(struct dma_heap *heap,
349349

350350
buffer = kzalloc(sizeof(*buffer), GFP_KERNEL);
351351
if (!buffer)
352-
return -ENOMEM;
352+
return ERR_PTR(-ENOMEM);
353353

354354
INIT_LIST_HEAD(&buffer->attachments);
355355
mutex_init(&buffer->lock);
@@ -363,8 +363,10 @@ static int system_heap_allocate(struct dma_heap *heap,
363363
* Avoid trying to allocate memory if the process
364364
* has been killed by SIGKILL
365365
*/
366-
if (fatal_signal_pending(current))
366+
if (fatal_signal_pending(current)) {
367+
ret = -EINTR;
367368
goto free_buffer;
369+
}
368370

369371
page = alloc_largest_available(size_remaining, max_order);
370372
if (!page)
@@ -397,14 +399,7 @@ static int system_heap_allocate(struct dma_heap *heap,
397399
ret = PTR_ERR(dmabuf);
398400
goto free_pages;
399401
}
400-
401-
ret = dma_buf_fd(dmabuf, fd_flags);
402-
if (ret < 0) {
403-
dma_buf_put(dmabuf);
404-
/* just return, as put will call release and that will free */
405-
return ret;
406-
}
407-
return ret;
402+
return dmabuf;
408403

409404
free_pages:
410405
for_each_sgtable_sg(table, sg, i) {
@@ -418,7 +413,7 @@ static int system_heap_allocate(struct dma_heap *heap,
418413
__free_pages(page, compound_order(page));
419414
kfree(buffer);
420415

421-
return ret;
416+
return ERR_PTR(ret);
422417
}
423418

424419
static const struct dma_heap_ops system_heap_ops = {

‎drivers/gpu/drm/amd/amdgpu/amdgpu.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,6 +1008,12 @@ struct amdgpu_device {
10081008
bool in_suspend;
10091009
bool in_hibernate;
10101010

1011+
/*
1012+
* The combination flag in_poweroff_reboot_com used to identify the poweroff
1013+
* and reboot opt in the s0i3 system-wide suspend.
1014+
*/
1015+
bool in_poweroff_reboot_com;
1016+
10111017
atomic_t in_gpu_reset;
10121018
enum pp_mp1_state mp1_state;
10131019
struct rw_semaphore reset_sem;

‎drivers/gpu/drm/amd/amdgpu/amdgpu_device.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2678,7 +2678,8 @@ static int amdgpu_device_ip_suspend_phase1(struct amdgpu_device *adev)
26782678
{
26792679
int i, r;
26802680

2681-
if (!amdgpu_acpi_is_s0ix_supported(adev) || amdgpu_in_reset(adev)) {
2681+
if (adev->in_poweroff_reboot_com ||
2682+
!amdgpu_acpi_is_s0ix_supported(adev) || amdgpu_in_reset(adev)) {
26822683
amdgpu_device_set_pg_state(adev, AMD_PG_STATE_UNGATE);
26832684
amdgpu_device_set_cg_state(adev, AMD_CG_STATE_UNGATE);
26842685
}
@@ -3741,7 +3742,8 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)
37413742

37423743
amdgpu_fence_driver_suspend(adev);
37433744

3744-
if (!amdgpu_acpi_is_s0ix_supported(adev) || amdgpu_in_reset(adev))
3745+
if (adev->in_poweroff_reboot_com ||
3746+
!amdgpu_acpi_is_s0ix_supported(adev) || amdgpu_in_reset(adev))
37453747
r = amdgpu_device_ip_suspend_phase2(adev);
37463748
else
37473749
amdgpu_gfx_state_change_set(adev, sGpuChangeState_D3Entry);

‎drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1270,7 +1270,9 @@ amdgpu_pci_shutdown(struct pci_dev *pdev)
12701270
*/
12711271
if (!amdgpu_passthrough(adev))
12721272
adev->mp1_state = PP_MP1_STATE_UNLOAD;
1273+
adev->in_poweroff_reboot_com = true;
12731274
amdgpu_device_ip_suspend(adev);
1275+
adev->in_poweroff_reboot_com = false;
12741276
adev->mp1_state = PP_MP1_STATE_NONE;
12751277
}
12761278

@@ -1312,8 +1314,13 @@ static int amdgpu_pmops_thaw(struct device *dev)
13121314
static int amdgpu_pmops_poweroff(struct device *dev)
13131315
{
13141316
struct drm_device *drm_dev = dev_get_drvdata(dev);
1317+
struct amdgpu_device *adev = drm_to_adev(drm_dev);
1318+
int r;
13151319

1316-
return amdgpu_device_suspend(drm_dev, true);
1320+
adev->in_poweroff_reboot_com = true;
1321+
r = amdgpu_device_suspend(drm_dev, true);
1322+
adev->in_poweroff_reboot_com = false;
1323+
return r;
13171324
}
13181325

13191326
static int amdgpu_pmops_restore(struct device *dev)

0 commit comments

Comments
 (0)