Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'drm-fixes-2024-10-04' of https://gitlab.freedesktop.org/drm/kernel

Pull drm fixes from Dave Airlie:
"Weekly fixes, xe and amdgpu lead the way, with panthor, and few core
components getting various fixes. Nothing seems too out of the
ordinary.

atomic:
- Use correct type when reading damage rectangles

display:
- Fix kernel docs

dp-mst:
- Fix DSC decompression detection

hdmi:
- Fix infoframe size

sched:
- Update maintainers
- Fix race condition whne queueing up jobs
- Fix locking in drm_sched_entity_modify_sched()
- Fix pointer deref if entity queue changes

sysfb:
- Disable sysfb if framebuffer parent device is unknown

amdgpu:
- DML2 fix
- DSC fix
- Dispclk fix
- eDP HDR fix
- IPS fix
- TBT fix

i915:
- One fix for bitwise and logical "and" mixup in PM code

xe:
- Restore pci state on resume
- Fix locking on submission, queue and vm
- Fix UAF on queue destruction
- Fix resource release on freq init error path
- Use rw_semaphore to reduce contention on ASID->VM lookup
- Fix steering for media on Xe2_HPM
- Tuning updates to Xe2
- Resume TDR after GT reset to prevent jobs running forever
- Move id allocation to avoid userspace using a guessed number to
trigger UAF
- Fix OA stream close preventing pbatch buffers to complete
- Fix NPD when migrating memory on LNL
- Fix memory leak when aborting binds

panthor:
- Fix locking
- Set FOP_UNSIGNED_OFFSET in fops instance
- Acquire lock in panthor_vm_prepare_map_op_ctx()
- Avoid uninitialized variable in tick_ctx_cleanup()
- Do not block scheduler queue if work is pending
- Do not add write fences to the shared BOs

vbox:
- Fix VLA handling"

* tag 'drm-fixes-2024-10-04' of https://gitlab.freedesktop.org/drm/kernel: (41 commits)
drm/xe: Fix memory leak when aborting binds
drm/xe: Prevent null pointer access in xe_migrate_copy
drm/xe/oa: Don't reset OAC_CONTEXT_ENABLE on OA stream close
drm/xe/queue: move xa_alloc to prevent UAF
drm/xe/vm: move xa_alloc to prevent UAF
drm/xe: Clean up VM / exec queue file lock usage.
drm/xe: Resume TDR after GT reset
drm/xe/xe2: Add performance tuning for L3 cache flushing
drm/xe/xe2: Extend performance tuning to media GT
drm/xe/mcr: Use Xe2_LPM steering tables for Xe2_HPM
drm/xe: Use helper for ASID -> VM in GPU faults and access counters
drm/xe: Convert to USM lock to rwsem
drm/xe: use devm_add_action_or_reset() helper
drm/xe: fix UAF around queue destruction
drm/xe/guc_submit: add missing locking in wedged_fini
drm/xe: Restore pci state upon resume
drm/amd/display: Fix system hang while resume with TBT monitor
drm/amd/display: Enable idle workqueue for more IPS modes
drm/amd/display: Add HDR workaround for specific eDP
drm/amd/display: avoid set dispclk to 0
...

+282 -108
+2 -2
Documentation/gpu/drm-kms-helpers.rst
··· 181 181 Bridge Connector Helper 182 182 ----------------------- 183 183 184 - .. kernel-doc:: drivers/gpu/drm/drm_bridge_connector.c 184 + .. kernel-doc:: drivers/gpu/drm/display/drm_bridge_connector.c 185 185 :doc: overview 186 186 187 187 ··· 204 204 Bridge Connector Helper Reference 205 205 --------------------------------- 206 206 207 - .. kernel-doc:: drivers/gpu/drm/drm_bridge_connector.c 207 + .. kernel-doc:: drivers/gpu/drm/display/drm_bridge_connector.c 208 208 :export: 209 209 210 210 Panel-Bridge Helper Reference
+2
MAINTAINERS
··· 7832 7832 DRM GPU SCHEDULER 7833 7833 M: Luben Tuikov <ltuikov89@gmail.com> 7834 7834 M: Matthew Brost <matthew.brost@intel.com> 7835 + M: Danilo Krummrich <dakr@kernel.org> 7836 + M: Philipp Stanner <pstanner@redhat.com> 7835 7837 L: dri-devel@lists.freedesktop.org 7836 7838 S: Maintained 7837 7839 T: git https://gitlab.freedesktop.org/drm/misc/kernel.git
+3 -1
drivers/firmware/sysfb.c
··· 67 67 void sysfb_disable(struct device *dev) 68 68 { 69 69 struct screen_info *si = &screen_info; 70 + struct device *parent; 70 71 71 72 mutex_lock(&disable_lock); 72 - if (!dev || dev == sysfb_parent_dev(si)) { 73 + parent = sysfb_parent_dev(si); 74 + if (!dev || !parent || dev == parent) { 73 75 sysfb_unregister(); 74 76 disabled = true; 75 77 }
+18 -2
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
··· 770 770 return; 771 771 } 772 772 773 + /* Skip DMUB HPD IRQ in suspend/resume. We will probe them later. */ 774 + if (notify->type == DMUB_NOTIFICATION_HPD && adev->in_suspend) { 775 + DRM_INFO("Skip DMUB HPD IRQ callback in suspend/resume\n"); 776 + return; 777 + } 778 + 773 779 link_index = notify->link_index; 774 780 link = adev->dm.dc->links[link_index]; 775 781 dev = adev->dm.ddev; ··· 2032 2026 DRM_ERROR("amdgpu: failed to initialize vblank_workqueue.\n"); 2033 2027 } 2034 2028 2035 - if (adev->dm.dc->caps.ips_support && adev->dm.dc->config.disable_ips == DMUB_IPS_ENABLE) 2029 + if (adev->dm.dc->caps.ips_support && 2030 + adev->dm.dc->config.disable_ips != DMUB_IPS_DISABLE_ALL) 2036 2031 adev->dm.idle_workqueue = idle_create_workqueue(adev); 2037 2032 2038 2033 if (adev->dm.dc->caps.max_links > 0 && adev->family >= AMDGPU_FAMILY_RV) { ··· 6742 6735 if (stream->signal == SIGNAL_TYPE_DISPLAY_PORT || 6743 6736 stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST || 6744 6737 stream->signal == SIGNAL_TYPE_EDP) { 6738 + const struct dc_edid_caps *edid_caps; 6739 + unsigned int disable_colorimetry = 0; 6740 + 6741 + if (aconnector->dc_sink) { 6742 + edid_caps = &aconnector->dc_sink->edid_caps; 6743 + disable_colorimetry = edid_caps->panel_patch.disable_colorimetry; 6744 + } 6745 + 6745 6746 // 6746 6747 // should decide stream support vsc sdp colorimetry capability 6747 6748 // before building vsc info packet 6748 6749 // 6749 6750 stream->use_vsc_sdp_for_colorimetry = stream->link->dpcd_caps.dpcd_rev.raw >= 0x14 && 6750 - stream->link->dpcd_caps.dprx_feature.bits.VSC_SDP_COLORIMETRY_SUPPORTED; 6751 + stream->link->dpcd_caps.dprx_feature.bits.VSC_SDP_COLORIMETRY_SUPPORTED && 6752 + !disable_colorimetry; 6751 6753 6752 6754 if (stream->out_transfer_func.tf == TRANSFER_FUNCTION_GAMMA22) 6753 6755 tf = TRANSFER_FUNC_GAMMA_22;
+4
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
··· 73 73 DRM_DEBUG_DRIVER("Clearing DPCD 0x317 on monitor with panel id %X\n", panel_id); 74 74 edid_caps->panel_patch.remove_sink_ext_caps = true; 75 75 break; 76 + case drm_edid_encode_panel_id('S', 'D', 'C', 0x4154): 77 + DRM_DEBUG_DRIVER("Disabling VSC on monitor with panel id %X\n", panel_id); 78 + edid_caps->panel_patch.disable_colorimetry = true; 79 + break; 76 80 default: 77 81 return; 78 82 }
+13 -4
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
··· 1027 1027 int remaining_to_try = 0; 1028 1028 int ret; 1029 1029 uint16_t fec_overhead_multiplier_x1000 = get_fec_overhead_multiplier(dc_link); 1030 + int var_pbn; 1030 1031 1031 1032 for (i = 0; i < count; i++) { 1032 1033 if (vars[i + k].dsc_enabled ··· 1058 1057 break; 1059 1058 1060 1059 DRM_DEBUG_DRIVER("MST_DSC index #%d, try no compression\n", next_index); 1060 + var_pbn = vars[next_index].pbn; 1061 1061 vars[next_index].pbn = kbps_to_peak_pbn(params[next_index].bw_range.stream_kbps, fec_overhead_multiplier_x1000); 1062 1062 ret = drm_dp_atomic_find_time_slots(state, 1063 1063 params[next_index].port->mgr, 1064 1064 params[next_index].port, 1065 1065 vars[next_index].pbn); 1066 - if (ret < 0) 1066 + if (ret < 0) { 1067 + DRM_DEBUG_DRIVER("%s:%d MST_DSC index #%d, failed to set pbn to the state, %d\n", 1068 + __func__, __LINE__, next_index, ret); 1069 + vars[next_index].pbn = var_pbn; 1067 1070 return ret; 1071 + } 1068 1072 1069 1073 ret = drm_dp_mst_atomic_check(state); 1070 1074 if (ret == 0) { ··· 1077 1071 vars[next_index].dsc_enabled = false; 1078 1072 vars[next_index].bpp_x16 = 0; 1079 1073 } else { 1080 - DRM_DEBUG_DRIVER("MST_DSC index #%d, restore minimum compression\n", next_index); 1081 - vars[next_index].pbn = kbps_to_peak_pbn(params[next_index].bw_range.max_kbps, fec_overhead_multiplier_x1000); 1074 + DRM_DEBUG_DRIVER("MST_DSC index #%d, restore optimized pbn value\n", next_index); 1075 + vars[next_index].pbn = var_pbn; 1082 1076 ret = drm_dp_atomic_find_time_slots(state, 1083 1077 params[next_index].port->mgr, 1084 1078 params[next_index].port, 1085 1079 vars[next_index].pbn); 1086 - if (ret < 0) 1080 + if (ret < 0) { 1081 + DRM_DEBUG_DRIVER("%s:%d MST_DSC index #%d, failed to set pbn to the state, %d\n", 1082 + __func__, __LINE__, next_index, ret); 1087 1083 return ret; 1084 + } 1088 1085 } 1089 1086 1090 1087 tried[next_index] = true;
+1
drivers/gpu/drm/amd/display/dc/dc_types.h
··· 178 178 unsigned int skip_avmute; 179 179 unsigned int mst_start_top_delay; 180 180 unsigned int remove_sink_ext_caps; 181 + unsigned int disable_colorimetry; 181 182 }; 182 183 183 184 struct dc_edid_caps {
-1
drivers/gpu/drm/amd/display/dc/dml2/dml2_policy.c
··· 303 303 if (project == dml_project_dcn35 || 304 304 project == dml_project_dcn351) { 305 305 policy->DCCProgrammingAssumesScanDirectionUnknownFinal = false; 306 - policy->EnhancedPrefetchScheduleAccelerationFinal = 0; 307 306 policy->AllowForPStateChangeOrStutterInVBlankFinal = dml_prefetch_support_uclk_fclk_and_stutter_if_possible; /*new*/ 308 307 policy->UseOnlyMaxPrefetchModes = 1; 309 308 }
+1
drivers/gpu/drm/amd/display/dc/resource/dcn351/dcn351_resource.c
··· 766 766 .disable_dmub_reallow_idle = false, 767 767 .static_screen_wait_frames = 2, 768 768 .notify_dpia_hr_bw = true, 769 + .min_disp_clk_khz = 50000, 769 770 }; 770 771 771 772 static const struct dc_panel_config panel_config_defaults = {
+8 -2
drivers/gpu/drm/display/drm_dp_mst_topology.c
··· 6083 6083 struct drm_dp_aux *immediate_upstream_aux; 6084 6084 struct drm_dp_mst_port *fec_port; 6085 6085 struct drm_dp_desc desc = {}; 6086 + u8 upstream_dsc; 6086 6087 u8 endpoint_fec; 6087 6088 u8 endpoint_dsc; 6088 6089 ··· 6110 6109 6111 6110 /* DP-to-DP peer device */ 6112 6111 if (drm_dp_mst_is_virtual_dpcd(immediate_upstream_port)) { 6113 - u8 upstream_dsc; 6114 - 6115 6112 if (drm_dp_dpcd_read(&port->aux, 6116 6113 DP_DSC_SUPPORT, &endpoint_dsc, 1) != 1) 6117 6114 return NULL; ··· 6154 6155 6155 6156 if (drm_dp_has_quirk(&desc, DP_DPCD_QUIRK_DSC_WITHOUT_VIRTUAL_DPCD)) { 6156 6157 u8 dpcd_ext[DP_RECEIVER_CAP_SIZE]; 6158 + 6159 + if (drm_dp_dpcd_read(immediate_upstream_aux, 6160 + DP_DSC_SUPPORT, &upstream_dsc, 1) != 1) 6161 + return NULL; 6162 + 6163 + if (!(upstream_dsc & DP_DSC_DECOMPRESSION_IS_SUPPORTED)) 6164 + return NULL; 6157 6165 6158 6166 if (drm_dp_read_dpcd_caps(immediate_upstream_aux, dpcd_ext) < 0) 6159 6167 return NULL;
+1 -3
drivers/gpu/drm/display/drm_hdmi_state_helper.c
··· 521 521 } 522 522 EXPORT_SYMBOL(drm_atomic_helper_connector_hdmi_check); 523 523 524 - #define HDMI_MAX_INFOFRAME_SIZE 29 525 - 526 524 static int clear_device_infoframe(struct drm_connector *connector, 527 525 enum hdmi_infoframe_type type) 528 526 { ··· 561 563 { 562 564 const struct drm_connector_hdmi_funcs *funcs = connector->hdmi.funcs; 563 565 struct drm_device *dev = connector->dev; 564 - u8 buffer[HDMI_MAX_INFOFRAME_SIZE]; 566 + u8 buffer[HDMI_INFOFRAME_SIZE(MAX)]; 565 567 int ret; 566 568 int len; 567 569
+1 -1
drivers/gpu/drm/drm_atomic_uapi.c
··· 543 543 &state->fb_damage_clips, 544 544 val, 545 545 -1, 546 - sizeof(struct drm_rect), 546 + sizeof(struct drm_mode_rect), 547 547 &replaced); 548 548 return ret; 549 549 } else if (property == plane->scaling_filter_property) {
+1 -3
drivers/gpu/drm/drm_debugfs.c
··· 520 520 .write = connector_write 521 521 }; 522 522 523 - #define HDMI_MAX_INFOFRAME_SIZE 29 524 - 525 523 static ssize_t 526 524 audio_infoframe_read(struct file *filp, char __user *ubuf, size_t count, loff_t *ppos) 527 525 { ··· 577 579 struct drm_connector *connector; \ 578 580 union hdmi_infoframe *frame; \ 579 581 struct drm_device *dev; \ 580 - u8 buf[HDMI_MAX_INFOFRAME_SIZE]; \ 582 + u8 buf[HDMI_INFOFRAME_SIZE(MAX)]; \ 581 583 ssize_t len = 0; \ 582 584 \ 583 585 connector = filp->private_data; \
+1 -1
drivers/gpu/drm/i915/gem/i915_gem_ttm.c
··· 1131 1131 GEM_WARN_ON(!i915_ttm_cpu_maps_iomem(bo->resource)); 1132 1132 } 1133 1133 1134 - if (wakeref & CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND) 1134 + if (wakeref && CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND != 0) 1135 1135 intel_wakeref_auto(&to_i915(obj->base.dev)->runtime_pm.userfault_wakeref, 1136 1136 msecs_to_jiffies_timeout(CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND)); 1137 1137
+1
drivers/gpu/drm/panthor/panthor_drv.c
··· 1383 1383 .read = drm_read, 1384 1384 .llseek = noop_llseek, 1385 1385 .mmap = panthor_mmap, 1386 + .fop_flags = FOP_UNSIGNED_OFFSET, 1386 1387 }; 1387 1388 1388 1389 #ifdef CONFIG_DEBUG_FS
+8
drivers/gpu/drm/panthor/panthor_mmu.c
··· 1251 1251 goto err_cleanup; 1252 1252 } 1253 1253 1254 + /* drm_gpuvm_bo_obtain_prealloc() will call drm_gpuvm_bo_put() on our 1255 + * pre-allocated BO if the <BO,VM> association exists. Given we 1256 + * only have one ref on preallocated_vm_bo, drm_gpuvm_bo_destroy() will 1257 + * be called immediately, and we have to hold the VM resv lock when 1258 + * calling this function. 1259 + */ 1260 + dma_resv_lock(panthor_vm_resv(vm), NULL); 1254 1261 mutex_lock(&bo->gpuva_list_lock); 1255 1262 op_ctx->map.vm_bo = drm_gpuvm_bo_obtain_prealloc(preallocated_vm_bo); 1256 1263 mutex_unlock(&bo->gpuva_list_lock); 1264 + dma_resv_unlock(panthor_vm_resv(vm)); 1257 1265 1258 1266 /* If the a vm_bo for this <VM,BO> combination exists, it already 1259 1267 * retains a pin ref, and we can release the one we took earlier.
+25 -11
drivers/gpu/drm/panthor/panthor_sched.c
··· 1103 1103 list_move_tail(&group->wait_node, 1104 1104 &group->ptdev->scheduler->groups.waiting); 1105 1105 } 1106 - group->blocked_queues |= BIT(cs_id); 1106 + 1107 + /* The queue is only blocked if there's no deferred operation 1108 + * pending, which can be checked through the scoreboard status. 1109 + */ 1110 + if (!cs_iface->output->status_scoreboards) 1111 + group->blocked_queues |= BIT(cs_id); 1112 + 1107 1113 queue->syncwait.gpu_va = cs_iface->output->status_wait_sync_ptr; 1108 1114 queue->syncwait.ref = cs_iface->output->status_wait_sync_value; 1109 1115 status_wait_cond = cs_iface->output->status_wait & CS_STATUS_WAIT_SYNC_COND_MASK; ··· 2052 2046 tick_ctx_cleanup(struct panthor_scheduler *sched, 2053 2047 struct panthor_sched_tick_ctx *ctx) 2054 2048 { 2049 + struct panthor_device *ptdev = sched->ptdev; 2055 2050 struct panthor_group *group, *tmp; 2056 2051 u32 i; 2057 2052 ··· 2061 2054 /* If everything went fine, we should only have groups 2062 2055 * to be terminated in the old_groups lists. 2063 2056 */ 2064 - drm_WARN_ON(&group->ptdev->base, !ctx->csg_upd_failed_mask && 2057 + drm_WARN_ON(&ptdev->base, !ctx->csg_upd_failed_mask && 2065 2058 group_can_run(group)); 2066 2059 2067 2060 if (!group_can_run(group)) { ··· 2084 2077 /* If everything went fine, the groups to schedule lists should 2085 2078 * be empty. 2086 2079 */ 2087 - drm_WARN_ON(&group->ptdev->base, 2080 + drm_WARN_ON(&ptdev->base, 2088 2081 !ctx->csg_upd_failed_mask && !list_empty(&ctx->groups[i])); 2089 2082 2090 2083 list_for_each_entry_safe(group, tmp, &ctx->groups[i], run_node) { ··· 3249 3242 return 0; 3250 3243 } 3251 3244 3245 + static struct panthor_group *group_from_handle(struct panthor_group_pool *pool, 3246 + u32 group_handle) 3247 + { 3248 + struct panthor_group *group; 3249 + 3250 + xa_lock(&pool->xa); 3251 + group = group_get(xa_load(&pool->xa, group_handle)); 3252 + xa_unlock(&pool->xa); 3253 + 3254 + return group; 3255 + } 3256 + 3252 3257 int panthor_group_get_state(struct panthor_file *pfile, 3253 3258 struct drm_panthor_group_get_state *get_state) 3254 3259 { ··· 3272 3253 if (get_state->pad) 3273 3254 return -EINVAL; 3274 3255 3275 - group = group_get(xa_load(&gpool->xa, get_state->group_handle)); 3256 + group = group_from_handle(gpool, get_state->group_handle); 3276 3257 if (!group) 3277 3258 return -EINVAL; 3278 3259 ··· 3403 3384 job->call_info.latest_flush = qsubmit->latest_flush; 3404 3385 INIT_LIST_HEAD(&job->node); 3405 3386 3406 - job->group = group_get(xa_load(&gpool->xa, group_handle)); 3387 + job->group = group_from_handle(gpool, group_handle); 3407 3388 if (!job->group) { 3408 3389 ret = -EINVAL; 3409 3390 goto err_put_job; ··· 3443 3424 { 3444 3425 struct panthor_job *job = container_of(sched_job, struct panthor_job, base); 3445 3426 3446 - /* Still not sure why we want USAGE_WRITE for external objects, since I 3447 - * was assuming this would be handled through explicit syncs being imported 3448 - * to external BOs with DMA_BUF_IOCTL_IMPORT_SYNC_FILE, but other drivers 3449 - * seem to pass DMA_RESV_USAGE_WRITE, so there must be a good reason. 3450 - */ 3451 3427 panthor_vm_update_resvs(job->group->vm, exec, &sched_job->s_fence->finished, 3452 - DMA_RESV_USAGE_BOOKKEEP, DMA_RESV_USAGE_WRITE); 3428 + DMA_RESV_USAGE_BOOKKEEP, DMA_RESV_USAGE_BOOKKEEP); 3453 3429 } 3454 3430 3455 3431 void panthor_sched_unplug(struct panthor_device *ptdev)
+11 -3
drivers/gpu/drm/scheduler/sched_entity.c
··· 133 133 { 134 134 WARN_ON(!num_sched_list || !sched_list); 135 135 136 + spin_lock(&entity->rq_lock); 136 137 entity->sched_list = sched_list; 137 138 entity->num_sched_list = num_sched_list; 139 + spin_unlock(&entity->rq_lock); 138 140 } 139 141 EXPORT_SYMBOL(drm_sched_entity_modify_sched); 140 142 ··· 382 380 container_of(cb, struct drm_sched_entity, cb); 383 381 384 382 drm_sched_entity_clear_dep(f, cb); 385 - drm_sched_wakeup(entity->rq->sched, entity); 383 + drm_sched_wakeup(entity->rq->sched); 386 384 } 387 385 388 386 /** ··· 599 597 600 598 /* first job wakes up scheduler */ 601 599 if (first) { 600 + struct drm_gpu_scheduler *sched; 601 + struct drm_sched_rq *rq; 602 + 602 603 /* Add the entity to the run queue */ 603 604 spin_lock(&entity->rq_lock); 604 605 if (entity->stopped) { ··· 611 606 return; 612 607 } 613 608 614 - drm_sched_rq_add_entity(entity->rq, entity); 609 + rq = entity->rq; 610 + sched = rq->sched; 611 + 612 + drm_sched_rq_add_entity(rq, entity); 615 613 spin_unlock(&entity->rq_lock); 616 614 617 615 if (drm_sched_policy == DRM_SCHED_POLICY_FIFO) 618 616 drm_sched_rq_update_fifo(entity, submit_ts); 619 617 620 - drm_sched_wakeup(entity->rq->sched, entity); 618 + drm_sched_wakeup(sched); 621 619 } 622 620 } 623 621 EXPORT_SYMBOL(drm_sched_entity_push_job);
+2 -5
drivers/gpu/drm/scheduler/sched_main.c
··· 1013 1013 /** 1014 1014 * drm_sched_wakeup - Wake up the scheduler if it is ready to queue 1015 1015 * @sched: scheduler instance 1016 - * @entity: the scheduler entity 1017 1016 * 1018 1017 * Wake up the scheduler if we can queue jobs. 1019 1018 */ 1020 - void drm_sched_wakeup(struct drm_gpu_scheduler *sched, 1021 - struct drm_sched_entity *entity) 1019 + void drm_sched_wakeup(struct drm_gpu_scheduler *sched) 1022 1020 { 1023 - if (drm_sched_can_queue(sched, entity)) 1024 - drm_sched_run_job_queue(sched); 1021 + drm_sched_run_job_queue(sched); 1025 1022 } 1026 1023 1027 1024 /**
+9 -1
drivers/gpu/drm/vboxvideo/hgsmi_base.c
··· 139 139 flags |= VBOX_MOUSE_POINTER_VISIBLE; 140 140 } 141 141 142 - p = hgsmi_buffer_alloc(ctx, sizeof(*p) + pixel_len, HGSMI_CH_VBVA, 142 + /* 143 + * The 4 extra bytes come from switching struct vbva_mouse_pointer_shape 144 + * from having a 4 bytes fixed array at the end to using a proper VLA 145 + * at the end. These 4 extra bytes were not subtracted from sizeof(*p) 146 + * before the switch to the VLA, so this way the behavior is unchanged. 147 + * Chances are these 4 extra bytes are not necessary but they are kept 148 + * to avoid regressions. 149 + */ 150 + p = hgsmi_buffer_alloc(ctx, sizeof(*p) + pixel_len + 4, HGSMI_CH_VBVA, 143 151 VBVA_MOUSE_POINTER_SHAPE); 144 152 if (!p) 145 153 return -ENOMEM;
+1 -3
drivers/gpu/drm/vboxvideo/vboxvideo.h
··· 351 351 * Bytes in the gap between the AND and the XOR mask are undefined. 352 352 * XOR mask scanlines have no gap between them and size of XOR mask is: 353 353 * xor_len = width * 4 * height. 354 - * 355 - * Preallocate 4 bytes for accessing actual data as p->data. 356 354 */ 357 - u8 data[4]; 355 + u8 data[]; 358 356 } __packed; 359 357 360 358 /* pointer is visible */
+11
drivers/gpu/drm/xe/regs/xe_gt_regs.h
··· 169 169 #define XEHP_SLICE_COMMON_ECO_CHICKEN1 XE_REG_MCR(0x731c, XE_REG_OPTION_MASKED) 170 170 #define MSC_MSAA_REODER_BUF_BYPASS_DISABLE REG_BIT(14) 171 171 172 + #define XE2LPM_CCCHKNREG1 XE_REG(0x82a8) 173 + 172 174 #define VF_PREEMPTION XE_REG(0x83a4, XE_REG_OPTION_MASKED) 173 175 #define PREEMPTION_VERTEX_COUNT REG_GENMASK(15, 0) 174 176 ··· 380 378 #define L3SQCREG3 XE_REG_MCR(0xb108) 381 379 #define COMPPWOVERFETCHEN REG_BIT(28) 382 380 381 + #define SCRATCH3_LBCF XE_REG_MCR(0xb154) 382 + #define RWFLUSHALLEN REG_BIT(17) 383 + 383 384 #define XEHP_L3SQCREG5 XE_REG_MCR(0xb158) 384 385 #define L3_PWM_TIMER_INIT_VAL_MASK REG_GENMASK(9, 0) 385 386 ··· 395 390 396 391 #define SCRATCH1LPFC XE_REG(0xb474) 397 392 #define EN_L3_RW_CCS_CACHE_FLUSH REG_BIT(0) 393 + 394 + #define XE2LPM_L3SQCREG2 XE_REG_MCR(0xb604) 395 + 396 + #define XE2LPM_L3SQCREG3 XE_REG_MCR(0xb608) 397 + 398 + #define XE2LPM_SCRATCH3_LBCF XE_REG_MCR(0xb654) 398 399 399 400 #define XE2LPM_L3SQCREG5 XE_REG_MCR(0xb658) 400 401
+2 -2
drivers/gpu/drm/xe/xe_bo.c
··· 680 680 tt_has_data = ttm && (ttm_tt_is_populated(ttm) || 681 681 (ttm->page_flags & TTM_TT_FLAG_SWAPPED)); 682 682 683 - move_lacks_source = handle_system_ccs ? (!bo->ccs_cleared) : 684 - (!mem_type_is_vram(old_mem_type) && !tt_has_data); 683 + move_lacks_source = !old_mem || (handle_system_ccs ? (!bo->ccs_cleared) : 684 + (!mem_type_is_vram(old_mem_type) && !tt_has_data)); 685 685 686 686 needs_clear = (ttm && ttm->page_flags & TTM_TT_FLAG_ZERO_ALLOC) || 687 687 (!ttm && ttm_bo->type == ttm_bo_type_device);
+6 -6
drivers/gpu/drm/xe/xe_device.c
··· 171 171 xe_exec_queue_kill(q); 172 172 xe_exec_queue_put(q); 173 173 } 174 - mutex_lock(&xef->vm.lock); 175 174 xa_for_each(&xef->vm.xa, idx, vm) 176 175 xe_vm_close_and_put(vm); 177 - mutex_unlock(&xef->vm.lock); 178 176 179 177 xe_file_put(xef); 180 178 ··· 296 298 if (xe->unordered_wq) 297 299 destroy_workqueue(xe->unordered_wq); 298 300 301 + if (xe->destroy_wq) 302 + destroy_workqueue(xe->destroy_wq); 303 + 299 304 ttm_device_fini(&xe->ttm); 300 305 } 301 306 ··· 337 336 338 337 init_waitqueue_head(&xe->ufence_wq); 339 338 340 - err = drmm_mutex_init(&xe->drm, &xe->usm.lock); 341 - if (err) 342 - goto err; 339 + init_rwsem(&xe->usm.lock); 343 340 344 341 xa_init_flags(&xe->usm.asid_to_vm, XA_FLAGS_ALLOC); 345 342 ··· 362 363 xe->preempt_fence_wq = alloc_ordered_workqueue("xe-preempt-fence-wq", 0); 363 364 xe->ordered_wq = alloc_ordered_workqueue("xe-ordered-wq", 0); 364 365 xe->unordered_wq = alloc_workqueue("xe-unordered-wq", 0, 0); 366 + xe->destroy_wq = alloc_workqueue("xe-destroy-wq", 0, 0); 365 367 if (!xe->ordered_wq || !xe->unordered_wq || 366 - !xe->preempt_fence_wq) { 368 + !xe->preempt_fence_wq || !xe->destroy_wq) { 367 369 /* 368 370 * Cleanup done in xe_device_destroy via 369 371 * drmm_add_action_or_reset register above
+15 -4
drivers/gpu/drm/xe/xe_device_types.h
··· 369 369 /** @usm.next_asid: next ASID, used to cyclical alloc asids */ 370 370 u32 next_asid; 371 371 /** @usm.lock: protects UM state */ 372 - struct mutex lock; 372 + struct rw_semaphore lock; 373 373 } usm; 374 374 375 375 /** @pinned: pinned BO state */ ··· 395 395 396 396 /** @unordered_wq: used to serialize unordered work, mostly display */ 397 397 struct workqueue_struct *unordered_wq; 398 + 399 + /** @destroy_wq: used to serialize user destroy work, like queue */ 400 + struct workqueue_struct *destroy_wq; 398 401 399 402 /** @tiles: device tiles */ 400 403 struct xe_tile tiles[XE_MAX_TILES_PER_DEVICE]; ··· 570 567 struct { 571 568 /** @vm.xe: xarray to store VMs */ 572 569 struct xarray xa; 573 - /** @vm.lock: protects file VM state */ 570 + /** 571 + * @vm.lock: Protects VM lookup + reference and removal a from 572 + * file xarray. Not an intended to be an outer lock which does 573 + * thing while being held. 574 + */ 574 575 struct mutex lock; 575 576 } vm; 576 577 577 578 /** @exec_queue: Submission exec queue state for file */ 578 579 struct { 579 - /** @exec_queue.xe: xarray to store engines */ 580 + /** @exec_queue.xa: xarray to store exece queues */ 580 581 struct xarray xa; 581 - /** @exec_queue.lock: protects file engine state */ 582 + /** 583 + * @exec_queue.lock: Protects exec queue lookup + reference and 584 + * removal a frommfile xarray. Not an intended to be an outer 585 + * lock which does thing while being held. 586 + */ 582 587 struct mutex lock; 583 588 } exec_queue; 584 589
+8 -1
drivers/gpu/drm/xe/xe_drm_client.c
··· 283 283 284 284 /* Accumulate all the exec queues from this client */ 285 285 mutex_lock(&xef->exec_queue.lock); 286 - xa_for_each(&xef->exec_queue.xa, i, q) 286 + xa_for_each(&xef->exec_queue.xa, i, q) { 287 + xe_exec_queue_get(q); 288 + mutex_unlock(&xef->exec_queue.lock); 289 + 287 290 xe_exec_queue_update_run_ticks(q); 291 + 292 + mutex_lock(&xef->exec_queue.lock); 293 + xe_exec_queue_put(q); 294 + } 288 295 mutex_unlock(&xef->exec_queue.lock); 289 296 290 297 /* Get the total GPU cycles */
+3 -3
drivers/gpu/drm/xe/xe_exec_queue.c
··· 635 635 } 636 636 } 637 637 638 - mutex_lock(&xef->exec_queue.lock); 638 + q->xef = xe_file_get(xef); 639 + 640 + /* user id alloc must always be last in ioctl to prevent UAF */ 639 641 err = xa_alloc(&xef->exec_queue.xa, &id, q, xa_limit_32b, GFP_KERNEL); 640 - mutex_unlock(&xef->exec_queue.lock); 641 642 if (err) 642 643 goto kill_exec_queue; 643 644 644 645 args->exec_queue_id = id; 645 - q->xef = xe_file_get(xef); 646 646 647 647 return 0; 648 648
+5
drivers/gpu/drm/xe/xe_gpu_scheduler.c
··· 90 90 cancel_work_sync(&sched->work_process_msg); 91 91 } 92 92 93 + void xe_sched_submission_resume_tdr(struct xe_gpu_scheduler *sched) 94 + { 95 + drm_sched_resume_timeout(&sched->base, sched->base.timeout); 96 + } 97 + 93 98 void xe_sched_add_msg(struct xe_gpu_scheduler *sched, 94 99 struct xe_sched_msg *msg) 95 100 {
+2
drivers/gpu/drm/xe/xe_gpu_scheduler.h
··· 22 22 void xe_sched_submission_start(struct xe_gpu_scheduler *sched); 23 23 void xe_sched_submission_stop(struct xe_gpu_scheduler *sched); 24 24 25 + void xe_sched_submission_resume_tdr(struct xe_gpu_scheduler *sched); 26 + 25 27 void xe_sched_add_msg(struct xe_gpu_scheduler *sched, 26 28 struct xe_sched_msg *msg); 27 29 void xe_sched_add_msg_locked(struct xe_gpu_scheduler *sched,
+2 -2
drivers/gpu/drm/xe/xe_gt_freq.c
··· 237 237 if (!gt->freq) 238 238 return -ENOMEM; 239 239 240 - err = devm_add_action(xe->drm.dev, freq_fini, gt->freq); 240 + err = sysfs_create_files(gt->freq, freq_attrs); 241 241 if (err) 242 242 return err; 243 243 244 - err = sysfs_create_files(gt->freq, freq_attrs); 244 + err = devm_add_action_or_reset(xe->drm.dev, freq_fini, gt->freq); 245 245 if (err) 246 246 return err; 247 247
+1 -1
drivers/gpu/drm/xe/xe_gt_mcr.c
··· 439 439 if (gt->info.type == XE_GT_TYPE_MEDIA) { 440 440 drm_WARN_ON(&xe->drm, MEDIA_VER(xe) < 13); 441 441 442 - if (MEDIA_VER(xe) >= 20) { 442 + if (MEDIA_VERx100(xe) >= 1301) { 443 443 gt->steering[OADDRM].ranges = xe2lpm_gpmxmt_steering_table; 444 444 gt->steering[INSTANCE0].ranges = xe2lpm_instance0_steering_table; 445 445 } else {
+21 -18
drivers/gpu/drm/xe/xe_gt_pagefault.c
··· 185 185 return err; 186 186 } 187 187 188 + static struct xe_vm *asid_to_vm(struct xe_device *xe, u32 asid) 189 + { 190 + struct xe_vm *vm; 191 + 192 + down_read(&xe->usm.lock); 193 + vm = xa_load(&xe->usm.asid_to_vm, asid); 194 + if (vm && xe_vm_in_fault_mode(vm)) 195 + xe_vm_get(vm); 196 + else 197 + vm = ERR_PTR(-EINVAL); 198 + up_read(&xe->usm.lock); 199 + 200 + return vm; 201 + } 202 + 188 203 static int handle_pagefault(struct xe_gt *gt, struct pagefault *pf) 189 204 { 190 205 struct xe_device *xe = gt_to_xe(gt); ··· 212 197 if (pf->trva_fault) 213 198 return -EFAULT; 214 199 215 - /* ASID to VM */ 216 - mutex_lock(&xe->usm.lock); 217 - vm = xa_load(&xe->usm.asid_to_vm, pf->asid); 218 - if (vm && xe_vm_in_fault_mode(vm)) 219 - xe_vm_get(vm); 220 - else 221 - vm = NULL; 222 - mutex_unlock(&xe->usm.lock); 223 - if (!vm) 224 - return -EINVAL; 200 + vm = asid_to_vm(xe, pf->asid); 201 + if (IS_ERR(vm)) 202 + return PTR_ERR(vm); 225 203 226 204 /* 227 205 * TODO: Change to read lock? Using write lock for simplicity. ··· 556 548 if (acc->access_type != ACC_TRIGGER) 557 549 return -EINVAL; 558 550 559 - /* ASID to VM */ 560 - mutex_lock(&xe->usm.lock); 561 - vm = xa_load(&xe->usm.asid_to_vm, acc->asid); 562 - if (vm) 563 - xe_vm_get(vm); 564 - mutex_unlock(&xe->usm.lock); 565 - if (!vm || !xe_vm_in_fault_mode(vm)) 566 - return -EINVAL; 551 + vm = asid_to_vm(xe, acc->asid); 552 + if (IS_ERR(vm)) 553 + return PTR_ERR(vm); 567 554 568 555 down_read(&vm->lock); 569 556
+1 -1
drivers/gpu/drm/xe/xe_gt_sysfs.c
··· 51 51 52 52 gt->sysfs = &kg->base; 53 53 54 - return devm_add_action(xe->drm.dev, gt_sysfs_fini, gt); 54 + return devm_add_action_or_reset(xe->drm.dev, gt_sysfs_fini, gt); 55 55 }
+34 -3
drivers/gpu/drm/xe/xe_guc_submit.c
··· 276 276 } 277 277 #endif 278 278 279 + static void xe_guc_submit_fini(struct xe_guc *guc) 280 + { 281 + struct xe_device *xe = guc_to_xe(guc); 282 + struct xe_gt *gt = guc_to_gt(guc); 283 + int ret; 284 + 285 + ret = wait_event_timeout(guc->submission_state.fini_wq, 286 + xa_empty(&guc->submission_state.exec_queue_lookup), 287 + HZ * 5); 288 + 289 + drain_workqueue(xe->destroy_wq); 290 + 291 + xe_gt_assert(gt, ret); 292 + } 293 + 279 294 static void guc_submit_fini(struct drm_device *drm, void *arg) 280 295 { 281 296 struct xe_guc *guc = arg; 282 297 298 + xe_guc_submit_fini(guc); 283 299 xa_destroy(&guc->submission_state.exec_queue_lookup); 284 300 free_submit_wq(guc); 285 301 } ··· 306 290 struct xe_exec_queue *q; 307 291 unsigned long index; 308 292 309 - xa_for_each(&guc->submission_state.exec_queue_lookup, index, q) 310 - if (exec_queue_wedged(q)) 293 + mutex_lock(&guc->submission_state.lock); 294 + xa_for_each(&guc->submission_state.exec_queue_lookup, index, q) { 295 + if (exec_queue_wedged(q)) { 296 + mutex_unlock(&guc->submission_state.lock); 311 297 xe_exec_queue_put(q); 298 + mutex_lock(&guc->submission_state.lock); 299 + } 300 + } 301 + mutex_unlock(&guc->submission_state.lock); 312 302 } 313 303 314 304 static const struct xe_exec_queue_ops guc_exec_queue_ops; ··· 367 345 368 346 xa_init(&guc->submission_state.exec_queue_lookup); 369 347 348 + init_waitqueue_head(&guc->submission_state.fini_wq); 349 + 370 350 primelockdep(guc); 371 351 372 352 return drmm_add_action_or_reset(&xe->drm, guc_submit_fini, guc); ··· 385 361 386 362 xe_guc_id_mgr_release_locked(&guc->submission_state.idm, 387 363 q->guc->id, q->width); 364 + 365 + if (xa_empty(&guc->submission_state.exec_queue_lookup)) 366 + wake_up(&guc->submission_state.fini_wq); 388 367 } 389 368 390 369 static int alloc_guc_id(struct xe_guc *guc, struct xe_exec_queue *q) ··· 1295 1268 1296 1269 static void guc_exec_queue_fini_async(struct xe_exec_queue *q) 1297 1270 { 1271 + struct xe_guc *guc = exec_queue_to_guc(q); 1272 + struct xe_device *xe = guc_to_xe(guc); 1273 + 1298 1274 INIT_WORK(&q->guc->fini_async, __guc_exec_queue_fini_async); 1299 1275 1300 1276 /* We must block on kernel engines so slabs are empty on driver unload */ 1301 1277 if (q->flags & EXEC_QUEUE_FLAG_PERMANENT || exec_queue_wedged(q)) 1302 1278 __guc_exec_queue_fini_async(&q->guc->fini_async); 1303 1279 else 1304 - queue_work(system_wq, &q->guc->fini_async); 1280 + queue_work(xe->destroy_wq, &q->guc->fini_async); 1305 1281 } 1306 1282 1307 1283 static void __guc_exec_queue_fini(struct xe_guc *guc, struct xe_exec_queue *q) ··· 1826 1796 } 1827 1797 1828 1798 xe_sched_submission_start(sched); 1799 + xe_sched_submission_resume_tdr(sched); 1829 1800 } 1830 1801 1831 1802 int xe_guc_submit_start(struct xe_guc *guc)
+2
drivers/gpu/drm/xe/xe_guc_types.h
··· 81 81 #endif 82 82 /** @submission_state.enabled: submission is enabled */ 83 83 bool enabled; 84 + /** @submission_state.fini_wq: submit fini wait queue */ 85 + wait_queue_head_t fini_wq; 84 86 } submission_state; 85 87 /** @hwconfig: Hardware config state */ 86 88 struct {
+3 -6
drivers/gpu/drm/xe/xe_oa.c
··· 709 709 { 710 710 RING_CONTEXT_CONTROL(stream->hwe->mmio_base), 711 711 regs_offset + CTX_CONTEXT_CONTROL, 712 - _MASKED_FIELD(CTX_CTRL_OAC_CONTEXT_ENABLE, 713 - enable ? CTX_CTRL_OAC_CONTEXT_ENABLE : 0) 712 + _MASKED_BIT_ENABLE(CTX_CTRL_OAC_CONTEXT_ENABLE), 714 713 }, 715 714 }; 716 715 struct xe_oa_reg reg_lri = { OAR_OACONTROL, oacontrol }; ··· 741 742 { 742 743 RING_CONTEXT_CONTROL(stream->hwe->mmio_base), 743 744 regs_offset + CTX_CONTEXT_CONTROL, 744 - _MASKED_FIELD(CTX_CTRL_OAC_CONTEXT_ENABLE, 745 - enable ? CTX_CTRL_OAC_CONTEXT_ENABLE : 0) | 746 - _MASKED_FIELD(CTX_CTRL_RUN_ALONE, 747 - enable ? CTX_CTRL_RUN_ALONE : 0), 745 + _MASKED_BIT_ENABLE(CTX_CTRL_OAC_CONTEXT_ENABLE) | 746 + _MASKED_FIELD(CTX_CTRL_RUN_ALONE, enable ? CTX_CTRL_RUN_ALONE : 0), 748 747 }, 749 748 }; 750 749 struct xe_oa_reg reg_lri = { OAC_OACONTROL, oacontrol };
+2
drivers/gpu/drm/xe/xe_pci.c
··· 924 924 if (err) 925 925 return err; 926 926 927 + pci_restore_state(pdev); 928 + 927 929 err = pci_enable_device(pdev); 928 930 if (err) 929 931 return err;
+1 -1
drivers/gpu/drm/xe/xe_pt.c
··· 2188 2188 pt_op->num_entries); 2189 2189 } 2190 2190 2191 - xe_bo_put_commit(&vops->pt_update_ops[tile->id].deferred); 2191 + xe_pt_update_ops_fini(tile, vops); 2192 2192 }
+28
drivers/gpu/drm/xe/xe_tuning.c
··· 42 42 XE_RTP_ACTIONS(CLR(CCCHKNREG1, ENCOMPPERFFIX), 43 43 SET(CCCHKNREG1, L3CMPCTRL)) 44 44 }, 45 + { XE_RTP_NAME("Tuning: Compression Overfetch - media"), 46 + XE_RTP_RULES(MEDIA_VERSION(2000)), 47 + XE_RTP_ACTIONS(CLR(XE2LPM_CCCHKNREG1, ENCOMPPERFFIX), 48 + SET(XE2LPM_CCCHKNREG1, L3CMPCTRL)) 49 + }, 45 50 { XE_RTP_NAME("Tuning: Enable compressible partial write overfetch in L3"), 46 51 XE_RTP_RULES(GRAPHICS_VERSION_RANGE(2001, XE_RTP_END_VERSION_UNDEFINED)), 47 52 XE_RTP_ACTIONS(SET(L3SQCREG3, COMPPWOVERFETCHEN)) 48 53 }, 54 + { XE_RTP_NAME("Tuning: Enable compressible partial write overfetch in L3 - media"), 55 + XE_RTP_RULES(MEDIA_VERSION(2000)), 56 + XE_RTP_ACTIONS(SET(XE2LPM_L3SQCREG3, COMPPWOVERFETCHEN)) 57 + }, 49 58 { XE_RTP_NAME("Tuning: L2 Overfetch Compressible Only"), 50 59 XE_RTP_RULES(GRAPHICS_VERSION_RANGE(2001, XE_RTP_END_VERSION_UNDEFINED)), 51 60 XE_RTP_ACTIONS(SET(L3SQCREG2, 61 + COMPMEMRD256BOVRFETCHEN)) 62 + }, 63 + { XE_RTP_NAME("Tuning: L2 Overfetch Compressible Only - media"), 64 + XE_RTP_RULES(MEDIA_VERSION(2000)), 65 + XE_RTP_ACTIONS(SET(XE2LPM_L3SQCREG2, 52 66 COMPMEMRD256BOVRFETCHEN)) 53 67 }, 54 68 { XE_RTP_NAME("Tuning: Stateless compression control"), ··· 70 56 XE_RTP_ACTIONS(FIELD_SET(STATELESS_COMPRESSION_CTRL, UNIFIED_COMPRESSION_FORMAT, 71 57 REG_FIELD_PREP(UNIFIED_COMPRESSION_FORMAT, 0))) 72 58 }, 59 + { XE_RTP_NAME("Tuning: Stateless compression control - media"), 60 + XE_RTP_RULES(MEDIA_VERSION_RANGE(1301, 2000)), 61 + XE_RTP_ACTIONS(FIELD_SET(STATELESS_COMPRESSION_CTRL, UNIFIED_COMPRESSION_FORMAT, 62 + REG_FIELD_PREP(UNIFIED_COMPRESSION_FORMAT, 0))) 63 + }, 64 + { XE_RTP_NAME("Tuning: L3 RW flush all Cache"), 65 + XE_RTP_RULES(GRAPHICS_VERSION(2004)), 66 + XE_RTP_ACTIONS(SET(SCRATCH3_LBCF, RWFLUSHALLEN)) 67 + }, 68 + { XE_RTP_NAME("Tuning: L3 RW flush all cache - media"), 69 + XE_RTP_RULES(MEDIA_VERSION(2000)), 70 + XE_RTP_ACTIONS(SET(XE2LPM_SCRATCH3_LBCF, RWFLUSHALLEN)) 71 + }, 72 + 73 73 {} 74 74 }; 75 75
+12 -16
drivers/gpu/drm/xe/xe_vm.c
··· 1613 1613 1614 1614 up_write(&vm->lock); 1615 1615 1616 - mutex_lock(&xe->usm.lock); 1616 + down_write(&xe->usm.lock); 1617 1617 if (vm->usm.asid) { 1618 1618 void *lookup; 1619 1619 ··· 1623 1623 lookup = xa_erase(&xe->usm.asid_to_vm, vm->usm.asid); 1624 1624 xe_assert(xe, lookup == vm); 1625 1625 } 1626 - mutex_unlock(&xe->usm.lock); 1626 + up_write(&xe->usm.lock); 1627 1627 1628 1628 for_each_tile(tile, xe, id) 1629 1629 xe_range_fence_tree_fini(&vm->rftree[id]); ··· 1765 1765 if (IS_ERR(vm)) 1766 1766 return PTR_ERR(vm); 1767 1767 1768 - mutex_lock(&xef->vm.lock); 1769 - err = xa_alloc(&xef->vm.xa, &id, vm, xa_limit_32b, GFP_KERNEL); 1770 - mutex_unlock(&xef->vm.lock); 1771 - if (err) 1772 - goto err_close_and_put; 1773 - 1774 1768 if (xe->info.has_asid) { 1775 - mutex_lock(&xe->usm.lock); 1769 + down_write(&xe->usm.lock); 1776 1770 err = xa_alloc_cyclic(&xe->usm.asid_to_vm, &asid, vm, 1777 1771 XA_LIMIT(1, XE_MAX_ASID - 1), 1778 1772 &xe->usm.next_asid, GFP_KERNEL); 1779 - mutex_unlock(&xe->usm.lock); 1773 + up_write(&xe->usm.lock); 1780 1774 if (err < 0) 1781 - goto err_free_id; 1775 + goto err_close_and_put; 1782 1776 1783 1777 vm->usm.asid = asid; 1784 1778 } 1785 1779 1786 - args->vm_id = id; 1787 1780 vm->xef = xe_file_get(xef); 1788 1781 1789 1782 /* Record BO memory for VM pagetable created against client */ ··· 1789 1796 args->reserved[0] = xe_bo_main_addr(vm->pt_root[0]->bo, XE_PAGE_SIZE); 1790 1797 #endif 1791 1798 1799 + /* user id alloc must always be last in ioctl to prevent UAF */ 1800 + err = xa_alloc(&xef->vm.xa, &id, vm, xa_limit_32b, GFP_KERNEL); 1801 + if (err) 1802 + goto err_close_and_put; 1803 + 1804 + args->vm_id = id; 1805 + 1792 1806 return 0; 1793 1807 1794 - err_free_id: 1795 - mutex_lock(&xef->vm.lock); 1796 - xa_erase(&xef->vm.xa, id); 1797 - mutex_unlock(&xef->vm.lock); 1798 1808 err_close_and_put: 1799 1809 xe_vm_close_and_put(vm); 1800 1810
+1 -1
include/drm/gpu_scheduler.h
··· 574 574 575 575 void drm_sched_tdr_queue_imm(struct drm_gpu_scheduler *sched); 576 576 void drm_sched_job_cleanup(struct drm_sched_job *job); 577 - void drm_sched_wakeup(struct drm_gpu_scheduler *sched, struct drm_sched_entity *entity); 577 + void drm_sched_wakeup(struct drm_gpu_scheduler *sched); 578 578 bool drm_sched_wqueue_ready(struct drm_gpu_scheduler *sched); 579 579 void drm_sched_wqueue_stop(struct drm_gpu_scheduler *sched); 580 580 void drm_sched_wqueue_start(struct drm_gpu_scheduler *sched);
+9
include/linux/hdmi.h
··· 59 59 #define HDMI_DRM_INFOFRAME_SIZE 26 60 60 #define HDMI_VENDOR_INFOFRAME_SIZE 4 61 61 62 + /* 63 + * HDMI 1.3a table 5-14 states that the largest InfoFrame_length is 27, 64 + * not including the packet header or checksum byte. We include the 65 + * checksum byte in HDMI_INFOFRAME_HEADER_SIZE, so this should allow 66 + * HDMI_INFOFRAME_SIZE(MAX) to be the largest buffer we could ever need 67 + * for any HDMI infoframe. 68 + */ 69 + #define HDMI_MAX_INFOFRAME_SIZE 27 70 + 62 71 #define HDMI_INFOFRAME_SIZE(type) \ 63 72 (HDMI_INFOFRAME_HEADER_SIZE + HDMI_ ## type ## _INFOFRAME_SIZE) 64 73