drm: allow encoder mode_set even when connectors change for crtc
Subsystems (7)
Sasha Levin
maintainerPATCH 1/23 drm: allow encoder mode_set even when connectors change for crtc
From: Abhinav Kumar <[email protected]>
[ Upstream commit 7e182cb4f5567f53417b762ec0d679f0b6f0039d ]
In certain use-cases, a CRTC could switch between two encoders and because the mode being programmed on the CRTC remains the same during this switch, the CRTC's mode_changed remains false. In such cases, the encoder's mode_set also gets skipped.
Skipping mode_set on the encoder for such cases could cause an issue because even though the same CRTC mode was being used, the encoder type could have changed like the CRTC could have switched from a real time encoder to a writeback encoder OR vice-versa.
Allow encoder's mode_set to happen even when connectors changed on a CRTC and not just when the mode changed.
--- drivers/gpu/drm/drm_atomic_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_atomic_helper.c +1 -1
@@ -1373,7 +1373,7 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state) mode = &new_crtc_state->mode; adjusted_mode = &new_crtc_state->adjusted_mode; -if (!new_crtc_state->mode_changed) +if (!new_crtc_state->mode_changed && !new_crtc_state->connectors_changed)continue ; drm_dbg_atomic(dev, "modeset on [ENCODER:%d:%s]\n",
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 2/23 drm/amd/display: Update Cursor request mode to the beginning prefetch always
From: Zhikai Zhai <[email protected]>
[ Upstream commit 4a4077b4b63a8404efd6d37fc2926f03fb25bace ]
[Why]
The double buffer cursor registers is updated by the cursor vupdate event. There is a gap between vupdate and cursor data fetch if cursor fetch data reletive to cursor position. Cursor corruption will happen if we update the cursor surface in this gap.
[How]
Modify the cursor request mode to the beginning prefetch always and avoid wraparound calculation issues.
--- .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 22 ++++++++----------- .../gpu/drm/amd/display/dc/dcn31/dcn31_hubp.c | 2 +- 2 files changed, 10 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +9 -13
@@ -1930,20 +1930,11 @@ static void delay_cursor_until_vupdate(struct dc *dc, struct pipe_ctx *pipe_ctx) dc->hwss.get_position (&pipe_ctx,1 , &position); vpos = position.vertical_count; -/* Avoid wraparound calculation issues */ - vupdate_start += stream->timing.v_total; - vupdate_end += stream->timing.v_total; - vpos += stream->timing.v_total; -if (vpos <= vupdate_start) {/* VPOS is in VACTIVE or back porch. */ lines_to_vupdate = vupdate_start - vpos; - }else if (vpos > vupdate_end) { -/* VPOS is in the front porch. */ -return ; }else { -/* VPOS is in VUPDATE. */ - lines_to_vupdate =0 ; + lines_to_vupdate = stream->timing.v_total - vpos + vupdate_start; }/* Calculate time until VUPDATE in microseconds. */
@@ -1951,13 +1942,18 @@ static void delay_cursor_until_vupdate(struct dc *dc, struct pipe_ctx *pipe_ctx) stream->timing.h_total *10000u / stream->timing.pix_clk_100hz; us_to_vupdate = lines_to_vupdate * us_per_line; +/* Stall out until the cursor update completes. */ +if (vupdate_end < vupdate_start) + vupdate_end += stream->timing.v_total; + +/* Position is in the range of vupdate start and end*/ +if (lines_to_vupdate > stream->timing.v_total - vupdate_end + vupdate_start) + us_to_vupdate =0 ; +/* 70 us is a conservative estimate of cursor update time*/ if (us_to_vupdate >70 )return ; -/* Stall out until the cursor update completes. */ -if (vupdate_end < vupdate_start) - vupdate_end += stream->timing.v_total; us_vupdate = (vupdate_end - vupdate_start +1 ) * us_per_line;udelay (us_to_vupdate + us_vupdate); }
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hubp.c +1 -1
@@ -44,7 +44,7 @@ void hubp31_set_unbounded_requesting(struct hubp *hubp, bool enable)struct dcn20_hubp *hubp2 =TO_DCN20_HUBP (hubp);REG_UPDATE (DCHUBP_CNTL ,HUBP_UNBOUNDED_REQ_MODE , enable); -REG_UPDATE (CURSOR_CONTROL ,CURSOR_REQ_MODE , enable); +REG_UPDATE (CURSOR_CONTROL ,CURSOR_REQ_MODE ,1 ); }void hubp31_soft_reset (struct hubp *hubp,bool reset)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 3/23 drm/amd/display: add workaround flag to link to force FFE preset
In reply to Sasha LevinFrom: Brendan Tam <[email protected]>
[ Upstream commit 51d1b338541dea83fec8e6f95d3e46fa469a73a8 ]
[Why]
There have been instances of some monitors being unable to link train on their reported link speed using their selected FFE preset. If a different FFE preset is found that has a higher rate of success during link training this workaround can be used to force its FFE preset.
[How]
A new link workaround flag is made called force_dp_ffe_preset. The flag is checked in override_training_settings and will set lt_settings->ffe_preset which is null if the flag is not set. The flag is then set in override_lane_settings.
--- drivers/gpu/drm/amd/display/dc/dc.h | 2 ++ .../gpu/drm/amd/display/dc/link/protocols/link_dp_training.c | 2 ++ 2 files changed, 4 insertions(+)
drivers/gpu/drm/amd/display/dc/dc.h +2 -0
@@ -1563,7 +1563,9 @@ struct dc_link {bool dongle_mode_timing_override;bool blank_stream_on_ocs_change;bool read_dpcd204h_on_irq_hpd; +bool force_dp_ffe_preset; } wa_flags; +union dc_dp_ffe_preset forced_dp_ffe_preset;struct link_mst_stream_allocation_table mst_stream_alloc_table;struct dc_link_status link_status;
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.c +2 -0
@@ -697,6 +697,8 @@ void override_training_settings( lt_settings->pre_emphasis = overrides->pre_emphasis;if (overrides->post_cursor2 !=NULL ) lt_settings->post_cursor2 = overrides->post_cursor2; +if (link->wa_flags.force_dp_ffe_preset && !dp_is_lttpr_present (link)) + lt_settings->ffe_preset = &link->forced_dp_ffe_preset;if (overrides->ffe_preset !=NULL ) lt_settings->ffe_preset = overrides->ffe_preset;/* Override HW lane settings with BIOS forced values if present */
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 4/23 drm: panel-orientation-quirks: Add support for AYANEO 2S
In reply to Sasha LevinFrom: Andrew Wyatt <[email protected]>
[ Upstream commit eb8f1e3e8ee10cff591d4a47437dfd34d850d454 ]
AYANEO 2S uses the same panel and orientation as the AYANEO 2.
Update the AYANEO 2 DMI match to also match AYANEO 2S.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_panel_orientation_quirks.c +2 -2
@@ -184,10 +184,10 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T103HAF"), }, .driver_data = (void *)&lcd800x1280_rightside_up, - }, { /* AYA NEO AYANEO 2 */ + }, { /* AYA NEO AYANEO 2/2S */ .matches = {DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"AYANEO" ), - DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "AYANEO 2"), + DMI_MATCH(DMI_PRODUCT_NAME, "AYANEO 2"), }, .driver_data = (void *)&lcd1200x1920_rightside_up, }, { /* AYA NEO 2021 */
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 5/23 drm: panel-orientation-quirks: Add quirks for AYA NEO Flip DS and KB
In reply to Sasha LevinFrom: Andrew Wyatt <[email protected]>
[ Upstream commit 529741c331da1fbf54f86c6ec3a4558b9b0b16dc ]
The AYA NEO Flip DS and KB both use a 1080x1920 portrait LCD panel. The Flip DS additionally uses a 640x960 portrait LCD panel as a second display.
Add DMI matches to correctly rotate these panels.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +18 -0
@@ -93,6 +93,12 @@ static const struct drm_dmi_panel_orientation_data onegx1_pro = { .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, }; +static const struct drm_dmi_panel_orientation_data lcd640x960_leftside_up = { + .width =640 , + .height =960 , + .orientation =DRM_MODE_PANEL_ORIENTATION_LEFT_UP , +}; +static const struct drm_dmi_panel_orientation_data lcd720x1280_rightside_up = { .width =720 , .height =1280 ,
@@ -202,6 +208,18 @@ static const struct dmi_system_id orientation_data[] = { DMI_MATCH(DMI_PRODUCT_NAME, "AIR"), }, .driver_data = (void *)&lcd1080x1920_leftside_up, + }, { /* AYA NEO Flip DS Bottom Screen */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"AYANEO" ), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "FLIP DS"), + }, + .driver_data = (void *)&lcd640x960_leftside_up, + }, { /* AYA NEO Flip KB/DS Top Screen */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"AYANEO" ), + DMI_MATCH(DMI_PRODUCT_NAME, "FLIP"), + }, + .driver_data = (void *)&lcd1080x1920_leftside_up, }, { /* AYA NEO Founder */ .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "AYA NEO"),
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 6/23 drm: panel-orientation-quirks: Add quirk for AYA NEO Slide
In reply to Sasha LevinFrom: Andrew Wyatt <[email protected]>
[ Upstream commit 132c89ef8872e602cfb909377815111d121fe8d7 ]
The AYANEO Slide uses a 1080x1920 portrait LCD panel. This is the same panel used on the AYANEO Air Plus, but the DMI data is too different to match both with one entry.
Add a DMI match to correctly rotate the panel on the AYANEO Slide.
This also covers the Antec Core HS, which is a rebranded AYANEO Slide with the exact same hardware and DMI strings.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +6 -0
@@ -244,6 +244,12 @@ static const struct dmi_system_id orientation_data[] = { DMI_MATCH(DMI_BOARD_NAME, "KUN"), }, .driver_data = (void *)&lcd1600x2560_rightside_up, + }, { /* AYA NEO SLIDE */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"AYANEO" ), + DMI_MATCH(DMI_PRODUCT_NAME, "SLIDE"), + }, + .driver_data = (void *)&lcd1080x1920_leftside_up, }, { /* AYN Loki Max */ .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ayn"),
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 7/23 drm: panel-orientation-quirks: Add new quirk for GPD Win 2
In reply to Sasha LevinFrom: Andrew Wyatt <[email protected]>
[ Upstream commit a860eb9c6ba6cdbf32e3e01a606556e5a90a2931 ]
Some GPD Win 2 units shipped with the correct DMI strings.
Add a DMI match to correctly rotate the panel on these units.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +6 -0
@@ -339,6 +339,12 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_BOARD_NAME, "Default string"), }, .driver_data = (void *)&gpd_win2, + }, { /* GPD Win 2 (correct DMI strings) */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"GPD" ), +DMI_EXACT_MATCH (DMI_PRODUCT_NAME ,"WIN2" ) + }, + .driver_data = (void *)&lcd720x1280_rightside_up, }, { /* GPD Win 3 */ .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "GPD"),
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 8/23 drm: panel-orientation-quirks: Add quirk for OneXPlayer Mini (Intel)
In reply to Sasha LevinFrom: Andrew Wyatt <[email protected]>
[ Upstream commit b24dcc183583fc360ae0f0899e286a68f46abbd0 ]
The Intel model of the OneXPlayer Mini uses a 1200x1920 portrait LCD panel. The DMI strings are the same as the OneXPlayer, which already has a DMI quirk, but the panel is different.
Add a DMI match to correctly rotate this panel.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +12 -0
@@ -129,6 +129,12 @@ static const struct drm_dmi_panel_orientation_data lcd1080x1920_rightside_up = { .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, }; +static const struct drm_dmi_panel_orientation_data lcd1200x1920_leftside_up = { + .width =1200 , + .height =1920 , + .orientation =DRM_MODE_PANEL_ORIENTATION_LEFT_UP , +}; +static const struct drm_dmi_panel_orientation_data lcd1200x1920_rightside_up = { .width =1200 , .height =1920 ,
@@ -473,6 +479,12 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "ONE XPLAYER"), }, .driver_data = (void *)&lcd1600x2560_leftside_up, + }, { /* OneXPlayer Mini (Intel) */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"ONE-NETBOOK TECHNOLOGY CO., LTD." ), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "ONE XPLAYER"), + }, + .driver_data = (void *)&lcd1200x1920_leftside_up, }, { /* OrangePi Neo */ .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "OrangePi"),
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 9/23 drm/bridge: panel: forbid initializing a panel with unknown connector type
In reply to Sasha LevinFrom: Luca Ceresoli <[email protected]>
[ Upstream commit b296955b3a740ecc8b3b08e34fd64f1ceabb8fb4 ]
Having an DRM_MODE_CONNECTOR_Unknown connector type is considered bad, and drm_panel_bridge_add_typed() and derivatives are deprecated for this.
drm_panel_init() won't prevent initializing a panel with a DRM_MODE_CONNECTOR_Unknown connector type. Luckily there are no in-tree users doing it, so take this as an opportinuty to document a valid connector type must be passed.
Returning an error if this rule is violated is not possible because drm_panel_init() is a void function. Add at least a warning to make any violations noticeable, especially to non-upstream drivers.
--- drivers/gpu/drm/drm_panel.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_panel.c +4 -1
@@ -49,7 +49,7 @@ static LIST_HEAD(panel_list);* @dev: parent device of the panel * @funcs: panel operations * @connector_type: the connector type (DRM_MODE_CONNECTOR_*) corresponding to -* the panel interface +* the panel interface (must NOT be DRM_MODE_CONNECTOR_Unknown) * * Initialize the panel structure for subsequent registration with * drm_panel_add().
@@ -57,6 +57,9 @@ static LIST_HEAD(panel_list);void drm_panel_init (struct drm_panel *panel,struct device *dev,const struct drm_panel_funcs *funcs,int connector_type) { +if (connector_type == DRM_MODE_CONNECTOR_Unknown) +DRM_WARN ("%s: %s: a valid connector type is required!\n" , __func__,dev_name (dev)); +INIT_LIST_HEAD (&panel->list);INIT_LIST_HEAD (&panel->followers);mutex_init (&panel->follower_lock);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 10/23 drivers: base: devres: Allow to release group on device release
In reply to Sasha LevinFrom: Lucas De Marchi <[email protected]>
[ Upstream commit 8e1ddfada4530939a8cb64ee9251aef780474274 ]
When releasing a device, if the release action causes a group to be released, a warning is emitted because it can't find the group. This happens because devres_release_all() moves the entire list to a todo list and also move the group markers. Considering r* normal resource nodes and g1 a group resource node:
g1 -----------. v v r1 -> r2 -> g1[0] -> r3-> g[1] -> r4
After devres_release_all(), dev->devres_head becomes empty and the todo list it iterates on becomes:
g1 v r1 -> r2 -> r3-> r4 -> g1[0]
When a call to component_del() is made and takes down the aggregate device, a warning like this happen:
RIP: 0010:devres_release_group+0x362/0x530 ... Call Trace: <TASK> component_unbind+0x156/0x380 component_unbind_all+0x1d0/0x270 mei_component_master_unbind+0x28/0x80 [mei_hdcp] take_down_aggregate_device+0xc1/0x160 component_del+0x1c6/0x3e0 intel_hdcp_component_fini+0xf1/0x170 [xe] xe_display_fini+0x1e/0x40 [xe]
Because the devres group corresponding to the hdcp component cannot be found. Just ignore this corner case: if the dev->devres_head is empty and the caller is trying to remove a group, it's likely in the process of device cleanup so just ignore it instead of warning.
--- drivers/base/devres.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/base/devres.c +7 -0
@@ -687,6 +687,13 @@ int devres_release_group(struct device *dev, void *id)spin_unlock_irqrestore (&dev->devres_lock, flags);release_nodes (dev, &todo); + }else if (list_empty (&dev->devres_head)) { +/* +* dev is probably dying via devres_release_all(): groups +* have already been removed and are on the process of +* being released - don't touch and don't warn. +*/ +spin_unlock_irqrestore (&dev->devres_lock, flags); }else {WARN_ON (1 );spin_unlock_irqrestore (&dev->devres_lock, flags);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 11/23 drm/amdkfd: clamp queue size to minimum
In reply to Sasha LevinFrom: David Yat Sin <[email protected]>
[ Upstream commit e90711946b53590371ecce32e8fcc381a99d6333 ]
If queue size is less than minimum, clamp it to minimum to prevent underflow when writing queue mqd.
--- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 10 ++++++++++ include/uapi/linux/kfd_ioctl.h | 2 ++ 2 files changed, 12 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +10 -0
@@ -212,6 +212,11 @@ static int set_queue_properties_from_user(struct queue_properties *q_properties,return -EINVAL ; } +if (args->ring_size <KFD_MIN_QUEUE_RING_SIZE ) { + args->ring_size =KFD_MIN_QUEUE_RING_SIZE ; +pr_debug ("Size lower. clamped to KFD_MIN_QUEUE_RING_SIZE" ); + } +if (!access_ok ((const void __user *) args->read_pointer_address,sizeof (uint32_t ))) {pr_err ("Can't access read pointer\n" );
@@ -477,6 +482,11 @@ static int kfd_ioctl_update_queue(struct file *filp, struct kfd_process *p,return -EINVAL ; } +if (args->ring_size <KFD_MIN_QUEUE_RING_SIZE ) { + args->ring_size =KFD_MIN_QUEUE_RING_SIZE ; +pr_debug ("Size lower. clamped to KFD_MIN_QUEUE_RING_SIZE" ); + } + properties.queue_address = args->ring_base_address; properties.queue_size = args->ring_size; properties.queue_percent = args->queue_percentage &0xFF ;
include/uapi/linux/kfd_ioctl.h +2 -0
@@ -58,6 +58,8 @@ struct kfd_ioctl_get_version_args {#define KFD_MAX_QUEUE_PERCENTAGE 100#define KFD_MAX_QUEUE_PRIORITY 15 +#define KFD_MIN_QUEUE_RING_SIZE 1024 +struct kfd_ioctl_create_queue_args {__u64 ring_base_address;/* to KFD */ __u64 write_pointer_address;/* from KFD */
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 12/23 drm/amdkfd: Fix mode1 reset crash issue
In reply to Sasha LevinFrom: Philip Yang <[email protected]>
[ Upstream commit f0b4440cdc1807bb6ec3dce0d6de81170803569b ]
If HW scheduler hangs and mode1 reset is used to recover GPU, KFD signal user space to abort the processes. After process abort exit, user queues still use the GPU to access system memory before h/w is reset while KFD cleanup worker free system memory and free VRAM.
There is use-after-free race bug that KFD allocate and reuse the freed system memory, and user queue write to the same system memory to corrupt the data structure and cause driver crash.
To fix this race, KFD cleanup worker terminate user queues, then flush reset_domain wq to wait for any GPU ongoing reset complete, and then free outstanding BOs.
--- drivers/gpu/drm/amd/amdkfd/kfd_process.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_process.c +17 -0
@@ -35,6 +35,7 @@#include <linux/pm_runtime.h> #include "amdgpu_amdkfd.h" #include "amdgpu.h" +#include "amdgpu_reset.h" struct mm_struct ;
@@ -1110,6 +1111,17 @@ static void kfd_process_remove_sysfs(struct kfd_process *p) p->kobj =NULL ; } +/* +* If any GPU is ongoing reset, wait for reset complete. +*/ +static void kfd_process_wait_gpu_reset_complete (struct kfd_process *p) +{ +int i; + +for (i =0 ; i < p->n_pdds; i++) +flush_workqueue (p->pdds[i]->dev->adev->reset_domain->wq); +} +/* No process locking is needed in this function, because the process * is not findable any more. We must assume that no other thread is * using it any more, otherwise we couldn't safely free the process
@@ -1123,6 +1135,11 @@ static void kfd_process_wq_release(struct work_struct *work)kfd_process_dequeue_from_all_devices (p);pqm_uninit (&p->pqm); +/* +* If GPU in reset, user queues may still running, wait for reset complete. +*/ +kfd_process_wait_gpu_reset_complete (p); +/* Signal the eviction fence after user mode queues are * destroyed. This allows any BOs to be freed without * triggering pointless evictions or waiting for fences.
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 13/23 drm/amdkfd: Fix pqm_destroy_queue race with GPU reset
In reply to Sasha LevinFrom: Philip Yang <[email protected]>
[ Upstream commit 7919b4cad5545ed93778f11881ceee72e4dbed66 ]
If GPU in reset, destroy_queue return -EIO, pqm_destroy_queue should delete the queue from process_queue_list and free the resource.
--- drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +1 -1
@@ -494,7 +494,7 @@ int pqm_destroy_queue(struct process_queue_manager *pqm, unsigned int qid)pr_err ("Pasid 0x%x destroy queue %d failed, ret %d\n" , pqm->process->pasid, pqn->q->properties.queue_id, retval); -if (retval != -ETIME ) +if (retval != -ETIME && retval != -EIO ) goto err_destroy_queue; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 14/23 drm/amdkfd: debugfs hang_hws skip GPU with MES
In reply to Sasha LevinFrom: Philip Yang <[email protected]>
[ Upstream commit fe9d0061c413f8fb8c529b18b592b04170850ded ]
debugfs hang_hws is used by GPU reset test with HWS, for MES this crash the kernel with NULL pointer access because dqm->packet_mgr is not setup for MES path.
Skip GPU with MES for now, MES hang_hws debugfs interface will be supported later.
--- drivers/gpu/drm/amd/amdkfd/kfd_device.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +5 -0
@@ -1388,6 +1388,11 @@ int kfd_debugfs_hang_hws(struct kfd_node *dev)return -EINVAL ; } +if (dev->kfd->shared_resources.enable_mes) { +dev_err (dev->adev->dev,"Inducing MES hang is not supported\n" ); +return -EINVAL ; + } +return dqm_debugfs_hang_hws (dev->dqm); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 15/23 drm/mediatek: mtk_dpi: Move the input_2p_en bit to platform data
In reply to Sasha LevinFrom: AngeloGioacchino Del Regno <[email protected]>
[ Upstream commit c90876a695dd83e76680b88b40067275a5982811 ]
In preparation for adding support for MT8195's HDMI reserved DPI instance, move the input_2p_en bit for DP_INTF to platform data.
While at it, remove the input_2pixel member from platform data as having this bit implies that the 2pixel feature must be enabled.
--- drivers/gpu/drm/mediatek/mtk_dpi.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/mediatek/mtk_dpi.c +7 -7
@@ -127,14 +127,14 @@ struct mtk_dpi_yc_limit {* @is_ck_de_pol: Support CK/DE polarity. * @swap_input_support: Support input swap function. * @support_direct_pin: IP supports direct connection to dpi panels. -* @input_2pixel: Input pixel of dp_intf is 2 pixel per round, so enable this -* config to enable this feature. * @dimension_mask: Mask used for HWIDTH, HPORCH, VSYNC_WIDTH and VSYNC_PORCH * (no shift). * @hvsize_mask: Mask of HSIZE and VSIZE mask (no shift). * @channel_swap_shift: Shift value of channel swap. * @yuv422_en_bit: Enable bit of yuv422. * @csc_enable_bit: Enable bit of CSC. +* @input_2p_en_bit: Enable bit for input two pixel per round feature. +* If present, implies that the feature must be enabled. * @pixels_per_iter: Quantity of transferred pixels per iteration. * @edge_cfg_in_mmsys: If the edge configuration for DPI's output needs to be set in MMSYS. */
@@ -148,12 +148,12 @@ struct mtk_dpi_conf {bool is_ck_de_pol;bool swap_input_support;bool support_direct_pin; -bool input_2pixel;u32 dimension_mask;u32 hvsize_mask;u32 channel_swap_shift;u32 yuv422_en_bit;u32 csc_enable_bit; +u32 input_2p_en_bit;u32 pixels_per_iter;bool edge_cfg_in_mmsys; };
@@ -610,9 +610,9 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi,mtk_dpi_dual_edge (dpi);mtk_dpi_config_disable_edge (dpi); } -if (dpi->conf->input_2pixel) { -mtk_dpi_mask (dpi,DPI_CON ,DPINTF_INPUT_2P_EN , -DPINTF_INPUT_2P_EN ); +if (dpi->conf->input_2p_en_bit) { +mtk_dpi_mask (dpi,DPI_CON , dpi->conf->input_2p_en_bit, + dpi->conf->input_2p_en_bit); }mtk_dpi_sw_reset (dpi, false);
@@ -980,12 +980,12 @@ static const struct mtk_dpi_conf mt8195_dpintf_conf = { .output_fmts = mt8195_output_fmts, .num_output_fmts = ARRAY_SIZE(mt8195_output_fmts), .pixels_per_iter = 4, - .input_2pixel = true, .dimension_mask = DPINTF_HPW_MASK, .hvsize_mask = DPINTF_HSIZE_MASK, .channel_swap_shift = DPINTF_CH_SWAP, .yuv422_en_bit = DPINTF_YUV422_EN, .csc_enable_bit = DPINTF_CSC_ENABLE, + .input_2p_en_bit = DPINTF_INPUT_2P_EN, };static int mtk_dpi_probe (struct platform_device *pdev)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 16/23 drm/mediatek: mtk_dpi: Explicitly manage TVD clock in power on/off
In reply to Sasha LevinFrom: AngeloGioacchino Del Regno <[email protected]>
[ Upstream commit 473c33f5ce651365468503c76f33158aaa1c7dd2 ]
In preparation for adding support for MT8195's HDMI reserved DPI, add calls to clk_prepare_enable() / clk_disable_unprepare() for the TVD clock: in this particular case, the aforementioned clock is not (and cannot be) parented to neither pixel or engine clocks hence it won't get enabled automatically by the clock framework.
Please note that on all of the currently supported MediaTek platforms, the TVD clock is always a parent of either pixel or engine clocks, and this means that the common clock framework is already enabling this clock before the children. On such platforms, this commit will only increase the refcount of the TVD clock without any functional change.
--- drivers/gpu/drm/mediatek/mtk_dpi.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/gpu/drm/mediatek/mtk_dpi.c +9 -0
@@ -471,6 +471,7 @@ static void mtk_dpi_power_off(struct mtk_dpi *dpi)mtk_dpi_disable (dpi);clk_disable_unprepare (dpi->pixel_clk); +clk_disable_unprepare (dpi->tvd_clk);clk_disable_unprepare (dpi->engine_clk); }
@@ -487,6 +488,12 @@ static int mtk_dpi_power_on(struct mtk_dpi *dpi) goto err_refcount; } + ret =clk_prepare_enable (dpi->tvd_clk); +if (ret) { +dev_err (dpi->dev,"Failed to enable tvd pll: %d\n" , ret); + goto err_engine; + } + ret =clk_prepare_enable (dpi->pixel_clk);if (ret) {dev_err (dpi->dev,"Failed to enable pixel clock: %d\n" , ret);
@@ -496,6 +503,8 @@ static int mtk_dpi_power_on(struct mtk_dpi *dpi)return 0 ; err_pixel: +clk_disable_unprepare (dpi->tvd_clk); +err_engine:clk_disable_unprepare (dpi->engine_clk); err_refcount: dpi->refcount--;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 17/23 drm/amdgpu: handle amdgpu_cgs_create_device() errors in amd_powerplay_create()
In reply to Sasha LevinFrom: Wentao Liang <[email protected]>
[ Upstream commit 1435e895d4fc967d64e9f5bf81e992ac32f5ac76 ]
Add error handling to propagate amdgpu_cgs_create_device() failures to the caller. When amdgpu_cgs_create_device() fails, release hwmgr and return -ENOMEM to prevent null pointer dereference.
[v1]->[v2]: Change error code from -EINVAL to -ENOMEM. Free hwmgr.
--- drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c +5 -0
@@ -51,6 +51,11 @@ static int amd_powerplay_create(struct amdgpu_device *adev) hwmgr->adev = adev; hwmgr->not_vf = !amdgpu_sriov_vf (adev); hwmgr->device =amdgpu_cgs_create_device (adev); +if (!hwmgr->device) { +kfree (hwmgr); +return -ENOMEM ; + } +mutex_init (&hwmgr->msg_lock); hwmgr->chip_family = adev->family; hwmgr->chip_id = adev->asic_type;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 18/23 PCI: vmd: Make vmd_dev::cfg_lock a raw_spinlock_t type
In reply to Sasha LevinFrom: Ryo Takakura <[email protected]>
[ Upstream commit 18056a48669a040bef491e63b25896561ee14d90 ]
The access to the PCI config space via pci_ops::read and pci_ops::write is a low-level hardware access. The functions can be accessed with disabled interrupts even on PREEMPT_RT. The pci_lock is a raw_spinlock_t for this purpose.
A spinlock_t becomes a sleeping lock on PREEMPT_RT, so it cannot be acquired with disabled interrupts. The vmd_dev::cfg_lock is accessed in the same context as the pci_lock.
Make vmd_dev::cfg_lock a raw_spinlock_t type so it can be used with interrupts disabled.
This was reported as:
BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48 Call Trace: rt_spin_lock+0x4e/0x130 vmd_pci_read+0x8d/0x100 [vmd] pci_user_read_config_byte+0x6f/0xe0 pci_read_config+0xfe/0x290 sysfs_kf_bin_read+0x68/0x90
[bhelgaas: add back report info from
https://lore.kernel.org/lkml/[email protected]/]
--- drivers/pci/controller/vmd.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/pci/controller/vmd.c +6 -6
@@ -125,7 +125,7 @@ struct vmd_irq_list {struct vmd_dev {struct pci_dev *dev; -spinlock_t cfg_lock; +raw_spinlock_t cfg_lock;void __iomem *cfgbar;int msix_count;
@@ -402,7 +402,7 @@ static int vmd_pci_read(struct pci_bus *bus, unsigned int devfn, int reg,if (!addr)return -EFAULT ; -spin_lock_irqsave (&vmd->cfg_lock, flags); +raw_spin_lock_irqsave (&vmd->cfg_lock, flags);switch (len) {case 1 : *value =readb (addr);
@@ -417,7 +417,7 @@ static int vmd_pci_read(struct pci_bus *bus, unsigned int devfn, int reg, ret = -EINVAL ;break ; } -spin_unlock_irqrestore (&vmd->cfg_lock, flags); +raw_spin_unlock_irqrestore (&vmd->cfg_lock, flags);return ret; }
@@ -437,7 +437,7 @@ static int vmd_pci_write(struct pci_bus *bus, unsigned int devfn, int reg,if (!addr)return -EFAULT ; -spin_lock_irqsave (&vmd->cfg_lock, flags); +raw_spin_lock_irqsave (&vmd->cfg_lock, flags);switch (len) {case 1 :writeb (value, addr);
@@ -455,7 +455,7 @@ static int vmd_pci_write(struct pci_bus *bus, unsigned int devfn, int reg, ret = -EINVAL ;break ; } -spin_unlock_irqrestore (&vmd->cfg_lock, flags); +raw_spin_unlock_irqrestore (&vmd->cfg_lock, flags);return ret; }
@@ -1020,7 +1020,7 @@ static int vmd_probe(struct pci_dev *dev, const struct pci_device_id *id)if (features &VMD_FEAT_OFFSET_FIRST_VECTOR ) vmd->first_vec =1 ; -spin_lock_init (&vmd->cfg_lock); +raw_spin_lock_init (&vmd->cfg_lock);pci_set_drvdata (dev, vmd); err =vmd_enable_domain (vmd, features);if (err)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 19/23 drm/amdgpu: grab an additional reference on the gang fence v2
In reply to Sasha LevinFrom: Christian König <[email protected]>
[ Upstream commit 0d9a95099dcb05b5f4719c830d15bf4fdcad0dc2 ]
We keep the gang submission fence around in adev, make sure that it stays alive.
v2: fix memory leak on retry
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +9 -1
@@ -6015,6 +6015,7 @@ struct dma_fence *amdgpu_device_switch_gang(struct amdgpu_device *adev, {struct dma_fence *old =NULL ; +dma_fence_get (gang); do { dma_fence_put(old); rcu_read_lock();
@@ -6024,12 +6025,19 @@ struct dma_fence *amdgpu_device_switch_gang(struct amdgpu_device *adev,if (old == gang)break ; -if (!dma_fence_is_signaled (old)) +if (!dma_fence_is_signaled (old)) { +dma_fence_put (gang);return old; + } }while (cmpxchg ((struct dma_fence __force **)&adev->gang_submit, old, gang) != old); +/* +* Drop it once for the exchanged reference in adev and once for the +* thread local reference acquired in amdgpu_device_get_gang(). +*/ +dma_fence_put (old);dma_fence_put (old);return NULL ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 20/23 fbdev: omapfb: Add 'plane' value check
In reply to Sasha LevinFrom: Leonid Arapov <[email protected]>
[ Upstream commit 3e411827f31db7f938a30a3c7a7599839401ec30 ]
Function dispc_ovl_setup is not intended to work with the value OMAP_DSS_WB of the enum parameter plane.
The value of this parameter is initialized in dss_init_overlays and in the current state of the code it cannot take this value so it's not a real problem.
For the purposes of defensive coding it wouldn't be superfluous to check the parameter value, because some functions down the call stack process this value correctly and some not.
For example, in dispc_ovl_setup_global_alpha it may lead to buffer overflow.
Add check for this value.
Found by Linux Verification Center (linuxtesting.org) with SVACE static analysis tool.
--- drivers/video/fbdev/omap2/omapfb/dss/dispc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/video/fbdev/omap2/omapfb/dss/dispc.c +5 -1
@@ -2749,9 +2749,13 @@ int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi, bool mem_to_mem) {int r; -enum omap_overlay_caps caps =dss_feat_get_overlay_caps (plane); +enum omap_overlay_caps caps;enum omap_channel channel; +if (plane ==OMAP_DSS_WB ) +return -EINVAL ; + + caps =dss_feat_get_overlay_caps (plane); channel =dispc_ovl_get_channel_out (plane); DSSDBG("dispc_ovl_setup %d, pa %pad, pa_uv %pad, sw %d, %d,%d, %dx%d ->"
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 21/23 tracing: probe-events: Add comments about entry data storing code
In reply to Sasha LevinFrom: "Masami Hiramatsu (Google)" <[email protected]>
[ Upstream commit bb9c6020f4c3a07a90dc36826cb5fbe83f09efd5 ]
Add comments about entry data storing code to __store_entry_arg() and traceprobe_get_entry_data_size(). These are a bit complicated because of building the entry data storing code and scanning it.
This just add comments, no behavior change.
--- kernel/trace/trace_probe.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
kernel/trace/trace_probe.c +28 -0
@@ -769,6 +769,10 @@ static int check_prepare_btf_string_fetch(char *typename,#ifdef CONFIG_HAVE_FUNCTION_ARG_ACCESS_API +/* +* Add the entry code to store the 'argnum'th parameter and return the offset +* in the entry data buffer where the data will be stored. +*/ static int __store_entry_arg (struct trace_probe *tp,int argnum) {struct probe_entry_arg *earg = tp->entry_arg;
@@ -792,6 +796,20 @@ static int __store_entry_arg(struct trace_probe *tp, int argnum) tp->entry_arg = earg; } +/* +* The entry code array is repeating the pair of +* [FETCH_OP_ARG(argnum)][FETCH_OP_ST_EDATA(offset of entry data buffer)] +* and the rest of entries are filled with [FETCH_OP_END]. +* +* To reduce the redundant function parameter fetching, we scan the entry +* code array to find the FETCH_OP_ARG which already fetches the 'argnum' +* parameter. If it doesn't match, update 'offset' to find the last +* offset. +* If we find the FETCH_OP_END without matching FETCH_OP_ARG entry, we +* will save the entry with FETCH_OP_ARG and FETCH_OP_ST_EDATA, and +* return data offset so that caller can find the data offset in the entry +* data buffer. +*/ offset =0 ;for (i =0 ; i < earg->size -1 ; i++) {switch (earg->code[i].op) {
@@ -825,6 +843,16 @@ int traceprobe_get_entry_data_size(struct trace_probe *tp)if (!earg)return 0 ; +/* +* earg->code[] array has an operation sequence which is run in +* the entry handler. +* The sequence stopped by FETCH_OP_END and each data stored in +* the entry data buffer by FETCH_OP_ST_EDATA. The FETCH_OP_ST_EDATA +* stores the data at the data buffer + its offset, and all data are +* "unsigned long" size. The offset must be increased when a data is +* stored. Thus we need to find the last FETCH_OP_ST_EDATA in the +* code array. +*/ for (i =0 ; i < earg->size; i++) {switch (earg->code[i].op) {case FETCH_OP_END :
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 22/23 ktest: Fix Test Failures Due to Missing LOG_FILE Directories
In reply to Sasha LevinFrom: Ayush Jain <[email protected]>
[ Upstream commit 5a1bed232781d356f842576daacc260f0d0c8d2e ]
Handle missing parent directories for LOG_FILE path to prevent test failures. If the parent directories don't exist, create them to ensure the tests proceed successfully.
--- tools/testing/ktest/ktest.pl | 8 ++++++++ 1 file changed, 8 insertions(+)
tools/testing/ktest/ktest.pl +8 -0
@@ -4289,6 +4289,14 @@ if (defined($opt{"LOG_FILE"})) { if ($opt{"CLEAR_LOG"}) { unlink $opt{"LOG_FILE"}; } + + if (! -e $opt{"LOG_FILE"} && $opt{"LOG_FILE"} =~ m,^(.*/),) { + my $dir = $1; + if (! -d $dir) { + mkpath($dir) or die "Failed to create directories '$dir': $!"; + print "\nThe log directory $dir did not exist, so it was created.\n"; + } + } open(LOG, ">> $opt{LOG_FILE}") or die "Can't write to $opt{LOG_FILE}"; LOG->autoflush(1); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 23/23 tpm, tpm_tis: Workaround failed command reception on Infineon devices
In reply to Sasha LevinFrom: Jonathan McDowell <[email protected]>
[ Upstream commit de9e33df7762abbfc2a1568291f2c3a3154c6a9d ]
Some Infineon devices have a issue where the status register will get stuck with a quick REQUEST_USE / COMMAND_READY sequence. This is not simply a matter of requiring a longer timeout; the work around is to retry the command submission. Add appropriate logic to do this in the send path.
This is fixed in later firmware revisions, but those are not always available, and cannot generally be easily updated from outside a firmware environment.
Testing has been performed with a simple repeated loop of doing a TPM2_CC_GET_CAPABILITY for TPM_CAP_PROP_MANUFACTURER using the Go code at:
https://the.earth.li/~noodles/tpm-stuff/timeout-reproducer-simple.go
It can take several hours to reproduce, and several million operations.
--- drivers/char/tpm/tpm_tis_core.c | 17 ++++++++++++++--- drivers/char/tpm/tpm_tis_core.h | 1 + include/linux/tpm.h | 1 + 3 files changed, 16 insertions(+), 3 deletions(-)
drivers/char/tpm/tpm_tis_core.c +14 -3
@@ -464,7 +464,10 @@ static int tpm_tis_send_data(struct tpm_chip *chip, const u8 *buf, size_t len)if (wait_for_tpm_stat (chip,TPM_STS_VALID , chip->timeout_c, &priv->int_queue, false) <0 ) { - rc = -ETIME ; +if (test_bit (TPM_TIS_STATUS_VALID_RETRY , &priv->flags)) + rc = -EAGAIN ; +else + rc = -ETIME ; goto out_err; } status =tpm_tis_status (chip);
@@ -481,7 +484,10 @@ static int tpm_tis_send_data(struct tpm_chip *chip, const u8 *buf, size_t len)if (wait_for_tpm_stat (chip,TPM_STS_VALID , chip->timeout_c, &priv->int_queue, false) <0 ) { - rc = -ETIME ; +if (test_bit (TPM_TIS_STATUS_VALID_RETRY , &priv->flags)) + rc = -EAGAIN ; +else + rc = -ETIME ; goto out_err; } status =tpm_tis_status (chip);
@@ -546,9 +552,11 @@ static int tpm_tis_send_main(struct tpm_chip *chip, const u8 *buf, size_t len)if (rc >=0 )/* Data transfer done successfully */ break ; -else if (rc != -EIO ) +else if (rc != -EAGAIN && rc != -EIO )/* Data transfer failed, not recoverable */ return rc; + +usleep_range (priv->timeout_min, priv->timeout_max); }/* go and do it */
@@ -1147,6 +1155,9 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, priv->timeout_max =TIS_TIMEOUT_MAX_ATML ; } +if (priv->manufacturer_id ==TPM_VID_IFX ) +set_bit (TPM_TIS_STATUS_VALID_RETRY , &priv->flags); +if (is_bsw ()) { priv->ilb_base_addr =ioremap (INTEL_LEGACY_BLK_BASE_ADDR ,ILB_REMAP_SIZE );
drivers/char/tpm/tpm_tis_core.h +1 -0
@@ -89,6 +89,7 @@ enum tpm_tis_flags {TPM_TIS_INVALID_STATUS =1 ,TPM_TIS_DEFAULT_CANCELLATION =2 ,TPM_TIS_IRQ_TESTED =3 , + TPM_TIS_STATUS_VALID_RETRY = 4, }; struct tpm_tis_data {
include/linux/tpm.h +1 -0
@@ -272,6 +272,7 @@ enum tpm2_cc_attrs {#define TPM_VID_WINBOND 0x1050#define TPM_VID_STM 0x104A#define TPM_VID_ATML 0x1114 +#define TPM_VID_IFX 0x15D1enum tpm_chip_flags {TPM_CHIP_FLAG_BOOTSTRAPPED =BIT (0 ),
Signature · 1 line
2.39.5