linux/drivers
Huacai Chen 366e77cd49 drm/amd/display: Protect FPU in dml2_validate()/dml21_validate()
Commit 7da55c27e7 ("drm/amd/display: Remove incorrect FP context
start") removes the FP context protection of dml2_create(), and it said
"All the DC_FP_START/END should be used before call anything from DML2".

However, dml2_validate()/dml21_validate() are not protected from their
callers, causing such errors:

 do_fpu invoked from kernel context![#1]:
 CPU: 10 UID: 0 PID: 331 Comm: kworker/10:1H Not tainted 6.14.0-rc6+ #4
 Workqueue: events_highpri dm_irq_work_func [amdgpu]
 pc ffff800003191eb0 ra ffff800003191e60 tp 9000000107a94000 sp 9000000107a975b0
 a0 9000000140ce4910 a1 0000000000000000 a2 9000000140ce49b0 a3 9000000140ce49a8
 a4 9000000140ce49a8 a5 0000000100000000 a6 0000000000000001 a7 9000000107a97660
 t0 ffff800003790000 t1 9000000140ce5000 t2 0000000000000001 t3 0000000000000000
 t4 0000000000000004 t5 0000000000000000 t6 0000000000000000 t7 0000000000000000
 t8 0000000100000000 u0 ffff8000031a3b9c s9 9000000130bc0000 s0 9000000132400000
 s1 9000000140ec0000 s2 9000000132400000 s3 9000000140ce0000 s4 90000000057f8b88
 s5 9000000140ec0000 s6 9000000140ce4910 s7 0000000000000001 s8 9000000130d45010
 ra: ffff800003191e60 dml21_map_dc_state_into_dml_display_cfg+0x40/0x1140 [amdgpu]
   ERA: ffff800003191eb0 dml21_map_dc_state_into_dml_display_cfg+0x90/0x1140 [amdgpu]
  CRMD: 000000b0 (PLV0 -IE -DA +PG DACF=CC DACM=CC -WE)
  PRMD: 00000004 (PPLV0 +PIE -PWE)
  EUEN: 00000000 (-FPE -SXE -ASXE -BTE)
  ECFG: 00071c1d (LIE=0,2-4,10-12 VS=7)
 ESTAT: 000f0000 [FPD] (IS= ECode=15 EsubCode=0)
  PRID: 0014d010 (Loongson-64bit, Loongson-3C6000/S)
 Process kworker/10:1H (pid: 331, threadinfo=000000007bf9ddb0, task=00000000cc4ab9f3)
 Stack : 0000000100000000 0000043800000780 0000000100000001 0000000100000001
         0000000000000000 0000078000000000 0000000000000438 0000078000000000
         0000000000000438 0000078000000000 0000000000000438 0000000100000000
         0000000100000000 0000000100000000 0000000100000000 0000000100000000
         0000000000000001 9000000140ec0000 9000000132400000 9000000132400000
         ffff800003408000 ffff800003408000 9000000132400000 9000000140ce0000
         9000000140ce0000 ffff800003193850 0000000000000001 9000000140ec0000
         9000000132400000 9000000140ec0860 9000000140ec0738 0000000000000001
         90000001405e8000 9000000130bc0000 9000000140ec02a8 ffff8000031b5db8
         0000000000000000 0000043800000780 0000000000000003 ffff8000031b79cc
         ...
 Call Trace:
 [<ffff800003191eb0>] dml21_map_dc_state_into_dml_display_cfg+0x90/0x1140 [amdgpu]
 [<ffff80000319384c>] dml21_validate+0xcc/0x520 [amdgpu]
 [<ffff8000031b8948>] dc_validate_global_state+0x2e8/0x460 [amdgpu]
 [<ffff800002e94034>] create_validate_stream_for_sink+0x3d4/0x420 [amdgpu]
 [<ffff800002e940e4>] amdgpu_dm_connector_mode_valid+0x64/0x240 [amdgpu]
 [<900000000441d6b8>] drm_connector_mode_valid+0x38/0x80
 [<900000000441d824>] __drm_helper_update_and_validate+0x124/0x3e0
 [<900000000441ddc0>] drm_helper_probe_single_connector_modes+0x2e0/0x620
 [<90000000044050dc>] drm_client_modeset_probe+0x23c/0x1780
 [<9000000004420384>] __drm_fb_helper_initial_config_and_unlock+0x44/0x5a0
 [<9000000004403acc>] drm_client_dev_hotplug+0xcc/0x140
 [<ffff800002e9ab50>] handle_hpd_irq_helper+0x1b0/0x1e0 [amdgpu]
 [<90000000038f5da0>] process_one_work+0x160/0x300
 [<90000000038f6718>] worker_thread+0x318/0x440
 [<9000000003901b8c>] kthread+0x12c/0x220
 [<90000000038b1484>] ret_from_kernel_thread+0x8/0xa4

Unfortunately, protecting dml2_validate()/dml21_validate() out of DML2
causes "sleeping function called from invalid context", so protect them
with DC_FP_START() and DC_FP_END() inside.

Fixes: 7da55c27e7 ("drm/amd/display: Remove incorrect FP context start")
Cc: stable@vger.kernel.org
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Tested-by: Dongyan Qian <qiandongyan@loongson.cn>
Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2025-04-07 14:36:50 -04:00
..
accel
accessibility
acpi ACPI: platform_profile: Add support for hidden choices 2025-03-04 20:45:34 +01:00
amba
android
ata ata fixes for 6.14-rc5 2025-03-01 08:59:29 -08:00
atm
auxdisplay
base Linux 6.14-rc6 2025-03-12 09:43:12 +10:00
bcma
block block-6.14-20250306 2025-03-07 11:12:33 -10:00
bluetooth bluetooth: btusb: Initialize .owner field of force_poll_sync_fops 2025-02-27 16:50:05 -05:00
bus Linux 6.14-rc6 2025-03-12 09:43:12 +10:00
cache
cdrom
cdx
char Char/Misc/IIO driver fixes for 6.14-rc6 2025-03-09 09:07:54 -10:00
clk
clocksource
comedi
connector
counter
cpufreq
cpuidle
crypto
cxl
dax
dca
devfreq
dio
dma dmaengine fixes for v6.14 2025-03-02 10:08:45 -08:00
dma-buf
dpll
edac
eisa
extcon
firewire
firmware EFI fixes for v6.14 #2 2025-02-28 08:47:21 -08:00
fpga
fsi
gnss
gpio gpio: rcar: Fix missing of_node_put() call 2025-03-06 15:51:27 +01:00
gpu drm/amd/display: Protect FPU in dml2_validate()/dml21_validate() 2025-04-07 14:36:50 -04:00
greybus
hid hid-for-linus-2025030501 2025-03-05 07:46:59 -10:00
hsi
hte
hv
hwmon hwmon: fix a NULL vs IS_ERR_OR_NULL() check in xgene_hwmon_probe() 2025-03-03 06:04:34 -08:00
hwspinlock
hwtracing
i2c
i3c
idle intel_idle: Handle older CPUs, which stop the TSC in deeper C states, correctly 2025-02-28 22:04:26 +01:00
iio
infiniband
input
interconnect
iommu iommu/vt-d: Fix suspicious RCU usage 2025-02-28 12:19:01 +01:00
ipack
irqchip
isdn
leds
macintosh
mailbox
mcb
md
media
memory
memstick
message
mfd
misc Revert "drivers/card_reader/rtsx_usb: Restore interrupt based detection" 2025-02-27 12:24:53 -08:00
mmc
most
mtd
mux
net mctp i3c: handle NULL header address 2025-03-06 10:33:07 +01:00
nfc
ntb
nubus
nvdimm
nvme nvme-tcp: fix signedness bug in nvme_tcp_init_connection() 2025-03-05 10:37:01 -08:00
nvmem
of
opp
parisc
parport
pci
pcmcia
peci
perf
phy
pinctrl
platform ACPI fix for 6.14-rc6 2025-03-07 12:17:42 -10:00
pmdomain
pnp
power
powercap
pps
ps3
ptp
pwm
rapidio rapidio: add check for rio_add_net() in rio_scan_alloc_net() 2025-03-05 21:36:19 -08:00
ras
regulator
remoteproc
reset
rpmsg
rtc
s390
sbus
scsi
sh
siox
slimbus
soc
soundwire
spi
spmi
ssb
staging fbtft: Remove access to page->index 2025-03-05 08:38:21 +01:00
target
tc
tee
thermal
thunderbolt
tty
ufs
uio
usb usb: typec: ucsi: Fix NULL pointer access 2025-03-06 16:55:46 +01:00
vdpa
vfio
vhost vhost: return task creation error instead of NULL 2025-03-01 02:52:52 -05:00
video gpu: nova-core: add initial driver stub 2025-03-09 19:24:27 +01:00
virt Char/Misc/IIO driver fixes for 6.14-rc6 2025-03-09 09:07:54 -10:00
virtio
w1
watchdog
xen
zorro
Kconfig
Makefile