Compare
7669e0b1b92a8296a3dace4f2cc49fec0dd83fd3..55a67aa89342545b89f469dea6f29bfb6fac6f3d
drm/amd/display: Fix NULL sink dereference in USB4 bandwidth functions
allocate_usb4_bandwidth_for_stream() and allocate_usb4_bandwidth() both
use ASSERT(stream->sink) before dereferencing stream->sink->link. ASSERT
is compiled out in production builds, so a NULL stream->sink causes a
NULL pointer dereference.
link_set_dpms_off() already guards two earlier accesses to stream->sink
with explicit NULL checks, confirming that stream->sink can legitimately
be NULL. The subsequent call to deallocate_usb4_bandwidth() had no
equivalent guard.
Replace the ASSERT() calls with proper NULL checks that return false
early, and add a matching stream->sink guard at the call site in
link_set_dpms_off() consistent with the surrounding pattern.
v2: Keep the existing ASSERT() calls for diagnostics (to report
unexpected NULL sink), and add explicit NULL checks that return false
before dereferencing stream->sink. Also add a matching stream->sink
guard at the deallocation call site in link_set_dpms_off(). (Alex)
Fixes: 8fa813b7fd1e ("drm/amd/display: Remove sink usage from DPMS")
Reported-by: Dan Carpenter <error27@gmail.com>
Cc: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Cc: Dominik Kaszewski <dominik.kaszewski@amd.com>
Cc: George Zhang <george.zhang@amd.com>
Cc: Aurabindo Pillai <aurabindo.pillai@amd.com>
Cc: Roman Li <Roman.Li@amd.com>
Cc: Ivan Lipski <ivan.lipski@amd.com>
Cc: Dan Wheeler <daniel.wheeler@amd.com>
Cc: Alex Hung <alex.hung@amd.com>
Cc: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Reviewed-by: Roman Li <roman.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 98029a0ce61feb52c563f65349dd9b25f672e355)
Cc: stable@vger.kernel.org
Srinivasan Shanmugam <srinivasan.shanmugam@amd.com> · 2026-09-17 06:14 UTC · committed by Alex Deucher
29 files changed,
+184
−256
- MAINTAINERS
- drivers/accel/amdxdna/Kconfig
- drivers/accel/rocket/rocket_device.c
- drivers/accel/rocket/rocket_device.h
- drivers/accel/rocket/rocket_drv.c
- drivers/accel/rocket/rocket_job.c
- drivers/dma-buf/Kconfig
- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
- drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c
- drivers/gpu/drm/amd/display/dc/link/link_dpms.c
- drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
- drivers/gpu/drm/drm_exec.c
- drivers/gpu/drm/i915/display/intel_cx0_phy.c
- drivers/gpu/drm/i915/display/intel_dmc.c
- drivers/gpu/drm/i915/display/intel_dmc_regs.h
- drivers/gpu/drm/panthor/panthor_hw.c
- drivers/gpu/drm/vc4/vc4_hdmi.c
- drivers/gpu/drm/virtio/virtgpu_drv.c
- drivers/gpu/drm/virtio/virtgpu_plane.c
- drivers/gpu/drm/xe/xe_bo.c
- drivers/gpu/drm/xe/xe_exec.c
- drivers/gpu/drm/xe/xe_oa.c
- drivers/gpu/drm/xe/xe_vm.c
- drivers/gpu/drm/xe/xe_vm.h
- include/drm/drm_exec.h
modified MAINTAINERS
| @@ -8013,7 +8013,6 @@ F: include/uapi/drm/ivpu_accel.h | |||
| 8013 | 8013 | ||
| 8014 | 8014 | DRM ACCEL DRIVER FOR ROCKCHIP NPU | |
| 8015 | 8015 | M: Tomeu Vizoso <tomeu@tomeuvizoso.net> | |
| 8016 | - | R: Heiko Stuebner <heiko@sntech.de> | |
| 8017 | 8016 | L: dri-devel@lists.freedesktop.org | |
| 8018 | 8017 | S: Supported | |
| 8019 | 8018 | T: git https://gitlab.freedesktop.org/drm/misc/kernel.git | |
| @@ -8576,7 +8575,7 @@ F: Documentation/devicetree/bindings/display/panel/synaptics,r63353.yaml | |||
| 8576 | 8575 | F: drivers/gpu/drm/panel/panel-synaptics-r63353.c | |
| 8577 | 8576 | ||
| 8578 | 8577 | DRM DRIVER FOR SYNOPSYS DESIGNWARE DISPLAYPORT BRIDGE | |
| 8579 | - | M: Andy Yan <andyshrk@163.com> | |
| 8578 | + | M: Andy Yan <andy.yan@rock-chips.com> | |
| 8580 | 8579 | S: Maintained | |
| 8581 | 8580 | T: git https://gitlab.freedesktop.org/drm/misc/kernel.git | |
| 8582 | 8581 | F: Documentation/devicetree/bindings/display/rockchip/rockchip,dw-dp.yaml | |
| @@ -8929,7 +8928,7 @@ F: include/linux/platform_data/shmob_drm.h | |||
| 8929 | 8928 | DRM DRIVERS FOR ROCKCHIP | |
| 8930 | 8929 | M: Sandy Huang <hjc@rock-chips.com> | |
| 8931 | 8930 | M: Heiko Stübner <heiko@sntech.de> | |
| 8932 | - | M: Andy Yan <andyshrk@163.com> | |
| 8931 | + | M: Andy Yan <andy.yan@rock-chips.com> | |
| 8933 | 8932 | L: dri-devel@lists.freedesktop.org | |
| 8934 | 8933 | L: linux-rockchip@lists.infradead.org | |
| 8935 | 8934 | S: Maintained | |
| @@ -12884,7 +12883,7 @@ S: Maintained | |||
| 12884 | 12883 | F: drivers/power/supply/ip5xxx_power.c | |
| 12885 | 12884 | ||
| 12886 | 12885 | INNOSILICON HDMI BRIDGE DRIVER | |
| 12887 | - | M: Andy Yan <andyshrk@163.com> | |
| 12886 | + | M: Andy Yan <andy.yan@rock-chips.com> | |
| 12888 | 12887 | L: dri-devel@lists.freedesktop.org | |
| 12889 | 12888 | S: Maintained | |
| 12890 | 12889 | T: git https://gitlab.freedesktop.org/drm/misc/kernel.git | |
modified drivers/accel/amdxdna/Kconfig
| @@ -6,7 +6,6 @@ config DRM_ACCEL_AMDXDNA | |||
| 6 | 6 | depends on DRM_ACCEL | |
| 7 | 7 | depends on PCI && HAS_IOMEM | |
| 8 | 8 | depends on X86_64 | |
| 9 | - | depends on AMD_PMF || !AMD_PMF | |
| 10 | 9 | select DRM_SCHED | |
| 11 | 10 | select DRM_GEM_SHMEM_HELPER | |
| 12 | 11 | select FW_LOADER | |
modified drivers/accel/rocket/rocket_device.c
| @@ -31,8 +31,6 @@ struct rocket_device *rocket_device_init(struct platform_device *pdev, | |||
| 31 | 31 | if (of_device_is_available(core_node)) | |
| 32 | 32 | num_cores++; | |
| 33 | 33 | ||
| 34 | - | rdev->max_cores = num_cores; | |
| 35 | - | ||
| 36 | 34 | rdev->cores = devm_kcalloc(dev, num_cores, sizeof(*rdev->cores), GFP_KERNEL); | |
| 37 | 35 | if (!rdev->cores) | |
| 38 | 36 | return ERR_PTR(-ENOMEM); | |
modified drivers/accel/rocket/rocket_device.h
| @@ -19,7 +19,6 @@ struct rocket_device { | |||
| 19 | 19 | ||
| 20 | 20 | struct rocket_core *cores; | |
| 21 | 21 | unsigned int num_cores; | |
| 22 | - | unsigned int max_cores; | |
| 23 | 22 | }; | |
| 24 | 23 | ||
| 25 | 24 | struct rocket_device *rocket_device_init(struct platform_device *pdev, | |
modified drivers/accel/rocket/rocket_drv.c
| @@ -165,11 +165,8 @@ static int rocket_probe(struct platform_device *pdev) | |||
| 165 | 165 | /* First core probing, initialize DRM device. */ | |
| 166 | 166 | rdev = rocket_device_init(drm_dev, &rocket_drm_driver); | |
| 167 | 167 | if (IS_ERR(rdev)) { | |
| 168 | - | int err = PTR_ERR(rdev); | |
| 169 | - | ||
| 170 | 168 | dev_err(&pdev->dev, "failed to initialize rocket device\n"); | |
| 171 | - | rdev = NULL; | |
| 172 | - | return err; | |
| 169 | + | return PTR_ERR(rdev); | |
| 173 | 170 | } | |
| 174 | 171 | } | |
| 175 | 172 | ||
| @@ -226,7 +223,7 @@ static int find_core_for_dev(struct device *dev) | |||
| 226 | 223 | { | |
| 227 | 224 | struct rocket_device *rdev = dev_get_drvdata(dev); | |
| 228 | 225 | ||
| 229 | - | for (unsigned int core = 0; core < rdev->max_cores; core++) { | |
| 226 | + | for (unsigned int core = 0; core < rdev->num_cores; core++) { | |
| 230 | 227 | if (dev == rdev->cores[core].dev) | |
| 231 | 228 | return core; | |
| 232 | 229 | } | |
modified drivers/accel/rocket/rocket_job.c
| @@ -283,7 +283,7 @@ static struct rocket_core *sched_to_core(struct rocket_device *rdev, | |||
| 283 | 283 | { | |
| 284 | 284 | unsigned int core; | |
| 285 | 285 | ||
| 286 | - | for (core = 0; core < rdev->max_cores; core++) { | |
| 286 | + | for (core = 0; core < rdev->num_cores; core++) { | |
| 287 | 287 | if (&rdev->cores[core].sched == sched) | |
| 288 | 288 | return &rdev->cores[core]; | |
| 289 | 289 | } | |
modified drivers/dma-buf/Kconfig
| @@ -43,7 +43,7 @@ config UDMABUF | |||
| 43 | 43 | config DMABUF_DEBUG | |
| 44 | 44 | bool "DMA-BUF debug checks" | |
| 45 | 45 | depends on DMA_SHARED_BUFFER | |
| 46 | - | default y if DEBUG | |
| 46 | + | default y if DEBUG_KERNEL | |
| 47 | 47 | help | |
| 48 | 48 | This option enables additional checks for DMA-BUF importers and | |
| 49 | 49 | exporters. Specifically it validates that importers do not peek at the | |
modified drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
| @@ -1431,6 +1431,7 @@ static void amdgpu_cs_parser_fini(struct amdgpu_cs_parser *parser) | |||
| 1431 | 1431 | int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) | |
| 1432 | 1432 | { | |
| 1433 | 1433 | struct amdgpu_device *adev = drm_to_adev(dev); | |
| 1434 | + | struct amdgpu_bo_list_entry *e; | |
| 1434 | 1435 | struct amdgpu_cs_parser parser; | |
| 1435 | 1436 | int r; | |
| 1436 | 1437 | ||
| @@ -1465,25 +1466,31 @@ int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) | |||
| 1465 | 1466 | ||
| 1466 | 1467 | r = amdgpu_cs_patch_jobs(&parser); | |
| 1467 | 1468 | if (r) | |
| 1468 | - | goto error_fini; | |
| 1469 | + | goto error_free_user_pages; | |
| 1469 | 1470 | ||
| 1470 | 1471 | r = amdgpu_cs_vm_handling(&parser); | |
| 1471 | 1472 | if (r) | |
| 1472 | - | goto error_fini; | |
| 1473 | + | goto error_free_user_pages; | |
| 1473 | 1474 | ||
| 1474 | 1475 | r = amdgpu_cs_sync_rings(&parser); | |
| 1475 | 1476 | if (r) | |
| 1476 | - | goto error_fini; | |
| 1477 | + | goto error_free_user_pages; | |
| 1477 | 1478 | ||
| 1478 | 1479 | trace_amdgpu_cs_ibs(&parser); | |
| 1479 | 1480 | ||
| 1480 | 1481 | r = amdgpu_cs_submit(&parser, data); | |
| 1481 | 1482 | if (r) | |
| 1482 | - | goto error_fini; | |
| 1483 | + | goto error_free_user_pages; | |
| 1483 | 1484 | ||
| 1484 | 1485 | amdgpu_cs_parser_fini(&parser); | |
| 1485 | 1486 | return 0; | |
| 1486 | 1487 | ||
| 1488 | + | error_free_user_pages: | |
| 1489 | + | /* amdgpu_cs_submit() only drops the ranges once it got that far. */ | |
| 1490 | + | amdgpu_bo_list_for_each_userptr_entry(e, parser.bo_list) { | |
| 1491 | + | amdgpu_hmm_range_free(e->range); | |
| 1492 | + | e->range = NULL; | |
| 1493 | + | } | |
| 1487 | 1494 | error_fini: | |
| 1488 | 1495 | amdgpu_cs_parser_fini(&parser); | |
| 1489 | 1496 | return r; | |
modified drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
| @@ -1266,7 +1266,6 @@ static ssize_t amdgpu_debugfs_gpr_read(struct file *f, char __user *buf, | |||
| 1266 | 1266 | { | |
| 1267 | 1267 | struct amdgpu_device *adev = f->f_inode->i_private; | |
| 1268 | 1268 | int r; | |
| 1269 | - | ssize_t result = 0; | |
| 1270 | 1269 | uint32_t offset, se, sh, cu, wave, simd, thread, bank, *data; | |
| 1271 | 1270 | ||
| 1272 | 1271 | if (size > 4096 || size & 3 || *pos & 3) | |
| @@ -1310,25 +1309,11 @@ static ssize_t amdgpu_debugfs_gpr_read(struct file *f, char __user *buf, | |||
| 1310 | 1309 | mutex_unlock(&adev->grbm_idx_mutex); | |
| 1311 | 1310 | ||
| 1312 | 1311 | pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); | |
| 1312 | + | amdgpu_virt_disable_access_debugfs(adev); | |
| 1313 | 1313 | ||
| 1314 | - | while (size) { | |
| 1315 | - | uint32_t value; | |
| 1316 | - | ||
| 1317 | - | value = data[result >> 2]; | |
| 1318 | - | r = put_user(value, (uint32_t *)buf); | |
| 1319 | - | if (r) { | |
| 1320 | - | amdgpu_virt_disable_access_debugfs(adev); | |
| 1321 | - | goto err; | |
| 1322 | - | } | |
| 1323 | - | ||
| 1324 | - | result += 4; | |
| 1325 | - | buf += 4; | |
| 1326 | - | size -= 4; | |
| 1327 | - | } | |
| 1328 | - | ||
| 1314 | + | r = copy_to_user(buf, data, size) ? -EFAULT : size; | |
| 1329 | 1315 | kfree(data); | |
| 1330 | - | amdgpu_virt_disable_access_debugfs(adev); | |
| 1331 | - | return result; | |
| 1316 | + | return r; | |
| 1332 | 1317 | ||
| 1333 | 1318 | err: | |
| 1334 | 1319 | pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); | |
modified drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
| @@ -567,8 +567,10 @@ int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void *data, | |||
| 567 | 567 | ||
| 568 | 568 | if (args->flags & AMDGPU_GEM_USERPTR_VALIDATE) { | |
| 569 | 569 | range = amdgpu_hmm_range_alloc(NULL); | |
| 570 | - | if (unlikely(!range)) | |
| 571 | - | return -ENOMEM; | |
| 570 | + | if (unlikely(!range)) { | |
| 571 | + | r = -ENOMEM; | |
| 572 | + | goto release_object; | |
| 573 | + | } | |
| 572 | 574 | r = amdgpu_ttm_tt_get_user_pages(bo, range); | |
| 573 | 575 | if (r) { | |
| 574 | 576 | amdgpu_hmm_range_free(range); | |
| @@ -1236,7 +1238,7 @@ int amdgpu_gem_list_handles_ioctl(struct drm_device *dev, void *data, | |||
| 1236 | 1238 | bo_entry->alloc_flags = bo->flags & AMDGPU_GEM_CREATE_SETTABLE_MASK; | |
| 1237 | 1239 | bo_entry->preferred_domains = bo->preferred_domains; | |
| 1238 | 1240 | bo_entry->gem_handle = id; | |
| 1239 | - | bo_entry->alignment = bo->tbo.page_alignment; | |
| 1241 | + | bo_entry->alignment = (u64)bo->tbo.page_alignment << PAGE_SHIFT; | |
| 1240 | 1242 | ||
| 1241 | 1243 | if (bo->tbo.base.import_attach) | |
| 1242 | 1244 | bo_entry->flags |= AMDGPU_GEM_LIST_HANDLES_FLAG_IS_IMPORT; | |
modified drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
| @@ -2065,14 +2065,15 @@ static int amdgpu_ttm_buffer_entity_init(struct amdgpu_gtt_mgr *mgr, | |||
| 2065 | 2065 | int i, r, num_pages; | |
| 2066 | 2066 | const u64 GTT_MAX_PAGES = (AMDGPU_GTT_MAX_TRANSFER_SIZE >> PAGE_SHIFT); | |
| 2067 | 2067 | ||
| 2068 | + | if (ARRAY_SIZE(entity->gart_window_offs) < num_gart_windows) | |
| 2069 | + | return -EINVAL; | |
| 2070 | + | ||
| 2068 | 2071 | r = drm_sched_entity_init(&entity->base, prio, scheds, num_schedulers, NULL); | |
| 2069 | 2072 | if (r) | |
| 2070 | 2073 | return r; | |
| 2071 | 2074 | ||
| 2072 | 2075 | mutex_init(&entity->lock); | |
| 2073 | 2076 | ||
| 2074 | - | if (ARRAY_SIZE(entity->gart_window_offs) < num_gart_windows) | |
| 2075 | - | return -EINVAL; | |
| 2076 | 2077 | if (num_gart_windows == 0) | |
| 2077 | 2078 | return 0; | |
| 2078 | 2079 | ||
| @@ -2080,6 +2081,7 @@ static int amdgpu_ttm_buffer_entity_init(struct amdgpu_gtt_mgr *mgr, | |||
| 2080 | 2081 | r = amdgpu_gtt_mgr_alloc_entries(mgr, &entity->gart_node, num_pages, | |
| 2081 | 2082 | DRM_MM_INSERT_BEST); | |
| 2082 | 2083 | if (r) { | |
| 2084 | + | mutex_destroy(&entity->lock); | |
| 2083 | 2085 | drm_sched_entity_destroy(&entity->base); | |
| 2084 | 2086 | return r; | |
| 2085 | 2087 | } | |
| @@ -2097,6 +2099,7 @@ static void amdgpu_ttm_buffer_entity_fini(struct amdgpu_gtt_mgr *mgr, | |||
| 2097 | 2099 | struct amdgpu_ttm_buffer_entity *entity) | |
| 2098 | 2100 | { | |
| 2099 | 2101 | amdgpu_gtt_mgr_free_entries(mgr, &entity->gart_node); | |
| 2102 | + | mutex_destroy(&entity->lock); | |
| 2100 | 2103 | drm_sched_entity_destroy(&entity->base); | |
| 2101 | 2104 | } | |
| 2102 | 2105 | ||
modified drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
| @@ -980,19 +980,21 @@ amdgpu_userq_bo_validate(struct amdgpu_device *adev, struct drm_exec *exec, | |||
| 980 | 980 | { | |
| 981 | 981 | struct ttm_operation_ctx ctx = { false, false }; | |
| 982 | 982 | struct amdgpu_bo_va *bo_va; | |
| 983 | - | struct amdgpu_bo *bo; | |
| 983 | + | struct amdgpu_bo *bo, *tmp; | |
| 984 | 984 | int ret; | |
| 985 | 985 | ||
| 986 | 986 | spin_lock(&vm->individual_lock); | |
| 987 | - | while (!list_empty(&vm->always_valid.evicted)) { | |
| 988 | - | bo_va = list_first_entry(&vm->always_valid.evicted, | |
| 987 | + | while (!list_empty(&vm->individual.evicted)) { | |
| 988 | + | bo_va = list_first_entry(&vm->individual.evicted, | |
| 989 | 989 | struct amdgpu_bo_va, | |
| 990 | 990 | base.vm_status); | |
| 991 | + | bo = bo_va->base.bo; | |
| 992 | + | tmp = amdgpu_bo_ref(bo); | |
| 991 | 993 | spin_unlock(&vm->individual_lock); | |
| 992 | 994 | ||
| 993 | - | bo = bo_va->base.bo; | |
| 994 | 995 | ret = drm_exec_prepare_obj(exec, &bo->tbo.base, | |
| 995 | 996 | TTM_NUM_MOVE_FENCES + 1); | |
| 997 | + | amdgpu_bo_unref(&tmp); | |
| 996 | 998 | if (unlikely(ret)) | |
| 997 | 999 | return ret; | |
| 998 | 1000 | ||
modified drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c
| @@ -288,7 +288,7 @@ static int uvd_v3_1_fw_validate(struct amdgpu_device *adev) | |||
| 288 | 288 | int i; | |
| 289 | 289 | uint32_t keysel = adev->uvd.keyselect; | |
| 290 | 290 | ||
| 291 | - | if (RREG32(mmUVD_FW_START) & UVD_FW_STATUS__PASS_MASK) { | |
| 291 | + | if (RREG32(mmUVD_FW_START)) { | |
| 292 | 292 | dev_dbg(adev->dev, "UVD keyselect already set: 0x%x (on CPU: 0x%x)\n", | |
| 293 | 293 | RREG32(mmUVD_FW_START), adev->uvd.keyselect); | |
| 294 | 294 | return 0; | |
modified drivers/gpu/drm/amd/display/dc/link/link_dpms.c
| @@ -2306,9 +2306,14 @@ static bool allocate_usb4_bandwidth_for_stream(struct dc_stream_state *stream, i | |||
| 2306 | 2306 | { | |
| 2307 | 2307 | ASSERT(stream->sink); | |
| 2308 | 2308 | ||
| 2309 | - | struct dc_link *link = stream->sink->link; | |
| 2309 | + | struct dc_link *link; | |
| 2310 | 2310 | int req_bw = stream_bw; | |
| 2311 | 2311 | ||
| 2312 | + | if (!stream->sink) | |
| 2313 | + | return false; | |
| 2314 | + | ||
| 2315 | + | link = stream->sink->link; | |
| 2316 | + | ||
| 2312 | 2317 | DC_LOGGER_INIT(link->ctx->logger); | |
| 2313 | 2318 | ||
| 2314 | 2319 | if (!link->dpia_bw_alloc_config.bw_alloc_enabled) | |
| @@ -2355,9 +2360,13 @@ static bool allocate_usb4_bandwidth(struct dc_stream_state *stream) | |||
| 2355 | 2360 | ASSERT(stream->sink); | |
| 2356 | 2361 | ||
| 2357 | 2362 | bool ret; | |
| 2363 | + | int bw; | |
| 2358 | 2364 | ||
| 2359 | - | int bw = dc_bandwidth_in_kbps_from_timing(&stream->timing, | |
| 2360 | - | dc_link_get_highest_encoding_format(stream->sink->link)); | |
| 2365 | + | if (!stream->sink) | |
| 2366 | + | return false; | |
| 2367 | + | ||
| 2368 | + | bw = dc_bandwidth_in_kbps_from_timing(&stream->timing, | |
| 2369 | + | dc_link_get_highest_encoding_format(stream->sink->link)); | |
| 2361 | 2370 | ||
| 2362 | 2371 | ret = allocate_usb4_bandwidth_for_stream(stream, bw); | |
| 2363 | 2372 | ||
| @@ -2419,7 +2428,8 @@ enum dc_status link_set_dpms_off(struct pipe_ctx *pipe_ctx) | |||
| 2419 | 2428 | update_psp_stream_config(pipe_ctx, true); | |
| 2420 | 2429 | dc->hwss.blank_stream(pipe_ctx); | |
| 2421 | 2430 | ||
| 2422 | - | if (pipe_ctx->link_config.dp_tunnel_settings.should_use_dp_bw_allocation) | |
| 2431 | + | if (pipe_ctx->link_config.dp_tunnel_settings.should_use_dp_bw_allocation && | |
| 2432 | + | stream->sink) | |
| 2423 | 2433 | deallocate_usb4_bandwidth(stream); | |
| 2424 | 2434 | ||
| 2425 | 2435 | if (stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST) | |
modified drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
| @@ -89,6 +89,7 @@ static const struct smu_feature_bits smu_v14_0_2_dpm_features = { | |||
| 89 | 89 | #define PP_OD_FEATURE_FAN_TARGET_TEMPERATURE 9 | |
| 90 | 90 | #define PP_OD_FEATURE_FAN_MINIMUM_PWM 10 | |
| 91 | 91 | #define PP_OD_FEATURE_FAN_ZERO_RPM_ENABLE 11 | |
| 92 | + | #define PP_OD_FEATURE_FAN_ZERO_RPM_STOP_TEMP 12 | |
| 92 | 93 | ||
| 93 | 94 | static struct cmn2asic_msg_mapping smu_v14_0_2_message_map[SMU_MSG_MAX_COUNT] = { | |
| 94 | 95 | MSG_MAP(TestMessage, PPSMC_MSG_TestMessage, 1), | |
| @@ -1020,6 +1021,10 @@ static void smu_v14_0_2_get_od_setting_limits(struct smu_context *smu, | |||
| 1020 | 1021 | od_min_setting = overdrive_lowerlimits->FanZeroRpmEnable; | |
| 1021 | 1022 | od_max_setting = overdrive_upperlimits->FanZeroRpmEnable; | |
| 1022 | 1023 | break; | |
| 1024 | + | case PP_OD_FEATURE_FAN_ZERO_RPM_STOP_TEMP: | |
| 1025 | + | od_min_setting = pptable->SkuTable.MsgLimits.FanStopTempMin; | |
| 1026 | + | od_max_setting = pptable->SkuTable.MsgLimits.FanStopTempMax; | |
| 1027 | + | break; | |
| 1023 | 1028 | default: | |
| 1024 | 1029 | od_min_setting = od_max_setting = INT_MAX; | |
| 1025 | 1030 | break; | |
| @@ -1244,6 +1249,24 @@ static int smu_v14_0_2_emit_clk_levels(struct smu_context *smu, | |||
| 1244 | 1249 | min_value, max_value); | |
| 1245 | 1250 | break; | |
| 1246 | 1251 | ||
| 1252 | + | case SMU_OD_FAN_ZERO_RPM_STOP_TEMP: | |
| 1253 | + | if (!smu_v14_0_2_is_od_feature_supported(smu, | |
| 1254 | + | PP_OD_FEATURE_ZERO_FAN_BIT)) | |
| 1255 | + | break; | |
| 1256 | + | ||
| 1257 | + | size += sysfs_emit_at(buf, size, "FAN_ZERO_RPM_STOP_TEMPERATURE:\n"); | |
| 1258 | + | size += sysfs_emit_at(buf, size, "%d\n", | |
| 1259 | + | (int)od_table->OverDriveTable.FanZeroRpmStopTemp); | |
| 1260 | + | ||
| 1261 | + | size += sysfs_emit_at(buf, size, "%s:\n", "OD_RANGE"); | |
| 1262 | + | smu_v14_0_2_get_od_setting_limits(smu, | |
| 1263 | + | PP_OD_FEATURE_FAN_ZERO_RPM_STOP_TEMP, | |
| 1264 | + | &min_value, | |
| 1265 | + | &max_value); | |
| 1266 | + | size += sysfs_emit_at(buf, size, "ZERO_RPM_STOP_TEMPERATURE: %u %u\n", | |
| 1267 | + | min_value, max_value); | |
| 1268 | + | break; | |
| 1269 | + | ||
| 1247 | 1270 | case SMU_OD_RANGE: | |
| 1248 | 1271 | if (!smu_v14_0_2_is_od_feature_supported(smu, PP_OD_FEATURE_GFXCLK_BIT) && | |
| 1249 | 1272 | !smu_v14_0_2_is_od_feature_supported(smu, PP_OD_FEATURE_UCLK_BIT) && | |
| @@ -2311,7 +2334,9 @@ static void smu_v14_0_2_set_supported_od_feature_mask(struct smu_context *smu) | |||
| 2311 | 2334 | OD_OPS_SUPPORT_FAN_MINIMUM_PWM_RETRIEVE | | |
| 2312 | 2335 | OD_OPS_SUPPORT_FAN_MINIMUM_PWM_SET | | |
| 2313 | 2336 | OD_OPS_SUPPORT_FAN_ZERO_RPM_ENABLE_RETRIEVE | | |
| 2314 | - | OD_OPS_SUPPORT_FAN_ZERO_RPM_ENABLE_SET; | |
| 2337 | + | OD_OPS_SUPPORT_FAN_ZERO_RPM_ENABLE_SET | | |
| 2338 | + | OD_OPS_SUPPORT_FAN_ZERO_RPM_STOP_TEMP_RETRIEVE | | |
| 2339 | + | OD_OPS_SUPPORT_FAN_ZERO_RPM_STOP_TEMP_SET; | |
| 2315 | 2340 | } | |
| 2316 | 2341 | ||
| 2317 | 2342 | static int smu_v14_0_2_get_overdrive_table(struct smu_context *smu, | |
| @@ -2392,6 +2417,8 @@ static int smu_v14_0_2_set_default_od_settings(struct smu_context *smu) | |||
| 2392 | 2417 | user_od_table_bak.OverDriveTable.FanMinimumPwm; | |
| 2393 | 2418 | user_od_table->OverDriveTable.FanZeroRpmEnable = | |
| 2394 | 2419 | user_od_table_bak.OverDriveTable.FanZeroRpmEnable; | |
| 2420 | + | user_od_table->OverDriveTable.FanZeroRpmStopTemp = | |
| 2421 | + | user_od_table_bak.OverDriveTable.FanZeroRpmStopTemp; | |
| 2395 | 2422 | } | |
| 2396 | 2423 | ||
| 2397 | 2424 | smu_v14_0_2_set_supported_od_feature_mask(smu); | |
| @@ -2446,6 +2473,11 @@ static int smu_v14_0_2_od_restore_table_single(struct smu_context *smu, long inp | |||
| 2446 | 2473 | boot_overdrive_table->OverDriveTable.FanZeroRpmEnable; | |
| 2447 | 2474 | od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_ZERO_FAN_BIT); | |
| 2448 | 2475 | break; | |
| 2476 | + | case PP_OD_EDIT_FAN_ZERO_RPM_STOP_TEMP: | |
| 2477 | + | od_table->OverDriveTable.FanZeroRpmStopTemp = | |
| 2478 | + | boot_overdrive_table->OverDriveTable.FanZeroRpmStopTemp; | |
| 2479 | + | od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_ZERO_FAN_BIT); | |
| 2480 | + | break; | |
| 2449 | 2481 | case PP_OD_EDIT_ACOUSTIC_LIMIT: | |
| 2450 | 2482 | od_table->OverDriveTable.AcousticLimitRpmThreshold = | |
| 2451 | 2483 | boot_overdrive_table->OverDriveTable.AcousticLimitRpmThreshold; | |
| @@ -2752,6 +2784,27 @@ static int smu_v14_0_2_od_edit_dpm_table(struct smu_context *smu, | |||
| 2752 | 2784 | od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_ZERO_FAN_BIT); | |
| 2753 | 2785 | break; | |
| 2754 | 2786 | ||
| 2787 | + | case PP_OD_EDIT_FAN_ZERO_RPM_STOP_TEMP: | |
| 2788 | + | if (!smu_v14_0_2_is_od_feature_supported(smu, PP_OD_FEATURE_ZERO_FAN_BIT)) { | |
| 2789 | + | dev_warn(adev->dev, "Zero RPM setting not supported!\n"); | |
| 2790 | + | return -ENOTSUPP; | |
| 2791 | + | } | |
| 2792 | + | ||
| 2793 | + | smu_v14_0_2_get_od_setting_limits(smu, | |
| 2794 | + | PP_OD_FEATURE_FAN_ZERO_RPM_STOP_TEMP, | |
| 2795 | + | &minimum, | |
| 2796 | + | &maximum); | |
| 2797 | + | if (input[0] < minimum || | |
| 2798 | + | input[0] > maximum) { | |
| 2799 | + | dev_info(adev->dev, "zero RPM stop temperature setting(%ld) must be within [%d, %d]!\n", | |
| 2800 | + | input[0], minimum, maximum); | |
| 2801 | + | return -EINVAL; | |
| 2802 | + | } | |
| 2803 | + | ||
| 2804 | + | od_table->OverDriveTable.FanZeroRpmStopTemp = input[0]; | |
| 2805 | + | od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_ZERO_FAN_BIT); | |
| 2806 | + | break; | |
| 2807 | + | ||
| 2755 | 2808 | case PP_OD_RESTORE_DEFAULT_TABLE: | |
| 2756 | 2809 | if (size == 1) { | |
| 2757 | 2810 | ret = smu_v14_0_2_od_restore_table_single(smu, input[0]); | |
modified drivers/gpu/drm/drm_exec.c
| @@ -48,16 +48,6 @@ | |||
| 48 | 48 | * See struct dma_exec for more details. | |
| 49 | 49 | */ | |
| 50 | 50 | ||
| 51 | - | /* Unlock and put the prelocked obj */ | |
| 52 | - | static void drm_exec_drop_prelocked(struct drm_exec *exec) | |
| 53 | - | { | |
| 54 | - | if (exec->prelocked) { | |
| 55 | - | dma_resv_unlock(exec->prelocked->resv); | |
| 56 | - | drm_gem_object_put(exec->prelocked); | |
| 57 | - | exec->prelocked = NULL; | |
| 58 | - | } | |
| 59 | - | } | |
| 60 | - | ||
| 61 | 51 | /* Unlock all objects and drop references */ | |
| 62 | 52 | static void drm_exec_unlock_all(struct drm_exec *exec) | |
| 63 | 53 | { | |
| @@ -68,7 +58,8 @@ static void drm_exec_unlock_all(struct drm_exec *exec) | |||
| 68 | 58 | drm_gem_object_put(obj); | |
| 69 | 59 | } | |
| 70 | 60 | ||
| 71 | - | drm_exec_drop_prelocked(exec); | |
| 61 | + | drm_gem_object_put(exec->prelocked); | |
| 62 | + | exec->prelocked = NULL; | |
| 72 | 63 | } | |
| 73 | 64 | ||
| 74 | 65 | /** | |
| @@ -127,14 +118,6 @@ EXPORT_SYMBOL(drm_exec_fini); | |||
| 127 | 118 | bool drm_exec_cleanup(struct drm_exec *exec) | |
| 128 | 119 | { | |
| 129 | 120 | if (likely(!exec->contended)) { | |
| 130 | - | ||
| 131 | - | /* | |
| 132 | - | * The contended and prelocked object might never be passed to | |
| 133 | - | * drm_exec_lock_obj() again. This can happen when the object | |
| 134 | - | * is about to be cleaned up and we now hold the last reference | |
| 135 | - | * to it. Make sure that we don't unnecessarily keep it around. | |
| 136 | - | */ | |
| 137 | - | drm_exec_drop_prelocked(exec); | |
| 138 | 121 | ww_acquire_done(&exec->ticket); | |
| 139 | 122 | return false; | |
| 140 | 123 | } | |
| @@ -192,16 +175,16 @@ static int drm_exec_lock_contended(struct drm_exec *exec) | |||
| 192 | 175 | dma_resv_lock_slow(obj->resv, &exec->ticket); | |
| 193 | 176 | } | |
| 194 | 177 | ||
| 195 | - | /* | |
| 196 | - | * It is perfectly possible that we see another contention before the | |
| 197 | - | * first one is fully handled. | |
| 198 | - | */ | |
| 199 | - | drm_exec_drop_prelocked(exec); | |
| 178 | + | ret = drm_exec_obj_locked(exec, obj); | |
| 179 | + | if (unlikely(ret)) | |
| 180 | + | goto error_unlock; | |
| 200 | 181 | ||
| 201 | - | /* We move the reference from contended to prelocked here */ | |
| 202 | 182 | exec->prelocked = obj; | |
| 203 | 183 | return 0; | |
| 204 | 184 | ||
| 185 | + | error_unlock: | |
| 186 | + | dma_resv_unlock(obj->resv); | |
| 187 | + | ||
| 205 | 188 | error_dropref: | |
| 206 | 189 | drm_gem_object_put(obj); | |
| 207 | 190 | return ret; | |
| @@ -229,31 +212,35 @@ int drm_exec_lock_obj(struct drm_exec *exec, struct drm_gem_object *obj) | |||
| 229 | 212 | if (exec->prelocked == obj) { | |
| 230 | 213 | drm_gem_object_put(exec->prelocked); | |
| 231 | 214 | exec->prelocked = NULL; | |
| 232 | - | } else { | |
| 233 | - | if (exec->flags & DRM_EXEC_INTERRUPTIBLE_WAIT) | |
| 234 | - | ret = dma_resv_lock_interruptible(obj->resv, | |
| 235 | - | &exec->ticket); | |
| 236 | - | else | |
| 237 | - | ret = dma_resv_lock(obj->resv, &exec->ticket); | |
| 238 | - | ||
| 239 | - | if (unlikely(ret == -EDEADLK)) { | |
| 240 | - | drm_gem_object_get(obj); | |
| 241 | - | exec->contended = obj; | |
| 242 | - | return -EDEADLK; | |
| 243 | - | } | |
| 215 | + | return 0; | |
| 216 | + | } | |
| 244 | 217 | ||
| 245 | - | if (unlikely(ret == -EALREADY) && | |
| 246 | - | exec->flags & DRM_EXEC_IGNORE_DUPLICATES) | |
| 247 | - | return 0; | |
| 218 | + | if (exec->flags & DRM_EXEC_INTERRUPTIBLE_WAIT) | |
| 219 | + | ret = dma_resv_lock_interruptible(obj->resv, &exec->ticket); | |
| 220 | + | else | |
| 221 | + | ret = dma_resv_lock(obj->resv, &exec->ticket); | |
| 248 | 222 | ||
| 249 | - | if (unlikely(ret)) | |
| 250 | - | return ret; | |
| 223 | + | if (unlikely(ret == -EDEADLK)) { | |
| 224 | + | drm_gem_object_get(obj); | |
| 225 | + | exec->contended = obj; | |
| 226 | + | return -EDEADLK; | |
| 251 | 227 | } | |
| 252 | 228 | ||
| 229 | + | if (unlikely(ret == -EALREADY) && | |
| 230 | + | exec->flags & DRM_EXEC_IGNORE_DUPLICATES) | |
| 231 | + | return 0; | |
| 232 | + | ||
| 233 | + | if (unlikely(ret)) | |
| 234 | + | return ret; | |
| 235 | + | ||
| 253 | 236 | ret = drm_exec_obj_locked(exec, obj); | |
| 254 | 237 | if (ret) | |
| 255 | - | dma_resv_unlock(obj->resv); | |
| 238 | + | goto error_unlock; | |
| 239 | + | ||
| 240 | + | return 0; | |
| 256 | 241 | ||
| 242 | + | error_unlock: | |
| 243 | + | dma_resv_unlock(obj->resv); | |
| 257 | 244 | return ret; | |
| 258 | 245 | } | |
| 259 | 246 | EXPORT_SYMBOL(drm_exec_lock_obj); | |
modified drivers/gpu/drm/i915/display/intel_cx0_phy.c
| @@ -2342,14 +2342,12 @@ static void intel_c10pll_dump_hw_state(struct drm_printer *p, | |||
| 2342 | 2342 | static bool is_arrowlake_s_by_host_bridge(void) | |
| 2343 | 2343 | { | |
| 2344 | 2344 | struct pci_dev *pdev = NULL; | |
| 2345 | - | while ((pdev = pci_get_class(PCI_CLASS_BRIDGE_HOST << 8, pdev))) { | |
| 2346 | - | if (IS_ARROWLAKE_S_BY_HOST_BRIDGE_ID(pdev->device)) { | |
| 2347 | - | pci_dev_put(pdev); | |
| 2348 | - | return true; | |
| 2349 | - | } | |
| 2350 | - | } | |
| 2345 | + | u16 host_bridge_pci_dev_id; | |
| 2351 | 2346 | ||
| 2352 | - | return false; | |
| 2347 | + | while ((pdev = pci_get_class(PCI_CLASS_BRIDGE_HOST << 8, pdev))) | |
| 2348 | + | host_bridge_pci_dev_id = pdev->device; | |
| 2349 | + | ||
| 2350 | + | return pdev && IS_ARROWLAKE_S_BY_HOST_BRIDGE_ID(host_bridge_pci_dev_id); | |
| 2353 | 2351 | } | |
| 2354 | 2352 | ||
| 2355 | 2353 | static u16 intel_c20_hdmi_tmds_tx_cgf_1(struct intel_display *display) | |
modified drivers/gpu/drm/i915/display/intel_dmc.c
| @@ -1023,55 +1023,6 @@ static void dmc_set_fw_offset(struct intel_dmc *dmc, | |||
| 1023 | 1023 | } | |
| 1024 | 1024 | } | |
| 1025 | 1025 | ||
| 1026 | - | /* | |
| 1027 | - | * Check if the load address is within the valid range for the given DMC ID. | |
| 1028 | - | */ | |
| 1029 | - | static bool dmc_load_addr_sanity_check(struct intel_dmc *dmc, | |
| 1030 | - | u32 start_addr, u32 payload_size, | |
| 1031 | - | int header_ver, enum intel_dmc_id dmc_id) | |
| 1032 | - | { | |
| 1033 | - | u32 start_range, end_range, end_addr; | |
| 1034 | - | ||
| 1035 | - | if (header_ver != 3) | |
| 1036 | - | return true; | |
| 1037 | - | ||
| 1038 | - | switch (dmc_id) { | |
| 1039 | - | case DMC_FW_MAIN: | |
| 1040 | - | start_range = DMC_MAIN_PROGRAM_BASE_START; | |
| 1041 | - | end_range = DMC_MAIN_PROGRAM_BASE_END; | |
| 1042 | - | break; | |
| 1043 | - | case DMC_FW_PIPEA: | |
| 1044 | - | start_range = DMC_PIPEA_PROGRAM_BASE_START; | |
| 1045 | - | end_range = DMC_PIPEA_PROGRAM_BASE_END; | |
| 1046 | - | break; | |
| 1047 | - | case DMC_FW_PIPEB: | |
| 1048 | - | start_range = DMC_PIPEB_PROGRAM_BASE_START; | |
| 1049 | - | end_range = DMC_PIPEB_PROGRAM_BASE_END; | |
| 1050 | - | break; | |
| 1051 | - | case DMC_FW_PIPEC: | |
| 1052 | - | start_range = DMC_PIPEC_PROGRAM_BASE_START; | |
| 1053 | - | end_range = DMC_PIPEC_PROGRAM_BASE_END; | |
| 1054 | - | break; | |
| 1055 | - | case DMC_FW_PIPED: | |
| 1056 | - | start_range = DMC_PIPED_PROGRAM_BASE_START; | |
| 1057 | - | end_range = DMC_PIPED_PROGRAM_BASE_END; | |
| 1058 | - | break; | |
| 1059 | - | default: | |
| 1060 | - | MISSING_CASE(dmc_id); | |
| 1061 | - | return false; | |
| 1062 | - | } | |
| 1063 | - | ||
| 1064 | - | if (payload_size == 0) | |
| 1065 | - | end_addr = start_addr; | |
| 1066 | - | else if (check_add_overflow(start_addr, payload_size - 1, &end_addr)) | |
| 1067 | - | return false; | |
| 1068 | - | ||
| 1069 | - | if (start_addr < start_range || end_addr > end_range) | |
| 1070 | - | return false; | |
| 1071 | - | ||
| 1072 | - | return true; | |
| 1073 | - | } | |
| 1074 | - | ||
| 1075 | 1026 | static bool dmc_mmio_addr_sanity_check(struct intel_dmc *dmc, | |
| 1076 | 1027 | const u32 *mmioaddr, u32 mmio_count, | |
| 1077 | 1028 | int header_ver, enum intel_dmc_id dmc_id) | |
| @@ -1169,7 +1120,7 @@ static u32 parse_dmc_fw_header(struct intel_dmc *dmc, | |||
| 1169 | 1120 | } | |
| 1170 | 1121 | ||
| 1171 | 1122 | /* Cache the dmc header info. */ | |
| 1172 | - | if (!mmio_count || mmio_count > mmio_count_max) { | |
| 1123 | + | if (mmio_count > mmio_count_max) { | |
| 1173 | 1124 | drm_err(display->drm, "DMC firmware has wrong mmio count %u\n", mmio_count); | |
| 1174 | 1125 | return 0; | |
| 1175 | 1126 | } | |
| @@ -1215,21 +1166,13 @@ static u32 parse_dmc_fw_header(struct intel_dmc *dmc, | |||
| 1215 | 1166 | disable_dmc_evt(display, dmc_id, dmc_info->mmioaddr[i], | |
| 1216 | 1167 | dmc_info->mmiodata[i]) ? " (disabling)" : ""); | |
| 1217 | 1168 | } | |
| 1169 | + | dmc_info->mmio_count = mmio_count; | |
| 1170 | + | dmc_info->start_mmioaddr = start_mmioaddr; | |
| 1218 | 1171 | ||
| 1219 | 1172 | rem_size -= header_len_bytes; | |
| 1220 | 1173 | ||
| 1221 | 1174 | /* fw_size is in dwords, so multiplied by 4 to convert into bytes. */ | |
| 1222 | - | if (check_mul_overflow(dmc_header->fw_size, 4u, &payload_size)) { | |
| 1223 | - | drm_err(display->drm, "DMC fw_size too large (%u dwords)\n", | |
| 1224 | - | dmc_header->fw_size); | |
| 1225 | - | return 0; | |
| 1226 | - | } | |
| 1227 | - | ||
| 1228 | - | if (!payload_size) { | |
| 1229 | - | drm_err(display->drm, "DMC firmware has empty payload\n"); | |
| 1230 | - | return 0; | |
| 1231 | - | } | |
| 1232 | - | ||
| 1175 | + | payload_size = dmc_header->fw_size * 4; | |
| 1233 | 1176 | if (rem_size < payload_size) | |
| 1234 | 1177 | goto error_truncated; | |
| 1235 | 1178 | ||
| @@ -1237,21 +1180,12 @@ static u32 parse_dmc_fw_header(struct intel_dmc *dmc, | |||
| 1237 | 1180 | drm_err(display->drm, "DMC FW too big (%u bytes)\n", payload_size); | |
| 1238 | 1181 | return 0; | |
| 1239 | 1182 | } | |
| 1240 | - | ||
| 1241 | - | if (!dmc_load_addr_sanity_check(dmc, start_mmioaddr, payload_size, | |
| 1242 | - | dmc_header->header_ver, dmc_id)) { | |
| 1243 | - | drm_err(display->drm, "DMC %d: firmware has wrong load address\n", dmc_id); | |
| 1244 | - | return 0; | |
| 1245 | - | } | |
| 1183 | + | dmc_info->dmc_fw_size = dmc_header->fw_size; | |
| 1246 | 1184 | ||
| 1247 | 1185 | dmc_info->payload = kmalloc(payload_size, GFP_KERNEL); | |
| 1248 | 1186 | if (!dmc_info->payload) | |
| 1249 | 1187 | return 0; | |
| 1250 | 1188 | ||
| 1251 | - | dmc_info->mmio_count = mmio_count; | |
| 1252 | - | dmc_info->start_mmioaddr = start_mmioaddr; | |
| 1253 | - | dmc_info->dmc_fw_size = dmc_header->fw_size; | |
| 1254 | - | ||
| 1255 | 1189 | payload = (u8 *)(dmc_header) + header_len_bytes; | |
| 1256 | 1190 | memcpy(dmc_info->payload, payload, payload_size); | |
| 1257 | 1191 | ||
modified drivers/gpu/drm/i915/display/intel_dmc_regs.h
| @@ -521,18 +521,6 @@ enum pipedmc_event_id { | |||
| 521 | 521 | #define TGL_PIPE_MMIO_END(dmc_id) _PICK_EVEN(((dmc_id) - 1), _TGL_PIPEA_MMIO_END,\ | |
| 522 | 522 | _TGL_PIPEB_MMIO_END) | |
| 523 | 523 | ||
| 524 | - | /* For DMC header version v3*/ | |
| 525 | - | #define DMC_MAIN_PROGRAM_BASE_START 0x80000 | |
| 526 | - | #define DMC_MAIN_PROGRAM_BASE_END 0x86fff | |
| 527 | - | #define DMC_PIPEA_PROGRAM_BASE_START 0x90000 | |
| 528 | - | #define DMC_PIPEA_PROGRAM_BASE_END 0x96fff | |
| 529 | - | #define DMC_PIPEB_PROGRAM_BASE_START 0x98000 | |
| 530 | - | #define DMC_PIPEB_PROGRAM_BASE_END 0x9efff | |
| 531 | - | #define DMC_PIPEC_PROGRAM_BASE_START 0x52000 | |
| 532 | - | #define DMC_PIPEC_PROGRAM_BASE_END 0x53fff | |
| 533 | - | #define DMC_PIPED_PROGRAM_BASE_START 0x59000 | |
| 534 | - | #define DMC_PIPED_PROGRAM_BASE_END 0x5afff | |
| 535 | - | ||
| 536 | 524 | #define SKL_DMC_DC3_DC5_COUNT _MMIO(0x80030) | |
| 537 | 525 | #define SKL_DMC_DC5_DC6_COUNT _MMIO(0x8002C) | |
| 538 | 526 | #define BXT_DMC_DC3_DC5_COUNT _MMIO(0x80038) | |
modified drivers/gpu/drm/panthor/panthor_hw.c
| @@ -136,7 +136,7 @@ static char *get_gpu_model_name(struct panthor_device *ptdev) | |||
| 136 | 136 | case GPU_PROD_ID_MAKE(10, 7): | |
| 137 | 137 | return "Mali-G610"; | |
| 138 | 138 | case GPU_PROD_ID_MAKE(11, 2): | |
| 139 | - | if (shader_core_count >= 10 && ray_intersection) | |
| 139 | + | if (shader_core_count > 10 && ray_intersection) | |
| 140 | 140 | return "Mali-G715-Immortalis"; | |
| 141 | 141 | else if (shader_core_count >= 7) | |
| 142 | 142 | return "Mali-G715"; | |
modified drivers/gpu/drm/vc4/vc4_hdmi.c
| @@ -894,7 +894,7 @@ static void vc4_hdmi_encoder_post_crtc_disable(struct drm_encoder *encoder, | |||
| 894 | 894 | ||
| 895 | 895 | spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); | |
| 896 | 896 | ||
| 897 | - | HDMI_WRITE(HDMI_RAM_PACKET_CONFIG, VC4_HDMI_RAM_PACKET_ENABLE); | |
| 897 | + | HDMI_WRITE(HDMI_RAM_PACKET_CONFIG, 0); | |
| 898 | 898 | ||
| 899 | 899 | HDMI_WRITE(HDMI_VID_CTL, HDMI_READ(HDMI_VID_CTL) | VC4_HD_VID_CTL_CLRRGB); | |
| 900 | 900 | ||
| @@ -1663,6 +1663,9 @@ static void vc4_hdmi_encoder_post_crtc_enable(struct drm_encoder *encoder, | |||
| 1663 | 1663 | WARN_ONCE(ret, "Timeout waiting for " | |
| 1664 | 1664 | "VC4_HDMI_SCHEDULER_CONTROL_HDMI_ACTIVE\n"); | |
| 1665 | 1665 | } else { | |
| 1666 | + | HDMI_WRITE(HDMI_RAM_PACKET_CONFIG, | |
| 1667 | + | HDMI_READ(HDMI_RAM_PACKET_CONFIG) & | |
| 1668 | + | ~(VC4_HDMI_RAM_PACKET_ENABLE)); | |
| 1666 | 1669 | HDMI_WRITE(HDMI_SCHEDULER_CONTROL, | |
| 1667 | 1670 | HDMI_READ(HDMI_SCHEDULER_CONTROL) & | |
| 1668 | 1671 | ~VC4_HDMI_SCHEDULER_CONTROL_MODE_HDMI); | |
| @@ -1681,6 +1684,9 @@ static void vc4_hdmi_encoder_post_crtc_enable(struct drm_encoder *encoder, | |||
| 1681 | 1684 | WARN_ON(!(HDMI_READ(HDMI_SCHEDULER_CONTROL) & | |
| 1682 | 1685 | VC4_HDMI_SCHEDULER_CONTROL_HDMI_ACTIVE)); | |
| 1683 | 1686 | ||
| 1687 | + | HDMI_WRITE(HDMI_RAM_PACKET_CONFIG, | |
| 1688 | + | VC4_HDMI_RAM_PACKET_ENABLE); | |
| 1689 | + | ||
| 1684 | 1690 | spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); | |
| 1685 | 1691 | vc4_hdmi->packet_ram_enabled = true; | |
| 1686 | 1692 | ||
| @@ -3137,11 +3143,6 @@ static int vc5_hdmi_init_resources(struct drm_device *drm, | |||
| 3137 | 3143 | static int vc4_hdmi_runtime_suspend(struct device *dev) | |
| 3138 | 3144 | { | |
| 3139 | 3145 | struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev); | |
| 3140 | - | unsigned long flags; | |
| 3141 | - | ||
| 3142 | - | spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); | |
| 3143 | - | HDMI_WRITE(HDMI_RAM_PACKET_CONFIG, 0); | |
| 3144 | - | spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); | |
| 3145 | 3146 | ||
| 3146 | 3147 | clk_disable_unprepare(vc4_hdmi->audio_clock); | |
| 3147 | 3148 | clk_disable_unprepare(vc4_hdmi->hsm_clock); | |
| @@ -3152,8 +3153,9 @@ static int vc4_hdmi_runtime_suspend(struct device *dev) | |||
| 3152 | 3153 | static int vc4_hdmi_runtime_resume(struct device *dev) | |
| 3153 | 3154 | { | |
| 3154 | 3155 | struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev); | |
| 3155 | - | unsigned long rate, flags; | |
| 3156 | + | unsigned long __maybe_unused flags; | |
| 3156 | 3157 | u32 __maybe_unused value; | |
| 3158 | + | unsigned long rate; | |
| 3157 | 3159 | int ret; | |
| 3158 | 3160 | ||
| 3159 | 3161 | ret = clk_prepare_enable(vc4_hdmi->hsm_clock); | |
| @@ -3199,10 +3201,6 @@ static int vc4_hdmi_runtime_resume(struct device *dev) | |||
| 3199 | 3201 | } | |
| 3200 | 3202 | #endif | |
| 3201 | 3203 | ||
| 3202 | - | spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); | |
| 3203 | - | HDMI_WRITE(HDMI_RAM_PACKET_CONFIG, VC4_HDMI_RAM_PACKET_ENABLE); | |
| 3204 | - | spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); | |
| 3205 | - | ||
| 3206 | 3204 | return 0; | |
| 3207 | 3205 | ||
| 3208 | 3206 | err_disable_clk: | |
modified drivers/gpu/drm/virtio/virtgpu_drv.c
| @@ -225,7 +225,6 @@ static int virtgpu_freeze(struct virtio_device *vdev) | |||
| 225 | 225 | goto err_resume; | |
| 226 | 226 | } | |
| 227 | 227 | ||
| 228 | - | virtio_reset_device(vdev); | |
| 229 | 228 | vdev->config->del_vqs(vdev); | |
| 230 | 229 | ||
| 231 | 230 | return 0; | |
modified drivers/gpu/drm/virtio/virtgpu_plane.c
| @@ -589,6 +589,7 @@ struct drm_plane *virtio_gpu_plane_init(struct virtio_gpu_device *vgdev, | |||
| 589 | 589 | struct drm_plane *plane; | |
| 590 | 590 | const uint32_t *formats; | |
| 591 | 591 | int nformats; | |
| 592 | + | int ret; | |
| 592 | 593 | ||
| 593 | 594 | if (type == DRM_PLANE_TYPE_CURSOR) { | |
| 594 | 595 | formats = virtio_gpu_cursor_formats; | |
| @@ -614,5 +615,17 @@ struct drm_plane *virtio_gpu_plane_init(struct virtio_gpu_device *vgdev, | |||
| 614 | 615 | drm_plane_create_blend_mode_property(plane, | |
| 615 | 616 | BIT(DRM_MODE_BLEND_PREMULTI)); | |
| 616 | 617 | ||
| 618 | + | if (type == DRM_PLANE_TYPE_CURSOR) { | |
| 619 | + | /* | |
| 620 | + | * The cursor plane exposes a format with an alpha channel, | |
| 621 | + | * which requires a blend mode property. The host blends | |
| 622 | + | * premultiplied alpha, matching the property's default. | |
| 623 | + | */ | |
| 624 | + | ret = drm_plane_create_blend_mode_property(plane, | |
| 625 | + | BIT(DRM_MODE_BLEND_PREMULTI)); | |
| 626 | + | if (ret) | |
| 627 | + | return ERR_PTR(ret); | |
| 628 | + | } | |
| 629 | + | ||
| 617 | 630 | return plane; | |
| 618 | 631 | } | |
modified drivers/gpu/drm/xe/xe_bo.c
| @@ -330,12 +330,6 @@ static void xe_evict_flags(struct ttm_buffer_object *tbo, | |||
| 330 | 330 | return; | |
| 331 | 331 | } | |
| 332 | 332 | ||
| 333 | - | /* No resource: nothing is placed/mapped, so there is nothing to evict. */ | |
| 334 | - | if (!tbo->resource) { | |
| 335 | - | placement->num_placement = 0; | |
| 336 | - | return; | |
| 337 | - | } | |
| 338 | - | ||
| 339 | 333 | bo = ttm_to_xe_bo(tbo); | |
| 340 | 334 | if (bo->flags & XE_BO_FLAG_CPU_ADDR_MIRROR) { | |
| 341 | 335 | *placement = sys_placement; | |
| @@ -950,8 +944,6 @@ static int xe_bo_move_notify(struct xe_bo *bo, | |||
| 950 | 944 | * | |
| 951 | 945 | * Transfers pages between shrinkable and purgeable buckets when the BO | |
| 952 | 946 | * purgeable state changes. Called automatically from xe_bo_set_purgeable_state(). | |
| 953 | - | * For pinned BOs, whose pages are not accounted, only the purgeable flag is | |
| 954 | - | * updated, so that the correct bucket is used when the BO is unpinned. | |
| 955 | 947 | */ | |
| 956 | 948 | static void xe_bo_set_purgeable_shrinker(struct xe_bo *bo, | |
| 957 | 949 | enum xe_madv_purgeable_state new_state) | |
| @@ -968,8 +960,7 @@ static void xe_bo_set_purgeable_shrinker(struct xe_bo *bo, | |||
| 968 | 960 | return; | |
| 969 | 961 | ||
| 970 | 962 | xe_tt = container_of(tt, struct xe_ttm_tt, ttm); | |
| 971 | - | /* Pinned bos are not accounted. Only update the purgeable flag. */ | |
| 972 | - | tt_pages = xe_bo_is_pinned(bo) ? 0 : tt->num_pages; | |
| 963 | + | tt_pages = tt->num_pages; | |
| 973 | 964 | ||
| 974 | 965 | if (!xe_tt->purgeable && new_state == XE_MADV_PURGEABLE_DONTNEED) { | |
| 975 | 966 | xe_tt->purgeable = true; | |
modified drivers/gpu/drm/xe/xe_exec.c
| @@ -346,8 +346,11 @@ retry: | |||
| 346 | 346 | xe_sched_job_push(job); | |
| 347 | 347 | xe_vm_reactivate_rebind(vm); | |
| 348 | 348 | ||
| 349 | - | if (!err && !xe_vm_in_lr_mode(vm)) | |
| 350 | - | xe_vm_bump_lru(vm, exec); | |
| 349 | + | if (!err && !xe_vm_in_lr_mode(vm)) { | |
| 350 | + | spin_lock(&xe->ttm.lru_lock); | |
| 351 | + | ttm_lru_bulk_move_tail(&vm->lru_bulk_move); | |
| 352 | + | spin_unlock(&xe->ttm.lru_lock); | |
| 353 | + | } | |
| 351 | 354 | ||
| 352 | 355 | if (mode == EXEC_MODE_LR) | |
| 353 | 356 | xe_hw_engine_group_resume_faulting_lr_jobs(group); | |
modified drivers/gpu/drm/xe/xe_oa.c
| @@ -914,13 +914,6 @@ static int xe_oa_alloc_oa_buffer(struct xe_oa_stream *stream, size_t size) | |||
| 914 | 914 | if (IS_ERR(bo)) | |
| 915 | 915 | return PTR_ERR(bo); | |
| 916 | 916 | ||
| 917 | - | /* | |
| 918 | - | * ttm_bo_type_kernel BOs are not zeroed on allocation, so the buffer can | |
| 919 | - | * hold stale data from previously freed pages. Since the OA buffer is | |
| 920 | - | * mmap'able by userspace, clear it here to avoid leaking kernel memory. | |
| 921 | - | */ | |
| 922 | - | xe_map_memset(stream->oa->xe, &bo->vmap, 0, 0, xe_bo_size(bo)); | |
| 923 | - | ||
| 924 | 917 | stream->oa_buffer.bo = bo; | |
| 925 | 918 | ||
| 926 | 919 | stream->oa_buffer.bounce = kmalloc(stream->oa_buffer.format->size, GFP_KERNEL); | |
modified drivers/gpu/drm/xe/xe_vm.c
| @@ -410,33 +410,6 @@ int xe_vm_validate_rebind(struct xe_vm *vm, struct drm_exec *exec, | |||
| 410 | 410 | return 0; | |
| 411 | 411 | } | |
| 412 | 412 | ||
| 413 | - | /** | |
| 414 | - | * xe_vm_bump_lru() - Bump the LRU position of BOs used by a submission | |
| 415 | - | * @vm: The vm for which we are bumping LRUs. | |
| 416 | - | * @exec: The struct drm_exec with the locked GEM objects. | |
| 417 | - | * | |
| 418 | - | * Move the VM's private BOs, and all external objects locked by @exec, | |
| 419 | - | * to the LRU tail. Private BOs are moved in bulk using @vm's | |
| 420 | - | * &xe_vm.lru_bulk_move. External objects, which may be shared with other | |
| 421 | - | * VMs, are not part of that bulk move and are bumped individually. | |
| 422 | - | */ | |
| 423 | - | void xe_vm_bump_lru(struct xe_vm *vm, struct drm_exec *exec) | |
| 424 | - | { | |
| 425 | - | spinlock_t *lru_lock = &vm->xe->ttm.lru_lock; | |
| 426 | - | struct drm_gem_object *obj; | |
| 427 | - | ||
| 428 | - | spin_lock(lru_lock); | |
| 429 | - | ttm_lru_bulk_move_tail(&vm->lru_bulk_move); | |
| 430 | - | drm_exec_for_each_locked_object(exec, obj) { | |
| 431 | - | if (!drm_gpuvm_is_extobj(&vm->gpuvm, obj)) | |
| 432 | - | continue; | |
| 433 | - | ||
| 434 | - | ttm_bo_move_to_lru_tail(&gem_to_xe_bo(obj)->ttm); | |
| 435 | - | cond_resched_lock(lru_lock); | |
| 436 | - | } | |
| 437 | - | spin_unlock(lru_lock); | |
| 438 | - | } | |
| 439 | - | ||
| 440 | 413 | static int xe_preempt_work_begin(struct drm_exec *exec, struct xe_vm *vm, | |
| 441 | 414 | bool *done) | |
| 442 | 415 | { | |
| @@ -587,7 +560,9 @@ retry: | |||
| 587 | 560 | ||
| 588 | 561 | #undef retry_required | |
| 589 | 562 | ||
| 590 | - | xe_vm_bump_lru(vm, &exec); | |
| 563 | + | spin_lock(&vm->xe->ttm.lru_lock); | |
| 564 | + | ttm_lru_bulk_move_tail(&vm->lru_bulk_move); | |
| 565 | + | spin_unlock(&vm->xe->ttm.lru_lock); | |
| 591 | 566 | ||
| 592 | 567 | /* Point of no return. */ | |
| 593 | 568 | arm_preempt_fences(vm, &preempt_fences); | |
modified drivers/gpu/drm/xe/xe_vm.h
| @@ -284,8 +284,6 @@ int xe_vm_lock_vma(struct drm_exec *exec, struct xe_vma *vma); | |||
| 284 | 284 | int xe_vm_validate_rebind(struct xe_vm *vm, struct drm_exec *exec, | |
| 285 | 285 | unsigned int num_fences); | |
| 286 | 286 | ||
| 287 | - | void xe_vm_bump_lru(struct xe_vm *vm, struct drm_exec *exec); | |
| 288 | - | ||
| 289 | 287 | struct dma_fence *xe_vm_bind_kernel_bo(struct xe_vm *vm, struct xe_bo *bo, | |
| 290 | 288 | struct xe_exec_queue *q, u64 addr, | |
| 291 | 289 | enum xe_cache_level cache_lvl); | |
modified include/drm/drm_exec.h
| @@ -73,15 +73,13 @@ drm_exec_obj(struct drm_exec *exec, unsigned long index) | |||
| 73 | 73 | ||
| 74 | 74 | /* Helper for drm_exec_for_each_locked_object(). Internal use only. */ | |
| 75 | 75 | #define __drm_exec_for_each_locked_object(exec, obj, __index) \ | |
| 76 | - | for (unsigned long __index = 0; ((obj) = drm_exec_obj(exec, __index)); \ | |
| 77 | - | ++__index) | |
| 76 | + | for (unsigned long __index = 0; ((obj) = drm_exec_obj(exec, __index)); ++__index) | |
| 78 | 77 | /** | |
| 79 | 78 | * drm_exec_for_each_locked_object - iterate over all the locked objects | |
| 80 | 79 | * @exec: drm_exec object | |
| 81 | 80 | * @obj: the current GEM object | |
| 82 | 81 | * | |
| 83 | - | * Iterate over all the explicitly locked GEM objects inside the drm_exec | |
| 84 | - | * container, except for the contended and implicit prelocked one. | |
| 82 | + | * Iterate over all the locked GEM objects inside the drm_exec object. | |
| 85 | 83 | */ | |
| 86 | 84 | #define drm_exec_for_each_locked_object(exec, obj) \ | |
| 87 | 85 | __drm_exec_for_each_locked_object(exec, obj, __UNIQUE_ID(drm_exec)) | |
| @@ -96,13 +94,12 @@ drm_exec_obj(struct drm_exec *exec, unsigned long index) | |||
| 96 | 94 | * @exec: drm_exec object | |
| 97 | 95 | * @obj: the current GEM object | |
| 98 | 96 | * | |
| 99 | - | * Iterate over all the explicitly locked GEM objects inside the drm_exec | |
| 100 | - | * container in reverse locking order. Note that the internal index may wrap | |
| 101 | - | * around, but that will be caught by drm_exec_obj(), returning a NULL object. | |
| 97 | + | * Iterate over all the locked GEM objects inside the drm_exec object in | |
| 98 | + | * reverse locking order. Note that the internal index may wrap around, | |
| 99 | + | * but that will be caught by drm_exec_obj(), returning a NULL object. | |
| 102 | 100 | */ | |
| 103 | 101 | #define drm_exec_for_each_locked_object_reverse(exec, obj) \ | |
| 104 | - | __drm_exec_for_each_locked_object_reverse(exec, obj, \ | |
| 105 | - | __UNIQUE_ID(drm_exec)) | |
| 102 | + | __drm_exec_for_each_locked_object_reverse(exec, obj, __UNIQUE_ID(drm_exec)) | |
| 106 | 103 | ||
| 107 | 104 | /** | |
| 108 | 105 | * drm_exec_until_all_locked - loop until all GEM objects are locked | |