drm/virtio: New fence for every plane update
Subsystems (6)
Sasha Levin
maintainerPATCH 1/31 drm/virtio: New fence for every plane update
From: Dongwon Kim <[email protected]>
[ Upstream commit d3c55b8ab6fe5fa2e7ab02efd36d09c39ee5022f ]
Having a fence linked to a virtio_gpu_framebuffer in the plane update sequence would cause conflict when several planes referencing the same framebuffer (e.g. Xorg screen covering multi-displays configured for an extended mode) and those planes are updated concurrently. So it is needed to allocate a fence for every plane state instead of the framebuffer.
--- drivers/gpu/drm/virtio/virtgpu_drv.h | 7 ++++ drivers/gpu/drm/virtio/virtgpu_plane.c | 58 +++++++++++++++++--------- 2 files changed, 46 insertions(+), 19 deletions(-)
drivers/gpu/drm/virtio/virtgpu_drv.h +7 -0
@@ -194,6 +194,13 @@ struct virtio_gpu_framebuffer {#define to_virtio_gpu_framebuffer (x) \ container_of(x, struct virtio_gpu_framebuffer, base) +struct virtio_gpu_plane_state { +struct drm_plane_state base; +struct virtio_gpu_fence *fence; +}; +#define to_virtio_gpu_plane_state (x) \ + container_of(x, struct virtio_gpu_plane_state, base) +struct virtio_gpu_queue {struct virtqueue *vq;spinlock_t qlock;
drivers/gpu/drm/virtio/virtgpu_plane.c +39 -19
132 lines not on this page · raw message
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 2/31 drm: Add panel backlight quirks
From: Thomas Weißschuh <[email protected]>
[ Upstream commit 22e5c7ae12145af13785e3ff138395d5b1a22116 ]
Panels using a PWM-controlled backlight source do not have a standard way to communicate their valid PWM ranges.
On x86 the ranges are read from ACPI through driver-specific tables. The built-in ranges are not necessarily correct, or may grow stale if an older device can be retrofitted with newer panels.
Add a quirk infrastructure with which the minimum valid backlight value can be maintained as part of the kernel.
--- Documentation/gpu/drm-kms-helpers.rst | 3 + drivers/gpu/drm/Kconfig | 4 ++ drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/drm_panel_backlight_quirks.c | 70 ++++++++++++++++++++ include/drm/drm_utils.h | 4 ++ 5 files changed, 82 insertions(+) create mode 100644 drivers/gpu/drm/drm_panel_backlight_quirks.c
Documentation/gpu/drm-kms-helpers.rst +3 -0
@@ -230,6 +230,9 @@ Panel Helper Reference .. kernel-doc:: drivers/gpu/drm/drm_panel_orientation_quirks.c :export: +.. kernel-doc:: drivers/gpu/drm/drm_panel_backlight_quirks.c + :export: + Panel Self Refresh Helper Reference ===================================
drivers/gpu/drm/Kconfig +4 -0
@@ -486,6 +486,10 @@ config DRM_HYPERV config DRM_EXPORT_FOR_TESTS bool +# Separate option as not all DRM drivers use it +config DRM_PANEL_BACKLIGHT_QUIRKS + tristate + config DRM_LIB_RANDOM bool default n
drivers/gpu/drm/Makefile +1 -0
@@ -93,6 +93,7 @@ drm-$(CONFIG_DRM_PANIC_SCREEN_QR_CODE) += drm_panic_qr.o obj-$(CONFIG_DRM) += drm.o obj-$(CONFIG_DRM_PANEL_ORIENTATION_QUIRKS) += drm_panel_orientation_quirks.o +obj-$(CONFIG_DRM_PANEL_BACKLIGHT_QUIRKS) += drm_panel_backlight_quirks.o # # Memory-management helpers
drivers/gpu/drm/drm_panel_backlight_quirks.c new file +70 -0
70 lines not on this page · raw message
include/drm/drm_utils.h +4 -0
@@ -12,8 +12,12 @@#include <linux/types.h> +struct drm_edid ; +int drm_get_panel_orientation_quirk (int width,int height); +int drm_get_panel_min_brightness_quirk (const struct drm_edid *edid); +signed long drm_timeout_abs_to_jiffies (int64_t timeout_nsec);#endif
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 3/31 drm: panel-backlight-quirks: Add Framework 13 matte panel
In reply to Sasha LevinFrom: Thomas Weißschuh <[email protected]>
[ Upstream commit 916ecc0db336768d80e14ef28a8c64a775274f95 ]
The value of "min_input_signal" returned from ATIF on a Framework AMD 13 is "12". This leads to a fairly bright minimum display backlight.
Add a quirk to override that the minimum backlight PWM to "0" which leads to a much lower minimum brightness, which is still visible.
Tested on a Framework AMD 13 BIOS 3.05 with the matte panel.
--- drivers/gpu/drm/drm_panel_backlight_quirks.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/drm_panel_backlight_quirks.c +8 -0
@@ -17,6 +17,14 @@ struct drm_panel_min_backlight_quirk { };static const struct drm_panel_min_backlight_quirk drm_panel_min_backlight_quirks[] = { +/* 13 inch matte panel */ + { + .dmi_match.field =DMI_BOARD_VENDOR , + .dmi_match.value ="Framework" , + .ident.panel_id =drm_edid_encode_panel_id ('B' ,'O' ,'E' ,0x0bca ), + .ident.name ="NE135FBM-N41" , + .min_brightness =0 , + }, }; static bool drm_panel_min_backlight_quirk_matches(const struct drm_panel_min_backlight_quirk *quirk,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 4/31 drm: panel-backlight-quirks: Add Framework 13 glossy and 2.8k panels
In reply to Sasha LevinFrom: "Dustin L. Howett" <[email protected]>
[ Upstream commit d80b5c5b9be6b2e1cdeaaeaa8259523b63cae292 ]
I have tested these panels on the Framework Laptop 13 AMD with firmware revision 3.05 (latest at time of submission).
--- drivers/gpu/drm/drm_panel_backlight_quirks.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/gpu/drm/drm_panel_backlight_quirks.c +16 -0
@@ -25,6 +25,22 @@ static const struct drm_panel_min_backlight_quirk drm_panel_min_backlight_quirks .ident.name = "NE135FBM-N41", .min_brightness = 0, }, +/* 13 inch glossy panel */ + { + .dmi_match.field = DMI_BOARD_VENDOR, + .dmi_match.value = "Framework", + .ident.panel_id = drm_edid_encode_panel_id('B', 'O', 'E', 0x095f), + .ident.name = "NE135FBM-N41", + .min_brightness = 0, + }, +/* 13 inch 2.8k panel */ + { + .dmi_match.field = DMI_BOARD_VENDOR, + .dmi_match.value = "Framework", + .ident.panel_id = drm_edid_encode_panel_id('B', 'O', 'E', 0x0cb4), + .ident.name = "NE135A1M-NY1", + .min_brightness = 0, + }, }; static bool drm_panel_min_backlight_quirk_matches(const struct drm_panel_min_backlight_quirk *quirk,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 5/31 nvkm/gsp: correctly advance the read pointer of GSP message queue
In reply to Sasha LevinFrom: Zhi Wang <[email protected]>
[ Upstream commit 8d9beb4aebc02c4bd09e1d39c9c5f1c68c786dbc ]
A GSP event message consists three parts: message header, RPC header, message body. GSP calculates the number of pages to write from the total size of a GSP message. This behavior can be observed from the movement of the write pointer.
However, nvkm takes only the size of RPC header and message body as the message size when advancing the read pointer. When handling a two-page GSP message in the non rollback case, It wrongly takes the message body of the previous message as the message header of the next message. As the "message length" tends to be zero, in the calculation of size needs to be copied (0 - size of (message header)), the size needs to be copied will be "0xffffffxx". It also triggers a kernel panic due to a NULL pointer error.
[ 547.614102] msg: 00000f90: ff ff ff ff ff ff ff ff 40 d7 18 fb 8b 00 00 00 ........@....... [ 547.622533] msg: 00000fa0: 00 00 00 00 ff ff ff ff ff ff ff ff 00 00 00 00 ................ [ 547.630965] msg: 00000fb0: ff ff ff ff ff ff ff ff 00 00 00 00 ff ff ff ff ................ [ 547.639397] msg: 00000fc0: ff ff ff ff 00 00 00 00 ff ff ff ff ff ff ff ff ................ [ 547.647832] nvkm 0000:c1:00.0: gsp: peek msg rpc fn:0 len:0x0/0xffffffffffffffe0 [ 547.655225] nvkm 0000:c1:00.0: gsp: get msg rpc fn:0 len:0x0/0xffffffffffffffe0 [ 547.662532] BUG: kernel NULL pointer dereference, address: 0000000000000020 [ 547.669485] #PF: supervisor read access in kernel mode [ 547.674624] #PF: error_code(0x0000) - not-present page [ 547.679755] PGD 0 P4D 0 [ 547.682294] Oops: 0000 [#1] PREEMPT SMP NOPTI [ 547.686643] CPU: 22 PID: 322 Comm: kworker/22:1 Tainted: G E 6.9.0-rc6+ #1 [ 547.694893] Hardware name: ASRockRack 1U1G-MILAN/N/ROMED8-NL, BIOS L3.12E 09/06/2022 [ 547.702626] Workqueue: events r535_gsp_msgq_work [nvkm] [ 547.707921] RIP: 0010:r535_gsp_msg_recv+0x87/0x230 [nvkm] [ 547.713375] Code: 00 8b 70 08 48 89 e1 31 d2 4c 89 f7 e8 12 f5 ff ff 48 89 c5 48 85 c0 0f 84 cf 00 00 00 48 81 fd 00 f0 ff ff 0f 87 c4 00 00 00 <8b> 55 10 41 8b 46 30 85 d2 0f 85 f6 00 00 00 83 f8 04 76 10 ba 05 [ 547.732119] RSP: 0018:ffffabe440f87e10 EFLAGS: 00010203 [ 547.737335] RAX: 0000000000000010 RBX: 0000000000000008 RCX: 000000000000003f [ 547.744461] RDX: 0000000000000000 RSI: ffffabe4480a8030 RDI: 0000000000000010 [ 547.751585] RBP: 0000000000000010 R08: 0000000000000000 R09: ffffabe440f87bb0 [ 547.758707] R10: ffffabe440f87dc8 R11: 0000000000000010 R12: 0000000000000000 [ 547.765834] R13: 0000000000000000 R14: ffff9351df1e5000 R15: 0000000000000000 [ 547.772958] FS: 0000000000000000(0000) GS:ffff93708eb00000(0000) knlGS:0000000000000000 [ 547.781035] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 547.786771] CR2: 0000000000000020 CR3: 00000003cc220002 CR4: 0000000000770ef0 [ 547.793896] PKRU: 55555554 [ 547.796600] Call Trace: [ 547.799046] <TASK> [ 547.801152] ? __die+0x20/0x70 [ 547.804211] ? page_fault_oops+0x75/0x170 [ 547.808221] ? print_hex_dump+0x100/0x160 [ 547.812226] ? exc_page_fault+0x64/0x150 [ 547.816152] ? asm_exc_page_fault+0x22/0x30 [ 547.820341] ? r535_gsp_msg_recv+0x87/0x230 [nvkm] [ 547.825184] r535_gsp_msgq_work+0x42/0x50 [nvkm] [ 547.829845] process_one_work+0x196/0x3d0 [ 547.833861] worker_thread+0x2fc/0x410 [ 547.837613] ? __pfx_worker_thread+0x10/0x10 [ 547.841885] kthread+0xdf/0x110 [ 547.845031] ? __pfx_kthread+0x10/0x10 [ 547.848775] ret_from_fork+0x30/0x50 [ 547.852354] ? __pfx_kthread+0x10/0x10 [ 547.856097] ret_from_fork_asm+0x1a/0x30 [ 547.860019] </TASK> [ 547.862208] Modules linked in: nvkm(E) gsp_log(E) snd_seq_dummy(E) snd_hrtimer(E) snd_seq(E) snd_timer(E) snd_seq_device(E) snd(E) soundcore(E) rfkill(E) qrtr(E) vfat(E) fat(E) ipmi_ssif(E) amd_atl(E) intel_rapl_msr(E) intel_rapl_common(E) amd64_edac(E) mlx5_ib(E) edac_mce_amd(E) kvm_amd(E) ib_uverbs(E) kvm(E) ib_core(E) acpi_ipmi(E) ipmi_si(E) ipmi_devintf(E) mxm_wmi(E) joydev(E) rapl(E) ptdma(E) i2c_piix4(E) acpi_cpufreq(E) wmi_bmof(E) pcspkr(E) k10temp(E) ipmi_msghandler(E) xfs(E) libcrc32c(E) ast(E) i2c_algo_bit(E) drm_shmem_helper(E) crct10dif_pclmul(E) drm_kms_helper(E) ahci(E) crc32_pclmul(E) nvme_tcp(E) libahci(E) nvme(E) crc32c_intel(E) nvme_fabrics(E) cdc_ether(E) nvme_core(E) usbnet(E) mlx5_core(E) ghash_clmulni_intel(E) drm(E) libata(E) ccp(E) mii(E) t10_pi(E) mlxfw(E) sp5100_tco(E) psample(E) pci_hyperv_intf(E) wmi(E) dm_multipath(E) sunrpc(E) dm_mirror(E) dm_region_hash(E) dm_log(E) dm_mod(E) be2iscsi(E) bnx2i(E) cnic(E) uio(E) cxgb4i(E) cxgb4(E) tls(E) libcxgbi(E) libcxgb(E) qla4xxx(E) [ 547.862283] iscsi_boot_sysfs(E) iscsi_tcp(E) libiscsi_tcp(E) libiscsi(E) scsi_transport_iscsi(E) fuse(E) [last unloaded: gsp_log(E)] [ 547.962691] CR2: 0000000000000020 [ 547.966003] ---[ end trace 0000000000000000 ]--- [ 549.012012] clocksource: Long readout interval, skipping watchdog check: cs_nsec: 1370499158 wd_nsec: 1370498904 [ 549.043676] pstore: backend (erst) writing error (-28) [ 549.050924] RIP: 0010:r535_gsp_msg_recv+0x87/0x230 [nvkm] [ 549.056389] Code: 00 8b 70 08 48 89 e1 31 d2 4c 89 f7 e8 12 f5 ff ff 48 89 c5 48 85 c0 0f 84 cf 00 00 00 48 81 fd 00 f0 ff ff 0f 87 c4 00 00 00 <8b> 55 10 41 8b 46 30 85 d2 0f 85 f6 00 00 00 83 f8 04 76 10 ba 05 [ 549.075138] RSP: 0018:ffffabe440f87e10 EFLAGS: 00010203 [ 549.080361] RAX: 0000000000000010 RBX: 0000000000000008 RCX: 000000000000003f [ 549.087484] RDX: 0000000000000000 RSI: ffffabe4480a8030 RDI: 0000000000000010 [ 549.094609] RBP: 0000000000000010 R08: 0000000000000000 R09: ffffabe440f87bb0 [ 549.101733] R10: ffffabe440f87dc8 R11: 0000000000000010 R12: 0000000000000000 [ 549.108857] R13: 0000000000000000 R14: ffff9351df1e5000 R15: 0000000000000000 [ 549.115982] FS: 0000000000000000(0000) GS:ffff93708eb00000(0000) knlGS:0000000000000000 [ 549.124061] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 549.129807] CR2: 0000000000000020 CR3: 00000003cc220002 CR4: 0000000000770ef0 [ 549.136940] PKRU: 55555554 [ 549.139653] Kernel panic - not syncing: Fatal exception [ 549.145054] Kernel Offset: 0x18c00000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff) [ 549.165074] ---[ end Kernel panic - not syncing: Fatal exception ]---
Also, nvkm wrongly advances the read pointer when handling a two-page GSP message in the rollback case. In the rollback case, the GSP message will be copied in two rounds. When handling a two-page GSP message, nvkm first copies amount of (GSP_PAGE_SIZE - header) data into the buffer, then advances the read pointer by the result of DIV_ROUND_UP(size, GSP_PAGE_SIZE). Thus, the read pointer is advanced by 1.
Next, nvkm copies the amount of (total size - (GSP_PAGE_SIZE - header)) data into the buffer. The left amount of the data will be always larger than one page since the message header is not taken into account in the first copy. Thus, the read pointer is advanced by DIV_ROUND_UP( size(larger than one page), GSP_PAGE_SIZE) = 2.
In the end, the read pointer is wrongly advanced by 3 when handling a two-page GSP message in the rollback case.
Fix the problems by taking the total size of the message into account when advancing the read pointer and calculate the read pointer in the end of the all copies for the rollback case.
BTW: the two-page GSP message can be observed in the msgq when vGPU is enabled.
--- drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +4 -6
@@ -121,6 +121,8 @@ r535_gsp_msgq_wait(struct nvkm_gsp *gsp, u32 repc, u32 *prepc, int *ptime)return mqe->data; } + size =ALIGN (repc +GSP_MSG_HDR_SIZE ,GSP_PAGE_SIZE ); + msg =kvmalloc (repc,GFP_KERNEL );if (!msg)return ERR_PTR (-ENOMEM );
@@ -129,19 +131,15 @@ r535_gsp_msgq_wait(struct nvkm_gsp *gsp, u32 repc, u32 *prepc, int *ptime) len =min_t (u32, repc, len);memcpy (msg, mqe->data, len); - rptr +=DIV_ROUND_UP (len,GSP_PAGE_SIZE ); -if (rptr == gsp->msgq.cnt) - rptr =0 ; - repc -= len;if (repc) { mqe = (void *)((u8 *)gsp->shm.msgq.ptr +0x1000 +0 *0x1000 );memcpy (msg + len, mqe, repc); - - rptr +=DIV_ROUND_UP (repc,GSP_PAGE_SIZE ); } + rptr = (rptr +DIV_ROUND_UP (size,GSP_PAGE_SIZE )) % gsp->msgq.cnt; +mb (); (*gsp->msgq.rptr) = rptr;return msg;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 6/31 nvkm: correctly calculate the available space of the GSP cmdq buffer
In reply to Sasha LevinFrom: Zhi Wang <[email protected]>
[ Upstream commit 01ed662bdd6fce4f59c1804b334610d710d79fa0 ]
r535_gsp_cmdq_push() waits for the available page in the GSP cmdq buffer when handling a large RPC request. When it sees at least one available page in the cmdq, it quits the waiting with the amount of free buffer pages in the queue.
Unfortunately, it always takes the [write pointer, buf_size) as available buffer pages before rolling back and wrongly calculates the size of the data should be copied. Thus, it can overwrite the RPC request that GSP is currently reading, which causes GSP hang due to corrupted RPC request:
[ 549.209389] ------------[ cut here ]------------ [ 549.214010] WARNING: CPU: 8 PID: 6314 at drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c:116 r535_gsp_msgq_wait+0xd0/0x190 [nvkm] [ 549.225678] Modules linked in: nvkm(E+) gsp_log(E) snd_seq_dummy(E) snd_hrtimer(E) snd_seq(E) snd_timer(E) snd_seq_device(E) snd(E) soundcore(E) rfkill(E) qrtr(E) vfat(E) fat(E) ipmi_ssif(E) amd_atl(E) intel_rapl_msr(E) intel_rapl_common(E) mlx5_ib(E) amd64_edac(E) edac_mce_amd(E) kvm_amd(E) ib_uverbs(E) kvm(E) ib_core(E) acpi_ipmi(E) ipmi_si(E) mxm_wmi(E) ipmi_devintf(E) rapl(E) i2c_piix4(E) wmi_bmof(E) joydev(E) ptdma(E) acpi_cpufreq(E) k10temp(E) pcspkr(E) ipmi_msghandler(E) xfs(E) libcrc32c(E) ast(E) i2c_algo_bit(E) crct10dif_pclmul(E) drm_shmem_helper(E) nvme_tcp(E) crc32_pclmul(E) ahci(E) drm_kms_helper(E) libahci(E) nvme_fabrics(E) crc32c_intel(E) nvme(E) cdc_ether(E) mlx5_core(E) nvme_core(E) usbnet(E) drm(E) libata(E) ccp(E) ghash_clmulni_intel(E) mii(E) t10_pi(E) mlxfw(E) sp5100_tco(E) psample(E) pci_hyperv_intf(E) wmi(E) dm_multipath(E) sunrpc(E) dm_mirror(E) dm_region_hash(E) dm_log(E) dm_mod(E) be2iscsi(E) bnx2i(E) cnic(E) uio(E) cxgb4i(E) cxgb4(E) tls(E) libcxgbi(E) libcxgb(E) qla4xxx(E) [ 549.225752] iscsi_boot_sysfs(E) iscsi_tcp(E) libiscsi_tcp(E) libiscsi(E) scsi_transport_iscsi(E) fuse(E) [last unloaded: gsp_log(E)] [ 549.326293] CPU: 8 PID: 6314 Comm: insmod Tainted: G E 6.9.0-rc6+ #1 [ 549.334039] Hardware name: ASRockRack 1U1G-MILAN/N/ROMED8-NL, BIOS L3.12E 09/06/2022 [ 549.341781] RIP: 0010:r535_gsp_msgq_wait+0xd0/0x190 [nvkm] [ 549.347343] Code: 08 00 00 89 da c1 e2 0c 48 8d ac 11 00 10 00 00 48 8b 0c 24 48 85 c9 74 1f c1 e0 0c 4c 8d 6d 30 83 e8 30 89 01 e9 68 ff ff ff <0f> 0b 49 c7 c5 92 ff ff ff e9 5a ff ff ff ba ff ff ff ff be c0 0c [ 549.366090] RSP: 0018:ffffacbccaaeb7d0 EFLAGS: 00010246 [ 549.371315] RAX: 0000000000000000 RBX: 0000000000000012 RCX: 0000000000923e28 [ 549.378451] RDX: 0000000000000000 RSI: 0000000055555554 RDI: ffffacbccaaeb730 [ 549.385590] RBP: 0000000000000001 R08: ffff8bd14d235f70 R09: ffff8bd14d235f70 [ 549.392721] R10: 0000000000000002 R11: ffff8bd14d233864 R12: 0000000000000020 [ 549.399854] R13: ffffacbccaaeb818 R14: 0000000000000020 R15: ffff8bb298c67000 [ 549.406988] FS: 00007f5179244740(0000) GS:ffff8bd14d200000(0000) knlGS:0000000000000000 [ 549.415076] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 549.420829] CR2: 00007fa844000010 CR3: 00000001567dc005 CR4: 0000000000770ef0 [ 549.427963] PKRU: 55555554 [ 549.430672] Call Trace: [ 549.433126] <TASK> [ 549.435233] ? __warn+0x7f/0x130 [ 549.438473] ? r535_gsp_msgq_wait+0xd0/0x190 [nvkm] [ 549.443426] ? report_bug+0x18a/0x1a0 [ 549.447098] ? handle_bug+0x3c/0x70 [ 549.450589] ? exc_invalid_op+0x14/0x70 [ 549.454430] ? asm_exc_invalid_op+0x16/0x20 [ 549.458619] ? r535_gsp_msgq_wait+0xd0/0x190 [nvkm] [ 549.463565] r535_gsp_msg_recv+0x46/0x230 [nvkm] [ 549.468257] r535_gsp_rpc_push+0x106/0x160 [nvkm] [ 549.473033] r535_gsp_rpc_rm_ctrl_push+0x40/0x130 [nvkm] [ 549.478422] nvidia_grid_init_vgpu_types+0xbc/0xe0 [nvkm] [ 549.483899] nvidia_grid_init+0xb1/0xd0 [nvkm] [ 549.488420] ? srso_alias_return_thunk+0x5/0xfbef5 [ 549.493213] nvkm_device_pci_probe+0x305/0x420 [nvkm] [ 549.498338] local_pci_probe+0x46/0xa0 [ 549.502096] pci_call_probe+0x56/0x170 [ 549.505851] pci_device_probe+0x79/0xf0 [ 549.509690] ? driver_sysfs_add+0x59/0xc0 [ 549.513702] really_probe+0xd9/0x380 [ 549.517282] __driver_probe_device+0x78/0x150 [ 549.521640] driver_probe_device+0x1e/0x90 [ 549.525746] __driver_attach+0xd2/0x1c0 [ 549.529594] ? __pfx___driver_attach+0x10/0x10 [ 549.534045] bus_for_each_dev+0x78/0xd0 [ 549.537893] bus_add_driver+0x112/0x210 [ 549.541750] driver_register+0x5c/0x120 [ 549.545596] ? __pfx_nvkm_init+0x10/0x10 [nvkm] [ 549.550224] do_one_initcall+0x44/0x300 [ 549.554063] ? do_init_module+0x23/0x240 [ 549.557989] do_init_module+0x64/0x240
Calculate the available buffer page before rolling back based on the result from the waiting.
--- drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +4 -2
@@ -161,7 +161,7 @@ r535_gsp_cmdq_push(struct nvkm_gsp *gsp, void *argv)u64 *end;u64 csum =0 ;int free, time =1000000 ; -u32 wptr, size; +u32 wptr, size, step;u32 off =0 ; argc =ALIGN (GSP_MSG_HDR_SIZE + argc,GSP_PAGE_SIZE );
@@ -195,7 +195,9 @@ r535_gsp_cmdq_push(struct nvkm_gsp *gsp, void *argv) } cqe = (void *)((u8 *)gsp->shm.cmdq.ptr +0x1000 + wptr *0x1000 ); - size =min_t (u32, argc, (gsp->cmdq.cnt - wptr) *GSP_PAGE_SIZE ); + step =min_t (u32, free, (gsp->cmdq.cnt - wptr)); + size =min_t (u32, argc, step *GSP_PAGE_SIZE ); +memcpy (cqe, (u8 *)cmd + off, size); wptr +=DIV_ROUND_UP (size,0x1000 );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 7/31 drm/tests: hdmi: handle empty modes in find_preferred_mode()
In reply to Sasha LevinFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit d3314efd6ebf335a3682b1d6b1b81cdab3d8254a ]
If the connector->modes list is empty, then list_first_entry() returns a bogus entry. Change that to use list_first_entry_or_null().
--- drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c +1 -1
@@ -46,7 +46,7 @@ static struct drm_display_mode *find_preferred_mode(struct drm_connector *connecstruct drm_display_mode *mode, *preferred;mutex_lock (&drm->mode_config.mutex); - preferred = list_first_entry(&connector->modes, struct drm_display_mode, head); + preferred = list_first_entry_or_null(&connector->modes, struct drm_display_mode, head);list_for_each_entry (mode, &connector->modes, head)if (mode->type &DRM_MODE_TYPE_PREFERRED ) preferred = mode;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 8/31 drm/tests: hdmi: return meaningful value from set_connector_edid()
In reply to Sasha LevinFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit a8403be6eea91e4f5d8ad5dbc463dd08339eaece ]
The set_connector_edid() function returns a bogus 0, performing the check on the connector->funcs->fill_modes() result internally. Make the function pass the fill_modes()'s return value to the caller and move corresponding checks to the caller site.
--- .../drm/tests/drm_hdmi_state_helper_test.c | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-)
drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c +15 -16
@@ -105,9 +105,8 @@ static int set_connector_edid(struct kunit *test, struct drm_connector *connectomutex_lock (&drm->mode_config.mutex); ret = connector->funcs->fill_modes (connector,4096 ,4096 );mutex_unlock (&drm->mode_config.mutex); -KUNIT_ASSERT_GT (test, ret,0 ); -return 0 ; +return ret; }static const struct drm_connector_hdmi_funcs dummy_connector_hdmi_funcs = {
@@ -223,7 +222,7 @@ drm_atomic_helper_connector_hdmi_init(struct kunit *test, ret =set_connector_edid (test, conn, test_edid_hdmi_1080p_rgb_max_200mhz,ARRAY_SIZE (test_edid_hdmi_1080p_rgb_max_200mhz)); -KUNIT_ASSERT_EQ (test, ret,0 ); +KUNIT_ASSERT_GT (test, ret,0 );return priv; }
@@ -728,7 +727,7 @@ static void drm_test_check_output_bpc_crtc_mode_changed(struct kunit *test) ret =set_connector_edid (test, conn, test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz,ARRAY_SIZE (test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz)); -KUNIT_ASSERT_EQ (test, ret,0 ); +KUNIT_ASSERT_GT (test, ret,0 ); ctx =drm_kunit_helper_acquire_ctx_alloc (test);KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx);
@@ -802,7 +801,7 @@ static void drm_test_check_output_bpc_crtc_mode_not_changed(struct kunit *test) ret =set_connector_edid (test, conn, test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz,ARRAY_SIZE (test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz)); -KUNIT_ASSERT_EQ (test, ret,0 ); +KUNIT_ASSERT_GT (test, ret,0 ); ctx =drm_kunit_helper_acquire_ctx_alloc (test);KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx);
@@ -873,7 +872,7 @@ static void drm_test_check_output_bpc_dvi(struct kunit *test) ret =set_connector_edid (test, conn, test_edid_dvi_1080p,ARRAY_SIZE (test_edid_dvi_1080p)); -KUNIT_ASSERT_EQ (test, ret,0 ); +KUNIT_ASSERT_GT (test, ret,0 ); info = &conn->display_info;KUNIT_ASSERT_FALSE (test, info->is_hdmi);
@@ -920,7 +919,7 @@ static void drm_test_check_tmds_char_rate_rgb_8bpc(struct kunit *test) ret =set_connector_edid (test, conn, test_edid_hdmi_1080p_rgb_max_200mhz,ARRAY_SIZE (test_edid_hdmi_1080p_rgb_max_200mhz)); -KUNIT_ASSERT_EQ (test, ret,0 ); +KUNIT_ASSERT_GT (test, ret,0 ); ctx =drm_kunit_helper_acquire_ctx_alloc (test);KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx);
@@ -967,7 +966,7 @@ static void drm_test_check_tmds_char_rate_rgb_10bpc(struct kunit *test) ret =set_connector_edid (test, conn, test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz,ARRAY_SIZE (test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz)); -KUNIT_ASSERT_EQ (test, ret,0 ); +KUNIT_ASSERT_GT (test, ret,0 ); ctx =drm_kunit_helper_acquire_ctx_alloc (test);KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx);
@@ -1014,7 +1013,7 @@ static void drm_test_check_tmds_char_rate_rgb_12bpc(struct kunit *test) ret =set_connector_edid (test, conn, test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz,ARRAY_SIZE (test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz)); -KUNIT_ASSERT_EQ (test, ret,0 ); +KUNIT_ASSERT_GT (test, ret,0 ); ctx =drm_kunit_helper_acquire_ctx_alloc (test);KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx);
@@ -1121,7 +1120,7 @@ static void drm_test_check_max_tmds_rate_bpc_fallback(struct kunit *test) ret =set_connector_edid (test, conn, test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz,ARRAY_SIZE (test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz)); -KUNIT_ASSERT_EQ (test, ret,0 ); +KUNIT_ASSERT_GT (test, ret,0 ); info = &conn->display_info;KUNIT_ASSERT_TRUE (test, info->is_hdmi);
@@ -1190,7 +1189,7 @@ static void drm_test_check_max_tmds_rate_format_fallback(struct kunit *test) ret =set_connector_edid (test, conn, test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz,ARRAY_SIZE (test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz)); -KUNIT_ASSERT_EQ (test, ret,0 ); +KUNIT_ASSERT_GT (test, ret,0 ); info = &conn->display_info;KUNIT_ASSERT_TRUE (test, info->is_hdmi);
@@ -1254,7 +1253,7 @@ static void drm_test_check_output_bpc_format_vic_1(struct kunit *test) ret =set_connector_edid (test, conn, test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz,ARRAY_SIZE (test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz)); -KUNIT_ASSERT_EQ (test, ret,0 ); +KUNIT_ASSERT_GT (test, ret,0 ); info = &conn->display_info;KUNIT_ASSERT_TRUE (test, info->is_hdmi);
@@ -1314,7 +1313,7 @@ static void drm_test_check_output_bpc_format_driver_rgb_only(struct kunit *test) ret =set_connector_edid (test, conn, test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz,ARRAY_SIZE (test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz)); -KUNIT_ASSERT_EQ (test, ret,0 ); +KUNIT_ASSERT_GT (test, ret,0 ); info = &conn->display_info;KUNIT_ASSERT_TRUE (test, info->is_hdmi);
@@ -1381,7 +1380,7 @@ static void drm_test_check_output_bpc_format_display_rgb_only(struct kunit *test ret =set_connector_edid (test, conn, test_edid_hdmi_1080p_rgb_max_200mhz,ARRAY_SIZE (test_edid_hdmi_1080p_rgb_max_200mhz)); -KUNIT_ASSERT_EQ (test, ret,0 ); +KUNIT_ASSERT_GT (test, ret,0 ); info = &conn->display_info;KUNIT_ASSERT_TRUE (test, info->is_hdmi);
@@ -1447,7 +1446,7 @@ static void drm_test_check_output_bpc_format_driver_8bpc_only(struct kunit *test ret =set_connector_edid (test, conn, test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz,ARRAY_SIZE (test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz)); -KUNIT_ASSERT_EQ (test, ret,0 ); +KUNIT_ASSERT_GT (test, ret,0 ); info = &conn->display_info;KUNIT_ASSERT_TRUE (test, info->is_hdmi);
@@ -1507,7 +1506,7 @@ static void drm_test_check_output_bpc_format_display_8bpc_only(struct kunit *tes ret =set_connector_edid (test, conn, test_edid_hdmi_1080p_rgb_max_340mhz,ARRAY_SIZE (test_edid_hdmi_1080p_rgb_max_340mhz)); -KUNIT_ASSERT_EQ (test, ret,0 ); +KUNIT_ASSERT_GT (test, ret,0 ); info = &conn->display_info;KUNIT_ASSERT_TRUE (test, info->is_hdmi);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 9/31 drm/amd/display: Populate chroma prefetch parameters, DET buffer fix
In reply to Sasha LevinFrom: Ausef Yousof <[email protected]>
[ Upstream commit 70fec46519fca859aa209f5f02e7e0a0123aca4a ]
[WHY]
Soft hang/lag observed during 10bit playback + moving cursor, corruption observed in other tickets for same reason, also failing MPO.
1. Currently, we are always running calculate_lowest_supported_state_for_temp_read which is only necessary on dGPU
2. Fast validate path does not apply DET buffer allocation policy
3. Prefetch UrgBFactor chroma parameter not populated in prefetch calculation
[HOW]
1. Add a check to see if we are on APU, if so, skip the code
2. Add det buffer alloc policy checks to fast validate path
3. Populate UrgentBurstChroma param in call to calculate UrgBChroma prefetch values
-revision commits: small formatting/brackets/null check addition + remove test change + dGPU code
--- .../amd/display/dc/dml2/display_mode_core.c | 5 ++- .../drm/amd/display/dc/dml2/dml2_wrapper.c | 35 +++++++++++++------ 2 files changed, 29 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2/display_mode_core.c +4 -1
@@ -6434,7 +6434,7 @@ static void dml_prefetch_check(struct display_mode_lib_st *mode_lib)/* Output */ &mode_lib->ms.UrgentBurstFactorCursorPre[k], &mode_lib->ms.UrgentBurstFactorLumaPre[k], - &mode_lib->ms.UrgentBurstFactorChroma[k], + &mode_lib->ms.UrgentBurstFactorChromaPre[k], &mode_lib->ms.NotUrgentLatencyHidingPre[k]); mode_lib->ms.cursor_bw_pre[k] = mode_lib->ms.cache_display_cfg.plane.NumberOfCursors[k] * mode_lib->ms.cache_display_cfg.plane.CursorWidth[k] *
@@ -9190,6 +9190,8 @@ void dml_core_mode_programming(struct display_mode_lib_st *mode_lib, const struc &locals->FractionOfUrgentBandwidth, &s->dummy_boolean[0]); // dml_bool_t *PrefetchBandwidthSupport + +if (s->VRatioPrefetchMoreThanMax != false || s->DestinationLineTimesForPrefetchLessThan2 != false) {dml_print ("DML::%s: VRatioPrefetchMoreThanMax = %u\n" , __func__, s->VRatioPrefetchMoreThanMax);dml_print ("DML::%s: DestinationLineTimesForPrefetchLessThan2 = %u\n" , __func__, s->DestinationLineTimesForPrefetchLessThan2);
@@ -9204,6 +9206,7 @@ void dml_core_mode_programming(struct display_mode_lib_st *mode_lib, const struc } } +if (locals->PrefetchModeSupported == true && mode_lib->ms.support.ImmediateFlipSupport == true) { locals->BandwidthAvailableForImmediateFlip = CalculateBandwidthAvailableForImmediateFlip( mode_lib->ms.num_active_planes,
drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c +25 -10
@@ -533,14 +533,21 @@ static bool optimize_pstate_with_svp_and_drr(struct dml2_context *dml2, struct dstatic bool call_dml_mode_support_and_programming (struct dc_state *context) {unsigned int result =0 ; -unsigned int min_state; +unsigned int min_state =0 ;int min_state_for_g6_temp_read =0 ; + + +if (!context) +return false; +struct dml2_context *dml2 = context->bw_ctx.dml2;struct dml2_wrapper_scratch *s = &dml2->v20.scratch; - min_state_for_g6_temp_read =calculate_lowest_supported_state_for_temp_read (dml2, context); +if (!context->streams[0 ]->sink->link->dc->caps.is_apu) { + min_state_for_g6_temp_read =calculate_lowest_supported_state_for_temp_read (dml2, context); -ASSERT (min_state_for_g6_temp_read >=0 ); +ASSERT (min_state_for_g6_temp_read >=0 ); + }if (!dml2->config.use_native_pstate_optimization) { result =optimize_pstate_with_svp_and_drr (dml2, context);
@@ -551,14 +558,20 @@ static bool call_dml_mode_support_and_programming(struct dc_state *context)/* Upon trying to sett certain frequencies in FRL, min_state_for_g6_temp_read is reported as -1. This leads to an invalid value of min_state causing crashes later on. * Use the default logic for min_state only when min_state_for_g6_temp_read is a valid value. In other cases, use the value calculated by the DML directly. */ -if (min_state_for_g6_temp_read >=0 ) - min_state = min_state_for_g6_temp_read > s->mode_support_params.out_lowest_state_idx ? min_state_for_g6_temp_read : s->mode_support_params.out_lowest_state_idx; -else - min_state = s->mode_support_params.out_lowest_state_idx; - -if (result) - result =dml_mode_programming (&dml2->v20.dml_core_ctx, min_state, &s->cur_display_config, true); +if (!context->streams[0 ]->sink->link->dc->caps.is_apu) { +if (min_state_for_g6_temp_read >=0 ) + min_state = min_state_for_g6_temp_read > s->mode_support_params.out_lowest_state_idx ? min_state_for_g6_temp_read : s->mode_support_params.out_lowest_state_idx; +else + min_state = s->mode_support_params.out_lowest_state_idx; + } +if (result) { +if (!context->streams[0 ]->sink->link->dc->caps.is_apu) { + result =dml_mode_programming (&dml2->v20.dml_core_ctx, min_state, &s->cur_display_config, true); + }else { + result =dml_mode_programming (&dml2->v20.dml_core_ctx, s->mode_support_params.out_lowest_state_idx, &s->cur_display_config, true); + } + }return result; }
@@ -687,6 +700,8 @@ static bool dml2_validate_only(struct dc_state *context)build_unoptimized_policy_settings (dml2->v20.dml_core_ctx.project, &dml2->v20.dml_core_ctx.policy);map_dc_state_into_dml_display_cfg (dml2, context, &dml2->v20.scratch.cur_display_config); +if (!dml2->config.skip_hw_state_mapping) +dml2_apply_det_buffer_allocation_policy (dml2, &dml2->v20.scratch.cur_display_config); result = pack_and_call_dml_mode_support_ex(dml2, &dml2->v20.scratch.cur_display_config,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 10/31 drm/amd/display: Overwriting dualDPP UBF values before usage
In reply to Sasha LevinFrom: Ausef Yousof <[email protected]>
[ Upstream commit 24909d9ec7c3afa8da2f3c9afa312e7a4a61f250 ]
[WHY]
Right now in dml2 mode validation we are calculating UBF parameters for prefetch calculation for single and dual DPP scenarios. Data structure to store such values are just 1D arrays, the single DPP values are overwritten by the dualDPP values, and we end up using dualDPP for prefetch calculations twice (once in place of singleDPP support check and again for dual).
This naturally leads to many problems, one of which validating a mode in "singleDPP" (when we used dual DPP parameters) and sending the singleDPP parameters to mode programming, if we cannot support then we observe the corruption as described in the ticket.
[HOW]
UBF values need to have 2d arrays to store values specific to single and dual DPP states to avoid single DPP values being overwritten. Other parameters are recorded on a per state basis such as prefetch UBF values but they are in the same loop used for calculation and at that point its fine to overwrite them, its not the case for plain UBF values.
--- .../amd/display/dc/dml2/display_mode_core.c | 30 +++++++++---------- .../dc/dml2/display_mode_core_structs.h | 6 ++-- 2 files changed, 18 insertions(+), 18 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2/display_mode_core.c +15 -15
@@ -6301,9 +6301,9 @@ static void dml_prefetch_check(struct display_mode_lib_st *mode_lib) mode_lib->ms.meta_row_bandwidth_this_state, mode_lib->ms.dpte_row_bandwidth_this_state, mode_lib->ms.NoOfDPPThisState, - mode_lib->ms.UrgentBurstFactorLuma, - mode_lib->ms.UrgentBurstFactorChroma, - mode_lib->ms.UrgentBurstFactorCursor); + mode_lib->ms.UrgentBurstFactorLuma[j], + mode_lib->ms.UrgentBurstFactorChroma[j], + mode_lib->ms.UrgentBurstFactorCursor[j]); s->VMDataOnlyReturnBWPerState = dml_get_return_bw_mbps_vm_only( &mode_lib->ms.soc,
@@ -6458,9 +6458,9 @@ static void dml_prefetch_check(struct display_mode_lib_st *mode_lib) mode_lib->ms.cursor_bw_pre, mode_lib->ms.prefetch_vmrow_bw, mode_lib->ms.NoOfDPPThisState, - mode_lib->ms.UrgentBurstFactorLuma, - mode_lib->ms.UrgentBurstFactorChroma, - mode_lib->ms.UrgentBurstFactorCursor, + mode_lib->ms.UrgentBurstFactorLuma[j], + mode_lib->ms.UrgentBurstFactorChroma[j], + mode_lib->ms.UrgentBurstFactorCursor[j], mode_lib->ms.UrgentBurstFactorLumaPre, mode_lib->ms.UrgentBurstFactorChromaPre, mode_lib->ms.UrgentBurstFactorCursorPre,
@@ -6517,9 +6517,9 @@ static void dml_prefetch_check(struct display_mode_lib_st *mode_lib) mode_lib->ms.cursor_bw, mode_lib->ms.cursor_bw_pre, mode_lib->ms.NoOfDPPThisState, - mode_lib->ms.UrgentBurstFactorLuma, - mode_lib->ms.UrgentBurstFactorChroma, - mode_lib->ms.UrgentBurstFactorCursor, + mode_lib->ms.UrgentBurstFactorLuma[j], + mode_lib->ms.UrgentBurstFactorChroma[j], + mode_lib->ms.UrgentBurstFactorCursor[j], mode_lib->ms.UrgentBurstFactorLumaPre, mode_lib->ms.UrgentBurstFactorChromaPre, mode_lib->ms.UrgentBurstFactorCursorPre);
@@ -6586,9 +6586,9 @@ static void dml_prefetch_check(struct display_mode_lib_st *mode_lib) mode_lib->ms.cursor_bw_pre, mode_lib->ms.prefetch_vmrow_bw, mode_lib->ms.NoOfDPP[j],// VBA_ERROR DPPPerSurface is not assigned at this point, should use NoOfDpp here - mode_lib->ms.UrgentBurstFactorLuma, - mode_lib->ms.UrgentBurstFactorChroma, - mode_lib->ms.UrgentBurstFactorCursor, + mode_lib->ms.UrgentBurstFactorLuma[j], + mode_lib->ms.UrgentBurstFactorChroma[j], + mode_lib->ms.UrgentBurstFactorCursor[j], mode_lib->ms.UrgentBurstFactorLumaPre, mode_lib->ms.UrgentBurstFactorChromaPre, mode_lib->ms.UrgentBurstFactorCursorPre,
@@ -7809,9 +7809,9 @@ dml_bool_t dml_core_mode_support(struct display_mode_lib_st *mode_lib) mode_lib->ms.DETBufferSizeYThisState[k], mode_lib->ms.DETBufferSizeCThisState[k],/* Output */ - &mode_lib->ms.UrgentBurstFactorCursor[k], - &mode_lib->ms.UrgentBurstFactorLuma[k], - &mode_lib->ms.UrgentBurstFactorChroma[k], + &mode_lib->ms.UrgentBurstFactorCursor[j][k], + &mode_lib->ms.UrgentBurstFactorLuma[j][k], + &mode_lib->ms.UrgentBurstFactorChroma[j][k], &mode_lib->ms.NotUrgentLatencyHiding[k]); }
drivers/gpu/drm/amd/display/dc/dml2/display_mode_core_structs.h +3 -3
@@ -884,11 +884,11 @@ struct mode_support_st {dml_uint_t meta_row_height[__DML_NUM_PLANES__];dml_uint_t meta_row_height_chroma[__DML_NUM_PLANES__];dml_float_t UrgLatency; -dml_float_t UrgentBurstFactorCursor[__DML_NUM_PLANES__]; +dml_float_t UrgentBurstFactorCursor[2 ][__DML_NUM_PLANES__];dml_float_t UrgentBurstFactorCursorPre[__DML_NUM_PLANES__]; -dml_float_t UrgentBurstFactorLuma[__DML_NUM_PLANES__]; +dml_float_t UrgentBurstFactorLuma[2 ][__DML_NUM_PLANES__];dml_float_t UrgentBurstFactorLumaPre[__DML_NUM_PLANES__]; -dml_float_t UrgentBurstFactorChroma[__DML_NUM_PLANES__]; +dml_float_t UrgentBurstFactorChroma[2 ][__DML_NUM_PLANES__];dml_float_t UrgentBurstFactorChromaPre[__DML_NUM_PLANES__];dml_float_t MaximumSwathWidthInLineBufferLuma;dml_float_t MaximumSwathWidthInLineBufferChroma;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 11/31 printk: Fix signed integer overflow when defining LOG_BUF_LEN_MAX
In reply to Sasha LevinFrom: Kuan-Wei Chiu <[email protected]>
[ Upstream commit 3d6f83df8ff2d5de84b50377e4f0d45e25311c7a ]
Shifting 1 << 31 on a 32-bit int causes signed integer overflow, which leads to undefined behavior. To prevent this, cast 1 to u32 before performing the shift, ensuring well-defined behavior.
This change explicitly avoids any potential overflow by ensuring that the shift occurs on an unsigned 32-bit integer.
--- kernel/printk/printk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/printk/printk.c +1 -1
@@ -523,7 +523,7 @@ static struct latched_seq clear_seq = {/* record buffer */ #define LOG_ALIGN __alignof__(unsigned long)#define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT) -#define LOG_BUF_LEN_MAX (u32)(1 << 31) +#define LOG_BUF_LEN_MAX ((u32)1 << 31)static char __log_buf[__LOG_BUF_LEN]__aligned(LOG_ALIGN) ;static char *log_buf = __log_buf;static u32 log_buf_len = __LOG_BUF_LEN;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 12/31 drm/connector: add mutex to protect ELD from concurrent access
In reply to Sasha LevinFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit df7c8e3dde37a9d81c0613285b43600f3cc70f34 ]
The connector->eld is accessed by the .get_eld() callback. This access can collide with the drm_edid_to_eld() updating the data at the same time. Add drm_connector.eld_mutex to protect the data from concurrenct access. Individual drivers are not updated (to reduce possible issues while applying the patch), maintainers are to find a best suitable way to lock that mutex while accessing the ELD data.
--- drivers/gpu/drm/drm_connector.c | 1 + drivers/gpu/drm/drm_edid.c | 6 ++++++ include/drm/drm_connector.h | 5 ++++- 3 files changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_connector.c +1 -0
@@ -277,6 +277,7 @@ static int __drm_connector_init(struct drm_device *dev,INIT_LIST_HEAD (&connector->probed_modes);INIT_LIST_HEAD (&connector->modes);mutex_init (&connector->mutex); +mutex_init (&connector->eld_mutex);mutex_init (&connector->edid_override_mutex);mutex_init (&connector->hdmi.infoframes.lock); connector->edid_blob_ptr =NULL ;
drivers/gpu/drm/drm_edid.c +6 -0
@@ -5605,7 +5605,9 @@ EXPORT_SYMBOL(drm_edid_get_monitor_name);static void clear_eld (struct drm_connector *connector) { +mutex_lock (&connector->eld_mutex);memset (connector->eld,0 ,sizeof (connector->eld)); +mutex_unlock (&connector->eld_mutex); connector->latency_present[0 ] = false; connector->latency_present[1 ] = false;
@@ -5657,6 +5659,8 @@ static void drm_edid_to_eld(struct drm_connector *connector,if (!drm_edid)return ; +mutex_lock (&connector->eld_mutex); + mnl =get_monitor_name (drm_edid, &eld[DRM_ELD_MONITOR_NAME_STRING ]); drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] ELD monitor %s\n", connector->base.id, connector->name,
@@ -5717,6 +5721,8 @@ static void drm_edid_to_eld(struct drm_connector *connector,drm_dbg_kms (connector->dev,"[CONNECTOR:%d:%s] ELD size %d, SAD count %d\n" , connector->base.id, connector->name,drm_eld_size (eld), total_sad_count); + +mutex_unlock (&connector->eld_mutex); } static int _drm_edid_to_sad(const struct drm_edid *drm_edid,
include/drm/drm_connector.h +4 -1
@@ -2001,8 +2001,11 @@ struct drm_connector {struct drm_encoder *encoder;#define MAX_ELD_BYTES 128 -/** @eld: EDID-like data, if present */ +/** @eld: EDID-like data, if present, protected by @eld_mutex */ uint8_t eld[MAX_ELD_BYTES ]; +/** @eld_mutex: protection for concurrenct access to @eld */ +struct mutex eld_mutex; +/** @latency_present: AV delay info from ELD, if found */ bool latency_present[2 ];/**
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 13/31 drm/bridge: anx7625: use eld_mutex to protect access to connector->eld
In reply to Sasha LevinFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit e72bf423a60afd744d13e40ab2194044a3af5217 ]
Reading access to connector->eld can happen at the same time the drm_edid_to_eld() updates the data. Take the newly added eld_mutex in order to protect connector->eld from concurrent access.
--- drivers/gpu/drm/bridge/analogix/anx7625.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/bridge/analogix/anx7625.c +2 -0
@@ -2002,8 +2002,10 @@ static int anx7625_audio_get_eld(struct device *dev, void *data,memset (buf,0 , len); }else {dev_dbg (dev,"audio copy eld\n" ); +mutex_lock (&ctx->connector->eld_mutex);memcpy (buf, ctx->connector->eld,min (sizeof (ctx->connector->eld), len)); +mutex_unlock (&ctx->connector->eld_mutex); }return 0 ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 14/31 drm/bridge: ite-it66121: use eld_mutex to protect access to connector->eld
In reply to Sasha LevinFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit 39ead6e02ea7d19b421e9d42299d4293fed3064e ]
Reading access to connector->eld can happen at the same time the drm_edid_to_eld() updates the data. Take the newly added eld_mutex in order to protect connector->eld from concurrent access.
--- drivers/gpu/drm/bridge/ite-it66121.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/bridge/ite-it66121.c +2 -0
@@ -1452,8 +1452,10 @@ static int it66121_audio_get_eld(struct device *dev, void *data,dev_dbg (dev,"No connector present, passing empty EDID data" );memset (buf,0 , len); }else { +mutex_lock (&ctx->connector->eld_mutex);memcpy (buf, ctx->connector->eld,min (sizeof (ctx->connector->eld), len)); +mutex_unlock (&ctx->connector->eld_mutex); }mutex_unlock (&ctx->lock);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 15/31 drm/amd/display: use eld_mutex to protect access to connector->eld
In reply to Sasha LevinFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit 819bee01eea06282d7bda17d46caf29cae4f6d84 ]
Reading access to connector->eld can happen at the same time the drm_edid_to_eld() updates the data. Take the newly added eld_mutex in order to protect connector->eld from concurrent access.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -0
@@ -1036,8 +1036,10 @@ static int amdgpu_dm_audio_component_get_eld(struct device *kdev, int port,continue ; *enabled = true; +mutex_lock (&connector->eld_mutex); ret =drm_eld_size (connector->eld);memcpy (buf, connector->eld,min (max_bytes, ret)); +mutex_unlock (&connector->eld_mutex);break ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 16/31 drm/exynos: hdmi: use eld_mutex to protect access to connector->eld
In reply to Sasha LevinFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit 5e8436d334ed7f6785416447c50b42077c6503e0 ]
Reading access to connector->eld can happen at the same time the drm_edid_to_eld() updates the data. Take the newly added eld_mutex in order to protect connector->eld from concurrent access.
--- drivers/gpu/drm/exynos/exynos_hdmi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/exynos/exynos_hdmi.c +2 -0
@@ -1643,7 +1643,9 @@ static int hdmi_audio_get_eld(struct device *dev, void *data, uint8_t *buf,struct hdmi_context *hdata =dev_get_drvdata (dev);struct drm_connector *connector = &hdata->connector; +mutex_lock (&connector->eld_mutex);memcpy (buf, connector->eld,min (sizeof (connector->eld), len)); +mutex_unlock (&connector->eld_mutex);return 0 ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 17/31 drm/radeon: use eld_mutex to protect access to connector->eld
In reply to Sasha LevinFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit b54c14f82428c8a602392d4cae1958a71a578132 ]
Reading access to connector->eld can happen at the same time the drm_edid_to_eld() updates the data. Take the newly added eld_mutex in order to protect connector->eld from concurrent access.
--- drivers/gpu/drm/radeon/radeon_audio.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/radeon/radeon_audio.c +2 -0
@@ -775,8 +775,10 @@ static int radeon_audio_component_get_eld(struct device *kdev, int port,if (!dig->pin || dig->pin->id != port)continue ; *enabled = true; +mutex_lock (&connector->eld_mutex); ret =drm_eld_size (connector->eld);memcpy (buf, connector->eld,min (max_bytes, ret)); +mutex_unlock (&connector->eld_mutex);break ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 18/31 drm/sti: hdmi: use eld_mutex to protect access to connector->eld
In reply to Sasha LevinFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit e99c0b517bcd53cf61f998a3c4291333401cb391 ]
Reading access to connector->eld can happen at the same time the drm_edid_to_eld() updates the data. Take the newly added eld_mutex in order to protect connector->eld from concurrent access.
--- drivers/gpu/drm/sti/sti_hdmi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/sti/sti_hdmi.c +2 -0
@@ -1225,7 +1225,9 @@ static int hdmi_audio_get_eld(struct device *dev, void *data, uint8_t *buf, sizestruct drm_connector *connector = hdmi->drm_connector;DRM_DEBUG_DRIVER ("\n" ); +mutex_lock (&connector->eld_mutex);memcpy (buf, connector->eld,min (sizeof (connector->eld), len)); +mutex_unlock (&connector->eld_mutex);return 0 ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 19/31 drm/vc4: hdmi: use eld_mutex to protect access to connector->eld
In reply to Sasha LevinFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit 81a9a93b169a273ccc4a9a1ee56f17e9981d3f98 ]
Reading access to connector->eld can happen at the same time the drm_edid_to_eld() updates the data. Take the newly added eld_mutex in order to protect connector->eld from concurrent access.
--- drivers/gpu/drm/vc4/vc4_hdmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/vc4/vc4_hdmi.c +2 -2
@@ -2192,9 +2192,9 @@ static int vc4_hdmi_audio_get_eld(struct device *dev, void *data,struct vc4_hdmi *vc4_hdmi =dev_get_drvdata (dev);struct drm_connector *connector = &vc4_hdmi->connector; -mutex_lock (&vc4_hdmi->mutex); +mutex_lock (&connector->eld_mutex);memcpy (buf, connector->eld,min (sizeof (connector->eld), len)); -mutex_unlock (&vc4_hdmi->mutex); +mutex_unlock (&connector->eld_mutex);return 0 ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 20/31 drm/amd/display: Fix Mode Cutoff in DSC Passthrough to DP2.1 Monitor
In reply to Sasha LevinFrom: Fangzhi Zuo <[email protected]>
[ Upstream commit e56ad45e991128bf4db160b75a1d9f647a341d8f ]
Source --> DP2.1 MST hub --> DP1.4/2.1 monitor
When change from DP1.4 to DP2.1 from monitor manual, modes higher than 4k120 are all cutoff by mode validation. Switch back to DP1.4 gets all the modes up to 4k240 available to be enabled by dsc passthrough.
[why]
Compared to DP1.4 link from hub to monitor, DP2.1 link has larger full_pbn value that causes overflow in the process of doing conversion from pbn to kbps.
[how]
Change the data type accordingly to fit into the data limit during conversion calculation.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +3 -3
@@ -1684,16 +1684,16 @@ int pre_validate_dsc(struct drm_atomic_state *state,return ret; } -static unsigned int kbps_from_pbn (unsigned int pbn) +static uint32_t kbps_from_pbn (unsigned int pbn) { -unsigned int kbps = pbn; +uint64_t kbps = (uint64_t )pbn; kbps *= (1000000 /PEAK_FACTOR_X1000 ); kbps *=8 ; kbps *=54 ; kbps /=64 ; -return kbps; +return (uint32_t )kbps; } static bool is_dsc_common_config_possible(struct dc_stream_state *stream,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 21/31 drm/amdgpu: Don't enable sdma 4.4.5 CTXEMPTY interrupt
In reply to Sasha LevinFrom: Philip Yang <[email protected]>
[ Upstream commit b4b7271e5ca95b581f2fcc4ae852c4079215e92d ]
The sdma context empty interrupt is dropped in amdgpu_irq_dispatch as unregistered interrupt src_id 243, this interrupt accounts to 1/3 of total interrupts and causes IH primary ring overflow when running stressful benchmark application. Disable this interrupt has no side effect found.
--- drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +5 -3
@@ -953,10 +953,12 @@ static int sdma_v4_4_2_inst_start(struct amdgpu_device *adev,/* set utc l1 enable flag always to 1 */ temp =RREG32_SDMA (i, regSDMA_CNTL); temp =REG_SET_FIELD (temp,SDMA_CNTL ,UTC_L1_ENABLE ,1 ); -/* enable context empty interrupt during initialization */ - temp =REG_SET_FIELD (temp,SDMA_CNTL ,CTXEMPTY_INT_ENABLE ,1 ); -WREG32_SDMA (i, regSDMA_CNTL, temp); +if (amdgpu_ip_version (adev,SDMA0_HWIP ,0 ) <IP_VERSION (4 ,4 ,5 )) { +/* enable context empty interrupt during initialization */ + temp =REG_SET_FIELD (temp,SDMA_CNTL ,CTXEMPTY_INT_ENABLE ,1 ); +WREG32_SDMA (i, regSDMA_CNTL, temp); + }if (!amdgpu_sriov_vf (adev)) {if (adev->firmware.load_type !=AMDGPU_FW_LOAD_PSP ) {/* unhalt engine */
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 22/31 drm/amdkfd: Queue interrupt work to different CPU
In reply to Sasha LevinFrom: Philip Yang <[email protected]>
[ Upstream commit 34db5a32617d102e8042151bb87590e43c97132e ]
For CPX mode, each KFD node has interrupt worker to process ih_fifo to send events to user space. Currently all interrupt workers of same adev queue to same CPU, all workers execution are actually serialized and this cause KFD ih_fifo overflow when CPU usage is high.
Use per-GPU unbounded highpri queue with number of workers equals to number of partitions, let queue_work select the next CPU round robin among the local CPUs of same NUMA.
--- drivers/gpu/drm/amd/amdkfd/kfd_device.c | 25 ++++++++-------------- drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c | 25 ++++++++-------------- drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 3 ++- 3 files changed, 20 insertions(+), 33 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +9 -16
@@ -637,6 +637,14 @@ static void kfd_cleanup_nodes(struct kfd_dev *kfd, unsigned int num_nodes)struct kfd_node *knode;unsigned int i; +/* +* flush_work ensures that there are no outstanding +* work-queue items that will access interrupt_ring. New work items +* can't be created because we stopped interrupt handling above. +*/ +flush_workqueue (kfd->ih_wq); +destroy_workqueue (kfd->ih_wq); +for (i =0 ; i < num_nodes; i++) { knode = kfd->nodes[i];device_queue_manager_uninit (knode->dqm);
@@ -1058,21 +1066,6 @@ static int kfd_resume(struct kfd_node *node)return err; } -static inline void kfd_queue_work (struct workqueue_struct *wq, -struct work_struct *work) -{ -int cpu, new_cpu; - - cpu = new_cpu =smp_processor_id (); -do { - new_cpu =cpumask_next (new_cpu, cpu_online_mask) % nr_cpu_ids; -if (cpu_to_node (new_cpu) ==numa_node_id ()) -break ; - }while (cpu != new_cpu); - -queue_work_on (new_cpu, wq, work); -} -/* This is called directly from KGD at ISR. */ void kgd2kfd_interrupt (struct kfd_dev *kfd,const void *ih_ring_entry) {
@@ -1098,7 +1091,7 @@ void kgd2kfd_interrupt(struct kfd_dev *kfd, const void *ih_ring_entry) patched_ihre, &is_patched) && enqueue_ih_ring_entry(node, is_patched ? patched_ihre : ih_ring_entry)) { -kfd_queue_work (node->ih_wq, &node->interrupt_work); +queue_work (node->kfd->ih_wq, &node->interrupt_work);spin_unlock_irqrestore (&node->interrupt_lock, flags);return ; }
drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c +9 -16
@@ -62,11 +62,14 @@ int kfd_interrupt_init(struct kfd_node *node)return r; } - node->ih_wq =alloc_workqueue ("KFD IH" ,WQ_HIGHPRI ,1 ); -if (unlikely (!node->ih_wq)) { -kfifo_free (&node->ih_fifo); -dev_err (node->adev->dev,"Failed to allocate KFD IH workqueue\n" ); -return -ENOMEM ; +if (!node->kfd->ih_wq) { + node->kfd->ih_wq =alloc_workqueue ("KFD IH" ,WQ_HIGHPRI |WQ_UNBOUND , + node->kfd->num_nodes); +if (unlikely (!node->kfd->ih_wq)) { +kfifo_free (&node->ih_fifo); +dev_err (node->adev->dev,"Failed to allocate KFD IH workqueue\n" ); +return -ENOMEM ; + } }spin_lock_init (&node->interrupt_lock);
@@ -96,16 +99,6 @@ void kfd_interrupt_exit(struct kfd_node *node)spin_lock_irqsave (&node->interrupt_lock, flags); node->interrupts_active = false;spin_unlock_irqrestore (&node->interrupt_lock, flags); - -/* -* flush_work ensures that there are no outstanding -* work-queue items that will access interrupt_ring. New work items -* can't be created because we stopped interrupt handling above. -*/ -flush_workqueue (node->ih_wq); - -destroy_workqueue (node->ih_wq); -kfifo_free (&node->ih_fifo); }
@@ -162,7 +155,7 @@ static void interrupt_wq(struct work_struct *work)/* If we spent more than a second processing signals, * reschedule the worker to avoid soft-lockup warnings */ -queue_work (dev->ih_wq, &dev->interrupt_work); +queue_work (dev->kfd->ih_wq, &dev->interrupt_work);break ; } }
drivers/gpu/drm/amd/amdkfd/kfd_priv.h +2 -1
@@ -273,7 +273,6 @@ struct kfd_node {/* Interrupts */ struct kfifo ih_fifo; -struct workqueue_struct *ih_wq;struct work_struct interrupt_work;spinlock_t interrupt_lock;
@@ -366,6 +365,8 @@ struct kfd_dev {struct kfd_node *nodes[MAX_KFD_NODES ];unsigned int num_nodes; +struct workqueue_struct *ih_wq; +/* Kernel doorbells for KFD device */ struct amdgpu_bo *doorbells;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 23/31 drm/bridge: it6505: Change definition MAX_HDCP_DOWN_STREAM_COUNT
In reply to Sasha LevinFrom: Hermes Wu <[email protected]>
[ Upstream commit 85597bc0d70c287ba41f17d14d3d857a38a3d727 ]
A HDCP source device shall support max downstream to 127 devices. Change definition MAX_HDCP_DOWN_STREAM_COUNT to 127
KSVs shall save for DRM blocked devices check.
This results in struct it6505 growth by ~0.5 KiB.
--- drivers/gpu/drm/bridge/ite-it6505.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/ite-it6505.c +1 -1
@@ -296,7 +296,7 @@#define MAX_LANE_COUNT 4#define MAX_LINK_RATE HBR#define AUTO_TRAIN_RETRY 3 -#define MAX_HDCP_DOWN_STREAM_COUNT 10 +#define MAX_HDCP_DOWN_STREAM_COUNT 127#define MAX_CR_LEVEL 0x03#define MAX_EQ_LEVEL 0x03#define AUX_WAIT_TIMEOUT_MS 15
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 24/31 drm/bridge: it6505: fix HDCP Bstatus check
In reply to Sasha LevinFrom: Hermes Wu <[email protected]>
[ Upstream commit 0fd2ff47d8c207fa3173661de04bb9e8201c0ad2 ]
When HDCP is activated,
a DisplayPort source receiving CP_IRQ from the sink shall check Bstatus from DPCD and process the corresponding value
--- drivers/gpu/drm/bridge/ite-it6505.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/gpu/drm/bridge/ite-it6505.c +9 -3
@@ -2312,14 +2312,20 @@ static int it6505_process_hpd_irq(struct it6505 *it6505)DRM_DEV_DEBUG_DRIVER (dev,"dp_irq_vector = 0x%02x" , dp_irq_vector);if (dp_irq_vector &DP_CP_IRQ ) { -it6505_set_bits (it6505,REG_HDCP_TRIGGER ,HDCP_TRIGGER_CPIRQ , -HDCP_TRIGGER_CPIRQ ); - bstatus =it6505_dpcd_read (it6505,DP_AUX_HDCP_BSTATUS );if (bstatus <0 )return bstatus;DRM_DEV_DEBUG_DRIVER (dev,"Bstatus = 0x%02x" , bstatus); + +/*Check BSTATUS when recive CP_IRQ */ +if (bstatus &DP_BSTATUS_R0_PRIME_READY && + it6505->hdcp_status ==HDCP_AUTH_GOING ) +it6505_set_bits (it6505,REG_HDCP_TRIGGER ,HDCP_TRIGGER_CPIRQ , +HDCP_TRIGGER_CPIRQ ); +else if (bstatus & (DP_BSTATUS_REAUTH_REQ |DP_BSTATUS_LINK_FAILURE ) && + it6505->hdcp_status ==HDCP_AUTH_DONE ) +it6505_start_hdcp (it6505); } ret =drm_dp_dpcd_read_link_status (&it6505->aux, link_status);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 25/31 drm/bridge: it6505: fix HDCP encryption when R0 ready
In reply to Sasha LevinFrom: Hermes Wu <[email protected]>
[ Upstream commit 8c01b0bae2f9e58f2fee0e811cb90d8331986554 ]
When starting HDCP authentication, HDCP encryption should be enabled when R0'is checked.
Change encryption enables time at R0' ready.
The hardware HDCP engine trigger is changed and the repeater KSV fails will restart HDCP.
--- drivers/gpu/drm/bridge/ite-it6505.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/gpu/drm/bridge/ite-it6505.c +9 -8
@@ -2081,15 +2081,12 @@ static void it6505_hdcp_wait_ksv_list(struct work_struct *work) ksv_list_check =it6505_hdcp_part2_ksvlist_check (it6505);DRM_DEV_DEBUG_DRIVER (dev,"ksv list ready, ksv list check %s" , ksv_list_check ?"pass" :"fail" ); -if (ksv_list_check) { -it6505_set_bits (it6505,REG_HDCP_TRIGGER , -HDCP_TRIGGER_KSV_DONE ,HDCP_TRIGGER_KSV_DONE ); + +if (ksv_list_check)return ; - } + timeout: -it6505_set_bits (it6505,REG_HDCP_TRIGGER , -HDCP_TRIGGER_KSV_DONE |HDCP_TRIGGER_KSV_FAIL , -HDCP_TRIGGER_KSV_DONE |HDCP_TRIGGER_KSV_FAIL ); +it6505_start_hdcp (it6505); }static void it6505_hdcp_work (struct work_struct *work)
@@ -2462,7 +2459,11 @@ static void it6505_irq_hdcp_ksv_check(struct it6505 *it6505) {struct device *dev = it6505->dev; -DRM_DEV_DEBUG_DRIVER (dev,"HDCP event Interrupt" ); +DRM_DEV_DEBUG_DRIVER (dev,"HDCP repeater R0 event Interrupt" ); +/* 1B01 HDCP encription should start when R0 is ready*/ +it6505_set_bits (it6505,REG_HDCP_TRIGGER , +HDCP_TRIGGER_KSV_DONE ,HDCP_TRIGGER_KSV_DONE ); +schedule_work (&it6505->hdcp_wait_ksv_list); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 26/31 drm/bridge: it6505: fix HDCP CTS compare V matching
In reply to Sasha LevinFrom: Hermes Wu <[email protected]>
[ Upstream commit 0989c02c7a5c887c70afeae80c64d0291624e1a7 ]
When HDCP negotiation with a repeater device.
Checking SHA V' matching must retry 3 times before restarting HDCP.
--- drivers/gpu/drm/bridge/ite-it6505.c | 32 +++++++++++++++++------------ 1 file changed, 19 insertions(+), 13 deletions(-)
drivers/gpu/drm/bridge/ite-it6505.c +19 -13
@@ -2023,7 +2023,7 @@ static bool it6505_hdcp_part2_ksvlist_check(struct it6505 *it6505) {struct device *dev = it6505->dev;u8 av[5 ][4 ], bv[5 ][4 ]; -int i, err; +int i, err, retry; i =it6505_setup_sha1_input (it6505, it6505->sha1_input);if (i <=0 ) {
@@ -2032,22 +2032,28 @@ static bool it6505_hdcp_part2_ksvlist_check(struct it6505 *it6505) }it6505_sha1_digest (it6505, it6505->sha1_input, i, (u8 *)av); +/*1B-05 V' must retry 3 times */ +for (retry =0 ; retry <3 ; retry++) { + err =it6505_get_dpcd (it6505,DP_AUX_HDCP_V_PRIME (0 ), (u8 *)bv, +sizeof (bv)); - err =it6505_get_dpcd (it6505,DP_AUX_HDCP_V_PRIME (0 ), (u8 *)bv, -sizeof (bv)); +if (err <0 ) { +dev_err (dev,"Read V' value Fail %d" , retry); +continue ; + } -if (err <0 ) { -dev_err (dev,"Read V' value Fail" ); -return false; - } +for (i =0 ; i <5 ; i++) { +if (bv[i][3 ] != av[i][0 ] || bv[i][2 ] != av[i][1 ] || + av[i][1 ] != av[i][2 ] || bv[i][0 ] != av[i][3 ]) +break ; -for (i =0 ; i <5 ; i++) -if (bv[i][3 ] != av[i][0 ] || bv[i][2 ] != av[i][1 ] || - bv[i][1 ] != av[i][2 ] || bv[i][0 ] != av[i][3 ]) -return false; +DRM_DEV_DEBUG_DRIVER (dev,"V' all match!! %d, %d" , retry, i); +return true; + } + } -DRM_DEV_DEBUG_DRIVER (dev,"V' all match!!" ); -return true; +DRM_DEV_DEBUG_DRIVER (dev,"V' NOT match!! %d" , retry); +return false; }static void it6505_hdcp_wait_ksv_list (struct work_struct *work)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 27/31 drm/bridge: it6505: fix HDCP CTS KSV list wait timer
In reply to Sasha LevinFrom: Hermes Wu <[email protected]>
[ Upstream commit 9f9eef9ec1a2b57d95a86fe81df758e8253a7766 ]
HDCP must disabled encryption and restart authentication after waiting KSV for 5s.
The original method uses a counter in a waitting loop that may wait much longer than it is supposed to.
Use time_after() for KSV wait timeout.
--- drivers/gpu/drm/bridge/ite-it6505.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/gpu/drm/bridge/ite-it6505.c +10 -10
@@ -2061,12 +2061,13 @@ static void it6505_hdcp_wait_ksv_list(struct work_struct *work) struct it6505 *it6505 = container_of(work, struct it6505, hdcp_wait_ksv_list);struct device *dev = it6505->dev; -unsigned int timeout =5000 ; -u8 bstatus =0 ; +u8 bstatus;bool ksv_list_check; +/* 1B-04 wait ksv list for 5s */ +unsigned long timeout = jiffies + +msecs_to_jiffies (5000 ) +1 ; - timeout /=20 ; -while (timeout >0 ) { +for (;;) {if (!it6505_get_sink_hpd_status (it6505))return ;
@@ -2075,13 +2076,12 @@ static void it6505_hdcp_wait_ksv_list(struct work_struct *work)if (bstatus &DP_BSTATUS_READY )break ; -msleep (20 ); - timeout--; - } +if (time_after (jiffies, timeout)) { +DRM_DEV_DEBUG_DRIVER (dev,"KSV list wait timeout" ); + goto timeout; + } -if (timeout ==0 ) { -DRM_DEV_DEBUG_DRIVER (dev,"timeout and ksv list wait failed" ); - goto timeout; +msleep (20 ); } ksv_list_check =it6505_hdcp_part2_ksvlist_check (it6505);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 28/31 safesetid: check size of policy writes
In reply to Sasha LevinFrom: Leo Stone <[email protected]>
[ Upstream commit f09ff307c7299392f1c88f763299e24bc99811c7 ]
syzbot attempts to write a buffer with a large size to a sysfs entry with writes handled by handle_policy_update(), triggering a warning in kmalloc.
Check the size specified for write buffers before allocating.
--- security/safesetid/securityfs.c | 3 +++ 1 file changed, 3 insertions(+)
security/safesetid/securityfs.c +3 -0
@@ -143,6 +143,9 @@ static ssize_t handle_policy_update(struct file *file,char *buf, *p, *end;int err; +if (len >=KMALLOC_MAX_SIZE ) +return -EINVAL ; + pol =kmalloc (sizeof (struct setid_ruleset ),GFP_KERNEL );if (!pol)return -ENOMEM ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 29/31 drm/amd/display: Increase sanitizer frame larger than limit when compile testing with clang
In reply to Sasha LevinFrom: Nathan Chancellor <[email protected]>
[ Upstream commit e4479aecf6581af81bc0908575447878d2a07e01 ]
Commit 24909d9ec7c3 ("drm/amd/display: Overwriting dualDPP UBF values before usage") added a new warning in dml2/display_mode_core.c when building allmodconfig with clang:
drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.c:6268:13: error: stack frame size (3128) exceeds limit (3072) in 'dml_prefetch_check' [-Werror,-Wframe-larger-than]
6268 | static void dml_prefetch_check(struct display_mode_lib_st *mode_lib)
| ^
Commit be4e3509314a ("drm/amd/display: DML21 Reintegration For Various Fixes") introduced one in dml2_core/dml2_core_dcn4_calcs.c with the same configuration:
drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/dml21/src/dml2_core/dml2_core_dcn4_calcs.c:7236:13: error: stack frame size (3256) exceeds limit (3072) in 'dml_core_mode_support' [-Werror,-Wframe-larger-than]
7236 | static bool dml_core_mode_support(struct dml2_core_calcs_mode_support_ex *in_out_params)
| ^
In the case of the first warning, the stack usage was already at the limit at the parent change, so the offending change was rather innocuous. In the case of the second warning, there was a rather dramatic increase in stack usage compared to the parent:
drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/dml21/src/dml2_core/dml2_core_dcn4_calcs.c:7032:13: error: stack frame size (2696) exceeds limit (2048) in 'dml_core_mode_support' [-Werror,-Wframe-larger-than]
7032 | static bool dml_core_mode_support(struct dml2_core_calcs_mode_support_ex *in_out_params)
| ^
This is an unfortunate interaction between an issue with stack slot reuse in LLVM that gets exacerbated by sanitization (which gets enabled with all{mod,yes}config) and function calls using a much higher number of parameters than is typical in the kernel, necessitating passing most of these values on the stack.
While it is possible that there should be source code changes to address these warnings, this code is difficult to modify for various reasons, as has been noted in other changes that have occurred for similar reasons, such as commit 6740ec97bcdb ("drm/amd/display: Increase frame warning limit with KASAN or KCSAN in dml2").
Increase the frame larger than limit when compile testing with clang and the sanitizers enabled to avoid this breakage in all{mod,yes}config, as they are commonly used and valuable testing targets. While it is not the best to hide this issue, it is not really relevant when compile testing, as the sanitizers are commonly stressful on optimizations and they are only truly useful at runtime, which COMPILE_TEST states will not occur with the current build.
--- drivers/gpu/drm/amd/display/dc/dml2/Makefile | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/display/dc/dml2/Makefile +4 -0
@@ -29,7 +29,11 @@ dml2_rcflags := $(CC_FLAGS_NO_FPU) ifneq ($(CONFIG_FRAME_WARN),0) ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)),y) +ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_COMPILE_TEST),yy) +frame_warn_flag := -Wframe-larger-than=4096 +else frame_warn_flag := -Wframe-larger-than=3072 +endif else frame_warn_flag := -Wframe-larger-than=2048 endif
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 30/31 drm/amd/display: Limit Scaling Ratio on DCN3.01
In reply to Sasha LevinFrom: Gabe Teeger <[email protected]>
[ Upstream commit abc0ad6d08440761b199988c329ad7ac83f41c9b ]
[why]
Underflow and flickering was occuring due to high scaling ratios when resizing videos.
[how]
Limit the scaling ratios by increasing the max scaling factor
--- .../drm/amd/display/dc/resource/dcn301/dcn301_resource.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/resource/dcn301/dcn301_resource.c +4 -4
@@ -671,9 +671,9 @@ static const struct dc_plane_cap plane_cap = {/* 6:1 downscaling ratio: 1000/6 = 166.666 */ .max_downscale_factor = { - .argb8888 = 167, - .nv12 = 167, - .fp16 =167 + .argb8888 = 358, + .nv12 = 358, + .fp16 =358 },64 ,64
@@ -694,7 +694,7 @@ static const struct dc_debug_options debug_defaults_drv = { .disable_dcc = DCC_ENABLE, .vsr_support = true, .performance_trace = false, - .max_downscale_src_width = 7680,/*upto 8K*/ + .max_downscale_src_width = 4096,/*upto true 4k*/ .scl_reset_length10 = true, .sanity_checks = false, .underflow_assert_delay_us = 0xFFFFFFFF,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 31/31 ring-buffer: Make reading page consistent with the code logic
In reply to Sasha LevinFrom: Jeongjun Park <[email protected]>
[ Upstream commit 6e31b759b076eebb4184117234f0c4eb9e4bc460 ]
In the loop of __rb_map_vma(), the 's' variable is calculated from the same logic that nr_pages is and they both come from nr_subbufs. But the relationship is not obvious and there's a WARN_ON_ONCE() around the 's' variable to make sure it never becomes equal to nr_subbufs within the loop. If that happens, then the code is buggy and needs to be fixed.
The 'page' variable is calculated from cpu_buffer->subbuf_ids[s] which is an array of 'nr_subbufs' entries. If the code becomes buggy and 's' becomes equal to or greater than 'nr_subbufs' then this will be an out of bounds hit before the WARN_ON() is triggered and the code exiting safely.
Make the 'page' initialization consistent with the code logic and assign it after the out of bounds check.
--- kernel/trace/ring_buffer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/trace/ring_buffer.c +3 -1
@@ -7059,7 +7059,7 @@ static int __rb_map_vma(struct ring_buffer_per_cpu *cpu_buffer, }while (p < nr_pages) { -struct page *page =virt_to_page ((void *)cpu_buffer->subbuf_ids[s]); +struct page *page;int off =0 ;if (WARN_ON_ONCE (s >= nr_subbufs)) {
@@ -7067,6 +7067,8 @@ static int __rb_map_vma(struct ring_buffer_per_cpu *cpu_buffer, goto out; } + page =virt_to_page ((void *)cpu_buffer->subbuf_ids[s]); +for (; off < (1 << (subbuf_order)); off++, page++) {if (p >= nr_pages)break ;
Signature · 1 line
2.39.5
Re: [PATCH AUTOSEL 6.12 02/31] drm: Add panel backlight quirks
In reply to Sasha LevinHi Sasha,
Quoted 4 lines · Sasha Levin
From: Thomas Weißschuh <[email protected]>
[ Upstream commit
22e5c7ae12145af13785e3ff138395d5b1a22116]
Quoted 8 lines
Panels using a PWM-controlled backlight source do not have a standard way to communicate their valid PWM ranges.
On x86 the ranges are read from ACPI through driver-specific tables. The built-in ranges are not necessarily correct, or may grow stale if an older device can be retrofitted with newer panels.Add a quirk infrastructure with which the minimum valid backlight value can be maintained as part of the kernel.
This series [0] has been applied to the 6.12 and 6.13 stable trees. However it is introducing new functionality and not fixing any bug. Furthermore, for 6.12 the patch for drm/amd/display enabling the new functionality was not even applied, making all of it dead code.
[0] https://lore.kernel.org/lkml/20241111-amdgpu-min-backlight-quirk-v7-0-f662851fda69@weissschuh.net/
Patches:
drm: Add panel backlight quirks
drm/amd/display: Add support for minimum backlight quirk
drm: panel-backlight-quirks: Add Framework 13 matte panel
drm: panel-backlight-quirks: Add Framework 13 glossy and 2.8k panels
Regards,
Thomas