drm/virtio: New fence for every plane update
Subsystems (3)
Sasha Levin
maintainerPATCH 1/9 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
@@ -190,6 +190,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/9 printk: Fix signed integer overflow when defining LOG_BUF_LEN_MAX
From: 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
@@ -403,7 +403,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 3/9 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
@@ -1220,7 +1220,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 4/9 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
@@ -1555,16 +1555,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 5/9 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 6/9 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
@@ -2292,14 +2292,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 7/9 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
@@ -2069,15 +2069,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)
@@ -2425,7 +2422,11 @@ static void it6505_irq_hdcp_ksv_check(struct it6505 *it6505) {struct device *dev = &it6505->client->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 8/9 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
@@ -2011,7 +2011,7 @@ static bool it6505_hdcp_part2_ksvlist_check(struct it6505 *it6505) {struct device *dev = &it6505->client->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 ) {
@@ -2020,22 +2020,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 9/9 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