Skip to content

Commit 76e26e3

Browse files
committed
Merge tag 'drm-fixes-2023-01-27' of git://anongit.freedesktop.org/drm/drm
Pull drm fixes from Dave Airlie: "Fairly small this week as well, i915 has a memory leak fix and some minor changes, and amdgpu has some MST fixes, and some other minor ones: drm: - DP MST kref fix - fb_helper: check return value i915: - Fix BSC default context for Meteor Lake - Fix selftest-scheduler's modify_type - memory leak fix amdgpu: - GC11.x fixes - SMU13.0.0 fix - Freesync video fix - DP MST fixes - build fix" * tag 'drm-fixes-2023-01-27' of git://anongit.freedesktop.org/drm/drm: amdgpu: fix build on non-DCN platforms. drm/amd/display: Fix timing not changning when freesync video is enabled drm/display/dp_mst: Correct the kref of port. drm/amdgpu/display/mst: update mst_mgr relevant variable when long HPD drm/amdgpu/display/mst: limit payload to be updated one by one drm/amdgpu/display/mst: Fix mst_state->pbn_div and slot count assignments drm/amdgpu: declare firmware for new MES 11.0.4 drm/amdgpu: enable imu firmware for GC 11.0.4 drm/amd/pm: add missing AllowIHInterrupt message mapping for SMU13.0.0 drm/amdgpu: remove unconditional trap enable on add gfx11 queues drm/fb-helper: Use a per-driver FB deferred I/O handler drm/fb-helper: Check fb_deferred_io_init() return value drm/i915/selftest: fix intel_selftest_modify_policy argument types drm/i915/mtl: Fix bcs default context drm/i915: Fix a memory leak with reused mmap_offset drm/drm_vma_manager: Add drm_vma_node_allow_once()
2 parents 04ad927 + d23db89 commit 76e26e3

File tree

15 files changed

+167
-89
lines changed

15 files changed

+167
-89
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ MODULE_FIRMWARE("amdgpu/gc_11_0_0_imu.bin");
3535
MODULE_FIRMWARE("amdgpu/gc_11_0_1_imu.bin");
3636
MODULE_FIRMWARE("amdgpu/gc_11_0_2_imu.bin");
3737
MODULE_FIRMWARE("amdgpu/gc_11_0_3_imu.bin");
38+
MODULE_FIRMWARE("amdgpu/gc_11_0_4_imu.bin");
3839

3940
static int imu_v11_0_init_microcode(struct amdgpu_device *adev)
4041
{

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ MODULE_FIRMWARE("amdgpu/gc_11_0_2_mes.bin");
4040
MODULE_FIRMWARE("amdgpu/gc_11_0_2_mes1.bin");
4141
MODULE_FIRMWARE("amdgpu/gc_11_0_3_mes.bin");
4242
MODULE_FIRMWARE("amdgpu/gc_11_0_3_mes1.bin");
43+
MODULE_FIRMWARE("amdgpu/gc_11_0_4_mes.bin");
44+
MODULE_FIRMWARE("amdgpu/gc_11_0_4_mes1.bin");
4345

4446
static int mes_v11_0_hw_fini(void *handle);
4547
static int mes_v11_0_kiq_hw_init(struct amdgpu_device *adev);
@@ -196,7 +198,6 @@ static int mes_v11_0_add_hw_queue(struct amdgpu_mes *mes,
196198
mes_add_queue_pkt.trap_handler_addr = input->tba_addr;
197199
mes_add_queue_pkt.tma_addr = input->tma_addr;
198200
mes_add_queue_pkt.is_kfd_process = input->is_kfd_process;
199-
mes_add_queue_pkt.trap_en = 1;
200201

201202
/* For KFD, gds_size is re-used for queue size (needed in MES for AQL queues) */
202203
mes_add_queue_pkt.is_aql_queue = input->is_aql_queue;

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8881,6 +8881,13 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm,
88818881
if (!dm_old_crtc_state->stream)
88828882
goto skip_modeset;
88838883

8884+
/* Unset freesync video if it was active before */
8885+
if (dm_old_crtc_state->freesync_config.state == VRR_STATE_ACTIVE_FIXED) {
8886+
dm_new_crtc_state->freesync_config.state = VRR_STATE_INACTIVE;
8887+
dm_new_crtc_state->freesync_config.fixed_refresh_in_uhz = 0;
8888+
}
8889+
8890+
/* Now check if we should set freesync video mode */
88848891
if (amdgpu_freesync_vid_mode && dm_new_crtc_state->stream &&
88858892
is_timing_unchanged_for_freesync(new_crtc_state,
88868893
old_crtc_state)) {
@@ -9497,6 +9504,8 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
94979504
bool lock_and_validation_needed = false;
94989505
struct dm_crtc_state *dm_old_crtc_state, *dm_new_crtc_state;
94999506
#if defined(CONFIG_DRM_AMD_DC_DCN)
9507+
struct drm_dp_mst_topology_mgr *mgr;
9508+
struct drm_dp_mst_topology_state *mst_state;
95009509
struct dsc_mst_fairness_vars vars[MAX_PIPES];
95019510
#endif
95029511

@@ -9745,6 +9754,28 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
97459754
lock_and_validation_needed = true;
97469755
}
97479756

9757+
#if defined(CONFIG_DRM_AMD_DC_DCN)
9758+
/* set the slot info for each mst_state based on the link encoding format */
9759+
for_each_new_mst_mgr_in_state(state, mgr, mst_state, i) {
9760+
struct amdgpu_dm_connector *aconnector;
9761+
struct drm_connector *connector;
9762+
struct drm_connector_list_iter iter;
9763+
u8 link_coding_cap;
9764+
9765+
drm_connector_list_iter_begin(dev, &iter);
9766+
drm_for_each_connector_iter(connector, &iter) {
9767+
if (connector->index == mst_state->mgr->conn_base_id) {
9768+
aconnector = to_amdgpu_dm_connector(connector);
9769+
link_coding_cap = dc_link_dp_mst_decide_link_encoding_format(aconnector->dc_link);
9770+
drm_dp_mst_update_slots(mst_state, link_coding_cap);
9771+
9772+
break;
9773+
}
9774+
}
9775+
drm_connector_list_iter_end(&iter);
9776+
}
9777+
#endif
9778+
97489779
/**
97499780
* Streams and planes are reset when there are changes that affect
97509781
* bandwidth. Anything that affects bandwidth needs to go through

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -120,23 +120,50 @@ enum dc_edid_status dm_helpers_parse_edid_caps(
120120
}
121121

122122
static void
123-
fill_dc_mst_payload_table_from_drm(struct drm_dp_mst_topology_state *mst_state,
124-
struct amdgpu_dm_connector *aconnector,
123+
fill_dc_mst_payload_table_from_drm(struct dc_link *link,
124+
bool enable,
125+
struct drm_dp_mst_atomic_payload *target_payload,
125126
struct dc_dp_mst_stream_allocation_table *table)
126127
{
127128
struct dc_dp_mst_stream_allocation_table new_table = { 0 };
128129
struct dc_dp_mst_stream_allocation *sa;
129-
struct drm_dp_mst_atomic_payload *payload;
130+
struct link_mst_stream_allocation_table copy_of_link_table =
131+
link->mst_stream_alloc_table;
132+
133+
int i;
134+
int current_hw_table_stream_cnt = copy_of_link_table.stream_count;
135+
struct link_mst_stream_allocation *dc_alloc;
136+
137+
/* TODO: refactor to set link->mst_stream_alloc_table directly if possible.*/
138+
if (enable) {
139+
dc_alloc =
140+
&copy_of_link_table.stream_allocations[current_hw_table_stream_cnt];
141+
dc_alloc->vcp_id = target_payload->vcpi;
142+
dc_alloc->slot_count = target_payload->time_slots;
143+
} else {
144+
for (i = 0; i < copy_of_link_table.stream_count; i++) {
145+
dc_alloc =
146+
&copy_of_link_table.stream_allocations[i];
147+
148+
if (dc_alloc->vcp_id == target_payload->vcpi) {
149+
dc_alloc->vcp_id = 0;
150+
dc_alloc->slot_count = 0;
151+
break;
152+
}
153+
}
154+
ASSERT(i != copy_of_link_table.stream_count);
155+
}
130156

131157
/* Fill payload info*/
132-
list_for_each_entry(payload, &mst_state->payloads, next) {
133-
if (payload->delete)
134-
continue;
135-
136-
sa = &new_table.stream_allocations[new_table.stream_count];
137-
sa->slot_count = payload->time_slots;
138-
sa->vcp_id = payload->vcpi;
139-
new_table.stream_count++;
158+
for (i = 0; i < MAX_CONTROLLER_NUM; i++) {
159+
dc_alloc =
160+
&copy_of_link_table.stream_allocations[i];
161+
if (dc_alloc->vcp_id > 0 && dc_alloc->slot_count > 0) {
162+
sa = &new_table.stream_allocations[new_table.stream_count];
163+
sa->slot_count = dc_alloc->slot_count;
164+
sa->vcp_id = dc_alloc->vcp_id;
165+
new_table.stream_count++;
166+
}
140167
}
141168

142169
/* Overwrite the old table */
@@ -185,7 +212,7 @@ bool dm_helpers_dp_mst_write_payload_allocation_table(
185212
* AUX message. The sequence is slot 1-63 allocated sequence for each
186213
* stream. AMD ASIC stream slot allocation should follow the same
187214
* sequence. copy DRM MST allocation to dc */
188-
fill_dc_mst_payload_table_from_drm(mst_state, aconnector, proposed_table);
215+
fill_dc_mst_payload_table_from_drm(stream->link, enable, payload, proposed_table);
189216

190217
return true;
191218
}

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -903,11 +903,6 @@ static int compute_mst_dsc_configs_for_link(struct drm_atomic_state *state,
903903
if (IS_ERR(mst_state))
904904
return PTR_ERR(mst_state);
905905

906-
mst_state->pbn_div = dm_mst_get_pbn_divider(dc_link);
907-
#if defined(CONFIG_DRM_AMD_DC_DCN)
908-
drm_dp_mst_update_slots(mst_state, dc_link_dp_mst_decide_link_encoding_format(dc_link));
909-
#endif
910-
911906
/* Set up params */
912907
for (i = 0; i < dc_state->stream_count; i++) {
913908
struct dc_dsc_policy dsc_policy = {0};

drivers/gpu/drm/amd/display/dc/core/dc_link.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3995,10 +3995,13 @@ static enum dc_status deallocate_mst_payload(struct pipe_ctx *pipe_ctx)
39953995
struct fixed31_32 avg_time_slots_per_mtp = dc_fixpt_from_int(0);
39963996
int i;
39973997
bool mst_mode = (link->type == dc_connection_mst_branch);
3998+
/* adjust for drm changes*/
3999+
bool update_drm_mst_state = true;
39984000
const struct link_hwss *link_hwss = get_link_hwss(link, &pipe_ctx->link_res);
39994001
const struct dc_link_settings empty_link_settings = {0};
40004002
DC_LOGGER_INIT(link->ctx->logger);
40014003

4004+
40024005
/* deallocate_mst_payload is called before disable link. When mode or
40034006
* disable/enable monitor, new stream is created which is not in link
40044007
* stream[] yet. For this, payload is not allocated yet, so de-alloc
@@ -4014,7 +4017,7 @@ static enum dc_status deallocate_mst_payload(struct pipe_ctx *pipe_ctx)
40144017
&empty_link_settings,
40154018
avg_time_slots_per_mtp);
40164019

4017-
if (mst_mode) {
4020+
if (mst_mode || update_drm_mst_state) {
40184021
/* when link is in mst mode, reply on mst manager to remove
40194022
* payload
40204023
*/
@@ -4077,11 +4080,18 @@ static enum dc_status deallocate_mst_payload(struct pipe_ctx *pipe_ctx)
40774080
stream->ctx,
40784081
stream);
40794082

4083+
if (!update_drm_mst_state)
4084+
dm_helpers_dp_mst_send_payload_allocation(
4085+
stream->ctx,
4086+
stream,
4087+
false);
4088+
}
4089+
4090+
if (update_drm_mst_state)
40804091
dm_helpers_dp_mst_send_payload_allocation(
40814092
stream->ctx,
40824093
stream,
40834094
false);
4084-
}
40854095

40864096
return DC_OK;
40874097
}

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ static struct cmn2asic_msg_mapping smu_v13_0_0_message_map[SMU_MSG_MAX_COUNT] =
145145
MSG_MAP(SetBadMemoryPagesRetiredFlagsPerChannel,
146146
PPSMC_MSG_SetBadMemoryPagesRetiredFlagsPerChannel, 0),
147147
MSG_MAP(AllowGpo, PPSMC_MSG_SetGpoAllow, 0),
148+
MSG_MAP(AllowIHHostInterrupt, PPSMC_MSG_AllowIHHostInterrupt, 0),
148149
};
149150

150151
static struct cmn2asic_mapping smu_v13_0_0_clk_map[SMU_CLK_COUNT] = {

drivers/gpu/drm/display/drm_dp_mst_topology.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3372,6 +3372,9 @@ void drm_dp_remove_payload(struct drm_dp_mst_topology_mgr *mgr,
33723372

33733373
mgr->payload_count--;
33743374
mgr->next_start_slot -= payload->time_slots;
3375+
3376+
if (payload->delete)
3377+
drm_dp_mst_put_port_malloc(payload->port);
33753378
}
33763379
EXPORT_SYMBOL(drm_dp_remove_payload);
33773380

@@ -4327,7 +4330,6 @@ int drm_dp_atomic_release_time_slots(struct drm_atomic_state *state,
43274330

43284331
drm_dbg_atomic(mgr->dev, "[MST PORT:%p] TU %d -> 0\n", port, payload->time_slots);
43294332
if (!payload->delete) {
4330-
drm_dp_mst_put_port_malloc(port);
43314333
payload->pbn = 0;
43324334
payload->delete = true;
43334335
topology_state->payload_mask &= ~BIT(payload->vcpi - 1);

drivers/gpu/drm/drm_fbdev_generic.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,6 @@ static const struct fb_ops drm_fbdev_fb_ops = {
171171
.fb_imageblit = drm_fbdev_fb_imageblit,
172172
};
173173

174-
static struct fb_deferred_io drm_fbdev_defio = {
175-
.delay = HZ / 20,
176-
.deferred_io = drm_fb_helper_deferred_io,
177-
};
178-
179174
/*
180175
* This function uses the client API to create a framebuffer backed by a dumb buffer.
181176
*/
@@ -222,8 +217,14 @@ static int drm_fbdev_fb_probe(struct drm_fb_helper *fb_helper,
222217
return -ENOMEM;
223218
fbi->flags |= FBINFO_VIRTFB | FBINFO_READS_FAST;
224219

225-
fbi->fbdefio = &drm_fbdev_defio;
226-
fb_deferred_io_init(fbi);
220+
/* Set a default deferred I/O handler */
221+
fb_helper->fbdefio.delay = HZ / 20;
222+
fb_helper->fbdefio.deferred_io = drm_fb_helper_deferred_io;
223+
224+
fbi->fbdefio = &fb_helper->fbdefio;
225+
ret = fb_deferred_io_init(fbi);
226+
if (ret)
227+
return ret;
227228
} else {
228229
/* buffer is mapped for HW framebuffer */
229230
ret = drm_client_buffer_vmap(fb_helper->buffer, &map);

drivers/gpu/drm/drm_vma_manager.c

Lines changed: 54 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -240,27 +240,8 @@ void drm_vma_offset_remove(struct drm_vma_offset_manager *mgr,
240240
}
241241
EXPORT_SYMBOL(drm_vma_offset_remove);
242242

243-
/**
244-
* drm_vma_node_allow - Add open-file to list of allowed users
245-
* @node: Node to modify
246-
* @tag: Tag of file to remove
247-
*
248-
* Add @tag to the list of allowed open-files for this node. If @tag is
249-
* already on this list, the ref-count is incremented.
250-
*
251-
* The list of allowed-users is preserved across drm_vma_offset_add() and
252-
* drm_vma_offset_remove() calls. You may even call it if the node is currently
253-
* not added to any offset-manager.
254-
*
255-
* You must remove all open-files the same number of times as you added them
256-
* before destroying the node. Otherwise, you will leak memory.
257-
*
258-
* This is locked against concurrent access internally.
259-
*
260-
* RETURNS:
261-
* 0 on success, negative error code on internal failure (out-of-mem)
262-
*/
263-
int drm_vma_node_allow(struct drm_vma_offset_node *node, struct drm_file *tag)
243+
static int vma_node_allow(struct drm_vma_offset_node *node,
244+
struct drm_file *tag, bool ref_counted)
264245
{
265246
struct rb_node **iter;
266247
struct rb_node *parent = NULL;
@@ -282,7 +263,8 @@ int drm_vma_node_allow(struct drm_vma_offset_node *node, struct drm_file *tag)
282263
entry = rb_entry(*iter, struct drm_vma_offset_file, vm_rb);
283264

284265
if (tag == entry->vm_tag) {
285-
entry->vm_count++;
266+
if (ref_counted)
267+
entry->vm_count++;
286268
goto unlock;
287269
} else if (tag > entry->vm_tag) {
288270
iter = &(*iter)->rb_right;
@@ -307,8 +289,58 @@ int drm_vma_node_allow(struct drm_vma_offset_node *node, struct drm_file *tag)
307289
kfree(new);
308290
return ret;
309291
}
292+
293+
/**
294+
* drm_vma_node_allow - Add open-file to list of allowed users
295+
* @node: Node to modify
296+
* @tag: Tag of file to remove
297+
*
298+
* Add @tag to the list of allowed open-files for this node. If @tag is
299+
* already on this list, the ref-count is incremented.
300+
*
301+
* The list of allowed-users is preserved across drm_vma_offset_add() and
302+
* drm_vma_offset_remove() calls. You may even call it if the node is currently
303+
* not added to any offset-manager.
304+
*
305+
* You must remove all open-files the same number of times as you added them
306+
* before destroying the node. Otherwise, you will leak memory.
307+
*
308+
* This is locked against concurrent access internally.
309+
*
310+
* RETURNS:
311+
* 0 on success, negative error code on internal failure (out-of-mem)
312+
*/
313+
int drm_vma_node_allow(struct drm_vma_offset_node *node, struct drm_file *tag)
314+
{
315+
return vma_node_allow(node, tag, true);
316+
}
310317
EXPORT_SYMBOL(drm_vma_node_allow);
311318

319+
/**
320+
* drm_vma_node_allow_once - Add open-file to list of allowed users
321+
* @node: Node to modify
322+
* @tag: Tag of file to remove
323+
*
324+
* Add @tag to the list of allowed open-files for this node.
325+
*
326+
* The list of allowed-users is preserved across drm_vma_offset_add() and
327+
* drm_vma_offset_remove() calls. You may even call it if the node is currently
328+
* not added to any offset-manager.
329+
*
330+
* This is not ref-counted unlike drm_vma_node_allow() hence drm_vma_node_revoke()
331+
* should only be called once after this.
332+
*
333+
* This is locked against concurrent access internally.
334+
*
335+
* RETURNS:
336+
* 0 on success, negative error code on internal failure (out-of-mem)
337+
*/
338+
int drm_vma_node_allow_once(struct drm_vma_offset_node *node, struct drm_file *tag)
339+
{
340+
return vma_node_allow(node, tag, false);
341+
}
342+
EXPORT_SYMBOL(drm_vma_node_allow_once);
343+
312344
/**
313345
* drm_vma_node_revoke - Remove open-file from list of allowed users
314346
* @node: Node to modify

0 commit comments

Comments
 (0)