Skip to content

Commit 6c8e404

Browse files
committed
Merge tag 'drm-misc-next-2025-12-12' of https://gitlab.freedesktop.org/drm/misc/kernel into drm-next
drm-misc-next for 6.19: UAPI Changes: - panfrost: Add PANFROST_BO_SYNC ioctl - panthor: Add PANTHOR_BO_SYNC ioctl Core Changes: - atomic: Add drm_device pointer to drm_private_obj - bridge: Introduce drm_bridge_unplug, drm_bridge_enter, and drm_bridge_exit - dma-buf: Improve sg_table debugging - dma-fence: Add new helpers, and use them when needed - dp_mst: Avoid out-of-bounds access with VCPI==0 - gem: Reduce page table overhead with transparent huge pages - panic: Report invalid panic modes - sched: Add TODO entries - ttm: Various cleanups - vblank: Various refactoring and cleanups - Kconfig cleanups - Removed support for kdb Driver Changes: - amdxdna: Fix race conditions at suspend, Improve handling of zero tail pointers, Fix cu_idx being overwritten during command setup - ast: Support imported cursor buffers - - panthor: Enable timestamp propagation, Multiple improvements and fixes to improve the overall robustness, notably of the scheduler. - panels: - panel-edp: Support for CSW MNE007QB3-1, AUO B140HAN06.4, AUO B140QAX01.H Signed-off-by: Dave Airlie <airlied@redhat.com> [airlied: fix mm conflict] From: Maxime Ripard <mripard@redhat.com> Link: https://patch.msgid.link/20251212-spectacular-agama-of-abracadabra-aaef32@penduick
2 parents 9448598 + 470cb09 commit 6c8e404

103 files changed

Lines changed: 2537 additions & 1482 deletions

File tree

Some content is hidden

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

Documentation/gpu/drm-mm.rst

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,12 @@ drm_gem_object_init() will create an shmfs file of the
155155
requested size and store it into the struct :c:type:`struct
156156
drm_gem_object <drm_gem_object>` filp field. The memory is
157157
used as either main storage for the object when the graphics hardware
158-
uses system memory directly or as a backing store otherwise.
158+
uses system memory directly or as a backing store otherwise. Drivers
159+
can call drm_gem_huge_mnt_create() to create, mount and use a huge
160+
shmem mountpoint instead of the default one ('shm_mnt'). For builds
161+
with CONFIG_TRANSPARENT_HUGEPAGE enabled, further calls to
162+
drm_gem_object_init() will let shmem allocate huge pages when
163+
possible.
159164

160165
Drivers are responsible for the actual physical pages allocation by
161166
calling shmem_read_mapping_page_gfp() for each page.
@@ -290,15 +295,27 @@ The open and close operations must update the GEM object reference
290295
count. Drivers can use the drm_gem_vm_open() and drm_gem_vm_close() helper
291296
functions directly as open and close handlers.
292297

293-
The fault operation handler is responsible for mapping individual pages
294-
to userspace when a page fault occurs. Depending on the memory
295-
allocation scheme, drivers can allocate pages at fault time, or can
296-
decide to allocate memory for the GEM object at the time the object is
297-
created.
298+
The fault operation handler is responsible for mapping pages to
299+
userspace when a page fault occurs. Depending on the memory allocation
300+
scheme, drivers can allocate pages at fault time, or can decide to
301+
allocate memory for the GEM object at the time the object is created.
298302

299303
Drivers that want to map the GEM object upfront instead of handling page
300304
faults can implement their own mmap file operation handler.
301305

306+
In order to reduce page table overhead, if the internal shmem mountpoint
307+
"shm_mnt" is configured to use transparent huge pages (for builds with
308+
CONFIG_TRANSPARENT_HUGEPAGE enabled) and if the shmem backing store
309+
managed to allocate a huge page for a faulty address, the fault handler
310+
will first attempt to insert that huge page into the VMA before falling
311+
back to individual page insertion. mmap() user address alignment for GEM
312+
objects is handled by providing a custom get_unmapped_area file
313+
operation which forwards to the shmem backing store. For most drivers,
314+
which don't create a huge mountpoint by default or through a module
315+
parameter, transparent huge pages can be enabled by either setting the
316+
"transparent_hugepage_shmem" kernel parameter or the
317+
"/sys/kernel/mm/transparent_hugepage/shmem_enabled" sysfs knob.
318+
302319
For platforms without MMU the GEM core provides a helper method
303320
drm_gem_dma_get_unmapped_area(). The mmap() routines will call this to get a
304321
proposed address for the mapping.

Documentation/gpu/todo.rst

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,51 @@ Contact: Christian König
878878

879879
Level: Starter
880880

881+
DRM GPU Scheduler
882+
=================
883+
884+
Provide a universal successor for drm_sched_resubmit_jobs()
885+
-----------------------------------------------------------
886+
887+
drm_sched_resubmit_jobs() is deprecated. Main reason being that it leads to
888+
reinitializing dma_fences. See that function's docu for details. The better
889+
approach for valid resubmissions by amdgpu and Xe is (apparently) to figure out
890+
which job (and, through association: which entity) caused the hang. Then, the
891+
job's buffer data, together with all other jobs' buffer data currently in the
892+
same hardware ring, must be invalidated. This can for example be done by
893+
overwriting it. amdgpu currently determines which jobs are in the ring and need
894+
to be overwritten by keeping copies of the job. Xe obtains that information by
895+
directly accessing drm_sched's pending_list.
896+
897+
Tasks:
898+
899+
1. implement scheduler functionality through which the driver can obtain the
900+
information which *broken* jobs are currently in the hardware ring.
901+
2. Such infrastructure would then typically be used in
902+
drm_sched_backend_ops.timedout_job(). Document that.
903+
3. Port a driver as first user.
904+
4. Document the new alternative in the docu of deprecated
905+
drm_sched_resubmit_jobs().
906+
907+
Contact: Christian König <christian.koenig@amd.com>
908+
Philipp Stanner <phasta@kernel.org>
909+
910+
Level: Advanced
911+
912+
Add locking for runqueues
913+
-------------------------
914+
915+
There is an old FIXME by Sima in include/drm/gpu_scheduler.h. It details that
916+
struct drm_sched_rq is read at many places without any locks, not even with a
917+
READ_ONCE. At XDC 2025 no one could really tell why that is the case, whether
918+
locks are needed and whether they could be added. (But for real, that should
919+
probably be locked!). Check whether it's possible to add locks everywhere, and
920+
do so if yes.
921+
922+
Contact: Philipp Stanner <phasta@kernel.org>
923+
924+
Level: Intermediate
925+
881926
Outside DRM
882927
===========
883928

Documentation/process/debugging/kgdb.rst

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -889,34 +889,6 @@ in the virtual console layer. On resuming kernel execution, the kernel
889889
debugger calls kgdboc_post_exp_handler() which in turn calls
890890
con_debug_leave().
891891

892-
Any video driver that wants to be compatible with the kernel debugger
893-
and the atomic kms callbacks must implement the ``mode_set_base_atomic``,
894-
``fb_debug_enter`` and ``fb_debug_leave operations``. For the
895-
``fb_debug_enter`` and ``fb_debug_leave`` the option exists to use the
896-
generic drm fb helper functions or implement something custom for the
897-
hardware. The following example shows the initialization of the
898-
.mode_set_base_atomic operation in
899-
drivers/gpu/drm/i915/intel_display.c::
900-
901-
902-
static const struct drm_crtc_helper_funcs intel_helper_funcs = {
903-
[...]
904-
.mode_set_base_atomic = intel_pipe_set_base_atomic,
905-
[...]
906-
};
907-
908-
909-
Here is an example of how the i915 driver initializes the
910-
fb_debug_enter and fb_debug_leave functions to use the generic drm
911-
helpers in ``drivers/gpu/drm/i915/intel_fb.c``::
912-
913-
914-
static struct fb_ops intelfb_ops = {
915-
[...]
916-
.fb_debug_enter = drm_fb_helper_debug_enter,
917-
.fb_debug_leave = drm_fb_helper_debug_leave,
918-
[...]
919-
};
920892

921893

922894
Credits

drivers/accel/amdxdna/aie2_message.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ static int aie2_send_mgmt_msg_wait(struct amdxdna_dev_hdl *ndev,
3939
if (!ndev->mgmt_chann)
4040
return -ENODEV;
4141

42-
drm_WARN_ON(&xdna->ddev, xdna->rpm_on && !mutex_is_locked(&xdna->dev_lock));
4342
ret = xdna_send_msg_wait(xdna, ndev->mgmt_chann, msg);
4443
if (ret == -ETIME) {
4544
xdna_mailbox_stop_channel(ndev->mgmt_chann);
@@ -59,8 +58,15 @@ static int aie2_send_mgmt_msg_wait(struct amdxdna_dev_hdl *ndev,
5958
int aie2_suspend_fw(struct amdxdna_dev_hdl *ndev)
6059
{
6160
DECLARE_AIE2_MSG(suspend, MSG_OP_SUSPEND);
61+
int ret;
6262

63-
return aie2_send_mgmt_msg_wait(ndev, &msg);
63+
ret = aie2_send_mgmt_msg_wait(ndev, &msg);
64+
if (ret) {
65+
XDNA_ERR(ndev->xdna, "Failed to suspend fw, ret %d", ret);
66+
return ret;
67+
}
68+
69+
return aie2_psp_waitmode_poll(ndev->psp_hdl);
6470
}
6571

6672
int aie2_resume_fw(struct amdxdna_dev_hdl *ndev)
@@ -646,6 +652,7 @@ aie2_cmdlist_fill_npu_cf(struct amdxdna_gem_obj *cmd_bo, void *slot, size_t *siz
646652
u32 cmd_len;
647653
void *cmd;
648654

655+
memset(npu_slot, 0, sizeof(*npu_slot));
649656
cmd = amdxdna_cmd_get_payload(cmd_bo, &cmd_len);
650657
if (*size < sizeof(*npu_slot) + cmd_len)
651658
return -EINVAL;
@@ -654,7 +661,6 @@ aie2_cmdlist_fill_npu_cf(struct amdxdna_gem_obj *cmd_bo, void *slot, size_t *siz
654661
if (npu_slot->cu_idx == INVALID_CU_IDX)
655662
return -EINVAL;
656663

657-
memset(npu_slot, 0, sizeof(*npu_slot));
658664
npu_slot->type = EXEC_NPU_TYPE_NON_ELF;
659665
npu_slot->arg_cnt = cmd_len / sizeof(u32);
660666
memcpy(npu_slot->args, cmd, cmd_len);
@@ -671,6 +677,7 @@ aie2_cmdlist_fill_npu_dpu(struct amdxdna_gem_obj *cmd_bo, void *slot, size_t *si
671677
u32 cmd_len;
672678
u32 arg_sz;
673679

680+
memset(npu_slot, 0, sizeof(*npu_slot));
674681
sn = amdxdna_cmd_get_payload(cmd_bo, &cmd_len);
675682
arg_sz = cmd_len - sizeof(*sn);
676683
if (cmd_len < sizeof(*sn) || arg_sz > MAX_NPU_ARGS_SIZE)
@@ -683,7 +690,6 @@ aie2_cmdlist_fill_npu_dpu(struct amdxdna_gem_obj *cmd_bo, void *slot, size_t *si
683690
if (npu_slot->cu_idx == INVALID_CU_IDX)
684691
return -EINVAL;
685692

686-
memset(npu_slot, 0, sizeof(*npu_slot));
687693
npu_slot->type = EXEC_NPU_TYPE_PARTIAL_ELF;
688694
npu_slot->inst_buf_addr = sn->buffer;
689695
npu_slot->inst_size = sn->buffer_size;
@@ -703,6 +709,7 @@ aie2_cmdlist_fill_npu_preempt(struct amdxdna_gem_obj *cmd_bo, void *slot, size_t
703709
u32 cmd_len;
704710
u32 arg_sz;
705711

712+
memset(npu_slot, 0, sizeof(*npu_slot));
706713
pd = amdxdna_cmd_get_payload(cmd_bo, &cmd_len);
707714
arg_sz = cmd_len - sizeof(*pd);
708715
if (cmd_len < sizeof(*pd) || arg_sz > MAX_NPU_ARGS_SIZE)
@@ -715,7 +722,6 @@ aie2_cmdlist_fill_npu_preempt(struct amdxdna_gem_obj *cmd_bo, void *slot, size_t
715722
if (npu_slot->cu_idx == INVALID_CU_IDX)
716723
return -EINVAL;
717724

718-
memset(npu_slot, 0, sizeof(*npu_slot));
719725
npu_slot->type = EXEC_NPU_TYPE_PREEMPT;
720726
npu_slot->inst_buf_addr = pd->inst_buf;
721727
npu_slot->save_buf_addr = pd->save_buf;
@@ -739,6 +745,7 @@ aie2_cmdlist_fill_npu_elf(struct amdxdna_gem_obj *cmd_bo, void *slot, size_t *si
739745
u32 cmd_len;
740746
u32 arg_sz;
741747

748+
memset(npu_slot, 0, sizeof(*npu_slot));
742749
pd = amdxdna_cmd_get_payload(cmd_bo, &cmd_len);
743750
arg_sz = cmd_len - sizeof(*pd);
744751
if (cmd_len < sizeof(*pd) || arg_sz > MAX_NPU_ARGS_SIZE)
@@ -747,7 +754,6 @@ aie2_cmdlist_fill_npu_elf(struct amdxdna_gem_obj *cmd_bo, void *slot, size_t *si
747754
if (*size < sizeof(*npu_slot) + arg_sz)
748755
return -EINVAL;
749756

750-
memset(npu_slot, 0, sizeof(*npu_slot));
751757
npu_slot->type = EXEC_NPU_TYPE_ELF;
752758
npu_slot->inst_buf_addr = pd->inst_buf;
753759
npu_slot->save_buf_addr = pd->save_buf;

drivers/accel/amdxdna/aie2_pci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ static int aie2_xrs_set_dft_dpm_level(struct drm_device *ddev, u32 dpm_level)
322322
if (ndev->pw_mode != POWER_MODE_DEFAULT || ndev->dpm_level == dpm_level)
323323
return 0;
324324

325-
return ndev->priv->hw_ops.set_dpm(ndev, dpm_level);
325+
return aie2_pm_set_dpm(ndev, dpm_level);
326326
}
327327

328328
static struct xrs_action_ops aie2_xrs_actions = {

drivers/accel/amdxdna/aie2_pci.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ enum psp_reg_idx {
7070
PSP_INTR_REG = PSP_NUM_IN_REGS,
7171
PSP_STATUS_REG,
7272
PSP_RESP_REG,
73+
PSP_PWAITMODE_REG,
7374
PSP_MAX_REGS /* Keep this at the end */
7475
};
7576

@@ -285,11 +286,13 @@ int npu4_set_dpm(struct amdxdna_dev_hdl *ndev, u32 dpm_level);
285286
/* aie2_pm.c */
286287
int aie2_pm_init(struct amdxdna_dev_hdl *ndev);
287288
int aie2_pm_set_mode(struct amdxdna_dev_hdl *ndev, enum amdxdna_power_mode_type target);
289+
int aie2_pm_set_dpm(struct amdxdna_dev_hdl *ndev, u32 dpm_level);
288290

289291
/* aie2_psp.c */
290292
struct psp_device *aie2m_psp_create(struct drm_device *ddev, struct psp_config *conf);
291293
int aie2_psp_start(struct psp_device *psp);
292294
void aie2_psp_stop(struct psp_device *psp);
295+
int aie2_psp_waitmode_poll(struct psp_device *psp);
293296

294297
/* aie2_error.c */
295298
int aie2_error_async_events_alloc(struct amdxdna_dev_hdl *ndev);

drivers/accel/amdxdna/aie2_pm.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#include "aie2_pci.h"
1212
#include "amdxdna_pci_drv.h"
13+
#include "amdxdna_pm.h"
1314

1415
#define AIE2_CLK_GATING_ENABLE 1
1516
#define AIE2_CLK_GATING_DISABLE 0
@@ -26,6 +27,20 @@ static int aie2_pm_set_clk_gating(struct amdxdna_dev_hdl *ndev, u32 val)
2627
return 0;
2728
}
2829

30+
int aie2_pm_set_dpm(struct amdxdna_dev_hdl *ndev, u32 dpm_level)
31+
{
32+
int ret;
33+
34+
ret = amdxdna_pm_resume_get(ndev->xdna);
35+
if (ret)
36+
return ret;
37+
38+
ret = ndev->priv->hw_ops.set_dpm(ndev, dpm_level);
39+
amdxdna_pm_suspend_put(ndev->xdna);
40+
41+
return ret;
42+
}
43+
2944
int aie2_pm_init(struct amdxdna_dev_hdl *ndev)
3045
{
3146
int ret;
@@ -94,7 +109,7 @@ int aie2_pm_set_mode(struct amdxdna_dev_hdl *ndev, enum amdxdna_power_mode_type
94109
return -EOPNOTSUPP;
95110
}
96111

97-
ret = ndev->priv->hw_ops.set_dpm(ndev, dpm_level);
112+
ret = aie2_pm_set_dpm(ndev, dpm_level);
98113
if (ret)
99114
return ret;
100115

drivers/accel/amdxdna/aie2_psp.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,21 @@ static int psp_exec(struct psp_device *psp, u32 *reg_vals)
7676
return 0;
7777
}
7878

79+
int aie2_psp_waitmode_poll(struct psp_device *psp)
80+
{
81+
struct amdxdna_dev *xdna = to_xdna_dev(psp->ddev);
82+
u32 mode_reg;
83+
int ret;
84+
85+
ret = readx_poll_timeout(readl, PSP_REG(psp, PSP_PWAITMODE_REG), mode_reg,
86+
(mode_reg & 0x1) == 1,
87+
PSP_POLL_INTERVAL, PSP_POLL_TIMEOUT);
88+
if (ret)
89+
XDNA_ERR(xdna, "fw waitmode reg error, ret %d", ret);
90+
91+
return ret;
92+
}
93+
7994
void aie2_psp_stop(struct psp_device *psp)
8095
{
8196
u32 reg_vals[PSP_NUM_IN_REGS] = { PSP_RELEASE_TMR, };

0 commit comments

Comments
 (0)