Skip to content

Commit 900241a

Browse files
committed
Merge tag 'drm-fixes-2025-04-11-1' of https://gitlab.freedesktop.org/drm/kernel
Pull drm fixes from Dave Airlie: "Weekly fixes, as expected it has a bit more in it than probably usual for rc2. amdgpu/xe/i915 lead the way with fixes all over for a bunch of other drivers. Nothing major stands out from what I can see. tests: - Clean up struct drm_display_mode in various places i915: - Fix scanline offset for LNL+ and BMG+ - Fix GVT unterminated-string-initialization build warning - Fix DP rate limit when sink doesn't support TPS4 - Handle GDDR + ECC memory type detection - Fix VRR parameter change check - Fix fence not released on early probe errors - Disable render power gating during live selftests xe: - Add another BMG PCI ID - Fix UAFs on migration paths - Fix shift-out-of-bounds access on TLB invalidation - Ensure ccs_mode is correctly set on gt reset - Extend some HW workarounds to Xe3 - Fix PM runtime get/put on sysfs files - Fix u64 division on 32b - Fix flickering due to missing L3 invalidations - Fix missing error code return amdgpu: - MES FW version caching fixes - Only use GTT as a fallback if we already have a backing store - dma_buf fix - IP discovery fix - Replay and PSR with VRR fix - DC FP fixes - eDP fixes - KIQ TLB invalidate fix - Enable dmem groups support - Allow pinning VRAM dma bufs if imports can do P2P - Workload profile fixes - Prevent possible division by 0 in fan handling amdkfd: - Queue reset fixes imagination: - Fix overflow - Fix use-after-free ivpu: - Fix suspend/resume nouveau: - Do not deref dangling pointer rockchip: - Set DP/HDMI registers correctly udmabuf: - Fix overflow virtgpu: - Set reservation lock on dma-buf import - Fix error handling in prepare_fb" * tag 'drm-fixes-2025-04-11-1' of https://gitlab.freedesktop.org/drm/kernel: (58 commits) drm/rockchip: dw_hdmi_qp: Fix io init for dw_hdmi_qp_rockchip_resume drm/rockchip: vop2: Fix interface enable/mux setting of DP1 on rk3588 drm/amdgpu/mes12: optimize MES pipe FW version fetching drm/amd/pm/smu11: Prevent division by zero drm/amdgpu: cancel gfx idle work in device suspend for s0ix drm/amd/display: pause the workload setting in dm drm/amdgpu/pm/swsmu: implement pause workload profile drm/amdgpu/pm: add workload profile pause helper drm/i915/huc: Fix fence not released on early probe errors drm/i915/vrr: Add vrr.vsync_{start, end} in vrr_params_changed drm/tests: probe-helper: Fix drm_display_mode memory leak drm/tests: modes: Fix drm_display_mode memory leak drm/tests: modes: Fix drm_display_mode memory leak drm/tests: cmdline: Fix drm_display_mode memory leak drm/tests: modeset: Fix drm_display_mode memory leak drm/tests: modeset: Fix drm_display_mode memory leak drm/tests: helpers: Create kunit helper to destroy a drm_display_mode drm/xe: Restore EIO errno return when GuC PC start fails drm/xe: Invalidate L3 read-only cachelines for geometry streams too drm/xe: avoid plain 64-bit division ...
2 parents ef77858 + 485442c commit 900241a

Some content is hidden

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

64 files changed

+542
-196
lines changed

drivers/accel/ivpu/ivpu_debugfs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ ivpu_force_recovery_fn(struct file *file, const char __user *user_buf, size_t si
332332
return -EINVAL;
333333

334334
ret = ivpu_rpm_get(vdev);
335-
if (ret)
335+
if (ret < 0)
336336
return ret;
337337

338338
ivpu_pm_trigger_recovery(vdev, "debugfs");
@@ -383,7 +383,7 @@ static int dct_active_set(void *data, u64 active_percent)
383383
return -EINVAL;
384384

385385
ret = ivpu_rpm_get(vdev);
386-
if (ret)
386+
if (ret < 0)
387387
return ret;
388388

389389
if (active_percent)

drivers/accel/ivpu/ivpu_ipc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,8 @@ ivpu_ipc_send_receive_internal(struct ivpu_device *vdev, struct vpu_jsm_msg *req
302302
struct ivpu_ipc_consumer cons;
303303
int ret;
304304

305-
drm_WARN_ON(&vdev->drm, pm_runtime_status_suspended(vdev->drm.dev));
305+
drm_WARN_ON(&vdev->drm, pm_runtime_status_suspended(vdev->drm.dev) &&
306+
pm_runtime_enabled(vdev->drm.dev));
306307

307308
ivpu_ipc_consumer_add(vdev, &cons, channel, NULL);
308309

drivers/accel/ivpu/ivpu_ms.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
#include <drm/drm_file.h>
7+
#include <linux/pm_runtime.h>
78

89
#include "ivpu_drv.h"
910
#include "ivpu_gem.h"
@@ -44,6 +45,10 @@ int ivpu_ms_start_ioctl(struct drm_device *dev, void *data, struct drm_file *fil
4445
args->sampling_period_ns < MS_MIN_SAMPLE_PERIOD_NS)
4546
return -EINVAL;
4647

48+
ret = ivpu_rpm_get(vdev);
49+
if (ret < 0)
50+
return ret;
51+
4752
mutex_lock(&file_priv->ms_lock);
4853

4954
if (get_instance_by_mask(file_priv, args->metric_group_mask)) {
@@ -96,6 +101,8 @@ int ivpu_ms_start_ioctl(struct drm_device *dev, void *data, struct drm_file *fil
96101
kfree(ms);
97102
unlock:
98103
mutex_unlock(&file_priv->ms_lock);
104+
105+
ivpu_rpm_put(vdev);
99106
return ret;
100107
}
101108

@@ -160,6 +167,10 @@ int ivpu_ms_get_data_ioctl(struct drm_device *dev, void *data, struct drm_file *
160167
if (!args->metric_group_mask)
161168
return -EINVAL;
162169

170+
ret = ivpu_rpm_get(vdev);
171+
if (ret < 0)
172+
return ret;
173+
163174
mutex_lock(&file_priv->ms_lock);
164175

165176
ms = get_instance_by_mask(file_priv, args->metric_group_mask);
@@ -187,6 +198,7 @@ int ivpu_ms_get_data_ioctl(struct drm_device *dev, void *data, struct drm_file *
187198
unlock:
188199
mutex_unlock(&file_priv->ms_lock);
189200

201+
ivpu_rpm_put(vdev);
190202
return ret;
191203
}
192204

@@ -204,11 +216,17 @@ int ivpu_ms_stop_ioctl(struct drm_device *dev, void *data, struct drm_file *file
204216
{
205217
struct ivpu_file_priv *file_priv = file->driver_priv;
206218
struct drm_ivpu_metric_streamer_stop *args = data;
219+
struct ivpu_device *vdev = file_priv->vdev;
207220
struct ivpu_ms_instance *ms;
221+
int ret;
208222

209223
if (!args->metric_group_mask)
210224
return -EINVAL;
211225

226+
ret = ivpu_rpm_get(vdev);
227+
if (ret < 0)
228+
return ret;
229+
212230
mutex_lock(&file_priv->ms_lock);
213231

214232
ms = get_instance_by_mask(file_priv, args->metric_group_mask);
@@ -217,6 +235,7 @@ int ivpu_ms_stop_ioctl(struct drm_device *dev, void *data, struct drm_file *file
217235

218236
mutex_unlock(&file_priv->ms_lock);
219237

238+
ivpu_rpm_put(vdev);
220239
return ms ? 0 : -EINVAL;
221240
}
222241

@@ -281,6 +300,9 @@ int ivpu_ms_get_info_ioctl(struct drm_device *dev, void *data, struct drm_file *
281300
void ivpu_ms_cleanup(struct ivpu_file_priv *file_priv)
282301
{
283302
struct ivpu_ms_instance *ms, *tmp;
303+
struct ivpu_device *vdev = file_priv->vdev;
304+
305+
pm_runtime_get_sync(vdev->drm.dev);
284306

285307
mutex_lock(&file_priv->ms_lock);
286308

@@ -293,6 +315,8 @@ void ivpu_ms_cleanup(struct ivpu_file_priv *file_priv)
293315
free_instance(file_priv, ms);
294316

295317
mutex_unlock(&file_priv->ms_lock);
318+
319+
pm_runtime_put_autosuspend(vdev->drm.dev);
296320
}
297321

298322
void ivpu_ms_cleanup_all(struct ivpu_device *vdev)

drivers/dma-buf/udmabuf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ static long udmabuf_create(struct miscdevice *device,
393393
if (!ubuf)
394394
return -ENOMEM;
395395

396-
pglimit = (size_limit_mb * 1024 * 1024) >> PAGE_SHIFT;
396+
pglimit = ((u64)size_limit_mb * 1024 * 1024) >> PAGE_SHIFT;
397397
for (i = 0; i < head->count; i++) {
398398
pgoff_t subpgcnt;
399399

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,6 @@ enum amdgpu_kiq_irq {
353353
AMDGPU_CP_KIQ_IRQ_DRIVER0 = 0,
354354
AMDGPU_CP_KIQ_IRQ_LAST
355355
};
356-
#define SRIOV_USEC_TIMEOUT 1200000 /* wait 12 * 100ms for SRIOV */
357356
#define MAX_KIQ_REG_WAIT 5000 /* in usecs, 5ms */
358357
#define MAX_KIQ_REG_BAILOUT_INTERVAL 5 /* in msecs, 5ms */
359358
#define MAX_KIQ_REG_TRY 1000

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3643,6 +3643,13 @@ static int amdgpu_device_ip_suspend_phase2(struct amdgpu_device *adev)
36433643
adev, adev->ip_blocks[i].version->type))
36443644
continue;
36453645

3646+
/* Since we skip suspend for S0i3, we need to cancel the delayed
3647+
* idle work here as the suspend callback never gets called.
3648+
*/
3649+
if (adev->in_s0ix &&
3650+
adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GFX &&
3651+
amdgpu_ip_version(adev, GC_HWIP, 0) >= IP_VERSION(10, 0, 0))
3652+
cancel_delayed_work_sync(&adev->gfx.idle_work);
36463653
/* skip suspend of gfx/mes and psp for S0ix
36473654
* gfx is in gfxoff state, so on resume it will exit gfxoff just
36483655
* like at runtime. PSP is also part of the always on hardware

drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ MODULE_FIRMWARE("amdgpu/vega20_ip_discovery.bin");
120120
MODULE_FIRMWARE("amdgpu/raven_ip_discovery.bin");
121121
MODULE_FIRMWARE("amdgpu/raven2_ip_discovery.bin");
122122
MODULE_FIRMWARE("amdgpu/picasso_ip_discovery.bin");
123+
MODULE_FIRMWARE("amdgpu/arcturus_ip_discovery.bin");
124+
MODULE_FIRMWARE("amdgpu/aldebaran_ip_discovery.bin");
123125

124126
#define mmIP_DISCOVERY_VERSION 0x16A00
125127
#define mmRCC_CONFIG_MEMSIZE 0xde3

drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,25 @@ static int amdgpu_dma_buf_attach(struct dma_buf *dmabuf,
7575
*/
7676
static int amdgpu_dma_buf_pin(struct dma_buf_attachment *attach)
7777
{
78-
struct drm_gem_object *obj = attach->dmabuf->priv;
79-
struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);
78+
struct dma_buf *dmabuf = attach->dmabuf;
79+
struct amdgpu_bo *bo = gem_to_amdgpu_bo(dmabuf->priv);
80+
u32 domains = bo->preferred_domains;
8081

81-
/* pin buffer into GTT */
82-
return amdgpu_bo_pin(bo, AMDGPU_GEM_DOMAIN_GTT);
82+
dma_resv_assert_held(dmabuf->resv);
83+
84+
/*
85+
* Try pinning into VRAM to allow P2P with RDMA NICs without ODP
86+
* support if all attachments can do P2P. If any attachment can't do
87+
* P2P just pin into GTT instead.
88+
*/
89+
list_for_each_entry(attach, &dmabuf->attachments, node)
90+
if (!attach->peer2peer)
91+
domains &= ~AMDGPU_GEM_DOMAIN_VRAM;
92+
93+
if (domains & AMDGPU_GEM_DOMAIN_VRAM)
94+
bo->flags |= AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
95+
96+
return amdgpu_bo_pin(bo, domains);
8397
}
8498

8599
/**
@@ -134,9 +148,6 @@ static struct sg_table *amdgpu_dma_buf_map(struct dma_buf_attachment *attach,
134148
r = ttm_bo_validate(&bo->tbo, &bo->placement, &ctx);
135149
if (r)
136150
return ERR_PTR(r);
137-
138-
} else if (bo->tbo.resource->mem_type != TTM_PL_TT) {
139-
return ERR_PTR(-EBUSY);
140151
}
141152

142153
switch (bo->tbo.resource->mem_type) {
@@ -184,7 +195,7 @@ static void amdgpu_dma_buf_unmap(struct dma_buf_attachment *attach,
184195
struct sg_table *sgt,
185196
enum dma_data_direction dir)
186197
{
187-
if (sgt->sgl->page_link) {
198+
if (sg_page(sgt->sgl)) {
188199
dma_unmap_sgtable(attach->dev, sgt, dir, 0);
189200
sg_free_table(sgt);
190201
kfree(sgt);

drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -699,12 +699,10 @@ int amdgpu_gmc_flush_gpu_tlb_pasid(struct amdgpu_device *adev, uint16_t pasid,
699699
uint32_t flush_type, bool all_hub,
700700
uint32_t inst)
701701
{
702-
u32 usec_timeout = amdgpu_sriov_vf(adev) ? SRIOV_USEC_TIMEOUT :
703-
adev->usec_timeout;
704702
struct amdgpu_ring *ring = &adev->gfx.kiq[inst].ring;
705703
struct amdgpu_kiq *kiq = &adev->gfx.kiq[inst];
706704
unsigned int ndw;
707-
int r;
705+
int r, cnt = 0;
708706
uint32_t seq;
709707

710708
/*
@@ -761,10 +759,21 @@ int amdgpu_gmc_flush_gpu_tlb_pasid(struct amdgpu_device *adev, uint16_t pasid,
761759

762760
amdgpu_ring_commit(ring);
763761
spin_unlock(&adev->gfx.kiq[inst].ring_lock);
764-
if (amdgpu_fence_wait_polling(ring, seq, usec_timeout) < 1) {
762+
763+
r = amdgpu_fence_wait_polling(ring, seq, MAX_KIQ_REG_WAIT);
764+
765+
might_sleep();
766+
while (r < 1 && cnt++ < MAX_KIQ_REG_TRY &&
767+
!amdgpu_reset_pending(adev->reset_domain)) {
768+
msleep(MAX_KIQ_REG_BAILOUT_INTERVAL);
769+
r = amdgpu_fence_wait_polling(ring, seq, MAX_KIQ_REG_WAIT);
770+
}
771+
772+
if (cnt > MAX_KIQ_REG_TRY) {
765773
dev_err(adev->dev, "timeout waiting for kiq fence\n");
766774
r = -ETIME;
767-
}
775+
} else
776+
r = 0;
768777
}
769778

770779
error_unlock_reset:

drivers/gpu/drm/amd/amdgpu/amdgpu_object.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain)
163163
* When GTT is just an alternative to VRAM make sure that we
164164
* only use it as fallback and still try to fill up VRAM first.
165165
*/
166-
if (domain & abo->preferred_domains & AMDGPU_GEM_DOMAIN_VRAM &&
167-
!(adev->flags & AMD_IS_APU))
166+
if (abo->tbo.resource && !(adev->flags & AMD_IS_APU) &&
167+
domain & abo->preferred_domains & AMDGPU_GEM_DOMAIN_VRAM)
168168
places[c].flags |= TTM_PL_FLAG_FALLBACK;
169169
c++;
170170
}

0 commit comments

Comments
 (0)