f2fs: fix to check return value of f2fs_reserve_new_block()
Subsystems (16)
Sasha Levin
maintainerPATCH 1/88 f2fs: fix to check return value of f2fs_reserve_new_block()
From: Chao Yu <[email protected]>
[ Upstream commit 956fa1ddc132e028f3b7d4cf17e6bfc8cb36c7fd ]
Let's check return value of f2fs_reserve_new_block() in do_recover_data() rather than letting it fails silently.
Also refactoring check condition on return value of f2fs_reserve_new_block() as below:
- trigger f2fs_bug_on() only for ENOSPC case;
- use do-while statement to avoid redundant codes;
--- fs/f2fs/recovery.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-)
fs/f2fs/recovery.c +17 -6
@@ -712,7 +712,16 @@ static int do_recover_data(struct f2fs_sb_info *sbi, struct inode *inode,*/ if (dest ==NEW_ADDR ) {f2fs_truncate_data_blocks_range (&dn,1 ); -f2fs_reserve_new_block (&dn); +do { + err =f2fs_reserve_new_block (&dn); +if (err == -ENOSPC ) { +f2fs_bug_on (sbi,1 ); +break ; + } + }while (err && +IS_ENABLED (CONFIG_F2FS_FAULT_INJECTION )); +if (err) + goto err;continue ; }
@@ -720,12 +729,14 @@ static int do_recover_data(struct f2fs_sb_info *sbi, struct inode *inode,if (f2fs_is_valid_blkaddr (sbi, dest,META_POR )) {if (src ==NULL_ADDR ) { - err =f2fs_reserve_new_block (&dn); -while (err && -IS_ENABLED (CONFIG_F2FS_FAULT_INJECTION )) +do { err =f2fs_reserve_new_block (&dn); -/* We should not get -ENOSPC */ -f2fs_bug_on (sbi, err); +if (err == -ENOSPC ) { +f2fs_bug_on (sbi,1 ); +break ; + } + }while (err && +IS_ENABLED (CONFIG_F2FS_FAULT_INJECTION ));if (err) goto err; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 2/88 ALSA: hda: Refer to correct stream index at loops
From: Takashi Iwai <[email protected]>
[ Upstream commit 26257869672fd4a06a60c2da841e15fb2cb47bbe ]
In a couple of loops over the all streams, we check the bitmap against the loop counter. A more correct reference would be, however, the index of each stream, instead.
This patch corrects the check of bitmaps to the stream index.
Note that this change doesn't fix anything for now; all existing drivers set up the stream indices properly, hence the loop count is always equal with the stream index. That said, this change is only for consistency.
--- sound/hda/hdac_stream.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
sound/hda/hdac_stream.c +3 -6
@@ -671,17 +671,15 @@ void snd_hdac_stream_timecounter_init(struct hdac_stream *azx_dev,struct hdac_stream *s;bool inited = false;u64 cycle_last =0 ; -int i =0 ;list_for_each_entry (s, &bus->stream_list, list) { -if (streams & (1 << i)) { +if ((streams & (1 << s->index))) {azx_timecounter_init (s, inited, cycle_last);if (!inited) { inited = true; cycle_last = s->tc.cycle_last; } } - i++; }snd_pcm_gettime (runtime, &runtime->trigger_tstamp);
@@ -726,14 +724,13 @@ void snd_hdac_stream_sync(struct hdac_stream *azx_dev, bool start, unsigned int streams) {struct hdac_bus *bus = azx_dev->bus; -int i, nwait, timeout; +int nwait, timeout;struct hdac_stream *s;for (timeout =5000 ; timeout; timeout--) { nwait =0 ; - i =0 ;list_for_each_entry (s, &bus->stream_list, list) { -if (!(streams & (1 << i++))) +if (!(streams & (1 << s->index)))continue ;if (start) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 3/88 ASoC: doc: Fix undefined SND_SOC_DAPM_NOPM argument
In reply to Sasha LevinFrom: Cristian Ciocaltea <[email protected]>
[ Upstream commit 67c7666fe808c3a7af3cc6f9d0a3dd3acfd26115 ]
The virtual widget example makes use of an undefined SND_SOC_DAPM_NOPM argument passed to SND_SOC_DAPM_MIXER(). Replace with the correct SND_SOC_NOPM definition.
--- Documentation/sound/soc/dapm.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/sound/soc/dapm.rst +1 -1
@@ -234,7 +234,7 @@ corresponding soft power control. In this case it is necessary to create a virtual widget - a widget with no control bits e.g. :: - SND_SOC_DAPM_MIXER("AC97 Mixer", SND_SOC_DAPM_NOPM, 0, 0, NULL, 0), + SND_SOC_DAPM_MIXER("AC97 Mixer", SND_SOC_NOPM, 0, 0, NULL, 0), This can be used to merge to signal paths together in software.
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 4/88 drm: Fix color LUT rounding
In reply to Sasha LevinFrom: Ville Syrjälä <[email protected]>
[ Upstream commit c6fbb6bca10838485b820e8a26c23996f77ce580 ]
The current implementation of drm_color_lut_extract() generates weird results. Eg. if we go through all the values for 16->8bpc conversion we see the following pattern:
in out (count)
0 - 7f -> 0 (128) 80 - 17f -> 1 (256) 180 - 27f -> 2 (256) 280 - 37f -> 3 (256)
...
fb80 - fc7f -> fc (256)
fc80 - fd7f -> fd (256)
fd80 - fe7f -> fe (256)
fe80 - ffff -> ff (384)
So less values map to 0 and more values map 0xff, which doesn't seem particularly great.
To get just the same number of input values to map to the same output values we'd just need to drop the rounding entrirely. But perhaps a better idea would be to follow the OpenGL int<->float conversion rules, in which case we get the following results:
in out (count)
0 - 80 -> 0 (129) 81 - 181 -> 1 (257) 182 - 282 -> 2 (257) 283 - 383 -> 3 (257)
...
fc7c - fd7c -> fc (257)
fd7d - fe7d -> fd (257)
fe7e - ff7e -> fe (257)
ff7f - ffff -> ff (129)
Note that since the divisor is constant the compiler is able to optimize away the integer division in most cases. The only exception is the _ULL() case on 32bit architectures since that gets emitted as inline asm via do_div() and thus the compiler doesn't get to optimize it.
--- include/drm/drm_color_mgmt.h | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)
include/drm/drm_color_mgmt.h +8 -11
@@ -36,20 +36,17 @@ struct drm_plane;* * Extract a degamma/gamma LUT value provided by user (in the form of * &drm_color_lut entries) and round it to the precision supported by the -* hardware. +* hardware, following OpenGL int<->float conversion rules +* (see eg. OpenGL 4.6 specification - 2.3.5 Fixed-Point Data Conversions). */ static inline u32 drm_color_lut_extract (u32 user_input,int bit_precision) { -u32 val = user_input; -u32 max =0xffff >> (16 - bit_precision); - -/* Round only if we're not using full precision. */ -if (bit_precision <16 ) { - val +=1UL << (16 - bit_precision -1 ); - val >>=16 - bit_precision; - } - -return clamp_val (val,0 , max); +if (bit_precision >16 ) +return DIV_ROUND_CLOSEST_ULL (mul_u32_u32 (user_input, (1 << bit_precision) -1 ), + (1 <<16 ) -1 ); +else +return DIV_ROUND_CLOSEST (user_input * ((1 << bit_precision) -1 ), + (1 <<16 ) -1 ); }u64 drm_color_ctm_s31_32_to_qm_n (u64 user_input,u32 m,u32 n);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 5/88 fast_dput(): handle underflows gracefully
In reply to Sasha LevinFrom: Al Viro <[email protected]>
[ Upstream commit 504e08cebe1d4e1efe25f915234f646e74a364a8 ]
If refcount is less than 1, we should just warn, unlock dentry and return true, so that the caller doesn't try to do anything else.
Taking care of that leaves the rest of "lockref_put_return() has failed" case equivalent to "decrement refcount and rejoin the normal slow path after the point where we grab ->d_lock".
NOTE: lockref_put_return() is strictly a fastpath thing - unlike the rest of lockref primitives, it does not contain a fallback. Caller (and it looks like fast_dput() is the only legitimate one in the entire kernel) has to do that itself. Reasons for lockref_put_return() failures:
* ->d_lock held by somebody
* refcount <= 0
* ... or an architecture not supporting lockref use of
cmpxchg - sparc, anything non-SMP, config with spinlock debugging...
We could add a fallback, but it would be a clumsy API - we'd have to distinguish between:
(1) refcount > 1 - decremented, lock not held on return
(2) refcount < 1 - left alone, probably no sense to hold the lock
(3) refcount is 1, no cmphxcg - decremented, lock held on return
(4) refcount is 1, cmphxcg supported - decremented, lock *NOT* held on return.
We want to return with no lock held in case (4); that's the whole point of that thing. We very much do not want to have the fallback in case (3) return without a lock, since the caller might have to retake it in that case.
So it wouldn't be more convenient than doing the fallback in the caller and it would be very easy to screw up, especially since the test coverage would suck - no way to test (3) and (4) on the same kernel build.
--- fs/dcache.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
fs/dcache.c +4 -3
@@ -787,12 +787,12 @@ static inline bool fast_dput(struct dentry *dentry)*/ if (unlikely (ret <0 )) {spin_lock (&dentry->d_lock); -if (dentry->d_lockref.count >1 ) { - dentry->d_lockref.count--; +if (WARN_ON_ONCE (dentry->d_lockref.count <=0 )) {spin_unlock (&dentry->d_lock);return true; } -return false; + dentry->d_lockref.count--; + goto locked; }/*
@@ -850,6 +850,7 @@ static inline bool fast_dput(struct dentry *dentry)* else could have killed it and marked it dead. Either way, we * don't need to do anything else. */ +locked:if (dentry->d_lockref.count) {spin_unlock (&dentry->d_lock);return true;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 6/88 reiserfs: Avoid touching renamed directory if parent does not change
In reply to Sasha LevinFrom: Jan Kara <[email protected]>
[ Upstream commit 49db9b1b86a82448dfaf3fcfefcf678dee56c8ed ]
The VFS will not be locking moved directory if its parent does not change. Change reiserfs rename code to avoid touching renamed directory if its parent does not change as without locking that can corrupt the filesystem.
--- fs/reiserfs/namei.c | 54 ++++++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 25 deletions(-)
fs/reiserfs/namei.c +29 -25
@@ -1324,8 +1324,8 @@ static int reiserfs_rename(struct mnt_idmap *idmap,struct inode *old_inode, *new_dentry_inode;struct reiserfs_transaction_handle th;int jbegin_count; -umode_t old_inode_mode;unsigned long savelink =1 ; +bool update_dir_parent = false;if (flags & ~RENAME_NOREPLACE )return -EINVAL ;
@@ -1375,8 +1375,7 @@ static int reiserfs_rename(struct mnt_idmap *idmap,return -ENOENT ; } - old_inode_mode = old_inode->i_mode; -if (S_ISDIR (old_inode_mode)) { +if (S_ISDIR (old_inode->i_mode)) {/* * make sure that directory being renamed has correct ".." * and that its new parent directory has not too many links
@@ -1389,24 +1388,28 @@ static int reiserfs_rename(struct mnt_idmap *idmap, } } -/* -* directory is renamed, its parent directory will be changed, -* so find ".." entry -*/ - dot_dot_de.de_gen_number_bit_string =NULL ; - retval = -reiserfs_find_entry (old_inode,".." ,2 , &dot_dot_entry_path, +if (old_dir != new_dir) { +/* +* directory is renamed, its parent directory will be +* changed, so find ".." entry +*/ + dot_dot_de.de_gen_number_bit_string =NULL ; + retval = +reiserfs_find_entry (old_inode,".." ,2 , + &dot_dot_entry_path, &dot_dot_de); -pathrelse (&dot_dot_entry_path); -if (retval !=NAME_FOUND ) { -reiserfs_write_unlock (old_dir->i_sb); -return -EIO ; - } +pathrelse (&dot_dot_entry_path); +if (retval !=NAME_FOUND ) { +reiserfs_write_unlock (old_dir->i_sb); +return -EIO ; + } -/* inode number of .. must equal old_dir->i_ino */ -if (dot_dot_de.de_objectid != old_dir->i_ino) { -reiserfs_write_unlock (old_dir->i_sb); -return -EIO ; +/* inode number of .. must equal old_dir->i_ino */ +if (dot_dot_de.de_objectid != old_dir->i_ino) { +reiserfs_write_unlock (old_dir->i_sb); +return -EIO ; + } + update_dir_parent = true; } }
@@ -1486,7 +1489,7 @@ static int reiserfs_rename(struct mnt_idmap *idmap,reiserfs_prepare_for_journal (old_inode->i_sb, new_de.de_bh,1 ); - if (S_ISDIR(old_inode->i_mode)) { + if (update_dir_parent) { if ((retval = search_by_entry_key(new_dir->i_sb, &dot_dot_de.de_entry_key,
@@ -1534,14 +1537,14 @@ static int reiserfs_rename(struct mnt_idmap *idmap, new_de.de_bh);reiserfs_restore_prepared_buffer (old_inode->i_sb, old_de.de_bh); -if (S_ISDIR (old_inode_mode)) +if (update_dir_parent)reiserfs_restore_prepared_buffer (old_inode-> i_sb, dot_dot_de. de_bh);continue ; } -if (S_ISDIR (old_inode_mode)) { +if (update_dir_parent) {if (item_moved (&dot_dot_ih, &dot_dot_entry_path) || !entry_points_to_object (".." ,2 , &dot_dot_de, old_dir)) {
@@ -1559,7 +1562,7 @@ static int reiserfs_rename(struct mnt_idmap *idmap, } } -RFALSE (S_ISDIR (old_inode_mode) && +RFALSE (update_dir_parent && !buffer_journal_prepared (dot_dot_de.de_bh),"" );break ;
@@ -1592,11 +1595,12 @@ static int reiserfs_rename(struct mnt_idmap *idmap, savelink = new_dentry_inode->i_nlink; } -if (S_ISDIR (old_inode_mode)) { +if (update_dir_parent) {/* adjust ".." of renamed directory */ set_ino_in_dir_entry (&dot_dot_de,INODE_PKEY (new_dir));journal_mark_dirty (&th, dot_dot_de.de_bh); - + } +if (S_ISDIR (old_inode->i_mode)) {/* * there (in new_dir) was no directory, so it got new link * (".." of renamed directory)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 7/88 ocfs2: Avoid touching renamed directory if parent does not change
In reply to Sasha LevinFrom: Jan Kara <[email protected]>
[ Upstream commit 9d618d19b29c2943527e3a43da0a35aea91062fc ]
The VFS will not be locking moved directory if its parent does not change. Change ocfs2 rename code to avoid touching renamed directory if its parent does not change as without locking that can corrupt the filesystem.
--- fs/ocfs2/namei.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
fs/ocfs2/namei.c +5 -3
@@ -1336,7 +1336,7 @@ static int ocfs2_rename(struct mnt_idmap *idmap, goto bail; } -if (S_ISDIR (old_inode->i_mode)) { +if (S_ISDIR (old_inode->i_mode) && new_dir != old_dir) {u64 old_inode_parent; update_dot_dot =1 ;
@@ -1353,8 +1353,7 @@ static int ocfs2_rename(struct mnt_idmap *idmap, goto bail; } -if (!new_inode && new_dir != old_dir && - new_dir->i_nlink >=ocfs2_link_max (osb)) { +if (!new_inode && new_dir->i_nlink >=ocfs2_link_max (osb)) { status = -EMLINK ; goto bail; }
@@ -1601,6 +1600,9 @@ static int ocfs2_rename(struct mnt_idmap *idmap,mlog_errno (status); goto bail; } + } + +if (S_ISDIR (old_inode->i_mode)) {drop_nlink (old_dir);if (new_inode) {drop_nlink (new_inode);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 8/88 drm/msm/a690: Fix reg values for a690
In reply to Sasha LevinFrom: Danylo Piliaiev <[email protected]>
[ Upstream commit 07e6de738aa6f0e873463e9ca88bdb7081c4bfd4 ]
KGSL doesn't support a690 so all reg values were the same as on a660. Now we know the values and they are different from the windows driver.
This fixes hangs on D3D12 games and some CTS tests.
Patchwork: https://patchwork.freedesktop.org/patch/568931/
--- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
drivers/gpu/drm/msm/adreno/a6xx_gpu.c +13 -10
@@ -1312,6 +1312,7 @@ static void a6xx_set_ubwc_config(struct msm_gpu *gpu)if (adreno_is_a650 (adreno_gpu) ||adreno_is_a660 (adreno_gpu) || +adreno_is_a690 (adreno_gpu) ||adreno_is_a730 (adreno_gpu) ||adreno_is_a740_family (adreno_gpu)) {/* TODO: get ddr type from bootloader and use 2 for LPDDR4 */
@@ -1321,13 +1322,6 @@ static void a6xx_set_ubwc_config(struct msm_gpu *gpu) uavflagprd_inv =2 ; } -if (adreno_is_a690 (adreno_gpu)) { - hbb_lo =2 ; - amsbc =1 ; - rgb565_predicator =1 ; - uavflagprd_inv =2 ; - } -if (adreno_is_7c3 (adreno_gpu)) { hbb_lo =1 ; amsbc =1 ;
@@ -1741,7 +1735,9 @@ static int hw_init(struct msm_gpu *gpu)/* Setting the primFifo thresholds default values, * and vccCacheSkipDis=1 bit (0x200) for A640 and newer */ -if (adreno_is_a650 (adreno_gpu) ||adreno_is_a660 (adreno_gpu) ||adreno_is_a690 (adreno_gpu)) +if (adreno_is_a690 (adreno_gpu)) +gpu_write (gpu,REG_A6XX_PC_DBG_ECO_CNTL ,0x00800200 ); +else if (adreno_is_a650 (adreno_gpu) ||adreno_is_a660 (adreno_gpu))gpu_write (gpu,REG_A6XX_PC_DBG_ECO_CNTL ,0x00300200 );else if (adreno_is_a640_family (adreno_gpu) ||adreno_is_7c3 (adreno_gpu))gpu_write (gpu,REG_A6XX_PC_DBG_ECO_CNTL ,0x00200200 );
@@ -1775,6 +1771,8 @@ static int hw_init(struct msm_gpu *gpu)if (adreno_is_a730 (adreno_gpu) ||adreno_is_a740_family (adreno_gpu))gpu_write (gpu,REG_A6XX_RBBM_INTERFACE_HANG_INT_CNTL , (1 <<30 ) |0xcfffff ); +else if (adreno_is_a690 (adreno_gpu)) +gpu_write (gpu,REG_A6XX_RBBM_INTERFACE_HANG_INT_CNTL , (1 <<30 ) |0x4fffff );else if (adreno_is_a619 (adreno_gpu))gpu_write (gpu,REG_A6XX_RBBM_INTERFACE_HANG_INT_CNTL , (1 <<30 ) |0x3fffff );else if (adreno_is_a610 (adreno_gpu))
@@ -1808,12 +1806,17 @@ static int hw_init(struct msm_gpu *gpu)a6xx_set_cp_protect (gpu);if (adreno_is_a660_family (adreno_gpu)) { -gpu_write (gpu,REG_A6XX_CP_CHICKEN_DBG ,0x1 ); +if (adreno_is_a690 (adreno_gpu)) +gpu_write (gpu,REG_A6XX_CP_CHICKEN_DBG ,0x00028801 ); +else +gpu_write (gpu,REG_A6XX_CP_CHICKEN_DBG ,0x1 );gpu_write (gpu,REG_A6XX_RBBM_GBIF_CLIENT_QOS_CNTL ,0x0 ); } +if (adreno_is_a690 (adreno_gpu)) +gpu_write (gpu,REG_A6XX_UCHE_CMDQ_CONFIG ,0x90 );/* Set dualQ + disable afull for A660 GPU */ -if (adreno_is_a660 (adreno_gpu)) +else if (adreno_is_a660 (adreno_gpu))gpu_write (gpu,REG_A6XX_UCHE_CMDQ_CONFIG ,0x66906 );else if (adreno_is_a7xx (adreno_gpu)) gpu_write(gpu, REG_A6XX_UCHE_CMDQ_CONFIG,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 9/88 RDMA/IPoIB: Fix error code return in ipoib_mcast_join
In reply to Sasha LevinFrom: Jack Wang <[email protected]>
[ Upstream commit 753fff78f430704548f45eda52d6d55371a52c0f ]
Return the error code in case of ib_sa_join_multicast fail.
--- drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/ulp/ipoib/ipoib_multicast.c +1 -0
@@ -546,6 +546,7 @@ static int ipoib_mcast_join(struct net_device *dev, struct ipoib_mcast *mcast)spin_unlock_irq (&priv->lock);complete (&mcast->done);spin_lock_irq (&priv->lock); +return ret; }return 0 ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 10/88 ASoC: SOF: icp3-dtrace: Fix wrong kfree() usage
In reply to Sasha LevinFrom: Kamil Duljas <[email protected]>
[ Upstream commit 8c91ca76f44804868d12aed20ebdbc2f89aa7d60 ]
trace_filter_parse() allocs memory for *out and when -ENOMEM is returned, caller function, dfsentry_trace_filter_write() trying to freed this memory.
After this patch, the memory is freed in trace_filter_parse() before -EINVAL returned. In caller function removed kfree(elms) from error label
--- sound/soc/sof/ipc3-dtrace.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/soc/sof/ipc3-dtrace.c +2 -1
@@ -137,6 +137,7 @@ static int trace_filter_parse(struct snd_sof_dev *sdev, char *string,dev_err (sdev->dev,"Parsing filter entry '%s' failed with %d\n" , entry, entry_len); +kfree (*out);return -EINVAL ; } }
@@ -208,13 +209,13 @@ static ssize_t dfsentry_trace_filter_write(struct file *file, const char __user ret =ipc3_trace_update_filter (sdev, num_elems, elems);if (ret <0 ) {dev_err (sdev->dev,"Filter update failed: %d\n" , ret); +kfree (elems); goto error; } } ret = count; error:kfree (string); -kfree (elems);return ret; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 11/88 drm/panel-edp: Add override_edid_mode quirk for generic edp
In reply to Sasha LevinFrom: Hsin-Yi Wang <[email protected]>
[ Upstream commit 9f7843b515811aea6c56527eb195b622e9c01f12 ]
Generic edp gets mode from edid. However, some panels report incorrect mode in this way, resulting in glitches on panel. Introduce a new quirk additional_mode to the generic edid to pick a correct hardcoded mode.
--- drivers/gpu/drm/panel/panel-edp.c | 48 +++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 3 deletions(-)
drivers/gpu/drm/panel/panel-edp.c +45 -3
@@ -203,6 +203,9 @@ struct edp_panel_entry {/** @name: Name of this panel (for printing to logs). */ const char *name; + +/** @override_edid_mode: Override the mode obtained by edid. */ +const struct drm_display_mode *override_edid_mode; };struct panel_edp {
@@ -301,6 +304,24 @@ static unsigned int panel_edp_get_display_modes(struct panel_edp *panel,return num; } +static int panel_edp_override_edid_mode (struct panel_edp *panel, +struct drm_connector *connector, +const struct drm_display_mode *override_mode) +{ +struct drm_display_mode *mode; + + mode =drm_mode_duplicate (connector->dev, override_mode); +if (!mode) { +dev_err (panel->base.dev,"failed to add additional mode\n" ); +return 0 ; + } + + mode->type |=DRM_MODE_TYPE_DRIVER |DRM_MODE_TYPE_PREFERRED ; +drm_mode_set_name (mode); +drm_mode_probed_add (connector, mode); +return 1 ; +} +static int panel_edp_get_non_edid_modes (struct panel_edp *panel,struct drm_connector *connector) {
@@ -568,6 +589,9 @@ static int panel_edp_get_modes(struct drm_panel *panel, {struct panel_edp *p =to_panel_edp (panel);int num =0 ; +bool has_override_edid_mode = p->detected_panel && + p->detected_panel !=ERR_PTR (-EINVAL ) && + p->detected_panel->override_edid_mode;/* probe EDID if a DDC bus is available */ if (p->ddc) {
@@ -575,9 +599,18 @@ static int panel_edp_get_modes(struct drm_panel *panel,if (!p->edid) p->edid =drm_get_edid (connector, p->ddc); - -if (p->edid) - num +=drm_add_edid_modes (connector, p->edid); +if (p->edid) { +if (has_override_edid_mode) { +/* +* override_edid_mode is specified. Use +* override_edid_mode instead of from edid. +*/ + num +=panel_edp_override_edid_mode (p, connector, + p->detected_panel->override_edid_mode); + }else { + num +=drm_add_edid_modes (connector, p->edid); + } + }pm_runtime_mark_last_busy (panel->dev);pm_runtime_put_autosuspend (panel->dev);
@@ -1828,6 +1861,15 @@ static const struct panel_delay delay_200_500_e200 = { .delay = _delay \ } +#define EDP_PANEL_ENTRY2 (vend_chr_0, vend_chr_1, vend_chr_2, product_id, _delay, _name, _mode) \ +{ \ + .name = _name, \ + .panel_id = drm_edid_encode_panel_id(vend_chr_0, vend_chr_1, vend_chr_2, \ + product_id), \ + .delay = _delay, \ + .override_edid_mode = _mode \ +} +/* * This table is used to figure out power sequencing delays for panels that * are detected by EDID. Entries here may point to entries in the
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 12/88 drm/bridge: anx7625: Fix Set HPD irq detect window to 2ms
In reply to Sasha LevinFrom: Xin Ji <[email protected]>
[ Upstream commit e3af7053de3f685c96158373bc234b2feca1f160 ]
Polling firmware HPD GPIO status, set HPD irq detect window to 2ms after firmware HPD GPIO initial done
--- drivers/gpu/drm/bridge/analogix/anx7625.c | 51 ++++++++++++++++------- drivers/gpu/drm/bridge/analogix/anx7625.h | 4 ++ 2 files changed, 40 insertions(+), 15 deletions(-)
drivers/gpu/drm/bridge/analogix/anx7625.c +36 -15
@@ -1298,10 +1298,32 @@ static void anx7625_config(struct anx7625_data *ctx) XTAL_FRQ_SEL, XTAL_FRQ_27M); } +static int anx7625_hpd_timer_config (struct anx7625_data *ctx) +{ +int ret; + +/* Set irq detect window to 2ms */ + ret =anx7625_reg_write (ctx, ctx->i2c.tx_p2_client, +HPD_DET_TIMER_BIT0_7 ,HPD_TIME &0xFF ); + ret |=anx7625_reg_write (ctx, ctx->i2c.tx_p2_client, +HPD_DET_TIMER_BIT8_15 , + (HPD_TIME >>8 ) &0xFF ); + ret |=anx7625_reg_write (ctx, ctx->i2c.tx_p2_client, +HPD_DET_TIMER_BIT16_23 , + (HPD_TIME >>16 ) &0xFF ); + +return ret; +} + +static int anx7625_read_hpd_gpio_config_status (struct anx7625_data *ctx) +{ +return anx7625_reg_read (ctx, ctx->i2c.rx_p0_client,GPIO_CTRL_2 ); +} +static void anx7625_disable_pd_protocol (struct anx7625_data *ctx) {struct device *dev = ctx->dev; -int ret; +int ret, val;/* Reset main ocm */ ret =anx7625_reg_write (ctx, ctx->i2c.rx_p0_client,0x88 ,0x40 );
@@ -1315,6 +1337,19 @@ static void anx7625_disable_pd_protocol(struct anx7625_data *ctx)DRM_DEV_DEBUG_DRIVER (dev,"disable PD feature fail.\n" ); else DRM_DEV_DEBUG_DRIVER(dev, "disable PD feature succeeded.\n"); + +/* +* Make sure the HPD GPIO already be configured after OCM release before +* setting HPD detect window register. Here we poll the status register +* at maximum 40ms, then config HPD irq detect window register +*/ +readx_poll_timeout (anx7625_read_hpd_gpio_config_status, + ctx, val, + ((val &HPD_SOURCE ) || (val <0 )), +2000 ,2000 *20 ); + +/* Set HPD irq detect window to 2ms */ +anx7625_hpd_timer_config (ctx); }static int anx7625_ocm_loading_check (struct anx7625_data *ctx)
@@ -1437,20 +1472,6 @@ static void anx7625_start_dp_work(struct anx7625_data *ctx)static int anx7625_read_hpd_status_p0 (struct anx7625_data *ctx) { -int ret; - -/* Set irq detect window to 2ms */ - ret =anx7625_reg_write (ctx, ctx->i2c.tx_p2_client, -HPD_DET_TIMER_BIT0_7 ,HPD_TIME &0xFF ); - ret |=anx7625_reg_write (ctx, ctx->i2c.tx_p2_client, -HPD_DET_TIMER_BIT8_15 , - (HPD_TIME >>8 ) &0xFF ); - ret |=anx7625_reg_write (ctx, ctx->i2c.tx_p2_client, -HPD_DET_TIMER_BIT16_23 , - (HPD_TIME >>16 ) &0xFF ); -if (ret <0 ) -return ret; -return anx7625_reg_read (ctx, ctx->i2c.rx_p0_client,SYSTEM_STSTUS ); }
drivers/gpu/drm/bridge/analogix/anx7625.h +4 -0
@@ -259,6 +259,10 @@#define AP_MIPI_RX_EN BIT(5)/* 1: MIPI RX input in 0: no RX in */ #define AP_DISABLE_PD BIT(6)#define AP_DISABLE_DISPLAY BIT(7) + +#define GPIO_CTRL_2 0x49 +#define HPD_SOURCE BIT(6) +/***************************************************************/ /* Register definition of device address 0x84 */ #define MIPI_PHY_CONTROL_3 0x03
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 13/88 drm/amd/display: Fix tiled display misalignment
In reply to Sasha LevinFrom: Meenakshikumar Somasundaram <[email protected]>
[ Upstream commit c4b8394e76adba4f50a3c2696c75b214a291e24a ]
[Why]
When otg workaround is applied during clock update, otgs of tiled display went out of sync.
[How]
To call dc_trigger_sync() after clock update to sync otgs again.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc.c +4 -0
@@ -1964,6 +1964,10 @@ static enum dc_status dc_commit_state_no_check(struct dc *dc, struct dc_state *cwait_for_no_pipes_pending (dc, context);/* pplib is notified if disp_num changed */ dc->hwss.optimize_bandwidth (dc, context); +/* Need to do otg sync again as otg could be out of sync due to otg +* workaround applied during clock update +*/ +dc_trigger_sync (dc, context); }if (dc->hwss.update_dsc_pg)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 14/88 media: renesas: vsp1: Fix references to pad config
In reply to Sasha LevinFrom: Laurent Pinchart <[email protected]>
[ Upstream commit 30d187cd74874aaf24e1b4a2dd2a64dc850c6b14 ]
V4L2 subdev operations have moved from operating on a v4l2_subdev_pad_config to a v4l2_subdev_state a long time ago. Fix remaining incorrect references to pad config in function and variable names.
--- .../media/platform/renesas/vsp1/vsp1_brx.c | 40 +++++---- .../media/platform/renesas/vsp1/vsp1_clu.c | 3 +- .../media/platform/renesas/vsp1/vsp1_entity.c | 85 +++++++++---------- .../media/platform/renesas/vsp1/vsp1_entity.h | 10 +-- .../media/platform/renesas/vsp1/vsp1_hgo.c | 4 +- .../media/platform/renesas/vsp1/vsp1_hgt.c | 4 +- .../media/platform/renesas/vsp1/vsp1_histo.c | 24 +++--- .../media/platform/renesas/vsp1/vsp1_hsit.c | 11 ++- .../media/platform/renesas/vsp1/vsp1_lif.c | 2 +- .../media/platform/renesas/vsp1/vsp1_rpf.c | 8 +- .../media/platform/renesas/vsp1/vsp1_rwpf.c | 37 ++++---- .../media/platform/renesas/vsp1/vsp1_sru.c | 36 ++++---- .../media/platform/renesas/vsp1/vsp1_uds.c | 39 ++++----- .../media/platform/renesas/vsp1/vsp1_uif.c | 24 +++--- .../media/platform/renesas/vsp1/vsp1_video.c | 4 +- .../media/platform/renesas/vsp1/vsp1_wpf.c | 10 +-- 16 files changed, 162 insertions(+), 179 deletions(-)
drivers/media/platform/renesas/vsp1/vsp1_brx.c +19 -21
@@ -136,29 +136,28 @@ static int brx_set_format(struct v4l2_subdev *subdev, struct v4l2_subdev_format *fmt) {struct vsp1_brx *brx =to_brx (subdev); -struct v4l2_subdev_state *config; +struct v4l2_subdev_state *state;struct v4l2_mbus_framefmt *format;int ret =0 ;mutex_lock (&brx->entity.lock); - config =vsp1_entity_get_pad_config (&brx->entity, sd_state, - fmt->which); -if (!config) { + state =vsp1_entity_get_state (&brx->entity, sd_state, fmt->which); +if (!state) { ret = -EINVAL ; goto done; } -brx_try_format (brx, config, fmt->pad, &fmt->format); +brx_try_format (brx, state, fmt->pad, &fmt->format); - format =vsp1_entity_get_pad_format (&brx->entity, config, fmt->pad); + format =vsp1_entity_get_pad_format (&brx->entity, state, fmt->pad); *format = fmt->format;/* Reset the compose rectangle. */ if (fmt->pad != brx->entity.source_pad) {struct v4l2_rect *compose; - compose =brx_get_compose (brx, config, fmt->pad); + compose =brx_get_compose (brx, state, fmt->pad); compose->left =0 ; compose->top =0 ; compose->width = format->width;
@@ -171,7 +170,7 @@ static int brx_set_format(struct v4l2_subdev *subdev,for (i =0 ; i <= brx->entity.source_pad; ++i) { format =vsp1_entity_get_pad_format (&brx->entity, - config, i); + state, i); format->code = fmt->format.code; } }
@@ -186,7 +185,7 @@ static int brx_get_selection(struct v4l2_subdev *subdev, struct v4l2_subdev_selection *sel) {struct vsp1_brx *brx =to_brx (subdev); -struct v4l2_subdev_state *config; +struct v4l2_subdev_state *state;if (sel->pad == brx->entity.source_pad)return -EINVAL ;
@@ -200,13 +199,13 @@ static int brx_get_selection(struct v4l2_subdev *subdev,return 0 ;case V4L2_SEL_TGT_COMPOSE : - config =vsp1_entity_get_pad_config (&brx->entity, sd_state, - sel->which); -if (!config) + state =vsp1_entity_get_state (&brx->entity, sd_state, + sel->which); +if (!state)return -EINVAL ;mutex_lock (&brx->entity.lock); - sel->r = *brx_get_compose (brx, config, sel->pad); + sel->r = *brx_get_compose (brx, state, sel->pad);mutex_unlock (&brx->entity.lock);return 0 ;
@@ -220,7 +219,7 @@ static int brx_set_selection(struct v4l2_subdev *subdev, struct v4l2_subdev_selection *sel) {struct vsp1_brx *brx =to_brx (subdev); -struct v4l2_subdev_state *config; +struct v4l2_subdev_state *state;struct v4l2_mbus_framefmt *format;struct v4l2_rect *compose;int ret =0 ;
@@ -233,9 +232,8 @@ static int brx_set_selection(struct v4l2_subdev *subdev,mutex_lock (&brx->entity.lock); - config =vsp1_entity_get_pad_config (&brx->entity, sd_state, - sel->which); -if (!config) { + state =vsp1_entity_get_state (&brx->entity, sd_state, sel->which); +if (!state) { ret = -EINVAL ; goto done; }
@@ -244,7 +242,7 @@ static int brx_set_selection(struct v4l2_subdev *subdev,* The compose rectangle top left corner must be inside the output * frame. */ - format =vsp1_entity_get_pad_format (&brx->entity, config, + format =vsp1_entity_get_pad_format (&brx->entity, state, brx->entity.source_pad); sel->r.left = clamp_t(unsigned int, sel->r.left, 0, format->width - 1); sel->r.top = clamp_t(unsigned int, sel->r.top, 0, format->height - 1);
@@ -253,11 +251,11 @@ static int brx_set_selection(struct v4l2_subdev *subdev,* Scaling isn't supported, the compose rectangle size must be identical * to the sink format size. */ - format =vsp1_entity_get_pad_format (&brx->entity, config, sel->pad); + format =vsp1_entity_get_pad_format (&brx->entity, state, sel->pad); sel->r.width = format->width; sel->r.height = format->height; - compose =brx_get_compose (brx, config, sel->pad); + compose =brx_get_compose (brx, state, sel->pad); *compose = sel->r; done:
@@ -293,7 +291,7 @@ static void brx_configure_stream(struct vsp1_entity *entity,unsigned int flags;unsigned int i; - format =vsp1_entity_get_pad_format (&brx->entity, brx->entity.config, + format =vsp1_entity_get_pad_format (&brx->entity, brx->entity.state, brx->entity.source_pad);/*
drivers/media/platform/renesas/vsp1/vsp1_clu.c +1 -2
@@ -182,8 +182,7 @@ static void clu_configure_stream(struct vsp1_entity *entity,* The yuv_mode can't be changed during streaming. Cache it internally * for future runtime configuration calls. */ - format =vsp1_entity_get_pad_format (&clu->entity, - clu->entity.config, + format =vsp1_entity_get_pad_format (&clu->entity, clu->entity.state,CLU_PAD_SINK ); clu->yuv_mode = format->code ==MEDIA_BUS_FMT_AYUV8_1X32 ; }
drivers/media/platform/renesas/vsp1/vsp1_entity.c +42 -43
218 lines not on this page · raw message
drivers/media/platform/renesas/vsp1/vsp1_entity.h +5 -5
@@ -115,9 +115,9 @@ struct vsp1_entity {unsigned int sink_pad;struct v4l2_subdev subdev; -struct v4l2_subdev_state *config; +struct v4l2_subdev_state *state; -struct mutex lock;/* Protects the pad config */ +struct mutex lock;/* Protects the state */ };static inline struct vsp1_entity *to_vsp1_entity (struct v4l2_subdev *subdev)
@@ -135,9 +135,9 @@ int vsp1_entity_link_setup(struct media_entity *entity, const struct media_pad *remote, u32 flags);struct v4l2_subdev_state * -vsp1_entity_get_pad_config (struct vsp1_entity *entity, -struct v4l2_subdev_state *sd_state, -enum v4l2_subdev_format_whence which); +vsp1_entity_get_state (struct vsp1_entity *entity, +struct v4l2_subdev_state *sd_state, +enum v4l2_subdev_format_whence which);struct v4l2_mbus_framefmt * vsp1_entity_get_pad_format(struct vsp1_entity *entity, struct v4l2_subdev_state *sd_state,
drivers/media/platform/renesas/vsp1/vsp1_hgo.c +2 -2
@@ -140,9 +140,9 @@ static void hgo_configure_stream(struct vsp1_entity *entity,unsigned int hratio;unsigned int vratio; - crop =vsp1_entity_get_pad_selection (entity, entity->config, + crop =vsp1_entity_get_pad_selection (entity, entity->state,HISTO_PAD_SINK ,V4L2_SEL_TGT_CROP ); - compose =vsp1_entity_get_pad_selection (entity, entity->config, + compose =vsp1_entity_get_pad_selection (entity, entity->state,HISTO_PAD_SINK ,V4L2_SEL_TGT_COMPOSE );
drivers/media/platform/renesas/vsp1/vsp1_hgt.c +2 -2
@@ -139,9 +139,9 @@ static void hgt_configure_stream(struct vsp1_entity *entity,u8 upper;unsigned int i; - crop =vsp1_entity_get_pad_selection (entity, entity->config, + crop =vsp1_entity_get_pad_selection (entity, entity->state,HISTO_PAD_SINK ,V4L2_SEL_TGT_CROP ); - compose =vsp1_entity_get_pad_selection (entity, entity->config, + compose =vsp1_entity_get_pad_selection (entity, entity->state,HISTO_PAD_SINK ,V4L2_SEL_TGT_COMPOSE );
drivers/media/platform/renesas/vsp1/vsp1_histo.c +11 -13
@@ -203,7 +203,7 @@ static int histo_get_selection(struct v4l2_subdev *subdev, struct v4l2_subdev_selection *sel) {struct vsp1_histogram *histo =subdev_to_histo (subdev); -struct v4l2_subdev_state *config; +struct v4l2_subdev_state *state;struct v4l2_mbus_framefmt *format;struct v4l2_rect *crop;int ret =0 ;
@@ -213,9 +213,8 @@ static int histo_get_selection(struct v4l2_subdev *subdev,mutex_lock (&histo->entity.lock); - config =vsp1_entity_get_pad_config (&histo->entity, sd_state, - sel->which); -if (!config) { + state =vsp1_entity_get_state (&histo->entity, sd_state, sel->which); +if (!state) { ret = -EINVAL ; goto done; }
@@ -223,7 +222,7 @@ static int histo_get_selection(struct v4l2_subdev *subdev,switch (sel->target) {case V4L2_SEL_TGT_COMPOSE_BOUNDS :case V4L2_SEL_TGT_COMPOSE_DEFAULT : - crop =vsp1_entity_get_pad_selection (&histo->entity, config, + crop =vsp1_entity_get_pad_selection (&histo->entity, state,HISTO_PAD_SINK ,V4L2_SEL_TGT_CROP ); sel->r.left =0 ;
@@ -234,7 +233,7 @@ static int histo_get_selection(struct v4l2_subdev *subdev,case V4L2_SEL_TGT_CROP_BOUNDS :case V4L2_SEL_TGT_CROP_DEFAULT : - format =vsp1_entity_get_pad_format (&histo->entity, config, + format =vsp1_entity_get_pad_format (&histo->entity, state,HISTO_PAD_SINK ); sel->r.left =0 ; sel->r.top =0 ;
@@ -244,7 +243,7 @@ static int histo_get_selection(struct v4l2_subdev *subdev,case V4L2_SEL_TGT_COMPOSE :case V4L2_SEL_TGT_CROP : - sel->r = *vsp1_entity_get_pad_selection (&histo->entity, config, + sel->r = *vsp1_entity_get_pad_selection (&histo->entity, state, sel->pad, sel->target);break ;
@@ -346,7 +345,7 @@ static int histo_set_selection(struct v4l2_subdev *subdev, struct v4l2_subdev_selection *sel) {struct vsp1_histogram *histo =subdev_to_histo (subdev); -struct v4l2_subdev_state *config; +struct v4l2_subdev_state *state;int ret;if (sel->pad !=HISTO_PAD_SINK )
@@ -354,17 +353,16 @@ static int histo_set_selection(struct v4l2_subdev *subdev,mutex_lock (&histo->entity.lock); - config =vsp1_entity_get_pad_config (&histo->entity, sd_state, - sel->which); -if (!config) { + state =vsp1_entity_get_state (&histo->entity, sd_state, sel->which); +if (!state) { ret = -EINVAL ; goto done; }if (sel->target ==V4L2_SEL_TGT_CROP ) - ret =histo_set_crop (subdev, config, sel); + ret =histo_set_crop (subdev, state, sel);else if (sel->target ==V4L2_SEL_TGT_COMPOSE ) - ret =histo_set_compose (subdev, config, sel); + ret =histo_set_compose (subdev, state, sel);else ret = -EINVAL ;
drivers/media/platform/renesas/vsp1/vsp1_hsit.c +5 -6
@@ -66,20 +66,19 @@ static int hsit_set_format(struct v4l2_subdev *subdev, struct v4l2_subdev_format *fmt) {struct vsp1_hsit *hsit =to_hsit (subdev); -struct v4l2_subdev_state *config; +struct v4l2_subdev_state *state;struct v4l2_mbus_framefmt *format;int ret =0 ;mutex_lock (&hsit->entity.lock); - config =vsp1_entity_get_pad_config (&hsit->entity, sd_state, - fmt->which); -if (!config) { + state =vsp1_entity_get_state (&hsit->entity, sd_state, fmt->which); +if (!state) { ret = -EINVAL ; goto done; } - format =vsp1_entity_get_pad_format (&hsit->entity, config, fmt->pad); + format =vsp1_entity_get_pad_format (&hsit->entity, state, fmt->pad);if (fmt->pad ==HSIT_PAD_SOURCE ) {/*
@@ -102,7 +101,7 @@ static int hsit_set_format(struct v4l2_subdev *subdev, fmt->format = *format;/* Propagate the format to the source pad. */ - format =vsp1_entity_get_pad_format (&hsit->entity, config, + format =vsp1_entity_get_pad_format (&hsit->entity, state,HSIT_PAD_SOURCE ); *format = fmt->format; format->code = hsit->inverse ? MEDIA_BUS_FMT_ARGB8888_1X32
drivers/media/platform/renesas/vsp1/vsp1_lif.c +1 -1
@@ -94,7 +94,7 @@ static void lif_configure_stream(struct vsp1_entity *entity,unsigned int obth;unsigned int lbth; - format =vsp1_entity_get_pad_format (&lif->entity, lif->entity.config, + format =vsp1_entity_get_pad_format (&lif->entity, lif->entity.state,LIF_PAD_SOURCE );switch (entity->vsp1->version &VI6_IP_VERSION_MODEL_MASK ) {
drivers/media/platform/renesas/vsp1/vsp1_rpf.c +4 -4
@@ -81,10 +81,10 @@ static void rpf_configure_stream(struct vsp1_entity *entity,/* Format */ sink_format =vsp1_entity_get_pad_format (&rpf->entity, - rpf->entity.config, + rpf->entity.state,RWPF_PAD_SINK ); source_format =vsp1_entity_get_pad_format (&rpf->entity, - rpf->entity.config, + rpf->entity.state,RWPF_PAD_SOURCE ); infmt =VI6_RPF_INFMT_CIPM
@@ -158,7 +158,7 @@ static void rpf_configure_stream(struct vsp1_entity *entity,const struct v4l2_rect *compose; compose =vsp1_entity_get_pad_selection (pipe->brx, - pipe->brx->config, + pipe->brx->state, rpf->brx_input,V4L2_SEL_TGT_COMPOSE ); left = compose->left;
@@ -302,7 +302,7 @@ static void rpf_configure_partition(struct vsp1_entity *entity,* offsets are needed, as planes 2 and 3 always have identical * strides. */ - crop = *vsp1_rwpf_get_crop (rpf, rpf->entity.config); + crop = *vsp1_rwpf_get_crop (rpf, rpf->entity.state);/* * Partition Algorithm Control
drivers/media/platform/renesas/vsp1/vsp1_rwpf.c +17 -20
@@ -62,15 +62,14 @@ static int vsp1_rwpf_set_format(struct v4l2_subdev *subdev, struct v4l2_subdev_format *fmt) {struct vsp1_rwpf *rwpf =to_rwpf (subdev); -struct v4l2_subdev_state *config; +struct v4l2_subdev_state *state;struct v4l2_mbus_framefmt *format;int ret =0 ;mutex_lock (&rwpf->entity.lock); - config =vsp1_entity_get_pad_config (&rwpf->entity, sd_state, - fmt->which); -if (!config) { + state =vsp1_entity_get_state (&rwpf->entity, sd_state, fmt->which); +if (!state) { ret = -EINVAL ; goto done; }
@@ -81,7 +80,7 @@ static int vsp1_rwpf_set_format(struct v4l2_subdev *subdev, fmt->format.code != MEDIA_BUS_FMT_AYUV8_1X32) fmt->format.code = MEDIA_BUS_FMT_AYUV8_1X32; - format =vsp1_entity_get_pad_format (&rwpf->entity, config, fmt->pad); + format =vsp1_entity_get_pad_format (&rwpf->entity, state, fmt->pad);if (fmt->pad ==RWPF_PAD_SOURCE ) {/*
@@ -107,7 +106,7 @@ static int vsp1_rwpf_set_format(struct v4l2_subdev *subdev,struct v4l2_rect *crop;/* Update the sink crop rectangle. */ - crop =vsp1_rwpf_get_crop (rwpf, config); + crop =vsp1_rwpf_get_crop (rwpf, state); crop->left =0 ; crop->top =0 ; crop->width = fmt->format.width;
@@ -115,7 +114,7 @@ static int vsp1_rwpf_set_format(struct v4l2_subdev *subdev, }/* Propagate the format to the source pad. */ - format =vsp1_entity_get_pad_format (&rwpf->entity, config, + format =vsp1_entity_get_pad_format (&rwpf->entity, state,RWPF_PAD_SOURCE ); *format = fmt->format;
@@ -134,7 +133,7 @@ static int vsp1_rwpf_get_selection(struct v4l2_subdev *subdev, struct v4l2_subdev_selection *sel) {struct vsp1_rwpf *rwpf =to_rwpf (subdev); -struct v4l2_subdev_state *config; +struct v4l2_subdev_state *state;struct v4l2_mbus_framefmt *format;int ret =0 ;
@@ -147,20 +146,19 @@ static int vsp1_rwpf_get_selection(struct v4l2_subdev *subdev,mutex_lock (&rwpf->entity.lock); - config =vsp1_entity_get_pad_config (&rwpf->entity, sd_state, - sel->which); -if (!config) { + state =vsp1_entity_get_state (&rwpf->entity, sd_state, sel->which); +if (!state) { ret = -EINVAL ; goto done; }switch (sel->target) {case V4L2_SEL_TGT_CROP : - sel->r = *vsp1_rwpf_get_crop (rwpf, config); + sel->r = *vsp1_rwpf_get_crop (rwpf, state);break ;case V4L2_SEL_TGT_CROP_BOUNDS : - format =vsp1_entity_get_pad_format (&rwpf->entity, config, + format =vsp1_entity_get_pad_format (&rwpf->entity, state,RWPF_PAD_SINK ); sel->r.left =0 ; sel->r.top =0 ;
@@ -183,7 +181,7 @@ static int vsp1_rwpf_set_selection(struct v4l2_subdev *subdev, struct v4l2_subdev_selection *sel) {struct vsp1_rwpf *rwpf =to_rwpf (subdev); -struct v4l2_subdev_state *config; +struct v4l2_subdev_state *state;struct v4l2_mbus_framefmt *format;struct v4l2_rect *crop;int ret =0 ;
@@ -200,15 +198,14 @@ static int vsp1_rwpf_set_selection(struct v4l2_subdev *subdev,mutex_lock (&rwpf->entity.lock); - config =vsp1_entity_get_pad_config (&rwpf->entity, sd_state, - sel->which); -if (!config) { + state =vsp1_entity_get_state (&rwpf->entity, sd_state, sel->which); +if (!state) { ret = -EINVAL ; goto done; }/* Make sure the crop rectangle is entirely contained in the image. */ - format =vsp1_entity_get_pad_format (&rwpf->entity, config, + format =vsp1_entity_get_pad_format (&rwpf->entity, state,RWPF_PAD_SINK );/*
@@ -229,11 +226,11 @@ static int vsp1_rwpf_set_selection(struct v4l2_subdev *subdev, sel->r.height = min_t(unsigned int, sel->r.height, format->height - sel->r.top); - crop =vsp1_rwpf_get_crop (rwpf, config); + crop =vsp1_rwpf_get_crop (rwpf, state); *crop = sel->r;/* Propagate the format to the source pad. */ - format =vsp1_entity_get_pad_format (&rwpf->entity, config, + format =vsp1_entity_get_pad_format (&rwpf->entity, state,RWPF_PAD_SOURCE ); format->width = crop->width; format->height = crop->height;
drivers/media/platform/renesas/vsp1/vsp1_sru.c +17 -19
@@ -123,16 +123,15 @@ static int sru_enum_frame_size(struct v4l2_subdev *subdev, struct v4l2_subdev_frame_size_enum *fse) {struct vsp1_sru *sru =to_sru (subdev); -struct v4l2_subdev_state *config; +struct v4l2_subdev_state *state;struct v4l2_mbus_framefmt *format;int ret =0 ; - config =vsp1_entity_get_pad_config (&sru->entity, sd_state, - fse->which); -if (!config) + state =vsp1_entity_get_state (&sru->entity, sd_state, fse->which); +if (!state)return -EINVAL ; - format =vsp1_entity_get_pad_format (&sru->entity, config,SRU_PAD_SINK ); + format =vsp1_entity_get_pad_format (&sru->entity, state,SRU_PAD_SINK );mutex_lock (&sru->entity.lock);
@@ -221,31 +220,30 @@ static int sru_set_format(struct v4l2_subdev *subdev, struct v4l2_subdev_format *fmt) {struct vsp1_sru *sru =to_sru (subdev); -struct v4l2_subdev_state *config; +struct v4l2_subdev_state *state;struct v4l2_mbus_framefmt *format;int ret =0 ;mutex_lock (&sru->entity.lock); - config =vsp1_entity_get_pad_config (&sru->entity, sd_state, - fmt->which); -if (!config) { + state =vsp1_entity_get_state (&sru->entity, sd_state, fmt->which); +if (!state) { ret = -EINVAL ; goto done; } -sru_try_format (sru, config, fmt->pad, &fmt->format); +sru_try_format (sru, state, fmt->pad, &fmt->format); - format =vsp1_entity_get_pad_format (&sru->entity, config, fmt->pad); + format =vsp1_entity_get_pad_format (&sru->entity, state, fmt->pad); *format = fmt->format;if (fmt->pad ==SRU_PAD_SINK ) {/* Propagate the format to the source pad. */ - format =vsp1_entity_get_pad_format (&sru->entity, config, + format =vsp1_entity_get_pad_format (&sru->entity, state,SRU_PAD_SOURCE ); *format = fmt->format; -sru_try_format (sru, config,SRU_PAD_SOURCE , format); +sru_try_format (sru, state,SRU_PAD_SOURCE , format); } done:
@@ -280,9 +278,9 @@ static void sru_configure_stream(struct vsp1_entity *entity,struct v4l2_mbus_framefmt *output;u32 ctrl0; - input =vsp1_entity_get_pad_format (&sru->entity, sru->entity.config, + input =vsp1_entity_get_pad_format (&sru->entity, sru->entity.state,SRU_PAD_SINK ); - output =vsp1_entity_get_pad_format (&sru->entity, sru->entity.config, + output =vsp1_entity_get_pad_format (&sru->entity, sru->entity.state,SRU_PAD_SOURCE );if (input->code ==MEDIA_BUS_FMT_ARGB8888_1X32 )
@@ -310,9 +308,9 @@ static unsigned int sru_max_width(struct vsp1_entity *entity,struct v4l2_mbus_framefmt *input;struct v4l2_mbus_framefmt *output; - input =vsp1_entity_get_pad_format (&sru->entity, sru->entity.config, + input =vsp1_entity_get_pad_format (&sru->entity, sru->entity.state,SRU_PAD_SINK ); - output =vsp1_entity_get_pad_format (&sru->entity, sru->entity.config, + output =vsp1_entity_get_pad_format (&sru->entity, sru->entity.state,SRU_PAD_SOURCE );/*
@@ -336,9 +334,9 @@ static void sru_partition(struct vsp1_entity *entity,struct v4l2_mbus_framefmt *input;struct v4l2_mbus_framefmt *output; - input =vsp1_entity_get_pad_format (&sru->entity, sru->entity.config, + input =vsp1_entity_get_pad_format (&sru->entity, sru->entity.state,SRU_PAD_SINK ); - output =vsp1_entity_get_pad_format (&sru->entity, sru->entity.config, + output =vsp1_entity_get_pad_format (&sru->entity, sru->entity.state,SRU_PAD_SOURCE );/* Adapt if SRUx2 is enabled. */
drivers/media/platform/renesas/vsp1/vsp1_uds.c +18 -21
@@ -128,17 +128,15 @@ static int uds_enum_frame_size(struct v4l2_subdev *subdev, struct v4l2_subdev_frame_size_enum *fse) {struct vsp1_uds *uds =to_uds (subdev); -struct v4l2_subdev_state *config; +struct v4l2_subdev_state *state;struct v4l2_mbus_framefmt *format;int ret =0 ; - config =vsp1_entity_get_pad_config (&uds->entity, sd_state, - fse->which); -if (!config) + state =vsp1_entity_get_state (&uds->entity, sd_state, fse->which); +if (!state)return -EINVAL ; - format =vsp1_entity_get_pad_format (&uds->entity, config, -UDS_PAD_SINK ); + format =vsp1_entity_get_pad_format (&uds->entity, state,UDS_PAD_SINK );mutex_lock (&uds->entity.lock);
@@ -205,31 +203,30 @@ static int uds_set_format(struct v4l2_subdev *subdev, struct v4l2_subdev_format *fmt) {struct vsp1_uds *uds =to_uds (subdev); -struct v4l2_subdev_state *config; +struct v4l2_subdev_state *state;struct v4l2_mbus_framefmt *format;int ret =0 ;mutex_lock (&uds->entity.lock); - config =vsp1_entity_get_pad_config (&uds->entity, sd_state, - fmt->which); -if (!config) { + state =vsp1_entity_get_state (&uds->entity, sd_state, fmt->which); +if (!state) { ret = -EINVAL ; goto done; } -uds_try_format (uds, config, fmt->pad, &fmt->format); +uds_try_format (uds, state, fmt->pad, &fmt->format); - format =vsp1_entity_get_pad_format (&uds->entity, config, fmt->pad); + format =vsp1_entity_get_pad_format (&uds->entity, state, fmt->pad); *format = fmt->format;if (fmt->pad ==UDS_PAD_SINK ) {/* Propagate the format to the source pad. */ - format =vsp1_entity_get_pad_format (&uds->entity, config, + format =vsp1_entity_get_pad_format (&uds->entity, state,UDS_PAD_SOURCE ); *format = fmt->format; -uds_try_format (uds, config,UDS_PAD_SOURCE , format); +uds_try_format (uds, state,UDS_PAD_SOURCE , format); } done:
@@ -269,9 +266,9 @@ static void uds_configure_stream(struct vsp1_entity *entity,unsigned int vscale;bool multitap; - input =vsp1_entity_get_pad_format (&uds->entity, uds->entity.config, + input =vsp1_entity_get_pad_format (&uds->entity, uds->entity.state,UDS_PAD_SINK ); - output =vsp1_entity_get_pad_format (&uds->entity, uds->entity.config, + output =vsp1_entity_get_pad_format (&uds->entity, uds->entity.state,UDS_PAD_SOURCE ); hscale =uds_compute_ratio (input->width, output->width);
@@ -314,7 +311,7 @@ static void uds_configure_partition(struct vsp1_entity *entity,struct vsp1_partition *partition = pipe->partition;const struct v4l2_mbus_framefmt *output; - output =vsp1_entity_get_pad_format (&uds->entity, uds->entity.config, + output =vsp1_entity_get_pad_format (&uds->entity, uds->entity.state,UDS_PAD_SOURCE );/* Input size clipping. */
@@ -339,9 +336,9 @@ static unsigned int uds_max_width(struct vsp1_entity *entity,const struct v4l2_mbus_framefmt *input;unsigned int hscale; - input =vsp1_entity_get_pad_format (&uds->entity, uds->entity.config, + input =vsp1_entity_get_pad_format (&uds->entity, uds->entity.state,UDS_PAD_SINK ); - output =vsp1_entity_get_pad_format (&uds->entity, uds->entity.config, + output =vsp1_entity_get_pad_format (&uds->entity, uds->entity.state,UDS_PAD_SOURCE ); hscale = output->width / input->width;
@@ -381,9 +378,9 @@ static void uds_partition(struct vsp1_entity *entity, partition->uds_sink = *window; partition->uds_source = *window; - input =vsp1_entity_get_pad_format (&uds->entity, uds->entity.config, + input =vsp1_entity_get_pad_format (&uds->entity, uds->entity.state,UDS_PAD_SINK ); - output =vsp1_entity_get_pad_format (&uds->entity, uds->entity.config, + output =vsp1_entity_get_pad_format (&uds->entity, uds->entity.state,UDS_PAD_SOURCE ); partition->uds_sink.width = window->width * input->width
drivers/media/platform/renesas/vsp1/vsp1_uif.c +11 -13
@@ -86,7 +86,7 @@ static int uif_get_selection(struct v4l2_subdev *subdev, struct v4l2_subdev_selection *sel) {struct vsp1_uif *uif =to_uif (subdev); -struct v4l2_subdev_state *config; +struct v4l2_subdev_state *state;struct v4l2_mbus_framefmt *format;int ret =0 ;
@@ -95,9 +95,8 @@ static int uif_get_selection(struct v4l2_subdev *subdev,mutex_lock (&uif->entity.lock); - config =vsp1_entity_get_pad_config (&uif->entity, sd_state, - sel->which); -if (!config) { + state =vsp1_entity_get_state (&uif->entity, sd_state, sel->which); +if (!state) { ret = -EINVAL ; goto done; }
@@ -105,7 +104,7 @@ static int uif_get_selection(struct v4l2_subdev *subdev,switch (sel->target) {case V4L2_SEL_TGT_CROP_BOUNDS :case V4L2_SEL_TGT_CROP_DEFAULT : - format =vsp1_entity_get_pad_format (&uif->entity, config, + format =vsp1_entity_get_pad_format (&uif->entity, state,UIF_PAD_SINK ); sel->r.left =0 ; sel->r.top =0 ;
@@ -114,7 +113,7 @@ static int uif_get_selection(struct v4l2_subdev *subdev,break ;case V4L2_SEL_TGT_CROP : - sel->r = *vsp1_entity_get_pad_selection (&uif->entity, config, + sel->r = *vsp1_entity_get_pad_selection (&uif->entity, state, sel->pad, sel->target);break ;
@@ -133,7 +132,7 @@ static int uif_set_selection(struct v4l2_subdev *subdev, struct v4l2_subdev_selection *sel) {struct vsp1_uif *uif =to_uif (subdev); -struct v4l2_subdev_state *config; +struct v4l2_subdev_state *state;struct v4l2_mbus_framefmt *format;struct v4l2_rect *selection;int ret =0 ;
@@ -144,15 +143,14 @@ static int uif_set_selection(struct v4l2_subdev *subdev,mutex_lock (&uif->entity.lock); - config =vsp1_entity_get_pad_config (&uif->entity, sd_state, - sel->which); -if (!config) { + state =vsp1_entity_get_state (&uif->entity, sd_state, sel->which); +if (!state) { ret = -EINVAL ; goto done; }/* The crop rectangle must be inside the input frame. */ - format =vsp1_entity_get_pad_format (&uif->entity, config,UIF_PAD_SINK ); + format =vsp1_entity_get_pad_format (&uif->entity, state,UIF_PAD_SINK ); sel->r.left = clamp_t(unsigned int, sel->r.left, 0, format->width - 1); sel->r.top = clamp_t(unsigned int, sel->r.top, 0, format->height - 1);
@@ -162,7 +160,7 @@ static int uif_set_selection(struct v4l2_subdev *subdev, format->height - sel->r.top);/* Store the crop rectangle. */ - selection =vsp1_entity_get_pad_selection (&uif->entity, config, + selection =vsp1_entity_get_pad_selection (&uif->entity, state, sel->pad,V4L2_SEL_TGT_CROP ); *selection = sel->r;
@@ -206,7 +204,7 @@ static void uif_configure_stream(struct vsp1_entity *entity,vsp1_uif_write (uif, dlb,VI6_UIF_DISCOM_DOCMPMR ,VI6_UIF_DISCOM_DOCMPMR_SEL (9 )); - crop =vsp1_entity_get_pad_selection (entity, entity->config, + crop =vsp1_entity_get_pad_selection (entity, entity->state,UIF_PAD_SINK ,V4L2_SEL_TGT_CROP ); left = crop->left;
drivers/media/platform/renesas/vsp1/vsp1_video.c +2 -2
@@ -198,7 +198,7 @@ static void vsp1_video_calculate_partition(struct vsp1_pipeline *pipe,* at the WPF sink. */ format =vsp1_entity_get_pad_format (&pipe->output->entity, - pipe->output->entity.config, + pipe->output->entity.state,RWPF_PAD_SINK );/* A single partition simply processes the output size in full. */
@@ -263,7 +263,7 @@ static int vsp1_video_pipeline_setup_partitions(struct vsp1_pipeline *pipe)* at the WPF sink. */ format =vsp1_entity_get_pad_format (&pipe->output->entity, - pipe->output->entity.config, + pipe->output->entity.state,RWPF_PAD_SINK ); div_size = format->width;
drivers/media/platform/renesas/vsp1/vsp1_wpf.c +5 -5
@@ -66,10 +66,10 @@ static int vsp1_wpf_set_rotation(struct vsp1_rwpf *wpf, unsigned int rotation) } sink_format =vsp1_entity_get_pad_format (&wpf->entity, - wpf->entity.config, + wpf->entity.state,RWPF_PAD_SINK ); source_format =vsp1_entity_get_pad_format (&wpf->entity, - wpf->entity.config, + wpf->entity.state,RWPF_PAD_SOURCE );mutex_lock (&wpf->entity.lock);
@@ -246,10 +246,10 @@ static void wpf_configure_stream(struct vsp1_entity *entity,int ret; sink_format =vsp1_entity_get_pad_format (&wpf->entity, - wpf->entity.config, + wpf->entity.state,RWPF_PAD_SINK ); source_format =vsp1_entity_get_pad_format (&wpf->entity, - wpf->entity.config, + wpf->entity.state,RWPF_PAD_SOURCE );/* Format */
@@ -384,7 +384,7 @@ static void wpf_configure_partition(struct vsp1_entity *entity,unsigned int i; sink_format =vsp1_entity_get_pad_format (&wpf->entity, - wpf->entity.config, + wpf->entity.state,RWPF_PAD_SINK ); width = sink_format->width; height = sink_format->height;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 15/88 f2fs: fix write pointers on zoned device after roll forward
In reply to Sasha LevinFrom: Jaegeuk Kim <[email protected]>
[ Upstream commit 9dad4d964291295ef48243d4e03972b85138bc9f ]
1. do roll forward recovery
2. update current segments pointers
3. fix the entire zones' write pointers
4. do checkpoint
--- fs/f2fs/recovery.c | 2 ++ 1 file changed, 2 insertions(+)
fs/f2fs/recovery.c +2 -0
@@ -917,6 +917,8 @@ int f2fs_recover_fsync_data(struct f2fs_sb_info *sbi, bool check_only)if (!err && fix_curseg_write_pointer && !f2fs_readonly (sbi->sb) &&f2fs_sb_has_blkzoned (sbi)) { err =f2fs_fix_curseg_write_pointer (sbi); +if (!err) + err =f2fs_check_write_pointer (sbi); ret = err; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 16/88 ASoC: amd: Add new dmi entries for acp5x platform
In reply to Sasha LevinFrom: Venkata Prasad Potturu <[email protected]>
[ Upstream commit c3ab23a10771bbe06300e5374efa809789c65455 ]
Add sys_vendor and product_name dmi entries for acp5x platform.
--- sound/soc/amd/acp-config.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
sound/soc/amd/acp-config.c +14 -1
@@ -3,7 +3,7 @@// This file is provided under a dual BSD/GPLv2 license. When using or // redistributing this file, you may do so under either license. // -// Copyright(c) 2021 Advanced Micro Devices, Inc. +// Copyright(c) 2021, 2023 Advanced Micro Devices, Inc. // // Authors: Ajit Kumar Pandey <[email protected]> //
@@ -47,6 +47,19 @@ static const struct config_entry config_table[] = { {} }, }, + { + .flags = FLAG_AMD_LEGACY, + .device = ACP_PCI_DEV_ID, + .dmi_table = (const struct dmi_system_id []) { + { + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Valve" ), +DMI_MATCH (DMI_PRODUCT_NAME ,"Jupiter" ), + }, + }, + {} + }, + }, { .flags = FLAG_AMD_SOF, .device = ACP_PCI_DEV_ID,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 17/88 drm/amd/display: initialize all the dpm level's stutter latency
In reply to Sasha LevinFrom: Charlene Liu <[email protected]>
[ Upstream commit 885c71ad791c1709f668a37f701d33e6872a902f ]
Fix issue when override level bigger than default. Levels 5, 6, and 7 had zero stutter latency, this is because override level being initialized after stutter latency inits.
--- drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c +3 -1
@@ -341,6 +341,9 @@ void dml2_init_soc_states(struct dml2_context *dml2, const struct dc *in_dc,break ; } +if (dml2->config.bbox_overrides.clks_table.num_states) + p->in_states->num_states = dml2->config.bbox_overrides.clks_table.num_states; +/* Override from passed values, if available */ for (i =0 ; i < p->in_states->num_states; i++) {if (dml2->config.bbox_overrides.sr_exit_latency_us) {
@@ -397,7 +400,6 @@ void dml2_init_soc_states(struct dml2_context *dml2, const struct dc *in_dc, }/* Copy clocks tables entries, if available */ if (dml2->config.bbox_overrides.clks_table.num_states) { - p->in_states->num_states = dml2->config.bbox_overrides.clks_table.num_states;for (i =0 ; i < dml2->config.bbox_overrides.clks_table.num_entries_per_clk.num_dcfclk_levels; i++) { p->in_states->state_array[i].dcfclk_mhz = dml2->config.bbox_overrides.clks_table.clk_entries[i].dcfclk_mhz;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 18/88 drm/amd/display: Fix MST PBN/X.Y value calculations
In reply to Sasha LevinFrom: Ilya Bakoulin <[email protected]>
[ Upstream commit 94bbf802efd0a8f13147d6664af6e653637340a8 ]
Changing PBN calculation to be more in line with spec. We don't need to inflate PBN_NATIVE value by the 1.006 margin, since that is already taken care of in the get_pbn_per_slot function.
--- drivers/gpu/drm/amd/display/dc/link/link_dpms.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/dc/link/link_dpms.c +8 -5
@@ -1057,18 +1057,21 @@ static struct fixed31_32 get_pbn_from_bw_in_kbps(uint64_t kbps)uint32_t denominator =1 ;/* -* margin 5300ppm + 300ppm ~ 0.6% as per spec, factor is 1.006 +* The 1.006 factor (margin 5300ppm + 300ppm ~ 0.6% as per spec) is not +* required when determining PBN/time slot utilization on the link between +* us and the branch, since that overhead is already accounted for in +* the get_pbn_per_slot function. +* * The unit of 54/64Mbytes/sec is an arbitrary unit chosen based on * common multiplier to render an integer PBN for all link rate/lane * counts combinations * calculate -* peak_kbps *= (1006/1000) * peak_kbps *= (64/54) -* peak_kbps *= 8 convert to bytes +* peak_kbps /= (8 * 1000) convert to bytes */ - numerator =64 *PEAK_FACTOR_X1000 ; - denominator =54 *8 *1000 *1000 ; + numerator =64 ; + denominator =54 *8 *1000 ; kbps *= numerator; peak_kbps =dc_fixpt_from_fraction (kbps, denominator);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 19/88 drm/amd/display: Fix disable_otg_wa logic
In reply to Sasha LevinFrom: Nicholas Susanto <[email protected]>
[ Upstream commit 2ce156482a6fef349d2eba98e5070c412d3af662 ]
[Why]
When switching to another HDMI mode, we are unnecesarilly disabling/enabling FIFO causing both HPO and DIG registers to be set at the same time when only HPO is supposed to be set.
This can lead to a system hang the next time we change refresh rates as there are cases when we don't disable OTG/FIFO but FIFO is enabled when it isn't supposed to be.
[How]
Removing the enable/disable FIFO entirely.
--- .../gpu/drm/amd/display/dc/clk_mgr/dcn35/dcn35_clk_mgr.c | 8 -------- 1 file changed, 8 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn35/dcn35_clk_mgr.c +0 -8
@@ -126,21 +126,13 @@ static void dcn35_disable_otg_wa(struct clk_mgr *clk_mgr_base, struct dc_state *continue ;if (pipe->stream && (pipe->stream->dpms_off ||dc_is_virtual_signal (pipe->stream->signal) || !pipe->stream->link_enc)) { -struct stream_encoder *stream_enc = pipe->stream_res.stream_enc; -if (disable) { -if (stream_enc && stream_enc->funcs->disable_fifo) - pipe->stream_res.stream_enc->funcs->disable_fifo (stream_enc); -if (pipe->stream_res.tg && pipe->stream_res.tg->funcs->immediate_disable_crtc) pipe->stream_res.tg->funcs->immediate_disable_crtc (pipe->stream_res.tg);reset_sync_context_for_pipe (dc, context, i); }else { pipe->stream_res.tg->funcs->enable_crtc (pipe->stream_res.tg); - -if (stream_enc && stream_enc->funcs->enable_fifo) - pipe->stream_res.stream_enc->funcs->enable_fifo (stream_enc); } } }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 20/88 drm/amd/display: Fix Replay Desync Error IRQ handler
In reply to Sasha LevinFrom: Dennis Chan <[email protected]>
[ Upstream commit dd5c6362ddcd8bdb07704faff8648593885ecfa1 ]
In previous case, Replay didn't identify the IRQ type, This commit fixes the issues for the interrupt.
--- .../display/dc/link/protocols/link_dp_irq_handler.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_irq_handler.c +6 -6
@@ -190,9 +190,6 @@ static void handle_hpd_irq_replay_sink(struct dc_link *link)/*AMD Replay version reuse DP_PSR_ERROR_STATUS for REPLAY_ERROR status.*/ union psr_error_status replay_error_status; -if (link->replay_settings.config.force_disable_desync_error_check) -return ; -if (!link->replay_settings.replay_feature_enabled)return ;
@@ -210,9 +207,6 @@ static void handle_hpd_irq_replay_sink(struct dc_link *link) &replay_error_status.raw, sizeof(replay_error_status.raw)); -if (replay_configuration.bits.DESYNC_ERROR_STATUS) - link->replay_settings.config.received_desync_error_hpd =1 ; - link->replay_settings.config.replay_error_status.bits.LINK_CRC_ERROR = replay_error_status.bits.LINK_CRC_ERROR; link->replay_settings.config.replay_error_status.bits.DESYNC_ERROR =
@@ -225,6 +219,12 @@ static void handle_hpd_irq_replay_sink(struct dc_link *link) link->replay_settings.config.replay_error_status.bits.STATE_TRANSITION_ERROR) {bool allow_active; +if (link->replay_settings.config.replay_error_status.bits.DESYNC_ERROR) + link->replay_settings.config.received_desync_error_hpd =1 ; + +if (link->replay_settings.config.force_disable_desync_error_check) +return ; +/* Acknowledge and clear configuration bits */ dm_helpers_dp_write_dpcd( link->ctx,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 21/88 drm/amd/display: add support for DTO genarated dscclk
In reply to Sasha LevinFrom: Wenjing Liu <[email protected]>
[ Upstream commit 08a32addf17317b9fac55be9b31275cbf6e41fb7 ]
Current implementation will choose to use refclk as dscclk. This is not recommended by hardware team as refclk is a fixed value which could cause unnecessary power consumption or it could be not enough for large DSC timings. So we are adding new interfaces so we could switch to use dynamically generated DSCCLK by DTO. So DSCCLK is programmable based on current pixel clock and dispclk.
--- .../amd/display/dc/hwss/dcn32/dcn32_hwseq.c | 25 +++++++++++++++++ drivers/gpu/drm/amd/display/dc/inc/hw/dccg.h | 4 +++ .../gpu/drm/amd/display/dc/link/link_dpms.c | 27 ++++++++++++++++++- 3 files changed, 55 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c +25 -0
@@ -995,9 +995,22 @@ static int calc_mpc_flow_ctrl_cnt(const struct dc_stream_state *stream,static void update_dsc_on_stream (struct pipe_ctx *pipe_ctx,bool enable) {struct display_stream_compressor *dsc = pipe_ctx->stream_res.dsc; +struct dc *dc = pipe_ctx->stream->ctx->dc;struct dc_stream_state *stream = pipe_ctx->stream;struct pipe_ctx *odm_pipe;int opp_cnt =1 ; +struct dccg *dccg = dc->res_pool->dccg; +/* It has been found that when DSCCLK is lower than 16Mhz, we will get DCN +* register access hung. When DSCCLk is based on refclk, DSCCLk is always a +* fixed value higher than 16Mhz so the issue doesn't occur. When DSCCLK is +* generated by DTO, DSCCLK would be based on 1/3 dispclk. For small timings +* with DSC such as 480p60Hz, the dispclk could be low enough to trigger +* this problem. We are implementing a workaround here to keep using dscclk +* based on fixed value refclk when timing is smaller than 3x16Mhz (i.e +* 48Mhz) pixel clock to avoid hitting this problem. +*/ +bool should_use_dto_dscclk = (dccg->funcs->set_dto_dscclk !=NULL ) && + stream->timing.pix_clk_100hz >480000 ;ASSERT (dsc);for (odm_pipe = pipe_ctx->next_odm_pipe; odm_pipe; odm_pipe = odm_pipe->next_odm_pipe)
@@ -1020,12 +1033,16 @@ static void update_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable) dsc->funcs->dsc_set_config (dsc, &dsc_cfg, &dsc_optc_cfg); dsc->funcs->dsc_enable (dsc, pipe_ctx->stream_res.opp->inst); +if (should_use_dto_dscclk) + dccg->funcs->set_dto_dscclk (dccg, dsc->inst);for (odm_pipe = pipe_ctx->next_odm_pipe; odm_pipe; odm_pipe = odm_pipe->next_odm_pipe) {struct display_stream_compressor *odm_dsc = odm_pipe->stream_res.dsc;ASSERT (odm_dsc); odm_dsc->funcs->dsc_set_config (odm_dsc, &dsc_cfg, &dsc_optc_cfg); odm_dsc->funcs->dsc_enable (odm_dsc, odm_pipe->stream_res.opp->inst); +if (should_use_dto_dscclk) + dccg->funcs->set_dto_dscclk (dccg, odm_dsc->inst); } dsc_cfg.dc_dsc_cfg.num_slices_h *= opp_cnt; dsc_cfg.pic_width *= opp_cnt;
@@ -1045,9 +1062,13 @@ static void update_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable) OPTC_DSC_DISABLED, 0, 0);/* disable DSC block */ +if (dccg->funcs->set_ref_dscclk) + dccg->funcs->set_ref_dscclk (dccg, pipe_ctx->stream_res.dsc->inst); dsc->funcs->dsc_disable (pipe_ctx->stream_res.dsc);for (odm_pipe = pipe_ctx->next_odm_pipe; odm_pipe; odm_pipe = odm_pipe->next_odm_pipe) {ASSERT (odm_pipe->stream_res.dsc); +if (dccg->funcs->set_ref_dscclk) + dccg->funcs->set_ref_dscclk (dccg, odm_pipe->stream_res.dsc->inst); odm_pipe->stream_res.dsc->funcs->dsc_disable (odm_pipe->stream_res.dsc); } }
@@ -1130,6 +1151,10 @@ void dcn32_update_odm(struct dc *dc, struct dc_state *context, struct pipe_ctx *if (!pipe_ctx->next_odm_pipe && current_pipe_ctx->next_odm_pipe && current_pipe_ctx->next_odm_pipe->stream_res.dsc) {struct display_stream_compressor *dsc = current_pipe_ctx->next_odm_pipe->stream_res.dsc; +struct dccg *dccg = dc->res_pool->dccg; + +if (dccg->funcs->set_ref_dscclk) + dccg->funcs->set_ref_dscclk (dccg, dsc->inst);/* disconnect DSC block from stream */ dsc->funcs->dsc_disconnect (dsc); }
drivers/gpu/drm/amd/display/dc/inc/hw/dccg.h +4 -0
@@ -201,6 +201,10 @@ struct dccg_funcs {struct dccg *dccg, enum streamclk_source src, uint32_t otg_inst); +void (*set_dto_dscclk)( +struct dccg *dccg, +uint32_t dsc_inst); + void (*set_ref_dscclk)(struct dccg *dccg, uint32_t dsc_inst); };#endif //__DAL_DCCG_H__
drivers/gpu/drm/amd/display/dc/link/link_dpms.c +26 -1
@@ -776,10 +776,26 @@ static bool dp_set_dsc_on_rx(struct pipe_ctx *pipe_ctx, bool enable)*/ void link_set_dsc_on_stream (struct pipe_ctx *pipe_ctx,bool enable) { +/* TODO: Move this to HWSS as this is hardware programming sequence not a +* link layer sequence +*/ struct display_stream_compressor *dsc = pipe_ctx->stream_res.dsc; +struct dc *dc = pipe_ctx->stream->ctx->dc;struct dc_stream_state *stream = pipe_ctx->stream;struct pipe_ctx *odm_pipe;int opp_cnt =1 ; +struct dccg *dccg = dc->res_pool->dccg; +/* It has been found that when DSCCLK is lower than 16Mhz, we will get DCN +* register access hung. When DSCCLk is based on refclk, DSCCLk is always a +* fixed value higher than 16Mhz so the issue doesn't occur. When DSCCLK is +* generated by DTO, DSCCLK would be based on 1/3 dispclk. For small timings +* with DSC such as 480p60Hz, the dispclk could be low enough to trigger +* this problem. We are implementing a workaround here to keep using dscclk +* based on fixed value refclk when timing is smaller than 3x16Mhz (i.e +* 48Mhz) pixel clock to avoid hitting this problem. +*/ +bool should_use_dto_dscclk = (dccg->funcs->set_dto_dscclk !=NULL ) && + stream->timing.pix_clk_100hz >480000 ;DC_LOGGER_INIT (dsc->ctx->logger);for (odm_pipe = pipe_ctx->next_odm_pipe; odm_pipe; odm_pipe = odm_pipe->next_odm_pipe)
@@ -802,11 +818,15 @@ void link_set_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable) dsc->funcs->dsc_set_config (dsc, &dsc_cfg, &dsc_optc_cfg); dsc->funcs->dsc_enable (dsc, pipe_ctx->stream_res.opp->inst); +if (should_use_dto_dscclk) + dccg->funcs->set_dto_dscclk (dccg, dsc->inst);for (odm_pipe = pipe_ctx->next_odm_pipe; odm_pipe; odm_pipe = odm_pipe->next_odm_pipe) {struct display_stream_compressor *odm_dsc = odm_pipe->stream_res.dsc; odm_dsc->funcs->dsc_set_config (odm_dsc, &dsc_cfg, &dsc_optc_cfg); odm_dsc->funcs->dsc_enable (odm_dsc, odm_pipe->stream_res.opp->inst); +if (should_use_dto_dscclk) + dccg->funcs->set_dto_dscclk (dccg, odm_dsc->inst); } dsc_cfg.dc_dsc_cfg.num_slices_h *= opp_cnt; dsc_cfg.pic_width *= opp_cnt;
@@ -856,9 +876,14 @@ void link_set_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable) }/* disable DSC block */ +if (dccg->funcs->set_ref_dscclk) + dccg->funcs->set_ref_dscclk (dccg, pipe_ctx->stream_res.dsc->inst); pipe_ctx->stream_res.dsc->funcs->dsc_disable (pipe_ctx->stream_res.dsc); -for (odm_pipe = pipe_ctx->next_odm_pipe; odm_pipe; odm_pipe = odm_pipe->next_odm_pipe) +for (odm_pipe = pipe_ctx->next_odm_pipe; odm_pipe; odm_pipe = odm_pipe->next_odm_pipe) { +if (dccg->funcs->set_ref_dscclk) + dccg->funcs->set_ref_dscclk (dccg, odm_pipe->stream_res.dsc->inst); odm_pipe->stream_res.dsc->funcs->dsc_disable (odm_pipe->stream_res.dsc); + } } }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 22/88 drm/amd/display: Fix writeback_info never got updated
In reply to Sasha LevinFrom: Alex Hung <[email protected]>
[ Upstream commit c09919e6ea5fefd49d8b7b54aa5b222937163108 ]
[WHY]wb_enabled field is set to false before it is used, and the following code will never be executed.
[HOW]
Setting wb_enable to false after all removal work is completed.
--- drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +4 -9
@@ -490,18 +490,13 @@ bool dc_stream_remove_writeback(struct dc *dc,return false; } -// stream->writeback_info[dwb_pipe_inst].wb_enabled = false; -for (i =0 ; i < stream->num_wb_info; i++) { -/*dynamic update*/ -if (stream->writeback_info[i].wb_enabled && - stream->writeback_info[i].dwb_pipe_inst == dwb_pipe_inst) { - stream->writeback_info[i].wb_enabled = false; - } - } -/* remove writeback info for disabled writeback pipes from stream */ for (i =0 , j =0 ; i < stream->num_wb_info; i++) {if (stream->writeback_info[i].wb_enabled) { + +if (stream->writeback_info[i].dwb_pipe_inst == dwb_pipe_inst) + stream->writeback_info[i].wb_enabled = false; +if (j < i)/* trim the array */ memcpy(&stream->writeback_info[j], &stream->writeback_info[i],
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 23/88 drm/amd/display: Fix writeback_info is not removed
In reply to Sasha LevinFrom: Alex Hung <[email protected]>
[ Upstream commit ab37b88ed9de9de8d582683f7ea17059f1251a7f ]
[WHY]
Counter j was not updated to present the num of writeback_info when writeback pipes are removed.
[HOW]
update j (num of writeback info) under the correct condition.
--- drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +4 -3
@@ -497,11 +497,12 @@ bool dc_stream_remove_writeback(struct dc *dc,if (stream->writeback_info[i].dwb_pipe_inst == dwb_pipe_inst) stream->writeback_info[i].wb_enabled = false; -if (j < i) -/* trim the array */ +/* trim the array */ +if (j < i) {memcpy (&stream->writeback_info[j], &stream->writeback_info[i],sizeof (struct dc_writeback_info )); - j++; + j++; + } } } stream->num_wb_info = j;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 24/88 drm/drm_file: fix use of uninitialized variable
In reply to Sasha LevinFrom: Tomi Valkeinen <[email protected]>
[ Upstream commit 1d3062fad9c7313fff9970a88e0538a24480ffb8 ]
smatch reports:
drivers/gpu/drm/drm_file.c:967 drm_show_memory_stats() error: uninitialized symbol 'supported_status'.
'supported_status' is only set in one code path. I'm not familiar with the code to say if that path will always be ran in real life, but whether that is the case or not, I think it is good to initialize 'supported_status' to 0 to silence the warning (and possibly fix a bug).
--- drivers/gpu/drm/drm_file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_file.c +1 -1
@@ -958,7 +958,7 @@ void drm_show_memory_stats(struct drm_printer *p, struct drm_file *file) {struct drm_gem_object *obj;struct drm_memory_stats status = {}; -enum drm_gem_object_status supported_status; +enum drm_gem_object_status supported_status =0 ;int id;spin_lock (&file->table_lock);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 25/88 drm/framebuffer: Fix use of uninitialized variable
In reply to Sasha LevinFrom: Tomi Valkeinen <[email protected]>
[ Upstream commit f9af8f0c1dc567a5a6a6318ff324c45d80d4a60f ]
smatch reports:
drivers/gpu/drm/drm_framebuffer.c:654 drm_mode_getfb2_ioctl() error: uninitialized symbol 'ret'.
'ret' is possibly not set when there are no errors, causing the error above. I can't say if that ever happens in real-life, but in any case I think it is good to initialize 'ret' to 0.
--- drivers/gpu/drm/drm_framebuffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_framebuffer.c +1 -1
@@ -552,7 +552,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev,struct drm_mode_fb_cmd2 *r = data;struct drm_framebuffer *fb;unsigned int i; -int ret; +int ret =0 ;if (!drm_core_check_feature (dev,DRIVER_MODESET ))return -EINVAL ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 26/88 drm/mipi-dsi: Fix detach call without attach
In reply to Sasha LevinFrom: Tomi Valkeinen <[email protected]>
[ Upstream commit 90d50b8d85834e73536fdccd5aa913b30494fef0 ]
It's been reported that DSI host driver's detach can be called without the attach ever happening:
https://lore.kernel.org/all/[email protected]/
After reading the code, I think this is what happens:
We have a DSI host defined in the device tree and a DSI peripheral under that host (i.e. an i2c device using the DSI as data bus doesn't exhibit this behavior).
The host driver calls mipi_dsi_host_register(), which causes (via a few functions) mipi_dsi_device_add() to be called for the DSI peripheral. So now we have a DSI device under the host, but attach hasn't been called.
Normally the probing of the devices continues, and eventually the DSI peripheral's driver will call mipi_dsi_attach(), attaching the peripheral.
However, if the host driver's probe encounters an error after calling mipi_dsi_host_register(), and before the peripheral has called mipi_dsi_attach(), the host driver will do cleanups and return an error from its probe function. The cleanups include calling mipi_dsi_host_unregister().
mipi_dsi_host_unregister() will call two functions for all its DSI peripheral devices: mipi_dsi_detach() and mipi_dsi_device_unregister(). The latter makes sense, as the device exists, but the former may be wrong as attach has not necessarily been done.
To fix this, track the attached state of the peripheral, and only detach from mipi_dsi_host_unregister() if the peripheral was attached.
Note that I have only tested this with a board with an i2c DSI peripheral, not with a "pure" DSI peripheral.
However, slightly related, the unregister machinery still seems broken. E.g. if the DSI host driver is unbound, it'll detach and unregister the DSI peripherals. After that, when the DSI peripheral driver unbound it'll call detach either directly or using the devm variant, leading to a crash. And probably the driver will crash if it happens, for some reason, to try to send a message via the DSI bus.
But that's another topic.
--- drivers/gpu/drm/drm_mipi_dsi.c | 17 +++++++++++++++-- include/drm/drm_mipi_dsi.h | 2 ++ 2 files changed, 17 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_mipi_dsi.c +15 -2
@@ -347,7 +347,8 @@ static int mipi_dsi_remove_device_fn(struct device *dev, void *priv) {struct mipi_dsi_device *dsi =to_mipi_dsi_device (dev); -mipi_dsi_detach (dsi); +if (dsi->attached) +mipi_dsi_detach (dsi);mipi_dsi_device_unregister (dsi);return 0 ;
@@ -370,11 +371,18 @@ EXPORT_SYMBOL(mipi_dsi_host_unregister);int mipi_dsi_attach (struct mipi_dsi_device *dsi) {const struct mipi_dsi_host_ops *ops = dsi->host->ops; +int ret;if (!ops || !ops->attach)return -ENOSYS ; -return ops->attach (dsi->host, dsi); + ret = ops->attach (dsi->host, dsi); +if (ret) +return ret; + + dsi->attached = true; + +return 0 ; }EXPORT_SYMBOL (mipi_dsi_attach);
@@ -386,9 +394,14 @@ int mipi_dsi_detach(struct mipi_dsi_device *dsi) {const struct mipi_dsi_host_ops *ops = dsi->host->ops; +if (WARN_ON (!dsi->attached)) +return -EINVAL ; +if (!ops || !ops->detach)return -ENOSYS ; + dsi->attached = false; +return ops->detach (dsi->host, dsi); }EXPORT_SYMBOL (mipi_dsi_detach);
include/drm/drm_mipi_dsi.h +2 -0
@@ -168,6 +168,7 @@ struct mipi_dsi_device_info {* struct mipi_dsi_device - DSI peripheral device * @host: DSI host for this peripheral * @dev: driver model device node for this peripheral +* @attached: the DSI device has been successfully attached * @name: DSI peripheral chip type * @channel: virtual channel assigned to the peripheral * @format: pixel format for video mode
@@ -184,6 +185,7 @@ struct mipi_dsi_device_info {struct mipi_dsi_device {struct mipi_dsi_host *host;struct device dev; +bool attached;char name[DSI_DEV_NAME_SIZE ];unsigned int channel;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 27/88 media: stk1160: Fixed high volume of stk1160_dbg messages
In reply to Sasha LevinFrom: Ghanshyam Agrawal <[email protected]>
[ Upstream commit b3695e86d25aafbe175dd51f6aaf6f68d341d590 ]
The function stk1160_dbg gets called too many times, which causes the output to get flooded with messages. Since stk1160_dbg uses printk, it is now replaced with printk_ratelimited.
--- drivers/media/usb/stk1160/stk1160-video.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/media/usb/stk1160/stk1160-video.c +2 -3
@@ -107,8 +107,7 @@ void stk1160_copy_video(struct stk1160 *dev, u8 *src, int len)/* * TODO: These stk1160_dbg are very spammy! -* We should 1) check why we are getting them -* and 2) add ratelimit. +* We should check why we are getting them. * * UPDATE: One of the reasons (the only one?) for getting these * is incorrect standard (mismatch between expected and configured).
@@ -151,7 +150,7 @@ void stk1160_copy_video(struct stk1160 *dev, u8 *src, int len)/* Let the bug hunt begin! sanity checks! */ if (lencopy <0 ) { -stk1160_dbg ("copy skipped: negative lencopy\n" ); +printk_ratelimited (KERN_DEBUG "copy skipped: negative lencopy\n" );return ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 28/88 media: rockchip: rga: fix swizzling for RGB formats
In reply to Sasha LevinFrom: Michael Tretter <[email protected]>
[ Upstream commit 9e7dc39260edac180c206bb6149595a40eabae3e ]
When using 32 bit RGB formats, the RGA on the rk3568 produces wrong colors as the wrong color channels are read or written. The reason is that the format description for the channel swizzeling is wrong and the wrong bits are configured. For example, when converting ARGB32 to NV12, the alpha channel is used as blue channel.. This doesn't happen if the color format is the same on both sides.
Fix the color_swap settings of the formats to correctly handle 32 bit RGB formats.
For RGA_COLOR_FMT_XBGR8888, the RGA_COLOR_ALPHA_SWAP bit doesn't have an effect. Thus, it isn't possible to handle the V4L2_PIX_FMT_XRGB32. Thus, it is removed from the list of supported formats.
--- drivers/media/platform/rockchip/rga/rga.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-)
drivers/media/platform/rockchip/rga/rga.c +3 -12
@@ -184,25 +184,16 @@ static int rga_setup_ctrls(struct rga_ctx *ctx)static struct rga_fmt formats[] = { { .fourcc =V4L2_PIX_FMT_ARGB32 , - .color_swap =RGA_COLOR_RB_SWAP , + .color_swap =RGA_COLOR_ALPHA_SWAP , .hw_format =RGA_COLOR_FMT_ABGR8888 , .depth =32 , .uv_factor =1 , .y_div =1 , .x_div =1 , }, - { - .fourcc =V4L2_PIX_FMT_XRGB32 , - .color_swap =RGA_COLOR_RB_SWAP , - .hw_format =RGA_COLOR_FMT_XBGR8888 , - .depth =32 , - .uv_factor =1 , - .y_div =1 , - .x_div =1 , - }, { .fourcc =V4L2_PIX_FMT_ABGR32 , - .color_swap =RGA_COLOR_ALPHA_SWAP , + .color_swap =RGA_COLOR_RB_SWAP , .hw_format =RGA_COLOR_FMT_ABGR8888 , .depth =32 , .uv_factor =1 ,
@@ -211,7 +202,7 @@ static struct rga_fmt formats[] = { }, { .fourcc = V4L2_PIX_FMT_XBGR32, - .color_swap = RGA_COLOR_ALPHA_SWAP, + .color_swap = RGA_COLOR_RB_SWAP, .hw_format = RGA_COLOR_FMT_XBGR8888, .depth = 32, .uv_factor = 1,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 29/88 PCI: add INTEL_HDA_ARL to pci_ids.h
In reply to Sasha LevinFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit 5ec42bf04d72fd6d0a6855810cc779e0ee31dfd7 ]
The PCI ID insertion follows the increasing order in the table, but this hardware follows MTL (MeteorLake).
--- include/linux/pci_ids.h | 1 + 1 file changed, 1 insertion(+)
include/linux/pci_ids.h +1 -0
@@ -3065,6 +3065,7 @@#define PCI_DEVICE_ID_INTEL_82443GX_0 0x71a0#define PCI_DEVICE_ID_INTEL_82443GX_2 0x71a2#define PCI_DEVICE_ID_INTEL_82372FB_1 0x7601 +#define PCI_DEVICE_ID_INTEL_HDA_ARL 0x7728#define PCI_DEVICE_ID_INTEL_HDA_RPL_S 0x7a50#define PCI_DEVICE_ID_INTEL_HDA_ADL_S 0x7ad0#define PCI_DEVICE_ID_INTEL_HDA_MTL 0x7e28
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 30/88 ALSA: hda: Intel: add HDA_ARL PCI ID support
In reply to Sasha LevinFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit a31014ebad617868c246d3985ff80d891f03711e ]
Yet another PCI ID.
--- sound/pci/hda/hda_intel.c | 2 ++ 1 file changed, 2 insertions(+)
sound/pci/hda/hda_intel.c +2 -0
@@ -2504,6 +2504,8 @@ static const struct pci_device_id azx_ids[] = { { PCI_DEVICE_DATA(INTEL, HDA_LNL_P, AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE) },/* Arrow Lake-S */ { PCI_DEVICE_DATA(INTEL, HDA_ARL_S, AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE) }, +/* Arrow Lake */ + { PCI_DEVICE_DATA(INTEL, HDA_ARL, AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE) },/* Apollolake (Broxton-P) */ { PCI_DEVICE_DATA(INTEL, HDA_APL, AZX_DRIVER_SKL | AZX_DCAPS_INTEL_BROXTON) },/* Gemini-Lake */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 31/88 ALSA: hda: intel-dspcfg: add filters for ARL-S and ARL
In reply to Sasha LevinFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit 7a9d6bbe8a663c817080be55d9fecf19a4a8fd8f ]
Same usual filters, SOF is required for DMIC and/or SoundWire support.
--- sound/hda/intel-dsp-config.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
sound/hda/intel-dsp-config.c +10 -0
@@ -521,6 +521,16 @@ static const struct config_entry config_table[] = { .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, .device = PCI_DEVICE_ID_INTEL_HDA_MTL, }, + /* ArrowLake-S */ + { + .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, + .device = PCI_DEVICE_ID_INTEL_HDA_ARL_S, + }, + /* ArrowLake */ + { + .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, + .device = PCI_DEVICE_ID_INTEL_HDA_ARL, + }, #endif /* Lunar Lake */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 32/88 drm/msm/dp: Add DisplayPort controller for SM8650
In reply to Sasha LevinFrom: Neil Armstrong <[email protected]>
[ Upstream commit 1b2d98bdd7b7c64265732f5f0dace4c52c9ba8a8 ]
The Qualcomm SM8650 platform comes with a DisplayPort controller with a different base offset than the previous SM8550 SoC, add support for this in the DisplayPort driver.
Patchwork: https://patchwork.freedesktop.org/patch/571132/
--- drivers/gpu/drm/msm/dp/dp_display.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/msm/dp/dp_display.c +6 -0
@@ -170,6 +170,11 @@ static const struct msm_dp_desc sm8350_dp_descs[] = { {} }; +static const struct msm_dp_desc sm8650_dp_descs[] = { + { .io_start =0x0af54000 , .id =MSM_DP_CONTROLLER_0 , .connector_type = DRM_MODE_CONNECTOR_DisplayPort }, + {} +}; +static const struct of_device_id dp_dt_match[] = { { .compatible ="qcom,sc7180-dp" , .data = &sc7180_dp_descs }, { .compatible ="qcom,sc7280-dp" , .data = &sc7280_dp_descs },
@@ -180,6 +185,7 @@ static const struct of_device_id dp_dt_match[] = { { .compatible = "qcom,sc8280xp-edp", .data = &sc8280xp_edp_descs }, { .compatible = "qcom,sdm845-dp", .data = &sc7180_dp_descs }, { .compatible = "qcom,sm8350-dp", .data = &sm8350_dp_descs }, + { .compatible = "qcom,sm8650-dp", .data = &sm8650_dp_descs }, {} };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 33/88 media: uvcvideo: Fix power line control for a Chicony camera
In reply to Sasha LevinFrom: Ricardo Ribalda <[email protected]>
[ Upstream commit dba3e701917a4cce92920f8ccb9fa4d4ee5ac07e ]
The device does not implement the control properly.
Fixes v4l2-compliance error:
info: checking control 'Power Line Frequency' (0x00980918)
fail: v4l2-test-controls.cpp(552): could not set valid menu item 3
--- drivers/media/usb/uvc/uvc_driver.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/media/usb/uvc/uvc_driver.c +9 -0
@@ -2592,6 +2592,15 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, .driver_info = (kernel_ulong_t)&uvc_ctrl_power_line_limited }, +/* Chicony Electronics Co., Ltd Integrated Camera */ + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE + | USB_DEVICE_ID_MATCH_INT_INFO, + .idVendor = 0x04f2, + .idProduct = 0xb67c, + .bInterfaceClass = USB_CLASS_VIDEO, + .bInterfaceSubClass = 1, + .bInterfaceProtocol = UVC_PC_PROTOCOL_15, + .driver_info = (kernel_ulong_t)&uvc_ctrl_power_line_uvc11 },/* Chicony EasyCamera */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 34/88 media: uvcvideo: Fix power line control for SunplusIT camera
In reply to Sasha LevinFrom: Ricardo Ribalda <[email protected]>
[ Upstream commit 6180056b0e0c097dad5d1569dcd661eaf509ea43 ]
The device does not implement the power line frequency control correctly. It is a UVC 1.5 device, but implements the control as a UVC 1.1 device.
Add the corresponding control mapping override.
Bus 003 Device 002: ID 2b7e:b752 SunplusIT Inc HD Camera Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.01
bDeviceClass 239 Miscellaneous Device
bDeviceSubClass 2
bDeviceProtocol 1 Interface Association
bMaxPacketSize0 64
idVendor 0x2b7e
idProduct 0xb752
bcdDevice 0.04
iManufacturer 1 SunplusIT Inc iProduct 2 HD Camera iSerial 3 01.00.00 bNumConfigurations 1
--- drivers/media/usb/uvc/uvc_driver.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/media/usb/uvc/uvc_driver.c +9 -0
@@ -3003,6 +3003,15 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, .driver_info = UVC_INFO_QUIRK(UVC_QUIRK_FORCE_BPP) }, +/* SunplusIT Inc HD Camera */ + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE + | USB_DEVICE_ID_MATCH_INT_INFO, + .idVendor = 0x2b7e, + .idProduct = 0xb752, + .bInterfaceClass = USB_CLASS_VIDEO, + .bInterfaceSubClass = 1, + .bInterfaceProtocol = UVC_PC_PROTOCOL_15, + .driver_info = (kernel_ulong_t)&uvc_ctrl_power_line_uvc11 },/* Lenovo Integrated Camera */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 35/88 media: rkisp1: Drop IRQF_SHARED
In reply to Sasha LevinFrom: Tomi Valkeinen <[email protected]>
[ Upstream commit 85d2a31fe4d9be1555f621ead7a520d8791e0f74 ]
In all known platforms the ISP has dedicated IRQ lines, but for some reason the driver uses IRQF_SHARED.
Supporting IRQF_SHARED properly requires handling interrupts even when our device is disabled, and the driver does not handle this. To avoid adding such code, and to be sure the driver won't accidentally be used in a platform with shared interrupts, let's drop the IRQF_SHARED flag.
--- drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c +1 -1
@@ -542,7 +542,7 @@ static int rkisp1_probe(struct platform_device *pdev)if (irq <0 )return irq; - ret =devm_request_irq (dev, irq, info->isrs[i].isr,IRQF_SHARED , + ret =devm_request_irq (dev, irq, info->isrs[i].isr,0 ,dev_driver_string (dev), dev);if (ret) {dev_err (dev,"request irq failed: %d\n" , ret);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 36/88 media: rkisp1: Fix IRQ handler return values
In reply to Sasha LevinFrom: Tomi Valkeinen <[email protected]>
[ Upstream commit 3eb7910e1b16a2c136be26a8380f21469225b2f6 ]
The IRQ handler rkisp1_isr() calls sub-handlers, all of which returns an irqreturn_t value, but rkisp1_isr() ignores those values and always returns IRQ_HANDLED.
Fix this by collecting the return values, and returning IRQ_HANDLED or IRQ_NONE as appropriate.
--- .../media/platform/rockchip/rkisp1/rkisp1-dev.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c +12 -4
@@ -442,17 +442,25 @@ static int rkisp1_entities_register(struct rkisp1_device *rkisp1)static irqreturn_t rkisp1_isr (int irq,void *ctx) { +irqreturn_t ret =IRQ_NONE ; +/* * Call rkisp1_capture_isr() first to handle the frame that * potentially completed using the current frame_sequence number before * it is potentially incremented by rkisp1_isp_isr() in the vertical * sync. */ -rkisp1_capture_isr (irq, ctx); -rkisp1_isp_isr (irq, ctx); -rkisp1_csi_isr (irq, ctx); -return IRQ_HANDLED ; +if (rkisp1_capture_isr (irq, ctx) ==IRQ_HANDLED ) + ret =IRQ_HANDLED ; + +if (rkisp1_isp_isr (irq, ctx) ==IRQ_HANDLED ) + ret =IRQ_HANDLED ; + +if (rkisp1_csi_isr (irq, ctx) ==IRQ_HANDLED ) + ret =IRQ_HANDLED ; + +return ret; }static const char *const px30_isp_clks[] = {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 37/88 media: rkisp1: Store IRQ lines
In reply to Sasha LevinFrom: Tomi Valkeinen <[email protected]>
[ Upstream commit 0753874617de883c6d4da903142f334f76a75d70 ]
Store the IRQ lines used by the driver for easy access. These are needed in future patches which fix IRQ race issues.
--- .../platform/rockchip/rkisp1/rkisp1-common.h | 11 ++++++++++- .../media/platform/rockchip/rkisp1/rkisp1-dev.c | 17 +++++++++++++---- 2 files changed, 23 insertions(+), 5 deletions(-)
drivers/media/platform/rockchip/rkisp1/rkisp1-common.h +10 -1
@@ -61,6 +61,14 @@ struct dentry; RKISP1_CIF_ISP_EXP_END | \ RKISP1_CIF_ISP_HIST_MEASURE_RDY) +/* IRQ lines */ +enum rkisp1_irq_line { +RKISP1_IRQ_ISP =0 , +RKISP1_IRQ_MI , +RKISP1_IRQ_MIPI , +RKISP1_NUM_IRQS , +}; +/* enum for the resizer pads */ enum rkisp1_rsz_pad {RKISP1_RSZ_PAD_SINK ,
@@ -423,7 +431,6 @@ struct rkisp1_debug {* struct rkisp1_device - ISP platform device * * @base_addr: base register address -* @irq: the irq number * @dev: a pointer to the struct device * @clk_size: number of clocks * @clks: array of clocks
@@ -441,6 +448,7 @@ struct rkisp1_debug {* @stream_lock: serializes {start/stop}_streaming callbacks between the capture devices. * @debug: debug params to be exposed on debugfs * @info: version-specific ISP information +* @irqs: IRQ line numbers */ struct rkisp1_device {void __iomem *base_addr;
@@ -461,6 +469,7 @@ struct rkisp1_device {struct mutex stream_lock;/* serialize {start/stop}_streaming cb between capture devices */ struct rkisp1_debug debug;const struct rkisp1_info *info; +int irqs[RKISP1_NUM_IRQS ]; };/*
drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c +13 -4
@@ -114,6 +114,7 @@struct rkisp1_isr_data {const char *name;irqreturn_t (*isr)(int irq,void *ctx); +u32 line_mask; };/* ----------------------------------------------------------------------------
@@ -471,9 +472,9 @@ static const char * const px30_isp_clks[] = { };static const struct rkisp1_isr_data px30_isp_isrs[] = { - {"isp" , rkisp1_isp_isr }, - {"mi" , rkisp1_capture_isr }, - {"mipi" , rkisp1_csi_isr }, + {"isp" , rkisp1_isp_isr,BIT (RKISP1_IRQ_ISP ) }, + {"mi" , rkisp1_capture_isr,BIT (RKISP1_IRQ_MI ) }, + {"mipi" , rkisp1_csi_isr,BIT (RKISP1_IRQ_MIPI ) }, };static const struct rkisp1_info px30_isp_info = {
@@ -492,7 +493,7 @@ static const char * const rk3399_isp_clks[] = { };static const struct rkisp1_isr_data rk3399_isp_isrs[] = { - {NULL , rkisp1_isr }, + {NULL , rkisp1_isr,BIT (RKISP1_IRQ_ISP ) |BIT (RKISP1_IRQ_MI ) |BIT (RKISP1_IRQ_MIPI ) }, };static const struct rkisp1_info rk3399_isp_info = {
@@ -543,6 +544,9 @@ static int rkisp1_probe(struct platform_device *pdev)if (IS_ERR (rkisp1->base_addr))return PTR_ERR (rkisp1->base_addr); +for (unsigned int il =0 ; il <ARRAY_SIZE (rkisp1->irqs); ++il) + rkisp1->irqs[il] =-1 ; +for (i =0 ; i < info->isr_size; i++) { irq = info->isrs[i].name ? platform_get_irq_byname(pdev, info->isrs[i].name)
@@ -550,6 +554,11 @@ static int rkisp1_probe(struct platform_device *pdev)if (irq <0 )return irq; +for (unsigned int il =0 ; il <ARRAY_SIZE (rkisp1->irqs); ++il) { +if (info->isrs[i].line_mask &BIT (il)) + rkisp1->irqs[il] = irq; + } + ret =devm_request_irq (dev, irq, info->isrs[i].isr,0 ,dev_driver_string (dev), dev);if (ret) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 38/88 media: rkisp1: Fix IRQ disable race issue
In reply to Sasha LevinFrom: Tomi Valkeinen <[email protected]>
[ Upstream commit 870565f063a58576e8a4529f122cac4325c6b395 ]
In rkisp1_isp_stop() and rkisp1_csi_disable() the driver masks the interrupts and then apparently assumes that the interrupt handler won't be running, and proceeds in the stop procedure. This is not the case, as the interrupt handler can already be running, which would lead to the ISP being disabled while the interrupt handler handling a captured frame.
This brings up two issues: 1) the ISP could be powered off while the interrupt handler is still running and accessing registers, leading to board lockup, and 2) the interrupt handler code and the code that disables the streaming might do things that conflict.
It is not clear to me if 2) causes a real issue, but 1) can be seen with a suitable delay (or printk in my case) in the interrupt handler, leading to board lockup.
--- .../platform/rockchip/rkisp1/rkisp1-csi.c | 14 ++++++++++++- .../platform/rockchip/rkisp1/rkisp1-isp.c | 20 ++++++++++++++++--- 2 files changed, 30 insertions(+), 4 deletions(-)
drivers/media/platform/rockchip/rkisp1/rkisp1-csi.c +13 -1
@@ -125,8 +125,20 @@ static void rkisp1_csi_disable(struct rkisp1_csi *csi)struct rkisp1_device *rkisp1 = csi->rkisp1;u32 val; -/* Mask and clear interrupts. */ +/* Mask MIPI interrupts. */ rkisp1_write (rkisp1,RKISP1_CIF_MIPI_IMSC ,0 ); + +/* Flush posted writes */ +rkisp1_read (rkisp1,RKISP1_CIF_MIPI_IMSC ); + +/* +* Wait until the IRQ handler has ended. The IRQ handler may get called +* even after this, but it will return immediately as the MIPI +* interrupts have been masked. +*/ +synchronize_irq (rkisp1->irqs[RKISP1_IRQ_MIPI ]); + +/* Clear MIPI interrupt status */ rkisp1_write (rkisp1,RKISP1_CIF_MIPI_ICR , ~0 ); val =rkisp1_read (rkisp1,RKISP1_CIF_MIPI_CTRL );
drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c +17 -3
@@ -254,11 +254,25 @@ static void rkisp1_isp_stop(struct rkisp1_isp *isp)* ISP(mi) stop in mi frame end -> Stop ISP(mipi) -> * Stop ISP(isp) ->wait for ISP isp off */ -/* stop and clear MI and ISP interrupts */ -rkisp1_write (rkisp1,RKISP1_CIF_ISP_IMSC ,0 ); -rkisp1_write (rkisp1,RKISP1_CIF_ISP_ICR , ~0 ); +/* Mask MI and ISP interrupts */ +rkisp1_write (rkisp1,RKISP1_CIF_ISP_IMSC ,0 );rkisp1_write (rkisp1,RKISP1_CIF_MI_IMSC ,0 ); + +/* Flush posted writes */ +rkisp1_read (rkisp1,RKISP1_CIF_MI_IMSC ); + +/* +* Wait until the IRQ handler has ended. The IRQ handler may get called +* even after this, but it will return immediately as the MI and ISP +* interrupts have been masked. +*/ +synchronize_irq (rkisp1->irqs[RKISP1_IRQ_ISP ]); +if (rkisp1->irqs[RKISP1_IRQ_ISP ] != rkisp1->irqs[RKISP1_IRQ_MI ]) +synchronize_irq (rkisp1->irqs[RKISP1_IRQ_MI ]); + +/* Clear MI and ISP interrupt status */ +rkisp1_write (rkisp1,RKISP1_CIF_ISP_ICR , ~0 );rkisp1_write (rkisp1,RKISP1_CIF_MI_ICR , ~0 );/* stop ISP */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 39/88 media: rkisp1: resizer: Stop manual allocation of v4l2_subdev_state
In reply to Sasha LevinFrom: Laurent Pinchart <[email protected]>
[ Upstream commit efa28efd9cba015f8c3d88123527c3c3cfcd13d0 ]
Supported media bus codes on the resizer sink pad are identical to the ISP source pad. The .enum_mbus_code() handler thus delegates the enumeration to the ISP's operation. This is problematic for two reasons:
- Format enumeration on the ISP source pad is dependent on the format configured on the ISP sink pad for the same subdev state (TRY or ACTIVE), while format enumeration on the resizer sink pad should return all formats supported by the resizer subdev, regardless of the ISP configuration.
- Delegating the operation involves creating a fake v4l2_subdev_state on the stack to pass to the ISP .enum_mbus_code() handler. This gets in the way of evolution of both the ISP enumeration handler and, more generally, the V4L2 subdev state infrastructure.
Fix those two issues by implementing format enumeration manually for the resizer.
--- .../platform/rockchip/rkisp1/rkisp1-resizer.c | 38 ++++++++++++------- 1 file changed, 24 insertions(+), 14 deletions(-)
drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c +24 -14
@@ -335,12 +335,8 @@ static int rkisp1_rsz_enum_mbus_code(struct v4l2_subdev *sd, {struct rkisp1_resizer *rsz = container_of(sd, struct rkisp1_resizer, sd); -struct v4l2_subdev_pad_config dummy_cfg; -struct v4l2_subdev_state pad_state = { - .pads = &dummy_cfg - }; -u32 pad = code->pad; -int ret; +unsigned int index = code->index; +unsigned int i;if (code->pad ==RKISP1_RSZ_PAD_SRC ) {/* supported mbus codes on the src are the same as in the capture */
@@ -360,15 +356,29 @@ static int rkisp1_rsz_enum_mbus_code(struct v4l2_subdev *sd,return 0 ; } -/* supported mbus codes on the sink pad are the same as isp src pad */ - code->pad =RKISP1_ISP_PAD_SOURCE_VIDEO ; - ret =v4l2_subdev_call (&rsz->rkisp1->isp.sd, pad, enum_mbus_code, - &pad_state, code); +/* +* Supported mbus codes on the sink pad are the same as on the ISP +* source pad. +*/ +for (i =0 ; ; i++) { +const struct rkisp1_mbus_info *fmt = +rkisp1_mbus_info_get_by_index (i); -/* restore pad */ - code->pad = pad; - code->flags =0 ; -return ret; +if (!fmt) +break ; + +if (!(fmt->direction &RKISP1_ISP_SD_SRC )) +continue ; + +if (!index) { + code->code = fmt->mbus_code; +return 0 ; + } + + index--; + } + +return -EINVAL ; } static int rkisp1_rsz_init_config(struct v4l2_subdev *sd,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 40/88 hwmon: (nct6775) Fix fan speed set failure in automatic mode
In reply to Sasha LevinFrom: Xing Tong Wu <[email protected]>
[ Upstream commit 8b3800256abad20e91c2698607f9b28591407b19 ]
Setting the fan speed is only valid in manual mode; it is not possible to set the fan's speed in automatic mode.
Return error when attempting to set the fan speed in automatic mode.
--- drivers/hwmon/nct6775-core.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/hwmon/nct6775-core.c +7 -0
@@ -2553,6 +2553,13 @@ store_pwm(struct device *dev, struct device_attribute *attr, const char *buf,int err;u16 reg; +/* +* The fan control mode should be set to manual if the user wants to adjust +* the fan speed. Otherwise, it will fail to set. +*/ +if (index ==0 && data->pwm_enable[nr] > manual) +return -EBUSY ; + err =kstrtoul (buf,10 , &val);if (err <0 )return err;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 41/88 hwmon: (pc87360) Bounds check data->innr usage
In reply to Sasha LevinFrom: Kees Cook <[email protected]>
[ Upstream commit 4265eb062a7303e537ab3792ade31f424c3c5189 ]
Without visibility into the initializers for data->innr, GCC suspects using it as an index could walk off the end of the various 14-element arrays in data. Perform an explicit clamp to the array size. Silences the following warning with GCC 12+:
../drivers/hwmon/pc87360.c: In function 'pc87360_update_device':../drivers/hwmon/pc87360.c:341:49: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
341 | data->in_max[i] = pc87360_read_value(data,
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
342 | LD_IN, i,
| ~~~~~~~~~
343 | PC87365_REG_IN_MAX);
| ~~~~~~~~~~~~~~~~~~~
../drivers/hwmon/pc87360.c:209:12: note: at offset 255 into destination object 'in_max' of size 14
209 | u8 in_max[14]; /* Register value */
| ^~~~~~--- drivers/hwmon/pc87360.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/hwmon/pc87360.c +5 -1
@@ -323,7 +323,11 @@ static struct pc87360_data *pc87360_update_device(struct device *dev) }/* Voltages */ -for (i =0 ; i < data->innr; i++) { +/* +* The min() below does not have any practical meaning and is +* only needed to silence a warning observed with gcc 12+. +*/ +for (i =0 ; i <min (data->innr,ARRAY_SIZE (data->in)); i++) { data->in_status[i] =pc87360_read_value (data,LD_IN , i,PC87365_REG_IN_STATUS );/* Clear bits */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 42/88 hwmon: (hp-wmi-sensors) Fix failure to load on EliteDesk 800 G6
In reply to Sasha LevinFrom: James Seo <[email protected]>
[ Upstream commit c9ba592580947b81f33f514320aeef02ddc001fd ]
The EliteDesk 800 G6 stores a raw WMI string within the ACPI object in its BIOS corresponding to one instance of HPBIOS_PlatformEvents.Name. This is evidently a valid way of representing a WMI data item as far as the Microsoft ACPI-WMI mapper is concerned, but is preventing the driver from loading.
This seems quite rare, but add support for such strings. Treating this as a quirk pretty much means adding that support anyway.
Also clean up an oversight in update_numeric_sensor_from_wobj() in which the result of hp_wmi_strdup() was being used without error checking.
--- drivers/hwmon/hp-wmi-sensors.c | 127 ++++++++++++++++++++++++++++----- 1 file changed, 111 insertions(+), 16 deletions(-)
drivers/hwmon/hp-wmi-sensors.c +111 -16
@@ -17,6 +17,8 @@* Available: https://github.com/linuxhw/ACPI * [4] P. Rohár, "bmfdec - Decompile binary MOF file (BMF) from WMI buffer", * 2017. [Online]. Available: https://github.com/pali/bmfdec +* [5] Microsoft Corporation, "Driver-Defined WMI Data Items", 2017. [Online]. +* Available: https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/driver-defined-wmi-data-items */ #include <linux/acpi.h>
@@ -24,6 +26,7 @@#include <linux/hwmon.h> #include <linux/jiffies.h> #include <linux/mutex.h> +#include <linux/nls.h> #include <linux/units.h> #include <linux/wmi.h>
@@ -395,6 +398,50 @@ struct hp_wmi_sensors {struct mutex lock;/* Lock polling WMI and driver state changes. */ }; +static bool is_raw_wmi_string (const u8 *pointer,u32 length) +{ +const u16 *ptr; +u16 len; + +/* WMI strings are length-prefixed UTF-16 [5]. */ +if (length <=sizeof (*ptr)) +return false; + + length -=sizeof (*ptr); + ptr = (const u16 *)pointer; + len = *ptr; + +return len <= length && !(len &1 ); +} + +static char *convert_raw_wmi_string (const u8 *buf) +{ +const wchar_t *src; +unsigned int cps; +unsigned int len; +char *dst; +int i; + + src = (const wchar_t *)buf; + +/* Count UTF-16 code points. Exclude trailing null padding. */ + cps = *src /sizeof (*src); +while (cps && !src[cps]) + cps--; + +/* Each code point becomes up to 3 UTF-8 characters. */ + len =min (cps *3 ,HP_WMI_MAX_STR_SIZE -1 ); + + dst =kmalloc ((len +1 ) *sizeof (*dst),GFP_KERNEL ); +if (!dst) +return NULL ; + + i =utf16s_to_utf8s (++src, cps,UTF16_LITTLE_ENDIAN , dst, len); + dst[i] ='\0' ; + +return dst; +} +/* hp_wmi_strdup - devm_kstrdup, but length-limited */ static char *hp_wmi_strdup (struct device *dev,const char *src) {
@@ -412,6 +459,23 @@ static char *hp_wmi_strdup(struct device *dev, const char *src)return dst; } +/* hp_wmi_wstrdup - hp_wmi_strdup, but for a raw WMI string */ +static char *hp_wmi_wstrdup (struct device *dev,const u8 *buf) +{ +char *src; +char *dst; + + src =convert_raw_wmi_string (buf); +if (!src) +return NULL ; + + dst =hp_wmi_strdup (dev,strim (src));/* Note: Copy is trimmed. */ + +kfree (src); + +return dst; +} +/* * hp_wmi_get_wobj - poll WMI for a WMI object instance * @guid: WMI object GUID
@@ -462,8 +526,14 @@ static int check_wobj(const union acpi_object *wobj,for (prop =0 ; prop <= last_prop; prop++) { type = elements[prop].type; valid_type = property_map[prop]; -if (type != valid_type) +if (type != valid_type) { +if (type ==ACPI_TYPE_BUFFER && + valid_type ==ACPI_TYPE_STRING && +is_raw_wmi_string (elements[prop].buffer.pointer, + elements[prop].buffer.length)) +continue ;return -EINVAL ; + } }return 0 ;
@@ -480,7 +550,9 @@ static int extract_acpi_value(struct device *dev,break ;case ACPI_TYPE_STRING : - *out_string =hp_wmi_strdup (dev,strim (element->string.pointer)); + *out_string = element->type ==ACPI_TYPE_BUFFER ? +hp_wmi_wstrdup (dev, element->buffer.pointer) : +hp_wmi_strdup (dev,strim (element->string.pointer));if (!*out_string)return -ENOMEM ;break ;
@@ -861,7 +933,9 @@ update_numeric_sensor_from_wobj(struct device *dev, {const union acpi_object *elements;const union acpi_object *element; -const char *string; +const char *new_string; +char *trimmed; +char *string;bool is_new;int offset;u8 size;
@@ -885,11 +959,21 @@ update_numeric_sensor_from_wobj(struct device *dev, offset = is_new ? size -1 :-2 ; element = &elements[HP_WMI_PROPERTY_CURRENT_STATE + offset]; - string =strim (element->string.pointer); - -if (strcmp (string, nsensor->current_state)) { -devm_kfree (dev, nsensor->current_state); - nsensor->current_state =hp_wmi_strdup (dev, string); + string = element->type ==ACPI_TYPE_BUFFER ? +convert_raw_wmi_string (element->buffer.pointer) : + element->string.pointer; + +if (string) { + trimmed =strim (string); +if (strcmp (trimmed, nsensor->current_state)) { + new_string =hp_wmi_strdup (dev, trimmed); +if (new_string) { +devm_kfree (dev, nsensor->current_state); + nsensor->current_state = new_string; + } + } +if (element->type ==ACPI_TYPE_BUFFER ) +kfree (string); }/* Old variant: -2 (not -1) because it lacks the Size property. */
@@ -996,11 +1080,15 @@ static int check_event_wobj(const union acpi_object *wobj) HP_WMI_EVENT_PROPERTY_STATUS); } -static int populate_event_from_wobj (struct hp_wmi_event *event, +static int populate_event_from_wobj (struct device *dev, +struct hp_wmi_event *event,union acpi_object *wobj) {int prop =HP_WMI_EVENT_PROPERTY_NAME ;union acpi_object *element; +acpi_object_type type; +char *string; +u32 value;int err; err =check_event_wobj (wobj);
@@ -1009,20 +1097,24 @@ static int populate_event_from_wobj(struct hp_wmi_event *event, element = wobj->package.elements; -/* Extracted strings are NOT device-managed copies. */ -for (; prop <=HP_WMI_EVENT_PROPERTY_CATEGORY ; prop++, element++) { + type = hp_wmi_event_property_map[prop]; + + err =extract_acpi_value (dev, element, type, &value, &string); +if (err) +return err; +switch (prop) {case HP_WMI_EVENT_PROPERTY_NAME : - event->name =strim (element->string.pointer); + event->name = string;break ;case HP_WMI_EVENT_PROPERTY_DESCRIPTION : - event->description =strim (element->string.pointer); + event->description = string;break ;case HP_WMI_EVENT_PROPERTY_CATEGORY : - event->category = element->integer.value; + event->category = value;break ;default :
@@ -1511,8 +1603,8 @@ static void hp_wmi_notify(u32 value, void *context)struct acpi_buffer out = {ACPI_ALLOCATE_BUFFER ,NULL };struct hp_wmi_sensors *state = context;struct device *dev = &state->wdev->dev; +struct hp_wmi_event event = {};struct hp_wmi_info *fan_info; -struct hp_wmi_event event;union acpi_object *wobj;acpi_status err;int event_type;
@@ -1546,7 +1638,7 @@ static void hp_wmi_notify(u32 value, void *context) wobj = out.pointer; - err =populate_event_from_wobj (&event, wobj); + err =populate_event_from_wobj (dev, &event, wobj);if (err) {dev_warn (dev,"Bad event data (ACPI type %d)\n" , wobj->type); goto out_free_wobj;
@@ -1577,6 +1669,9 @@ static void hp_wmi_notify(u32 value, void *context) out_free_wobj:kfree (wobj); +devm_kfree (dev, event.name); +devm_kfree (dev, event.description); + out_unlock:mutex_unlock (&state->lock); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 43/88 f2fs: fix to tag gcing flag on page during block migration
In reply to Sasha LevinFrom: Chao Yu <[email protected]>
[ Upstream commit 4961acdd65c956e97c1a000c82d91a8c1cdbe44b ]
It needs to add missing gcing flag on page during block migration, in order to garantee migrated data be persisted during checkpoint, otherwise out-of-order persistency between data and node may cause data corruption after SPOR.
Similar issue was fixed by commit 2d1fe8a86bf5 ("f2fs: fix to tag gcing flag on page during file defragment").
--- fs/f2fs/compress.c | 4 +++- fs/f2fs/file.c | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-)
fs/f2fs/compress.c +3 -1
@@ -1036,8 +1036,10 @@ static void set_cluster_dirty(struct compress_ctx *cc)int i;for (i =0 ; i < cc->cluster_size; i++) -if (cc->rpages[i]) +if (cc->rpages[i]) {set_page_dirty (cc->rpages[i]); +set_page_private_gcing (cc->rpages[i]); + } } static int prepare_compress_overwrite(struct compress_ctx *cc,
fs/f2fs/file.c +2 -0
@@ -1317,6 +1317,7 @@ static int __clone_blkaddrs(struct inode *src_inode, struct inode *dst_inode, }memcpy_page (pdst,0 , psrc,0 ,PAGE_SIZE );set_page_dirty (pdst); +set_page_private_gcing (pdst);f2fs_put_page (pdst,1 );f2fs_put_page (psrc,1 );
@@ -4054,6 +4055,7 @@ static int redirty_blocks(struct inode *inode, pgoff_t page_idx, int len)f2fs_bug_on (F2FS_I_SB (inode), !page);set_page_dirty (page); +set_page_private_gcing (page);f2fs_put_page (page,1 );f2fs_put_page (page,0 ); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 44/88 drm/exynos: Call drm_atomic_helper_shutdown() at shutdown/unbind time
In reply to Sasha LevinFrom: Douglas Anderson <[email protected]>
[ Upstream commit 16ac5b21b31b439f03cdf44c153c5f5af94fb3eb ]
Based on grepping through the source code this driver appears to be missing a call to drm_atomic_helper_shutdown() at system shutdown time and at driver unbind time. Among other things, this means that if a panel is in use that it won't be cleanly powered off at system shutdown time.
The fact that we should call drm_atomic_helper_shutdown() in the case of OS shutdown/restart and at driver remove (or unbind) time comes straight out of the kernel doc "driver instance overview" in drm_drv.c.
A few notes about this fix:
- When adding drm_atomic_helper_shutdown() to the unbind path, I added it after drm_kms_helper_poll_fini() since that's when other drivers seemed to have it.
- Technically with a previous patch, ("drm/atomic-helper:
drm_atomic_helper_shutdown(NULL) should be a noop"), we don't actually need to check to see if our "drm" pointer is NULL before calling drm_atomic_helper_shutdown(). We'll leave the "if" test in, though, so that this patch can land without any dependencies. It could potentially be removed later.
- This patch also makes sure to set the drvdata to NULL in the case of bind errors to make sure that shutdown can't access freed data.
--- drivers/gpu/drm/exynos/exynos_drm_drv.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/gpu/drm/exynos/exynos_drm_drv.c +11 -0
@@ -300,6 +300,7 @@ static int exynos_drm_bind(struct device *dev)drm_mode_config_cleanup (drm);exynos_drm_cleanup_dma (drm);kfree (private); +dev_set_drvdata (dev,NULL ); err_free_drm:drm_dev_put (drm);
@@ -313,6 +314,7 @@ static void exynos_drm_unbind(struct device *dev)drm_dev_unregister (drm);drm_kms_helper_poll_fini (drm); +drm_atomic_helper_shutdown (drm);component_unbind_all (drm->dev, drm);drm_mode_config_cleanup (drm);
@@ -350,9 +352,18 @@ static int exynos_drm_platform_remove(struct platform_device *pdev)return 0 ; } +static void exynos_drm_platform_shutdown (struct platform_device *pdev) +{ +struct drm_device *drm =platform_get_drvdata (pdev); + +if (drm) +drm_atomic_helper_shutdown (drm); +} +static struct platform_driver exynos_drm_platform_driver = { .probe = exynos_drm_platform_probe, .remove = exynos_drm_platform_remove, + .shutdown = exynos_drm_platform_shutdown, .driver = { .name ="exynos-drm" , .pm = &exynos_drm_pm_ops,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 45/88 IB/ipoib: Fix mcast list locking
In reply to Sasha LevinFrom: Daniel Vacek <[email protected]>
[ Upstream commit 4f973e211b3b1c6d36f7c6a19239d258856749f9 ]
Releasing the priv->lock while iterating the priv->multicast_list in ipoib_mcast_join_task() opens a window for ipoib_mcast_dev_flush() to remove the items while in the middle of iteration. If the mcast is removed while the lock was dropped, the for loop spins forever resulting in a hard lockup (as was reported on RHEL 4.18.0-372.75.1.el8_6 kernel):
Task A (kworker/u72:2 below) | Task B (kworker/u72:0 below)
-----------------------------------+-----------------------------------
ipoib_mcast_join_task(work) | ipoib_ib_dev_flush_light(work)
spin_lock_irq(&priv->lock) | __ipoib_ib_dev_flush(priv, ...)
list_for_each_entry(mcast, | ipoib_mcast_dev_flush(dev = priv->dev)
&priv->multicast_list, list) |
ipoib_mcast_join(dev, mcast) |
spin_unlock_irq(&priv->lock) |
| spin_lock_irqsave(&priv->lock, flags)
| list_for_each_entry_safe(mcast, tmcast,
| &priv->multicast_list, list)
| list_del(&mcast->list);
| list_add_tail(&mcast->list, &remove_list)
| spin_unlock_irqrestore(&priv->lock, flags)
spin_lock_irq(&priv->lock) |
| ipoib_mcast_remove_list(&remove_list)
(Here, `mcast` is no longer on the | list_for_each_entry_safe(mcast, tmcast,
`priv->multicast_list` and we keep | remove_list, list)
spinning on the `remove_list` of | >>> wait_for_completion(&mcast->done)
the other thread which is blocked |
and the list is still valid on |it's stack.)
Fix this by keeping the lock held and changing to GFP_ATOMIC to prevent eventual sleeps.
Unfortunately we could not reproduce the lockup and confirm this fix but based on the code review I think this fix should address such lockups.
crash> bc 31
PID: 747 TASK: ff1c6a1a007e8000 CPU: 31 COMMAND: "kworker/u72:2"
--
[exception RIP: ipoib_mcast_join_task+0x1b1]
RIP: ffffffffc0944ac1 RSP: ff646f199a8c7e00 RFLAGS: 00000002
RAX: 0000000000000000 RBX: ff1c6a1a04dc82f8 RCX: 0000000000000000
work (&priv->mcast_task{,.work})
RDX: ff1c6a192d60ac68 RSI: 0000000000000286 RDI: ff1c6a1a04dc8000
&mcast->list
RBP: ff646f199a8c7e90 R8: ff1c699980019420 R9: ff1c6a1920c9a000
R10: ff646f199a8c7e00 R11: ff1c6a191a7d9800 R12: ff1c6a192d60ac00
mcast
R13: ff1c6a1d82200000 R14: ff1c6a1a04dc8000 R15: ff1c6a1a04dc82d8
dev priv (&priv->lock) &priv->multicast_list (aka head)
ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018--- <NMI exception stack> ---
#5 [ff646f199a8c7e00] ipoib_mcast_join_task+0x1b1 at ffffffffc0944ac1 [ib_ipoib] #6 [ff646f199a8c7e98] process_one_work+0x1a7 at ffffffff9bf10967
crash> rx ff646f199a8c7e68ff646f199a8c7e68: ff1c6a1a04dc82f8 <<< work = &priv->mcast_task.work
crash> list -hO ipoib_dev_priv.multicast_list ff1c6a1a04dc8000 (empty)
crash> ipoib_dev_priv.mcast_task.work.func,mcast_mutex.owner.counter ff1c6a1a04dc8000
mcast_task.work.func = 0xffffffffc0944910 <ipoib_mcast_join_task>, mcast_mutex.owner.counter = 0xff1c69998efec000
crash> b 8
PID: 8 TASK: ff1c69998efec000 CPU: 33 COMMAND: "kworker/u72:0"
--
#3 [ff646f1980153d50] wait_for_completion+0x96 at ffffffff9c7d7646 #4 [ff646f1980153d90] ipoib_mcast_remove_list+0x56 at ffffffffc0944dc6 [ib_ipoib] #5 [ff646f1980153de8] ipoib_mcast_dev_flush+0x1a7 at ffffffffc09455a7 [ib_ipoib] #6 [ff646f1980153e58] __ipoib_ib_dev_flush+0x1a4 at ffffffffc09431a4 [ib_ipoib] #7 [ff646f1980153e98] process_one_work+0x1a7 at ffffffff9bf10967
crash> rx ff646f1980153e68ff646f1980153e68: ff1c6a1a04dc83f0 <<< work = &priv->flush_light
crash> ipoib_dev_priv.flush_light.func,broadcast ff1c6a1a04dc8000
flush_light.func = 0xffffffffc0943820 <ipoib_ib_dev_flush_light>, broadcast = 0x0,
The mcast(s) on the remove_list (the remaining part of the ex priv->multicast_list):
crash> list -s ipoib_mcast.done.done ipoib_mcast.list -H ff646f1980153e10 | paste - -ff1c6a192bd0c200 done.done = 0x0,ff1c6a192d60ac00 done.done = 0x0,
--- drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/infiniband/ulp/ipoib/ipoib_multicast.c +1 -5
@@ -531,21 +531,17 @@ static int ipoib_mcast_join(struct net_device *dev, struct ipoib_mcast *mcast)if (test_bit (IPOIB_MCAST_FLAG_SENDONLY , &mcast->flags)) rec.join_state =SENDONLY_FULLMEMBER_JOIN ; } -spin_unlock_irq (&priv->lock); multicast =ib_sa_join_multicast (&ipoib_sa_client, priv->ca, priv->port, - &rec, comp_mask,GFP_KERNEL , + &rec, comp_mask,GFP_ATOMIC , ipoib_mcast_join_complete, mcast); -spin_lock_irq (&priv->lock);if (IS_ERR (multicast)) { ret =PTR_ERR (multicast);ipoib_warn (priv,"ib_sa_join_multicast failed, status %d\n" , ret);/* Requeue this join task with a backoff delay */ __ipoib_mcast_schedule_join_thread (priv, mcast,1 );clear_bit (IPOIB_MCAST_FLAG_BUSY , &mcast->flags); -spin_unlock_irq (&priv->lock);complete (&mcast->done); -spin_lock_irq (&priv->lock);return ret; }return 0 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 46/88 media: amphion: remove mutext lock in condition of wait_event
In reply to Sasha LevinFrom: Ming Qian <[email protected]>
[ Upstream commit f9c8ddce2fe3b767582f299d03fc8fb85943568c ]
mutext_lock should not be called in condition of wait_event, otherwise, when CONFIG_DEBUG_ATOMIC_SLEEP is enabled, we may meet the following warning:
do not call blocking ops when !TASK_RUNNING; state=2
WARNING: CPU: 5 PID: 741 at kernel/sched/core.c:9859 __might_sleep+0x80/0xa4 Hardware name: Freescale i.MX8QM MEK (DT) pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : __might_sleep+0x80/0xa4 lr : __might_sleep+0x80/0xa4 sp : ffffffc0123738a0 x29: ffffffc0123738a0 x28: ffffffc009194c48 x27: ffffffc00bbc1050 x26: ffffff8814b282f0 x25: ffffff8814b280d0 x24: ffffff8814b28080 x23: 0000000000000001 x22: 0000000000000032 x21: ffffffc00bbc1000 x20: 000000000000011b x19: ffffffc009324670 x18: 00000000fffffffd x17: 30303c5b20746120 x16: 74657320323d6574 x15: 617473203b474e49 x14: 00058b5b8b9aa1f1 x13: ffffffc00903cda0 x12: 00000000d744fcc9 x11: 000000000000001c x10: 00000000000009a0 x9 : ffffffc0090201f4 x8 : ffffff8828245000 x7 : 0000000000000001 x6 : 0000000000000001 x5 : 00000000410fd080 x4 : 0000000000000002 x3 : ffffff8815aab4c8 x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffffff8828244600 Call trace: __might_sleep+0x80/0xa4 mutex_lock+0x2c/0x80 sync_session_response+0x110/0x310 vpu_session_send_cmd+0x18c/0x244 vpu_session_start+0x38/0x70 vdec_start_session+0x1b4/0x3e0 vpu_vb2_start_streaming+0xa0/0x1c4 vb2_start_streaming+0x74/0x160 vb2_core_qbuf+0x488/0x650 vb2_qbuf+0x9c/0x100 v4l2_m2m_qbuf+0x7c/0x224 v4l2_m2m_ioctl_qbuf+0x20/0x2c v4l_qbuf+0x50/0x6c __video_do_ioctl+0x174/0x3f0 video_usercopy+0x210/0x7cc video_ioctl2+0x20/0x30 v4l2_ioctl+0x48/0x6c
we need to refine check_is_responsed() to remove the mutext_lock, each cmd has a monotonically increasing id, and cmds are executed sequentially, so we can check the id of the last reponsed cmd, then determine whether a command has been responded or not.
--- drivers/media/platform/amphion/vpu.h | 3 ++- drivers/media/platform/amphion/vpu_cmds.c | 28 ++++++++--------------- drivers/media/platform/amphion/vpu_v4l2.c | 1 + 3 files changed, 12 insertions(+), 20 deletions(-)
drivers/media/platform/amphion/vpu.h +2 -1
@@ -154,7 +154,6 @@ struct vpu_core {struct vpu_mbox tx_type;struct vpu_mbox tx_data;struct vpu_mbox rx; -unsigned long cmd_seq;wait_queue_head_t ack_wq;struct completion cmp;
@@ -253,6 +252,8 @@ struct vpu_inst {struct list_head cmd_q;void *pending; +unsigned long cmd_seq; +atomic_long_t last_response_cmd;struct vpu_inst_ops *ops;const struct vpu_format *formats;
drivers/media/platform/amphion/vpu_cmds.c +9 -19
@@ -32,6 +32,7 @@ struct vpu_cmd_t {struct vpu_cmd_request *request;struct vpu_rpc_event *pkt;unsigned long key; +atomic_long_t *last_response_cmd; };static struct vpu_cmd_request vpu_cmd_requests[] = {
@@ -115,6 +116,8 @@ static void vpu_free_cmd(struct vpu_cmd_t *cmd) {if (!cmd)return ; +if (cmd->last_response_cmd) +atomic_long_set (cmd->last_response_cmd, cmd->key);vfree (cmd->pkt);vfree (cmd); }
@@ -172,7 +175,8 @@ static int vpu_request_cmd(struct vpu_inst *inst, u32 id, void *data,return -ENOMEM ;mutex_lock (&core->cmd_lock); - cmd->key = core->cmd_seq++; + cmd->key = ++inst->cmd_seq; + cmd->last_response_cmd = &inst->last_response_cmd;if (key) *key = cmd->key;if (sync)
@@ -246,26 +250,12 @@ void vpu_clear_request(struct vpu_inst *inst)static bool check_is_responsed (struct vpu_inst *inst,unsigned long key) { -struct vpu_core *core = inst->core; -struct vpu_cmd_t *cmd; -bool flag = true; +unsigned long last_response =atomic_long_read (&inst->last_response_cmd); -mutex_lock (&core->cmd_lock); - cmd = inst->pending; -if (cmd && key == cmd->key) { - flag = false; - goto exit; - } -list_for_each_entry (cmd, &inst->cmd_q, list) { -if (key == cmd->key) { - flag = false; -break ; - } - } -exit: -mutex_unlock (&core->cmd_lock); +if (key <= last_response && (last_response - key) < (ULONG_MAX >>1 )) +return true; -return flag; +return false; }static int sync_session_response (struct vpu_inst *inst,unsigned long key,long timeout,int try)
drivers/media/platform/amphion/vpu_v4l2.c +1 -0
@@ -716,6 +716,7 @@ int vpu_v4l2_open(struct file *file, struct vpu_inst *inst) func = &vpu->decoder;atomic_set (&inst->ref_count,0 ); +atomic_long_set (&inst->last_response_cmd,0 );vpu_inst_get (inst); inst->vpu = vpu; inst->core =vpu_request_core (vpu, inst->type);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 47/88 media: ddbridge: fix an error code problem in ddb_probe
In reply to Sasha LevinFrom: Su Hui <[email protected]>
[ Upstream commit 09b4195021be69af1e1936cca995712a6d0f2562 ]
Error code is assigned to 'stat', return 'stat' rather than '-1'.
--- drivers/media/pci/ddbridge/ddbridge-main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/pci/ddbridge/ddbridge-main.c +1 -1
@@ -238,7 +238,7 @@ static int ddb_probe(struct pci_dev *pdev,ddb_unmap (dev);pci_set_drvdata (pdev,NULL );pci_disable_device (pdev); -return -1 ; +return stat; }/****************************************************************************/
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 48/88 media: ov2740: Fix hts value
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit 3735228bbe3511f844e03dfcc4003fadb59dde23 ]
HTS must be more then width, so the 1080 value clearly is wrong, this is then corrected with some weird math dividing clocks in to_pixels_per_line() which results in the hts getting multiplied by 2, resulting in 2160.
Instead just directly set hts to the correct value of 2160 and drop to_pixels_per_line().
--- drivers/media/i2c/ov2740.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-)
drivers/media/i2c/ov2740.c +3 -14
@@ -310,7 +310,7 @@ static const struct ov2740_mode supported_modes[] = { { .width = 1932, .height = 1092, - .hts = 1080, + .hts = 2160, .vts_def = OV2740_VTS_DEF, .vts_min = OV2740_VTS_MIN, .reg_list = {
@@ -357,15 +357,6 @@ static u64 to_pixel_rate(u32 f_index)return pixel_rate; } -static u64 to_pixels_per_line (u32 hts,u32 f_index) -{ -u64 ppl = hts *to_pixel_rate (f_index); - -do_div (ppl,OV2740_SCLK ); - -return ppl; -} -static int ov2740_read_reg (struct ov2740 *ov2740,u16 reg,u16 len,u32 *val) {struct i2c_client *client =v4l2_get_subdevdata (&ov2740->sd);
@@ -598,8 +589,7 @@ static int ov2740_init_controls(struct ov2740 *ov2740)V4L2_CID_VBLANK , vblank_min, vblank_max, 1, vblank_default); - h_blank =to_pixels_per_line (cur_mode->hts, cur_mode->link_freq_index); - h_blank -= cur_mode->width; + h_blank = cur_mode->hts - cur_mode->width; ov2740->hblank =v4l2_ctrl_new_std (ctrl_hdlr, &ov2740_ctrl_ops,V4L2_CID_HBLANK , h_blank, h_blank,1 , h_blank);
@@ -842,8 +832,7 @@ static int ov2740_set_format(struct v4l2_subdev *sd, mode->vts_min - mode->height, OV2740_VTS_MAX - mode->height, 1, vblank_def);__v4l2_ctrl_s_ctrl (ov2740->vblank, vblank_def); - h_blank =to_pixels_per_line (mode->hts, mode->link_freq_index) - - mode->width; + h_blank = mode->hts - mode->width;__v4l2_ctrl_modify_range (ov2740->hblank, h_blank, h_blank,1 , h_blank);return 0 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 49/88 media: i2c: imx335: Fix hblank min/max values
In reply to Sasha LevinFrom: Kieran Bingham <[email protected]>
[ Upstream commit d7b95ad7a8d56248dfc34f861e445fad7a4004f4 ]
The V4L2_CID_HBLANK control is marked as readonly and can only be a single value.
Set the minimum and maximum value to match the mode value.
--- drivers/media/i2c/imx335.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/i2c/imx335.c +2 -2
@@ -962,8 +962,8 @@ static int imx335_init_controls(struct imx335 *imx335) imx335->hblank_ctrl =v4l2_ctrl_new_std (ctrl_hdlr, &imx335_ctrl_ops,V4L2_CID_HBLANK , -IMX335_REG_MIN , -IMX335_REG_MAX , + mode->hblank, + mode->hblank,1 , mode->hblank);if (imx335->hblank_ctrl) imx335->hblank_ctrl->flags |=V4L2_CTRL_FLAG_READ_ONLY ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 50/88 drm/amd/display: For prefetch mode > 0, extend prefetch if possible
In reply to Sasha LevinFrom: Alvin Lee <[email protected]>
[ Upstream commit dd4e4bb28843393065eed279e869fac248d03f0f ]
[Description]
For mode programming we want to extend the prefetch as much as possible (up to oto, or as long as we can for equ) if we're not already applying the 60us prefetch requirement. This is to avoid intermittent underflow issues during prefetch.
The prefetch extension is applied under the following scenarios:
1. We're in prefetch mode 1 (i.e. we don't support MCLK switch in blank)
2. We're using subvp or drr methods of p-state switch, in which case we we don't care if prefetch takes up more of the blanking time
Mode programming typically chooses the smallest prefetch time possible (i.e. highest bandwidth during prefetch) presumably to create margin between p-states / c-states that happen in vblank and prefetch. Therefore we only apply this prefetch extension when p-state in vblank is not required (UCLK p-states take up the most vblank time).
--- .../dc/dml/dcn32/display_mode_vba_32.c | 3 ++ .../dc/dml/dcn32/display_mode_vba_util_32.c | 33 +++++++++++++++---- .../dc/dml/dcn32/display_mode_vba_util_32.h | 1 + 3 files changed, 31 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c +3 -0
@@ -813,6 +813,8 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman (v->DRAMSpeedPerState[mode_lib->vba.VoltageLevel] <=MEM_STROBE_FREQ_MHZ || v->DCFCLKPerState[mode_lib->vba.VoltageLevel] <=DCFCLK_FREQ_EXTRA_PREFETCH_REQ_MHZ ) ? mode_lib->vba.ip.min_prefetch_in_strobe_us :0 , + mode_lib->vba.PrefetchModePerState[mode_lib->vba.VoltageLevel][mode_lib->vba.maxMpcComb] >0 || mode_lib->vba.DRAMClockChangeRequirementFinal == false, +/* Output */ &v->DSTXAfterScaler[k], &v->DSTYAfterScaler[k],
@@ -3317,6 +3319,7 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l v->SwathHeightCThisState[k], v->TWait, (v->DRAMSpeedPerState[i] <=MEM_STROBE_FREQ_MHZ || v->DCFCLKState[i][j] <=DCFCLK_FREQ_EXTRA_PREFETCH_REQ_MHZ ) ? mode_lib->vba.ip.min_prefetch_in_strobe_us :0 , + mode_lib->vba.PrefetchModePerState[i][j] >0 || mode_lib->vba.DRAMClockChangeRequirementFinal == false,/* Output */ &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.DSTXAfterScaler[k],
drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c +27 -6
@@ -3423,6 +3423,7 @@ bool dml32_CalculatePrefetchSchedule(unsigned int SwathHeightC, double TWait, double TPreReq, + bool ExtendPrefetchIfPossible,/* Output */ double *DSTXAfterScaler, double *DSTYAfterScaler,
@@ -3892,12 +3893,32 @@ bool dml32_CalculatePrefetchSchedule(/* Clamp to oto for bandwidth calculation */ LinesForPrefetchBandwidth = dst_y_prefetch_oto; }else { - *DestinationLinesForPrefetch = dst_y_prefetch_equ; - TimeForFetchingMetaPTE = Tvm_equ; - TimeForFetchingRowInVBlank = Tr0_equ; - *PrefetchBandwidth = prefetch_bw_equ; -/* Clamp to equ for bandwidth calculation */ - LinesForPrefetchBandwidth = dst_y_prefetch_equ; +/* For mode programming we want to extend the prefetch as much as possible +* (up to oto, or as long as we can for equ) if we're not already applying +* the 60us prefetch requirement. This is to avoid intermittent underflow +* issues during prefetch. +* +* The prefetch extension is applied under the following scenarios: +* 1. We're in prefetch mode > 0 (i.e. we don't support MCLK switch in blank) +* 2. We're using subvp or drr methods of p-state switch, in which case we +* we don't care if prefetch takes up more of the blanking time +* +* Mode programming typically chooses the smallest prefetch time possible +* (i.e. highest bandwidth during prefetch) presumably to create margin between +* p-states / c-states that happen in vblank and prefetch. Therefore we only +* apply this prefetch extension when p-state in vblank is not required (UCLK +* p-states take up the most vblank time). +*/ +if (ExtendPrefetchIfPossible && TPreReq ==0 && VStartup < MaxVStartup) { + MyError = true; + }else { + *DestinationLinesForPrefetch = dst_y_prefetch_equ; + TimeForFetchingMetaPTE = Tvm_equ; + TimeForFetchingRowInVBlank = Tr0_equ; + *PrefetchBandwidth = prefetch_bw_equ; +/* Clamp to equ for bandwidth calculation */ + LinesForPrefetchBandwidth = dst_y_prefetch_equ; + } } *DestinationLinesToRequestVMInVBlank =dml_ceil (4.0 * TimeForFetchingMetaPTE / LineTime,1.0 ) /4.0 ;
drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.h +1 -0
@@ -747,6 +747,7 @@ bool dml32_CalculatePrefetchSchedule(unsigned int SwathHeightC, double TWait, double TPreReq, + bool ExtendPrefetchIfPossible,/* Output */ double *DSTXAfterScaler, double *DSTYAfterScaler,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 51/88 drm/amd/display: Force p-state disallow if leaving no plane config
In reply to Sasha LevinFrom: Alvin Lee <[email protected]>
[ Upstream commit 9a902a9073c287353e25913c0761bfed49d75a88 ]
[Description]
- When we're in a no plane config, DCN is always asserting P-State allow
- This creates a scenario where the P-State blackout can start just as VUPDATE takes place and transitions the DCN config to a one where one or more HUBP's are active which can result in underflow
- To fix this issue, force p-state disallow and unforce after the transition from no planes case -> one or more planes active
--- .../amd/display/dc/hwss/dcn20/dcn20_hwseq.c | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+)
drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c +20 -0
@@ -1877,6 +1877,8 @@ void dcn20_program_front_end_for_ctx(int i;struct dce_hwseq *hws = dc->hwseq;DC_LOGGER_INIT (dc->ctx->logger); +unsigned int prev_hubp_count =0 ; +unsigned int hubp_count =0 ;if (resource_is_pipe_topology_changed (dc->current_state, context))resource_log_pipe_topology_update (dc, context);
@@ -1894,6 +1896,20 @@ void dcn20_program_front_end_for_ctx( } } +for (i =0 ; i < dc->res_pool->pipe_count; i++) { +if (dc->current_state->res_ctx.pipe_ctx[i].plane_state) + prev_hubp_count++; +if (context->res_ctx.pipe_ctx[i].plane_state) + hubp_count++; + } + +if (prev_hubp_count ==0 && hubp_count >0 ) { +if (dc->res_pool->hubbub->funcs->force_pstate_change_control) + dc->res_pool->hubbub->funcs->force_pstate_change_control ( + dc->res_pool->hubbub, true, false); +udelay (500 ); + } +/* Set pipe update flags and lock pipes */ for (i =0 ; i < dc->res_pool->pipe_count; i++) dcn20_detect_pipe_changes(&dc->current_state->res_ctx.pipe_ctx[i],
@@ -2039,6 +2055,10 @@ void dcn20_post_unlock_program_front_end( } } +if (dc->res_pool->hubbub->funcs->force_pstate_change_control) + dc->res_pool->hubbub->funcs->force_pstate_change_control ( + dc->res_pool->hubbub, false, false); +for (i =0 ; i < dc->res_pool->pipe_count; i++) {struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 52/88 drm/amdkfd: fix mes set shader debugger process management
In reply to Sasha LevinFrom: Jonathan Kim <[email protected]>
[ Upstream commit bd33bb1409b494558a2935f7bbc7842def957fcd ]
MES provides the driver a call to explicitly flush stale process memory within the MES to avoid a race condition that results in a fatal memory violation.
When SET_SHADER_DEBUGGER is called, the driver passes a memory address that represents a process context address MES uses to keep track of future per-process calls.
Normally, MES will purge its process context list when the last queue has been removed. The driver, however, can call SET_SHADER_DEBUGGER regardless of whether a queue has been added or not.
If SET_SHADER_DEBUGGER has been called with no queues as the last call prior to process termination, the passed process context address will still reside within MES.
On a new process call to SET_SHADER_DEBUGGER, the driver may end up passing an identical process context address value (based on per-process gpu memory address) to MES but is now pointing to a new allocated buffer object during KFD process creation. Since the MES is unaware of this, access of the passed address points to the stale object within MES and triggers a fatal memory violation.
The solution is for KFD to explicitly flush the process context address from MES on process termination.
Note that the flush call and the MES debugger calls use the same MES interface but are separated as KFD calls to avoid conflicting with each other.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 31 +++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 10 +++--- .../amd/amdkfd/kfd_process_queue_manager.c | 1 + drivers/gpu/drm/amd/include/mes_v11_api_def.h | 3 +- 4 files changed, 40 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +31 -0
@@ -886,6 +886,11 @@ int amdgpu_mes_set_shader_debugger(struct amdgpu_device *adev, op_input.op =MES_MISC_OP_SET_SHADER_DEBUGGER ; op_input.set_shader_debugger.process_context_addr = process_context_addr; op_input.set_shader_debugger.flags.u32all = flags; + +/* use amdgpu mes_flush_shader_debugger instead */ +if (op_input.set_shader_debugger.flags.process_ctx_flush) +return -EINVAL ; + op_input.set_shader_debugger.spi_gdbg_per_vmid_cntl = spi_gdbg_per_vmid_cntl;memcpy (op_input.set_shader_debugger.tcp_watch_cntl, tcp_watch_cntl,sizeof (op_input.set_shader_debugger.tcp_watch_cntl));
@@ -905,6 +910,32 @@ int amdgpu_mes_set_shader_debugger(struct amdgpu_device *adev,return r; } +int amdgpu_mes_flush_shader_debugger (struct amdgpu_device *adev, +uint64_t process_context_addr) +{ +struct mes_misc_op_input op_input = {0 }; +int r; + +if (!adev->mes.funcs->misc_op) { +DRM_ERROR ("mes flush shader debugger is not supported!\n" ); +return -EINVAL ; + } + + op_input.op =MES_MISC_OP_SET_SHADER_DEBUGGER ; + op_input.set_shader_debugger.process_context_addr = process_context_addr; + op_input.set_shader_debugger.flags.process_ctx_flush = true; + +amdgpu_mes_lock (&adev->mes); + + r = adev->mes.funcs->misc_op (&adev->mes, &op_input); +if (r) +DRM_ERROR ("failed to set_shader_debugger\n" ); + +amdgpu_mes_unlock (&adev->mes); + +return r; +} + static void amdgpu_mes_ring_to_queue_props(struct amdgpu_device *adev, struct amdgpu_ring *ring,
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h +6 -4
@@ -291,9 +291,10 @@ struct mes_misc_op_input {uint64_t process_context_addr;union {struct { -uint64_t single_memop :1 ; -uint64_t single_alu_op :1 ; -uint64_t reserved:30 ; +uint32_t single_memop :1 ; +uint32_t single_alu_op :1 ; +uint32_t reserved:29 ; +uint32_t process_ctx_flush:1 ; };uint32_t u32all; } flags;
@@ -369,7 +370,8 @@ int amdgpu_mes_set_shader_debugger(struct amdgpu_device *adev,const uint32_t *tcp_watch_cntl, uint32_t flags, bool trap_en); - +int amdgpu_mes_flush_shader_debugger (struct amdgpu_device *adev, +uint64_t process_context_addr); int amdgpu_mes_add_ring(struct amdgpu_device *adev, int gang_id, int queue_type, int idx, struct amdgpu_mes_ctx_data *ctx_data,
drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +1 -0
@@ -87,6 +87,7 @@ void kfd_process_dequeue_from_device(struct kfd_process_device *pdd)return ; dev->dqm->ops.process_termination (dev->dqm, &pdd->qpd); +amdgpu_mes_flush_shader_debugger (dev->adev, pdd->proc_ctx_gpu_addr); pdd->already_dequeued = true; }
drivers/gpu/drm/amd/include/mes_v11_api_def.h +2 -1
@@ -571,7 +571,8 @@ struct SET_SHADER_DEBUGGER {struct {uint32_t single_memop :1 ;/* SQ_DEBUG.single_memop */ uint32_t single_alu_op :1 ;/* SQ_DEBUG.single_alu_op */ -uint32_t reserved :30 ; +uint32_t reserved :29 ; +uint32_t process_ctx_flush :1 ; };uint32_t u32all; } flags;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 53/88 drm/msm/dpu: enable writeback on SM8350
In reply to Sasha LevinFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit c2949a49dfe960e952400029e14751dceff79d38 ]
Enable WB2 hardware block, enabling writeback support on this platform.
Patchwork: https://patchwork.freedesktop.org/patch/570188/
--- .../drm/msm/disp/dpu1/catalog/dpu_7_0_sm8350.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_7_0_sm8350.h +18 -0
@@ -31,6 +31,7 @@ static const struct dpu_mdp_cfg sm8350_mdp = { [DPU_CLK_CTRL_DMA1] = { .reg_off = 0x2b4, .bit_off = 8 }, [DPU_CLK_CTRL_DMA2] = { .reg_off = 0x2bc, .bit_off = 8 }, [DPU_CLK_CTRL_DMA3] = { .reg_off = 0x2c4, .bit_off = 8 }, + [DPU_CLK_CTRL_WB2] = { .reg_off = 0x2bc, .bit_off = 16 }, [DPU_CLK_CTRL_REG_DMA] = { .reg_off = 0x2bc, .bit_off = 20 }, }, };
@@ -298,6 +299,21 @@ static const struct dpu_dsc_cfg sm8350_dsc[] = { }, }; +static const struct dpu_wb_cfg sm8350_wb[] = { + { + .name ="wb_2" , .id =WB_2 , + .base =0x65000 , .len =0x2c8 , + .features =WB_SM8250_MASK , + .format_list = wb2_formats, + .num_formats =ARRAY_SIZE (wb2_formats), + .clk_ctrl =DPU_CLK_CTRL_WB2 , + .xin_id =6 , + .vbif_idx =VBIF_RT , + .maxlinewidth =4096 , + .intr_wb_done =DPU_IRQ_IDX (MDP_SSPP_TOP0_INTR ,4 ), + }, +}; +static const struct dpu_intf_cfg sm8350_intf[] = { { .name ="intf_0" , .id =INTF_0 ,
@@ -393,6 +409,8 @@ const struct dpu_mdss_cfg dpu_sm8350_cfg = { .dsc = sm8350_dsc, .merge_3d_count = ARRAY_SIZE(sm8350_merge_3d), .merge_3d = sm8350_merge_3d, + .wb_count = ARRAY_SIZE(sm8350_wb), + .wb = sm8350_wb, .intf_count = ARRAY_SIZE(sm8350_intf), .intf = sm8350_intf, .vbif_count = ARRAY_SIZE(sdm845_vbif),
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 54/88 drm/msm/dpu: enable writeback on SM8450
In reply to Sasha LevinFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit eaa647cdbf2e357b4a14903f2f1e47ed9c4f8df3 ]
Enable WB2 hardware block, enabling writeback support on this platform.
Patchwork: https://patchwork.freedesktop.org/patch/570187/
--- .../drm/msm/disp/dpu1/catalog/dpu_8_1_sm8450.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_8_1_sm8450.h +18 -0
@@ -32,6 +32,7 @@ static const struct dpu_mdp_cfg sm8450_mdp = { [DPU_CLK_CTRL_DMA1] = { .reg_off = 0x2b4, .bit_off = 8 }, [DPU_CLK_CTRL_DMA2] = { .reg_off = 0x2bc, .bit_off = 8 }, [DPU_CLK_CTRL_DMA3] = { .reg_off = 0x2c4, .bit_off = 8 }, + [DPU_CLK_CTRL_WB2] = { .reg_off = 0x2bc, .bit_off = 16 }, [DPU_CLK_CTRL_REG_DMA] = { .reg_off = 0x2bc, .bit_off = 20 }, }, };
@@ -316,6 +317,21 @@ static const struct dpu_dsc_cfg sm8450_dsc[] = { }, }; +static const struct dpu_wb_cfg sm8450_wb[] = { + { + .name ="wb_2" , .id =WB_2 , + .base =0x65000 , .len =0x2c8 , + .features =WB_SM8250_MASK , + .format_list = wb2_formats, + .num_formats =ARRAY_SIZE (wb2_formats), + .clk_ctrl =DPU_CLK_CTRL_WB2 , + .xin_id =6 , + .vbif_idx =VBIF_RT , + .maxlinewidth =4096 , + .intr_wb_done =DPU_IRQ_IDX (MDP_SSPP_TOP0_INTR ,4 ), + }, +}; +static const struct dpu_intf_cfg sm8450_intf[] = { { .name ="intf_0" , .id =INTF_0 ,
@@ -411,6 +427,8 @@ const struct dpu_mdss_cfg dpu_sm8450_cfg = { .dsc = sm8450_dsc, .merge_3d_count = ARRAY_SIZE(sm8450_merge_3d), .merge_3d = sm8450_merge_3d, + .wb_count = ARRAY_SIZE(sm8450_wb), + .wb = sm8450_wb, .intf_count = ARRAY_SIZE(sm8450_intf), .intf = sm8450_intf, .vbif_count = ARRAY_SIZE(sdm845_vbif),
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 55/88 drm/msm/dpu: Ratelimit framedone timeout msgs
In reply to Sasha LevinFrom: Rob Clark <[email protected]>
[ Upstream commit 2b72e50c62de60ad2d6bcd86aa38d4ccbdd633f2 ]
When we start getting these, we get a *lot*. So ratelimit it to not flood dmesg.
Patchwork: https://patchwork.freedesktop.org/patch/571584/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 5 ++++- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +4 -1
@@ -39,6 +39,9 @@#define DPU_ERROR_ENC (e, fmt, ...) DPU_ERROR("enc%d " fmt,\ (e) ? (e)->base.base.id : -1, ##__VA_ARGS__) +#define DPU_ERROR_ENC_RATELIMITED (e, fmt, ...) DPU_ERROR_RATELIMITED("enc%d " fmt,\ + (e) ? (e)->base.base.id : -1, ##__VA_ARGS__) +/* * Two to anticipate panels that can do cmd/vid dynamic switching * plan is to create all possible physical encoder types, and switch between
@@ -2339,7 +2342,7 @@ static void dpu_encoder_frame_done_timeout(struct timer_list *t)return ; } -DPU_ERROR_ENC (dpu_enc,"frame done timeout\n" ); +DPU_ERROR_ENC_RATELIMITED (dpu_enc,"frame done timeout\n" ); event =DPU_ENCODER_FRAME_EVENT_ERROR ;trace_dpu_enc_frame_done_timeout (DRMID (drm_enc), event);
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h +1 -0
@@ -51,6 +51,7 @@ } while (0)#define DPU_ERROR (fmt, ...) pr_err("[dpu error]" fmt, ##__VA_ARGS__) +#define DPU_ERROR_RATELIMITED (fmt, ...) pr_err_ratelimited("[dpu error]" fmt, ##__VA_ARGS__)/** * ktime_compare_safe - compare two ktime structures
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 56/88 drm/msm/dpu: fix writeback programming for YUV cases
In reply to Sasha LevinFrom: Abhinav Kumar <[email protected]>
[ Upstream commit 79caf2f2202b9eaad3a5a726e4b33807f67d0f1b ]
For YUV cases, setting the required format bits was missed out in the register programming. Lets fix it now in preparation of adding YUV formats support for writeback.
changes in v2:
- dropped the fixes tag as its not a fix but adding new functionality
Patchwork: https://patchwork.freedesktop.org/patch/571814/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c +3 -0
@@ -87,6 +87,9 @@ static void dpu_hw_wb_setup_format(struct dpu_hw_wb *ctx, dst_format |=BIT (14 );/* DST_ALPHA_X */ } +if (DPU_FORMAT_IS_YUV (fmt)) + dst_format |=BIT (15 ); + pattern = (fmt->element[3 ] <<24 ) | (fmt->element[2 ] <<16 ) | (fmt->element[1] << 8) |
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 57/88 drm/msm/dpu: Add mutex lock in control vblank irq
In reply to Sasha LevinFrom: Paloma Arellano <[email protected]>
[ Upstream commit 45284ff733e4caf6c118aae5131eb7e7cf3eea5a ]
Add a mutex lock to control vblank irq to synchronize vblank enable/disable operations happening from different threads to prevent race conditions while registering/unregistering the vblank irq callback.
v4: -Removed vblank_ctl_lock from dpu_encoder_virt, so it is only a
parameter of dpu_encoder_phys.
-Switch from atomic refcnt to a simple int counter as mutex has now been added
v3: Mistakenly did not change wording in last version. It is done now.
v2: Slightly changed wording of commit message
Patchwork: https://patchwork.freedesktop.org/patch/571854/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 1 - .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h | 4 ++- .../drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 32 ++++++++++++------ .../drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 33 ++++++++++++------- 4 files changed, 47 insertions(+), 23 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +0 -1
@@ -2500,7 +2500,6 @@ void dpu_encoder_phys_init(struct dpu_encoder_phys *phys_enc, phys_enc->enc_spinlock = p->enc_spinlock; phys_enc->enable_state =DPU_ENC_DISABLED ; -atomic_set (&phys_enc->vblank_refcount,0 );atomic_set (&phys_enc->pending_kickoff_cnt,0 );atomic_set (&phys_enc->pending_ctlstart_cnt,0 );
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h +3 -1
@@ -155,6 +155,7 @@ enum dpu_intr_idx {* @hw_wb: Hardware interface to the wb registers * @dpu_kms: Pointer to the dpu_kms top level * @cached_mode: DRM mode cached at mode_set time, acted on in enable +* @vblank_ctl_lock: Vblank ctl mutex lock to protect vblank_refcount * @enabled: Whether the encoder has enabled and running a mode * @split_role: Role to play in a split-panel configuration * @intf_mode: Interface mode
@@ -183,11 +184,12 @@ struct dpu_encoder_phys {struct dpu_hw_wb *hw_wb;struct dpu_kms *dpu_kms;struct drm_display_mode cached_mode; +struct mutex vblank_ctl_lock;enum dpu_enc_split_role split_role;enum dpu_intf_mode intf_mode;spinlock_t *enc_spinlock;enum dpu_enc_enable_state enable_state; -atomic_t vblank_refcount; +int vblank_refcount;atomic_t vsync_cnt;atomic_t underrun_cnt;atomic_t pending_ctlstart_cnt;
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +22 -10
@@ -244,7 +244,8 @@ static int dpu_encoder_phys_cmd_control_vblank_irq(return -EINVAL ; } - refcount =atomic_read (&phys_enc->vblank_refcount); +mutex_lock (&phys_enc->vblank_ctl_lock); + refcount = phys_enc->vblank_refcount;/* Slave encoders don't report vblank */ if (!dpu_encoder_phys_cmd_is_master (phys_enc))
@@ -260,16 +261,24 @@ static int dpu_encoder_phys_cmd_control_vblank_irq( phys_enc->hw_pp->idx -PINGPONG_0 , enable ? "true" : "false", refcount); -if (enable &&atomic_inc_return (&phys_enc->vblank_refcount) ==1 ) - ret =dpu_core_irq_register_callback (phys_enc->dpu_kms, - phys_enc->irq[INTR_IDX_RDPTR ], - dpu_encoder_phys_cmd_te_rd_ptr_irq, - phys_enc); -else if (!enable &&atomic_dec_return (&phys_enc->vblank_refcount) ==0 ) - ret =dpu_core_irq_unregister_callback (phys_enc->dpu_kms, - phys_enc->irq[INTR_IDX_RDPTR ]); +if (enable) { +if (phys_enc->vblank_refcount ==0 ) + ret =dpu_core_irq_register_callback (phys_enc->dpu_kms, + phys_enc->irq[INTR_IDX_RDPTR ], + dpu_encoder_phys_cmd_te_rd_ptr_irq, + phys_enc); +if (!ret) + phys_enc->vblank_refcount++; + }else if (!enable) { +if (phys_enc->vblank_refcount ==1 ) + ret =dpu_core_irq_unregister_callback (phys_enc->dpu_kms, + phys_enc->irq[INTR_IDX_RDPTR ]); +if (!ret) + phys_enc->vblank_refcount--; + } end: +mutex_unlock (&phys_enc->vblank_ctl_lock);if (ret) { DRM_ERROR("vblank irq err id:%u pp:%d ret:%d, enable %s/%d\n", DRMID(phys_enc->parent),
@@ -285,7 +294,7 @@ static void dpu_encoder_phys_cmd_irq_control(struct dpu_encoder_phys *phys_enc, {trace_dpu_enc_phys_cmd_irq_ctrl (DRMID (phys_enc->parent), phys_enc->hw_pp->idx -PINGPONG_0 , - enable,atomic_read (&phys_enc->vblank_refcount)); + enable, phys_enc->vblank_refcount);if (enable) { dpu_core_irq_register_callback(phys_enc->dpu_kms,
@@ -763,6 +772,9 @@ struct dpu_encoder_phys *dpu_encoder_phys_cmd_init(dpu_encoder_phys_init (phys_enc, p); +mutex_init (&phys_enc->vblank_ctl_lock); + phys_enc->vblank_refcount =0 ; +dpu_encoder_phys_cmd_init_ops (&phys_enc->ops); phys_enc->intf_mode =INTF_MODE_CMD ; cmd_enc->stream_sel =0 ;
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c +22 -11
@@ -364,7 +364,8 @@ static int dpu_encoder_phys_vid_control_vblank_irq(int ret =0 ;int refcount; - refcount =atomic_read (&phys_enc->vblank_refcount); +mutex_lock (&phys_enc->vblank_ctl_lock); + refcount = phys_enc->vblank_refcount;/* Slave encoders don't report vblank */ if (!dpu_encoder_phys_vid_is_master (phys_enc))
@@ -377,18 +378,26 @@ static int dpu_encoder_phys_vid_control_vblank_irq( }DRM_DEBUG_VBL ("id:%u enable=%d/%d\n" ,DRMID (phys_enc->parent), enable, -atomic_read (&phys_enc->vblank_refcount)); + refcount); -if (enable &&atomic_inc_return (&phys_enc->vblank_refcount) ==1 ) - ret =dpu_core_irq_register_callback (phys_enc->dpu_kms, - phys_enc->irq[INTR_IDX_VSYNC ], - dpu_encoder_phys_vid_vblank_irq, - phys_enc); -else if (!enable &&atomic_dec_return (&phys_enc->vblank_refcount) ==0 ) - ret =dpu_core_irq_unregister_callback (phys_enc->dpu_kms, - phys_enc->irq[INTR_IDX_VSYNC ]); +if (enable) { +if (phys_enc->vblank_refcount ==0 ) + ret =dpu_core_irq_register_callback (phys_enc->dpu_kms, + phys_enc->irq[INTR_IDX_VSYNC ], + dpu_encoder_phys_vid_vblank_irq, + phys_enc); +if (!ret) + phys_enc->vblank_refcount++; + }else if (!enable) { +if (phys_enc->vblank_refcount ==1 ) + ret =dpu_core_irq_unregister_callback (phys_enc->dpu_kms, + phys_enc->irq[INTR_IDX_VSYNC ]); +if (!ret) + phys_enc->vblank_refcount--; + } end: +mutex_unlock (&phys_enc->vblank_ctl_lock);if (ret) { DRM_ERROR("failed: id:%u intf:%d ret:%d enable:%d refcnt:%d\n", DRMID(phys_enc->parent),
@@ -618,7 +627,7 @@ static void dpu_encoder_phys_vid_irq_control(struct dpu_encoder_phys *phys_enc,trace_dpu_enc_phys_vid_irq_ctrl (DRMID (phys_enc->parent), phys_enc->hw_intf->idx -INTF_0 , enable, -atomic_read (&phys_enc->vblank_refcount)); + phys_enc->vblank_refcount);if (enable) { ret =dpu_encoder_phys_vid_control_vblank_irq (phys_enc, true);
@@ -713,6 +722,8 @@ struct dpu_encoder_phys *dpu_encoder_phys_vid_init(DPU_DEBUG_VIDENC (phys_enc,"\n" );dpu_encoder_phys_init (phys_enc, p); +mutex_init (&phys_enc->vblank_ctl_lock); + phys_enc->vblank_refcount =0 ;dpu_encoder_phys_vid_init_ops (&phys_enc->ops); phys_enc->intf_mode =INTF_MODE_VIDEO ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 58/88 drm/amdgpu: fix ftrace event amdgpu_bo_move always move on same heap
In reply to Sasha LevinFrom: "Wang, Beyond" <[email protected]>
[ Upstream commit 94aeb4117343d072e3a35b9595bcbfc0058ee724 ]
Issue: during evict or validate happened on amdgpu_bo, the 'from' and 'to' is always same in ftrace event of amdgpu_bo_move
where calling the 'trace_amdgpu_bo_move', the comment says move_notify is called before move happens, but actually it is called after move happens, here the new_mem is same as bo->resource
Fix: move trace_amdgpu_bo_move from move_notify to amdgpu_bo_move
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 13 +------------ drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 4 +--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 5 +++-- 3 files changed, 5 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1 -12
@@ -1245,19 +1245,15 @@ int amdgpu_bo_get_metadata(struct amdgpu_bo *bo, void *buffer,* amdgpu_bo_move_notify - notification about a memory move * @bo: pointer to a buffer object * @evict: if this move is evicting the buffer from the graphics address space -* @new_mem: new information of the bufer object * * Marks the corresponding &amdgpu_bo buffer object as invalid, also performs * bookkeeping. * TTM driver callback which is called when ttm moves a buffer. */ -void amdgpu_bo_move_notify (struct ttm_buffer_object *bo, -bool evict, -struct ttm_resource *new_mem) +void amdgpu_bo_move_notify (struct ttm_buffer_object *bo,bool evict) {struct amdgpu_device *adev =amdgpu_ttm_adev (bo->bdev);struct amdgpu_bo *abo; -struct ttm_resource *old_mem = bo->resource;if (!amdgpu_bo_is_amdgpu_bo (bo))return ;
@@ -1274,13 +1270,6 @@ void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,/* remember the eviction */ if (evict)atomic64_inc (&adev->num_evictions); - -/* update statistics */ -if (!new_mem) -return ; - -/* move_notify is called before move happens */ -trace_amdgpu_bo_move (abo, new_mem->mem_type, old_mem->mem_type); } void amdgpu_bo_get_memory(struct amdgpu_bo *bo,
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +1 -3
@@ -344,9 +344,7 @@ int amdgpu_bo_set_metadata (struct amdgpu_bo *bo, void *metadata,int amdgpu_bo_get_metadata (struct amdgpu_bo *bo,void *buffer,size_t buffer_size,uint32_t *metadata_size,uint64_t *flags); -void amdgpu_bo_move_notify (struct ttm_buffer_object *bo, -bool evict, -struct ttm_resource *new_mem); +void amdgpu_bo_move_notify (struct ttm_buffer_object *bo,bool evict);void amdgpu_bo_release_notify (struct ttm_buffer_object *bo);vm_fault_t amdgpu_bo_fault_reserve_notify (struct ttm_buffer_object *bo); void amdgpu_bo_fence(struct amdgpu_bo *bo, struct dma_fence *fence,
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +3 -2
@@ -545,10 +545,11 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict,return r; } +trace_amdgpu_bo_move (abo, new_mem->mem_type, old_mem->mem_type); out:/* update statistics */ atomic64_add (bo->base.size, &adev->num_bytes_moved); -amdgpu_bo_move_notify (bo, evict, new_mem); +amdgpu_bo_move_notify (bo, evict);return 0 ; }
@@ -1553,7 +1554,7 @@ static int amdgpu_ttm_access_memory(struct ttm_buffer_object *bo,static void amdgpu_bo_delete_mem_notify (struct ttm_buffer_object *bo) { -amdgpu_bo_move_notify (bo, false,NULL ); +amdgpu_bo_move_notify (bo, false); }static struct ttm_device_funcs amdgpu_bo_driver = {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 59/88 clk: hi3620: Fix memory leak in hi3620_mmc_clk_init()
In reply to Sasha LevinFrom: Kuan-Wei Chiu <[email protected]>
[ Upstream commit bfbea9e5667cfa9552c3d88f023386f017f6c308 ]
In cases where kcalloc() fails for the 'clk_data->clks' allocation, the code path does not handle the failure gracefully, potentially leading to a memory leak. This fix ensures proper cleanup by freeing the allocated memory for 'clk_data' before returning.
--- drivers/clk/hisilicon/clk-hi3620.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/clk/hisilicon/clk-hi3620.c +3 -1
@@ -466,8 +466,10 @@ static void __init hi3620_mmc_clk_init(struct device_node *node)return ; clk_data->clks =kcalloc (num,sizeof (*clk_data->clks),GFP_KERNEL ); -if (!clk_data->clks) +if (!clk_data->clks) { +kfree (clk_data);return ; + }for (i =0 ; i < num; i++) {struct hisi_mmc_clock *mmc_clk = &hi3620_mmc_clks[i];
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 60/88 clk: mmp: pxa168: Fix memory leak in pxa168_clk_init()
In reply to Sasha LevinFrom: Kuan-Wei Chiu <[email protected]>
[ Upstream commit 2fbabea626b6467eb4e6c4cb7a16523da12e43b4 ]
In cases where mapping of mpmu/apmu/apbc registers fails, the code path does not handle the failure gracefully, potentially leading to a memory leak. This fix ensures proper cleanup by freeing the allocated memory for 'pxa_unit' before returning.
--- drivers/clk/mmp/clk-of-pxa168.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/clk/mmp/clk-of-pxa168.c +3 -0
@@ -308,18 +308,21 @@ static void __init pxa168_clk_init(struct device_node *np) pxa_unit->mpmu_base =of_iomap (np,0 );if (!pxa_unit->mpmu_base) {pr_err ("failed to map mpmu registers\n" ); +kfree (pxa_unit);return ; } pxa_unit->apmu_base =of_iomap (np,1 );if (!pxa_unit->apmu_base) {pr_err ("failed to map apmu registers\n" ); +kfree (pxa_unit);return ; } pxa_unit->apbc_base =of_iomap (np,2 );if (!pxa_unit->apbc_base) {pr_err ("failed to map apbc registers\n" ); +kfree (pxa_unit);return ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 61/88 watchdog: starfive: add lock annotations to fix context imbalances
In reply to Sasha LevinFrom: Ben Dooks <[email protected]>
[ Upstream commit f77999887235f8c378af343df11a6bcedda5b284 ]
Add the necessary __acquires() and __releases() to the functions that take and release the wdt lock to avoid the following sparse warnings:
drivers/watchdog/starfive-wdt.c:204:13: warning: context imbalance in 'starfive_wdt_unlock' - wrong count at exit drivers/watchdog/starfive-wdt.c:212:9: warning: context imbalance in 'starfive_wdt_lock' - unexpected unlock
--- drivers/watchdog/starfive-wdt.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/watchdog/starfive-wdt.c +2 -0
@@ -202,12 +202,14 @@ static u32 starfive_wdt_ticks_to_sec(struct starfive_wdt *wdt, u32 ticks)/* Write unlock-key to unlock. Write other value to lock. */ static void starfive_wdt_unlock (struct starfive_wdt *wdt) + __acquires(&wdt->lock) {spin_lock (&wdt->lock);writel (wdt->variant->unlock_key, wdt->base + wdt->variant->unlock); }static void starfive_wdt_lock (struct starfive_wdt *wdt) + __releases(&wdt->lock) {writel (~wdt->variant->unlock_key, wdt->base + wdt->variant->unlock);spin_unlock (&wdt->lock);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 62/88 watchdog: it87_wdt: Keep WDTCTRL bit 3 unmodified for IT8784/IT8786
In reply to Sasha LevinFrom: Werner Fischer <[email protected]>
[ Upstream commit d12971849d71781c1e4ffd1117d4878ce233d319 ]
WDTCTRL bit 3 sets the mode choice for the clock input of IT8784/IT8786. Some motherboards require this bit to be set to 1 (= PCICLK mode), otherwise the watchdog functionality gets broken. The BIOS of those motherboards sets WDTCTRL bit 3 already to 1.
Instead of setting all bits of WDTCTRL to 0 by writing 0x00 to it, keep bit 3 of it unchanged for IT8784/IT8786 chips. In this way, bit 3 keeps the status as set by the BIOS of the motherboard.
Watchdog tests have been successful with this patch with the following systems:
IT8784: Thomas-Krenn LES plus v2 (YANLING YL-KBRL2 V2)
IT8786: Thomas-Krenn LES plus v3 (YANLING YL-CLU L2)
IT8786: Thomas-Krenn LES network 6L v2 (YANLING YL-CLU6L)
--- drivers/watchdog/it87_wdt.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/watchdog/it87_wdt.c +13 -1
@@ -256,6 +256,7 @@ static struct watchdog_device wdt_dev = {static int __init it87_wdt_init (void ) {u8 chip_rev; +u8 ctrl;int rc; rc =superio_enter ();
@@ -315,7 +316,18 @@ static int __init it87_wdt_init(void)superio_select (GPIO );superio_outb (WDT_TOV1 ,WDTCFG ); -superio_outb (0x00 ,WDTCTRL ); + +switch (chip_type) { +case IT8784_ID : +case IT8786_ID : + ctrl =superio_inb (WDTCTRL ); + ctrl &=0x08 ; +superio_outb (ctrl,WDTCTRL ); +break ; +default : +superio_outb (0x00 ,WDTCTRL ); + } +superio_exit ();if (timeout <1 || timeout > max_units *60 ) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 63/88 accel/habanalabs: add support for Gaudi2C device
In reply to Sasha LevinFrom: Oded Gabbay <[email protected]>
[ Upstream commit 42422993cf28d456778ee9168d73758ec037cd51 ]
Gaudi2 with PCI revision ID with the value of '3' represents Gaudi2C device and should be detected and initialized as Gaudi2.
--- drivers/accel/habanalabs/common/device.c | 3 +++ drivers/accel/habanalabs/common/habanalabs.h | 2 ++ drivers/accel/habanalabs/common/habanalabs_drv.c | 3 +++ drivers/accel/habanalabs/common/mmu/mmu.c | 1 + drivers/accel/habanalabs/common/sysfs.c | 3 +++ drivers/accel/habanalabs/include/hw_ip/pci/pci_general.h | 1 + 6 files changed, 13 insertions(+)
drivers/accel/habanalabs/common/device.c +3 -0
@@ -853,6 +853,9 @@ static int device_early_init(struct hl_device *hdev)gaudi2_set_asic_funcs (hdev);strscpy (hdev->asic_name,"GAUDI2B" ,sizeof (hdev->asic_name));break ; +case ASIC_GAUDI2C : +gaudi2_set_asic_funcs (hdev); +strscpy (hdev->asic_name,"GAUDI2C" ,sizeof (hdev->asic_name));break ;default : dev_err(hdev->dev, "Unrecognized ASIC type %d\n",
drivers/accel/habanalabs/common/habanalabs.h +2 -0
@@ -1262,6 +1262,7 @@ struct hl_dec {* @ASIC_GAUDI_SEC: Gaudi secured device (HL-2000). * @ASIC_GAUDI2: Gaudi2 device. * @ASIC_GAUDI2B: Gaudi2B device. +* @ASIC_GAUDI2C: Gaudi2C device. */ enum hl_asic_type {ASIC_INVALID ,
@@ -1270,6 +1271,7 @@ enum hl_asic_type {ASIC_GAUDI_SEC ,ASIC_GAUDI2 ,ASIC_GAUDI2B , + ASIC_GAUDI2C, };struct hl_cs_parser ;
drivers/accel/habanalabs/common/habanalabs_drv.c +3 -0
@@ -141,6 +141,9 @@ static enum hl_asic_type get_asic_type(struct hl_device *hdev)case REV_ID_B : asic_type =ASIC_GAUDI2B ;break ; +case REV_ID_C : + asic_type =ASIC_GAUDI2C ; +break ;default :break ; }
drivers/accel/habanalabs/common/mmu/mmu.c +1 -0
@@ -596,6 +596,7 @@ int hl_mmu_if_set_funcs(struct hl_device *hdev)break ;case ASIC_GAUDI2 :case ASIC_GAUDI2B : +case ASIC_GAUDI2C :/* MMUs in Gaudi2 are always host resident */ hl_mmu_v2_hr_set_funcs (hdev, &hdev->mmu_func[MMU_HR_PGT ]);break ;
drivers/accel/habanalabs/common/sysfs.c +3 -0
@@ -251,6 +251,9 @@ static ssize_t device_type_show(struct device *dev,case ASIC_GAUDI2B : str ="GAUDI2B" ;break ; +case ASIC_GAUDI2C : + str ="GAUDI2C" ; +break ;default :dev_err (hdev->dev,"Unrecognized ASIC type %d\n" , hdev->asic_type);
drivers/accel/habanalabs/include/hw_ip/pci/pci_general.h +1 -0
@@ -25,6 +25,7 @@ enum hl_revision_id {REV_ID_INVALID =0x00 ,REV_ID_A =0x01 ,REV_ID_B =0x02 , +REV_ID_C =0x03 };#endif /* INCLUDE_PCI_GENERAL_H_ */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 64/88 accel/habanalabs: fix EQ heartbeat mechanism
In reply to Sasha LevinFrom: Farah Kassabri <[email protected]>
[ Upstream commit d1958dce5ab6a3e089c60cf474e8c9b7e96e70ad ]
Stop rescheduling another heartbeat check when EQ heartbeat check fails as it generates confusing logs in dmesg that the heartbeat fails.
--- drivers/accel/habanalabs/common/device.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/accel/habanalabs/common/device.c +7 -7
@@ -1044,18 +1044,19 @@ static bool is_pci_link_healthy(struct hl_device *hdev)return (vendor_id ==PCI_VENDOR_ID_HABANALABS ); } -static void hl_device_eq_heartbeat (struct hl_device *hdev) +static int hl_device_eq_heartbeat_check (struct hl_device *hdev) { -u64 event_mask =HL_NOTIFIER_EVENT_DEVICE_RESET |HL_NOTIFIER_EVENT_DEVICE_UNAVAILABLE ;struct asic_fixed_properties *prop = &hdev->asic_prop;if (!prop->cpucp_info.eq_health_check_supported) -return ; +return 0 ;if (hdev->eq_heartbeat_received) hdev->eq_heartbeat_received = false;else -hl_device_cond_reset (hdev,HL_DRV_RESET_HARD , event_mask); +return -EIO ; + +return 0 ; }static void hl_device_heartbeat (struct work_struct *work)
@@ -1072,10 +1073,9 @@ static void hl_device_heartbeat(struct work_struct *work)/* * For EQ health check need to check if driver received the heartbeat eq event * in order to validate the eq is working. +* Only if both the EQ is healthy and we managed to send the next heartbeat reschedule. */ -hl_device_eq_heartbeat (hdev); - -if (!hdev->asic_funcs->send_heartbeat (hdev)) +if ((!hl_device_eq_heartbeat_check (hdev)) && (!hdev->asic_funcs->send_heartbeat (hdev))) goto reschedule;if (hl_device_operational (hdev,NULL ))
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 65/88 accel/habanalabs/gaudi2: fix undef opcode reporting
In reply to Sasha LevinFrom: Dafna Hirschfeld <[email protected]>
[ Upstream commit 0ec346779644039c4c05cfa7f071b1a24e54d8d9 ]
currently the undefined opcode event bit in set only for lower cp and only if 'write_enable' is true. It should be set anyway and for all streams in order to report that event to userspace.
--- drivers/accel/habanalabs/gaudi2/gaudi2.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/accel/habanalabs/gaudi2/gaudi2.c +6 -8
@@ -7929,21 +7929,19 @@ static int gaudi2_handle_qman_err_generic(struct hl_device *hdev, u16 event_type error_count++; } -if (i ==QMAN_STREAMS && error_count) { -/* check for undefined opcode */ -if (glbl_sts_val &PDMA0_QM_GLBL_ERR_STS_CP_UNDEF_CMD_ERR_MASK && - hdev->captured_err_info.undef_opcode.write_enable) { +/* check for undefined opcode */ +if (glbl_sts_val &PDMA0_QM_GLBL_ERR_STS_CP_UNDEF_CMD_ERR_MASK ) { + *event_mask |=HL_NOTIFIER_EVENT_UNDEFINED_OPCODE ; +if (hdev->captured_err_info.undef_opcode.write_enable) {memset (&hdev->captured_err_info.undef_opcode,0 ,sizeof (hdev->captured_err_info.undef_opcode)); - - hdev->captured_err_info.undef_opcode.write_enable = false; hdev->captured_err_info.undef_opcode.timestamp =ktime_get (); hdev->captured_err_info.undef_opcode.engine_id = gaudi2_queue_id_to_engine_id[qid_base]; - *event_mask |=HL_NOTIFIER_EVENT_UNDEFINED_OPCODE ; } -handle_lower_qman_data_on_err (hdev, qman_base, *event_mask); +if (i ==QMAN_STREAMS ) +handle_lower_qman_data_on_err (hdev, qman_base, *event_mask); } }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 66/88 drm/amd/display: make flip_timestamp_in_us a 64-bit variable
In reply to Sasha LevinFrom: Josip Pavic <[email protected]>
[ Upstream commit 6fb12518ca58412dc51054e2a7400afb41328d85 ]
[Why]
This variable currently overflows after about 71 minutes. This doesn't cause any known functional issues but it does make debugging more difficult.
[How]
Make it a 64-bit variable.
--- drivers/gpu/drm/amd/display/dc/dc_hw_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dc_hw_types.h +1 -1
@@ -244,7 +244,7 @@ enum pixel_format {#define DC_MAX_DIRTY_RECTS 3struct dc_flip_addrs {struct dc_plane_address address; -unsigned int flip_timestamp_in_us; +unsigned long long flip_timestamp_in_us;bool flip_immediate;/* TODO: add flip duration for FreeSync */ bool triplebuffer_flips;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 67/88 drm/amd/display: fix usb-c connector_type
In reply to Sasha LevinFrom: Allen Pan <[email protected]>
[ Upstream commit 0d26644bc57d8737c8e2fb3145366f7d0b941935 ]
[why]
BIOS switches to use USB-C connector type 0x18, but VBIOS's objectInfo table not supported yet. driver needs to patch it based on enc_cap from system integration info table.
--- .../gpu/drm/amd/display/dc/dcn35/dcn35_dio_link_encoder.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/display/dc/dcn35/dcn35_dio_link_encoder.c +5 -0
@@ -256,6 +256,10 @@ void dcn35_link_encoder_construct( enc10->base.features.flags.bits.IS_UHBR10_CAPABLE = bp_cap_info.DP_UHBR10_EN; enc10->base.features.flags.bits.IS_UHBR13_5_CAPABLE = bp_cap_info.DP_UHBR13_5_EN; enc10->base.features.flags.bits.IS_UHBR20_CAPABLE = bp_cap_info.DP_UHBR20_EN; +if (bp_cap_info.DP_IS_USB_C) { +/*BIOS not switch to use CONNECTOR_ID_USBC = 24 yet*/ + enc10->base.features.flags.bits.DP_IS_USB_C =1 ; + } }else { DC_LOG_WARNING("%s: Failed to get encoder_cap_info from VBIOS with error code %d!\n",
@@ -264,4 +268,5 @@ void dcn35_link_encoder_construct( }if (enc10->base.ctx->dc->debug.hdmi20_disable) enc10->base.features.flags.bits.HDMI_6GB_EN =0 ; + }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 68/88 drm/amd/display: Fix lightup regression with DP2 single display configs
In reply to Sasha LevinFrom: Michael Strauss <[email protected]>
[ Upstream commit 5a82b8d6c05f9b30828ede1b103b9ee5cb5c912e ]
[WHY]
Previous fix for multiple displays downstream of DP2 MST hub caused regression
[HOW]
Match sink IDs instead of sink struct addresses
--- drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.c +8 -0
@@ -157,6 +157,14 @@ bool is_dp2p0_output_encoder(const struct pipe_ctx *pipe_ctx) {/* If this assert is hit then we have a link encoder dynamic management issue */ ASSERT (pipe_ctx->stream_res.hpo_dp_stream_enc ? pipe_ctx->link_res.hpo_dp_link_enc !=NULL : true); +/* Count MST hubs once by treating only 1st remote sink in topology as an encoder */ +if (pipe_ctx->stream->link && pipe_ctx->stream->link->remote_sinks[0 ]) { +return (pipe_ctx->stream_res.hpo_dp_stream_enc && + pipe_ctx->link_res.hpo_dp_link_enc && +dc_is_dp_signal (pipe_ctx->stream->signal) && + (pipe_ctx->stream->link->remote_sinks[0 ]->sink_id == pipe_ctx->stream->sink->sink_id)); + } +return (pipe_ctx->stream_res.hpo_dp_stream_enc && pipe_ctx->link_res.hpo_dp_link_enc &&dc_is_dp_signal (pipe_ctx->stream->signal));
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 69/88 drm/amd/display: Only clear symclk otg flag for HDMI
In reply to Sasha LevinFrom: Alvin Lee <[email protected]>
[ Upstream commit dff45f03f508c92cd8eb2050e27b726726b8ae0b ]
[Description]
There is a corner case where the symclk otg flag is cleared when disabling the phantom pipe for subvp (because the phantom and main pipe share the same link). This is undesired because we need the maintain the correct symclk otg flag state for the main pipe.
For now only clear the flag only for HDMI signal type, since it's only set for HDMI signal type (phantom is virtual). The ideal solution is to not clear it if the stream is phantom but currently there's a bug that doesn't allow us to do this. Once this issue is fixed the proper fix can be implemented.
--- drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c | 3 ++- drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c | 3 ++- drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c | 3 ++- drivers/gpu/drm/amd/display/dc/hwss/dcn31/dcn31_hwseq.c | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c +2 -1
@@ -2124,7 +2124,8 @@ static void dce110_reset_hw_ctx_wrap(BREAK_TO_DEBUGGER (); } pipe_ctx_old->stream_res.tg->funcs->disable_crtc (pipe_ctx_old->stream_res.tg); - pipe_ctx_old->stream->link->phy_state.symclk_ref_cnts.otg =0 ; +if (dc_is_hdmi_tmds_signal (pipe_ctx_old->stream->signal)) + pipe_ctx_old->stream->link->phy_state.symclk_ref_cnts.otg =0 ; pipe_ctx_old->plane_res.mi->funcs->free_mem_input ( pipe_ctx_old->plane_res.mi, dc->current_state->stream_count);
drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c +2 -1
@@ -1057,7 +1057,8 @@ static void dcn10_reset_back_end_for_pipe(if (pipe_ctx->stream_res.tg->funcs->set_drr) pipe_ctx->stream_res.tg->funcs->set_drr ( pipe_ctx->stream_res.tg,NULL ); - pipe_ctx->stream->link->phy_state.symclk_ref_cnts.otg =0 ; +if (dc_is_hdmi_tmds_signal (pipe_ctx->stream->signal)) + pipe_ctx->stream->link->phy_state.symclk_ref_cnts.otg =0 ; }for (i =0 ; i < dc->res_pool->pipe_count; i++)
drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c +2 -1
@@ -2610,7 +2610,8 @@ static void dcn20_reset_back_end_for_pipe(* the case where the same symclk is shared across multiple otg * instances */ - link->phy_state.symclk_ref_cnts.otg =0 ; +if (dc_is_hdmi_tmds_signal (pipe_ctx->stream->signal)) + link->phy_state.symclk_ref_cnts.otg =0 ;if (link->phy_state.symclk_state ==SYMCLK_ON_TX_OFF ) { link_hwss->disable_link_output (link, &pipe_ctx->link_res, pipe_ctx->stream->signal);
drivers/gpu/drm/amd/display/dc/hwss/dcn31/dcn31_hwseq.c +2 -1
@@ -523,7 +523,8 @@ static void dcn31_reset_back_end_for_pipe(if (pipe_ctx->stream_res.tg->funcs->set_odm_bypass) pipe_ctx->stream_res.tg->funcs->set_odm_bypass ( pipe_ctx->stream_res.tg, &pipe_ctx->stream->timing); - pipe_ctx->stream->link->phy_state.symclk_ref_cnts.otg =0 ; +if (dc_is_hdmi_tmds_signal (pipe_ctx->stream->signal)) + pipe_ctx->stream->link->phy_state.symclk_ref_cnts.otg =0 ;if (pipe_ctx->stream_res.tg->funcs->set_drr) pipe_ctx->stream_res.tg->funcs->set_drr(
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 70/88 clk: imx: scu: Fix memory leak in __imx_clk_gpr_scu()
In reply to Sasha LevinFrom: Kuan-Wei Chiu <[email protected]>
[ Upstream commit 21c0efbcb45cf94724d17b040ebc03fcd4a81f22 ]
In cases where imx_clk_is_resource_owned() returns false, the code path does not handle the failure gracefully, potentially leading to a memory leak. This fix ensures proper cleanup by freeing the allocated memory for 'clk_node' before returning.
--- drivers/clk/imx/clk-scu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/clk/imx/clk-scu.c +3 -1
@@ -886,8 +886,10 @@ struct clk_hw *__imx_clk_gpr_scu(const char *name, const char * const *parent_nareturn ERR_PTR (-EINVAL ); } -if (!imx_clk_is_resource_owned (rsrc_id)) +if (!imx_clk_is_resource_owned (rsrc_id)) { +kfree (clk_node);return NULL ; + } clk =kzalloc (sizeof (*clk),GFP_KERNEL );if (!clk) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 71/88 clk: imx: clk-imx8qxp: fix LVDS bypass, pixel and phy clocks
In reply to Sasha LevinFrom: Alexander Stein <[email protected]>
[ Upstream commit 3f5f63adeea7e7aa715e101ffe4b4ac9705f9664 ]
To be compatible with SCU firmware based on 1.15 a different clock routing for LVDS is needed.
--- drivers/clk/imx/clk-imx8qxp.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-)
drivers/clk/imx/clk-imx8qxp.c +20 -4
@@ -66,6 +66,22 @@ static const char * const lcd_pxl_sels[] = { "lcd_pxl_bypass_div_clk", }; +static const char *const lvds0_sels[] = { +"clk_dummy" , +"clk_dummy" , +"clk_dummy" , +"clk_dummy" , +"mipi0_lvds_bypass_clk" , +}; + +static const char *const lvds1_sels[] = { +"clk_dummy" , +"clk_dummy" , +"clk_dummy" , +"clk_dummy" , +"mipi1_lvds_bypass_clk" , +}; +static const char *const mipi_sels[] = {"clk_dummy" ,"clk_dummy" ,
@@ -207,9 +223,9 @@ static int imx8qxp_clk_probe(struct platform_device *pdev)/* MIPI-LVDS SS */ imx_clk_scu ("mipi0_bypass_clk" ,IMX_SC_R_MIPI_0 ,IMX_SC_PM_CLK_BYPASS );imx_clk_scu ("mipi0_pixel_clk" ,IMX_SC_R_MIPI_0 ,IMX_SC_PM_CLK_PER ); -imx_clk_scu ("mipi0_lvds_pixel_clk" ,IMX_SC_R_LVDS_0 ,IMX_SC_PM_CLK_MISC2 );imx_clk_scu ("mipi0_lvds_bypass_clk" ,IMX_SC_R_LVDS_0 ,IMX_SC_PM_CLK_BYPASS ); -imx_clk_scu ("mipi0_lvds_phy_clk" ,IMX_SC_R_LVDS_0 ,IMX_SC_PM_CLK_MISC3 ); +imx_clk_scu2 ("mipi0_lvds_pixel_clk" , lvds0_sels,ARRAY_SIZE (lvds0_sels),IMX_SC_R_LVDS_0 ,IMX_SC_PM_CLK_MISC2 ); +imx_clk_scu2 ("mipi0_lvds_phy_clk" , lvds0_sels,ARRAY_SIZE (lvds0_sels),IMX_SC_R_LVDS_0 ,IMX_SC_PM_CLK_MISC3 );imx_clk_scu2 ("mipi0_dsi_tx_esc_clk" , mipi_sels,ARRAY_SIZE (mipi_sels),IMX_SC_R_MIPI_0 ,IMX_SC_PM_CLK_MST_BUS );imx_clk_scu2 ("mipi0_dsi_rx_esc_clk" , mipi_sels,ARRAY_SIZE (mipi_sels),IMX_SC_R_MIPI_0 ,IMX_SC_PM_CLK_SLV_BUS );imx_clk_scu2 ("mipi0_dsi_phy_clk" , mipi_sels,ARRAY_SIZE (mipi_sels),IMX_SC_R_MIPI_0 ,IMX_SC_PM_CLK_PHY );
@@ -219,9 +235,9 @@ static int imx8qxp_clk_probe(struct platform_device *pdev)imx_clk_scu ("mipi1_bypass_clk" ,IMX_SC_R_MIPI_1 ,IMX_SC_PM_CLK_BYPASS );imx_clk_scu ("mipi1_pixel_clk" ,IMX_SC_R_MIPI_1 ,IMX_SC_PM_CLK_PER ); -imx_clk_scu ("mipi1_lvds_pixel_clk" ,IMX_SC_R_LVDS_1 ,IMX_SC_PM_CLK_MISC2 );imx_clk_scu ("mipi1_lvds_bypass_clk" ,IMX_SC_R_LVDS_1 ,IMX_SC_PM_CLK_BYPASS ); -imx_clk_scu ("mipi1_lvds_phy_clk" ,IMX_SC_R_LVDS_1 ,IMX_SC_PM_CLK_MISC3 ); +imx_clk_scu2 ("mipi1_lvds_pixel_clk" , lvds1_sels,ARRAY_SIZE (lvds1_sels),IMX_SC_R_LVDS_1 ,IMX_SC_PM_CLK_MISC2 ); +imx_clk_scu2 ("mipi1_lvds_phy_clk" , lvds1_sels,ARRAY_SIZE (lvds1_sels),IMX_SC_R_LVDS_1 ,IMX_SC_PM_CLK_MISC3 );imx_clk_scu2 ("mipi1_dsi_tx_esc_clk" , mipi_sels,ARRAY_SIZE (mipi_sels),IMX_SC_R_MIPI_1 ,IMX_SC_PM_CLK_MST_BUS );imx_clk_scu2 ("mipi1_dsi_rx_esc_clk" , mipi_sels,ARRAY_SIZE (mipi_sels),IMX_SC_R_MIPI_1 ,IMX_SC_PM_CLK_SLV_BUS );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 72/88 ALSA: hda/tas2781: add fixup for Lenovo 14ARB7
In reply to Sasha LevinFrom: Gergo Koteles <[email protected]>
[ Upstream commit b5cb53fd32779f3a971c45bcd997ae2608aa1086 ]
The 14ARB7 has two tas2563 amplifier on i2c.
Connect it to the tas2781 driver.
--- sound/pci/hda/patch_realtek.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
sound/pci/hda/patch_realtek.c +14 -0
@@ -6984,6 +6984,12 @@ static void tas2781_fixup_i2c(struct hda_codec *cdc,tas2781_generic_fixup (cdc, action,"i2c" ,"TIAS2781" ); } +static void yoga7_14arb7_fixup_i2c (struct hda_codec *cdc, +const struct hda_fixup *fix,int action) +{ +tas2781_generic_fixup (cdc, action,"i2c" ,"INT8866" ); +} +/* for alc295_fixup_hp_top_speakers */ #include "hp_x360_helper.c"
@@ -7454,6 +7460,7 @@ enum {ALC236_FIXUP_DELL_DUAL_CODECS ,ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI ,ALC287_FIXUP_TAS2781_I2C , +ALC287_FIXUP_YOGA7_14ARB7_I2C ,ALC245_FIXUP_HP_MUTE_LED_COEFBIT ,ALC245_FIXUP_HP_X360_MUTE_LEDS , ALC287_FIXUP_THINKPAD_I2S_SPK,
@@ -9568,6 +9575,12 @@ static const struct hda_fixup alc269_fixups[] = { .chained = true, .chain_id = ALC269_FIXUP_THINKPAD_ACPI, }, + [ALC287_FIXUP_YOGA7_14ARB7_I2C] = { + .type = HDA_FIXUP_FUNC, + .v.func = yoga7_14arb7_fixup_i2c, + .chained = true, + .chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK, + }, [ALC245_FIXUP_HP_MUTE_LED_COEFBIT] = { .type = HDA_FIXUP_FUNC, .v.func = alc245_fixup_hp_mute_led_coefbit,
@@ -10221,6 +10234,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x17aa ,0x3853 ,"Lenovo Yoga 7 15ITL5" ,ALC287_FIXUP_YOGA7_14ITL_SPEAKERS ),SND_PCI_QUIRK (0x17aa ,0x3855 ,"Legion 7 16ITHG6" ,ALC287_FIXUP_LEGION_16ITHG6 ),SND_PCI_QUIRK (0x17aa ,0x3869 ,"Lenovo Yoga7 14IAL7" ,ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN ), +SND_PCI_QUIRK (0x17aa ,0x3870 ,"Lenovo Yoga 7 14ARB7" ,ALC287_FIXUP_YOGA7_14ARB7_I2C ),SND_PCI_QUIRK (0x17aa ,0x387d ,"Yoga S780-16 pro Quad AAC" ,ALC287_FIXUP_TAS2781_I2C ),SND_PCI_QUIRK (0x17aa ,0x387e ,"Yoga S780-16 pro Quad YC" ,ALC287_FIXUP_TAS2781_I2C ), SND_PCI_QUIRK(0x17aa, 0x3881, "YB9 dual power mode2 YC", ALC287_FIXUP_TAS2781_I2C),
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 73/88 drm/amdgpu: Fix ecc irq enable/disable unpaired
In reply to Sasha LevinFrom: "Stanley.Yang" <[email protected]>
[ Upstream commit a32c6f7f5737cc7e31cd7ad5133f0d96fca12ea6 ]
The ecc_irq is disabled while GPU mode2 reset suspending process, but not be enabled during GPU mode2 reset resume process.
Changed from V1:
only do sdma/gfx ras_late_init in aldebaran_mode2_restore_ip delete amdgpu_ras_late_resume function
Changed from V2:
check umc ras supported before put ecc_irq
--- drivers/gpu/drm/amd/amdgpu/aldebaran.c | 26 +++++++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 4 ++++ drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c | 5 +++++ drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 4 ++++ 4 files changed, 38 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/aldebaran.c +25 -1
@@ -330,6 +330,7 @@ aldebaran_mode2_restore_hwcontext(struct amdgpu_reset_control *reset_ctl, {struct list_head *reset_device_list = reset_context->reset_device_list;struct amdgpu_device *tmp_adev =NULL ; +struct amdgpu_ras *con;int r;if (reset_device_list ==NULL )
@@ -355,7 +356,30 @@ aldebaran_mode2_restore_hwcontext(struct amdgpu_reset_control *reset_ctl,*/ amdgpu_register_gpu_instance (tmp_adev); -/* Resume RAS */ +/* Resume RAS, ecc_irq */ + con =amdgpu_ras_get_context (tmp_adev); +if (!amdgpu_sriov_vf (tmp_adev) && con) { +if (tmp_adev->sdma.ras && + tmp_adev->sdma.ras->ras_block.ras_late_init) { + r = tmp_adev->sdma.ras->ras_block.ras_late_init (tmp_adev, + &tmp_adev->sdma.ras->ras_block.ras_comm); +if (r) { +dev_err (tmp_adev->dev,"SDMA failed to execute ras_late_init! ret:%d\n" , r); + goto end; + } + } + +if (tmp_adev->gfx.ras && + tmp_adev->gfx.ras->ras_block.ras_late_init) { + r = tmp_adev->gfx.ras->ras_block.ras_late_init (tmp_adev, + &tmp_adev->gfx.ras->ras_block.ras_comm); +if (r) { +dev_err (tmp_adev->dev,"GFX failed to execute ras_late_init! ret:%d\n" , r); + goto end; + } + } + } +amdgpu_ras_resume (tmp_adev);/* Update PSP FW topology after reset */
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +4 -0
@@ -1041,6 +1041,10 @@ static int gmc_v10_0_hw_fini(void *handle)amdgpu_irq_put (adev, &adev->gmc.vm_fault,0 ); +if (adev->gmc.ecc_irq.funcs && +amdgpu_ras_is_supported (adev,AMDGPU_RAS_BLOCK__UMC )) +amdgpu_irq_put (adev, &adev->gmc.ecc_irq,0 ); +return 0 ; }
drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c +5 -0
@@ -941,6 +941,11 @@ static int gmc_v11_0_hw_fini(void *handle) }amdgpu_irq_put (adev, &adev->gmc.vm_fault,0 ); + +if (adev->gmc.ecc_irq.funcs && +amdgpu_ras_is_supported (adev,AMDGPU_RAS_BLOCK__UMC )) +amdgpu_irq_put (adev, &adev->gmc.ecc_irq,0 ); +gmc_v11_0_gart_disable (adev);return 0 ;
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +4 -0
@@ -2380,6 +2380,10 @@ static int gmc_v9_0_hw_fini(void *handle)amdgpu_irq_put (adev, &adev->gmc.vm_fault,0 ); +if (adev->gmc.ecc_irq.funcs && +amdgpu_ras_is_supported (adev,AMDGPU_RAS_BLOCK__UMC )) +amdgpu_irq_put (adev, &adev->gmc.ecc_irq,0 ); +return 0 ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 74/88 drm/amd/display: Fix minor issues in BW Allocation Phase2
In reply to Sasha LevinFrom: Meenakshikumar Somasundaram <[email protected]>
[ Upstream commit aa5dc05340eb97486a631ce6bccb8d020bf6b56b ]
[Why]
Fix minor issues in BW Allocation Phase2.
[How]
- In set_usb4_req_bw_req(), link->dpia_bw_alloc_config.response_ready flag should be reset before writing DPCD REQUEST_BW.
- Fix the granularity for value of 2 in get_bw_granularity().
- Removed bandwidth allocation support display fw boot option as the fw would read feature enable status from bios.
- Clean up DPIA_EST_BW_CHANGED and DPIA_BW_REQ_SUCCESS cases in dpia_handle_bw_alloc_response().
- Removed allocate_usb4_bw and deallocate_usb4_bw.
- Optimized loop in get_lowest_dpia_index().
- Updated link_dp_dpia_allocate_usb4_bandwidth_for_stream() and set_usb4_req_bw_req() to always issue request bw.
--- .../dc/link/protocols/link_dp_dpia_bw.c | 221 ++++++++---------- .../dc/link/protocols/link_dp_dpia_bw.h | 4 +- 2 files changed, 101 insertions(+), 124 deletions(-)
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c +99 -122
@@ -50,6 +50,7 @@ static bool get_bw_alloc_proceed_flag(struct dc_link *tmp) && tmp->hpd_status && tmp->dpia_bw_alloc_config.bw_alloc_enabled); } +static void reset_bw_alloc_struct (struct dc_link *link) { link->dpia_bw_alloc_config.bw_alloc_enabled = false;
@@ -59,6 +60,11 @@ static void reset_bw_alloc_struct(struct dc_link *link) link->dpia_bw_alloc_config.bw_granularity =0 ; link->dpia_bw_alloc_config.response_ready = false; } + +#define BW_GRANULARITY_0 4 // 0.25 Gbps +#define BW_GRANULARITY_1 2 // 0.5 Gbps +#define BW_GRANULARITY_2 1 // 1 Gbps +static uint8_t get_bw_granularity (struct dc_link *link) {uint8_t bw_granularity =0 ;
@@ -71,16 +77,20 @@ static uint8_t get_bw_granularity(struct dc_link *link)switch (bw_granularity &0x3 ) {case 0 : - bw_granularity =4 ; + bw_granularity =BW_GRANULARITY_0 ;break ;case 1 : + bw_granularity =BW_GRANULARITY_1 ; +break ; +case 2 :default : - bw_granularity =2 ; + bw_granularity =BW_GRANULARITY_2 ;break ; }return bw_granularity; } +static int get_estimated_bw (struct dc_link *link) {uint8_t bw_estimated_bw =0 ;
@@ -93,31 +103,7 @@ static int get_estimated_bw(struct dc_link *link)return bw_estimated_bw * (Kbps_TO_Gbps / link->dpia_bw_alloc_config.bw_granularity); } -static bool allocate_usb4_bw (int *stream_allocated_bw,int bw_needed,struct dc_link *link) -{ -if (bw_needed >0 ) - *stream_allocated_bw += bw_needed; - -return true; -} -static bool deallocate_usb4_bw (int *stream_allocated_bw,int bw_to_dealloc,struct dc_link *link) -{ -bool ret = false; - -if (*stream_allocated_bw >0 ) { - *stream_allocated_bw -= bw_to_dealloc; - ret = true; - }else { -//Do nothing for now - ret = true; - } -// Unplug so reset values -if (!link->hpd_status) -reset_bw_alloc_struct (link); - -return ret; -}/* * Read all New BW alloc configuration ex: estimated_bw, allocated_bw, * granuality, Driver_ID, CM_Group, & populate the BW allocation structs
@@ -128,7 +114,12 @@ static void init_usb4_bw_struct(struct dc_link *link)// Init the known values link->dpia_bw_alloc_config.bw_granularity =get_bw_granularity (link); link->dpia_bw_alloc_config.estimated_bw =get_estimated_bw (link); + +DC_LOG_DEBUG ("%s: bw_granularity(%d), estimated_bw(%d)\n" , + __func__, link->dpia_bw_alloc_config.bw_granularity, + link->dpia_bw_alloc_config.estimated_bw); } +static uint8_t get_lowest_dpia_index (struct dc_link *link) {const struct dc *dc_struct = link->dc;
@@ -141,12 +132,15 @@ static uint8_t get_lowest_dpia_index(struct dc_link *link) dc_struct->links[i]->ep_type != DISPLAY_ENDPOINT_USB4_DPIA) continue; -if (idx > dc_struct->links[i]->link_index) +if (idx > dc_struct->links[i]->link_index) { idx = dc_struct->links[i]->link_index; +break ; + } }return idx; } +/* * Get the Max Available BW or Max Estimated BW for each Host Router *
@@ -186,6 +180,7 @@ static int get_host_router_total_bw(struct dc_link *link, uint8_t type)return total_bw; } +/* * Cleanup function for when the dpia is unplugged to reset struct * and perform any required clean up
@@ -194,42 +189,50 @@ static int get_host_router_total_bw(struct dc_link *link, uint8_t type)* * return: none */ -static bool dpia_bw_alloc_unplug (struct dc_link *link) +static void dpia_bw_alloc_unplug (struct dc_link *link) { -if (!link) -return true; - -return deallocate_usb4_bw (&link->dpia_bw_alloc_config.sink_allocated_bw, - link->dpia_bw_alloc_config.sink_allocated_bw, link); +if (link) { +DC_LOG_DEBUG ("%s: resetting bw alloc config for link(%d)\n" , + __func__, link->link_index); + link->dpia_bw_alloc_config.sink_allocated_bw =0 ; +reset_bw_alloc_struct (link); + } } +static void set_usb4_req_bw_req (struct dc_link *link,int req_bw) {uint8_t requested_bw;uint32_t temp; -// 1. Add check for this corner case #1 -if (req_bw > link->dpia_bw_alloc_config.estimated_bw) +/* Error check whether request bw greater than allocated */ +if (req_bw > link->dpia_bw_alloc_config.estimated_bw) { +DC_LOG_ERROR ("%s: Request bw greater than estimated bw for link(%d)\n" , + __func__, link->link_index); req_bw = link->dpia_bw_alloc_config.estimated_bw; + } temp = req_bw * link->dpia_bw_alloc_config.bw_granularity; requested_bw = temp / Kbps_TO_Gbps; -// Always make sure to add more to account for floating points +/* Always make sure to add more to account for floating points */ if (temp % Kbps_TO_Gbps) ++requested_bw; -// 2. Add check for this corner case #2 +/* Error check whether requested and allocated are equal */ req_bw = requested_bw * (Kbps_TO_Gbps / link->dpia_bw_alloc_config.bw_granularity); -if (req_bw == link->dpia_bw_alloc_config.sink_allocated_bw) -return ; +if (req_bw == link->dpia_bw_alloc_config.sink_allocated_bw) { +DC_LOG_ERROR ("%s: Request bw equals to allocated bw for link(%d)\n" , + __func__, link->link_index); + } -if (core_link_write_dpcd ( + link->dpia_bw_alloc_config.response_ready = false;// Reset flag +core_link_write_dpcd ( link,REQUESTED_BW , &requested_bw, -sizeof (uint8_t )) ==DC_OK ) - link->dpia_bw_alloc_config.response_ready = false;// Reset flag +sizeof (uint8_t )); } +/* * Return the response_ready flag from dc_link struct *
@@ -241,6 +244,7 @@ static bool get_cm_response_ready_flag(struct dc_link *link) {return link->dpia_bw_alloc_config.response_ready; } +// ------------------------------------------------------------------ // PUBLIC FUNCTIONS // ------------------------------------------------------------------
@@ -277,27 +281,27 @@ bool link_dp_dpia_set_dptx_usb4_bw_alloc_support(struct dc_link *link) DPTX_BW_ALLOCATION_MODE_CONTROL, &response, sizeof(uint8_t)) != DC_OK) { - DC_LOG_DEBUG("%s: **** FAILURE Enabling DPtx BW Allocation Mode Support ***\n", - __func__); + DC_LOG_DEBUG("%s: FAILURE Enabling DPtx BW Allocation Mode Support for link(%d)\n", + __func__, link->link_index); } else {// SUCCESS Enabled DPtx BW Allocation Mode Support - link->dpia_bw_alloc_config.bw_alloc_enabled = true; -DC_LOG_DEBUG ("%s: **** SUCCESS Enabling DPtx BW Allocation Mode Support ***\n" , - __func__); +DC_LOG_DEBUG ("%s: SUCCESS Enabling DPtx BW Allocation Mode Support for link(%d)\n" , + __func__, link->link_index); ret = true;init_usb4_bw_struct (link); + link->dpia_bw_alloc_config.bw_alloc_enabled = true; } } out:return ret; } +void dpia_handle_bw_alloc_response (struct dc_link *link,uint8_t bw,uint8_t result) {int bw_needed =0 ;int estimated =0 ; -int host_router_total_estimated_bw =0 ;if (!get_bw_alloc_proceed_flag ((link)))return ;
@@ -306,14 +310,22 @@ void dpia_handle_bw_alloc_response(struct dc_link *link, uint8_t bw, uint8_t rescase DPIA_BW_REQ_FAILED : -DC_LOG_DEBUG ("%s: *** *** BW REQ FAILURE for DP-TX Request *** ***\n" , __func__); +/* +* Ideally, we shouldn't run into this case as we always validate available +* bandwidth and request within that limit +*/ + estimated = bw * (Kbps_TO_Gbps / link->dpia_bw_alloc_config.bw_granularity); -// Update the new Estimated BW value updated by CM - link->dpia_bw_alloc_config.estimated_bw = - bw * (Kbps_TO_Gbps / link->dpia_bw_alloc_config.bw_granularity); +DC_LOG_ERROR ("%s: BW REQ FAILURE for DP-TX Request for link(%d)\n" , + __func__, link->link_index); +DC_LOG_ERROR ("%s: current estimated_bw(%d), new estimated_bw(%d)\n" , + __func__, link->dpia_bw_alloc_config.estimated_bw, estimated); +/* Update the new Estimated BW value updated by CM */ + link->dpia_bw_alloc_config.estimated_bw = estimated; + +/* Allocate the previously requested bandwidth */ set_usb4_req_bw_req (link, link->dpia_bw_alloc_config.estimated_bw); - link->dpia_bw_alloc_config.response_ready = false;/* * If FAIL then it is either:
@@ -326,68 +338,34 @@ void dpia_handle_bw_alloc_response(struct dc_link *link, uint8_t bw, uint8_t rescase DPIA_BW_REQ_SUCCESS : -DC_LOG_DEBUG ("%s: *** BW REQ SUCCESS for DP-TX Request ***\n" , __func__); - -// 1. SUCCESS 1st time before any Pruning is done -// 2. SUCCESS after prev. FAIL before any Pruning is done -// 3. SUCCESS after Pruning is done but before enabling link - bw_needed = bw * (Kbps_TO_Gbps / link->dpia_bw_alloc_config.bw_granularity); -// 1. -if (!link->dpia_bw_alloc_config.sink_allocated_bw) { - -allocate_usb4_bw (&link->dpia_bw_alloc_config.sink_allocated_bw, bw_needed, link); - link->dpia_bw_alloc_config.sink_verified_bw = - link->dpia_bw_alloc_config.sink_allocated_bw; +DC_LOG_DEBUG ("%s: BW REQ SUCCESS for DP-TX Request for link(%d)\n" , + __func__, link->link_index); +DC_LOG_DEBUG ("%s: current allocated_bw(%d), new allocated_bw(%d)\n" , + __func__, link->dpia_bw_alloc_config.sink_allocated_bw, bw_needed); -// SUCCESS from first attempt -if (link->dpia_bw_alloc_config.sink_allocated_bw > - link->dpia_bw_alloc_config.sink_max_bw) - link->dpia_bw_alloc_config.sink_verified_bw = - link->dpia_bw_alloc_config.sink_max_bw; - } -// 3. -else if (link->dpia_bw_alloc_config.sink_allocated_bw) { - -// Find out how much do we need to de-alloc -if (link->dpia_bw_alloc_config.sink_allocated_bw > bw_needed) -deallocate_usb4_bw (&link->dpia_bw_alloc_config.sink_allocated_bw, - link->dpia_bw_alloc_config.sink_allocated_bw - bw_needed, link); -else -allocate_usb4_bw (&link->dpia_bw_alloc_config.sink_allocated_bw, - bw_needed - link->dpia_bw_alloc_config.sink_allocated_bw, link); - } - -// 4. If this is the 2nd sink then any unused bw will be reallocated to master DPIA -// => check if estimated_bw changed + link->dpia_bw_alloc_config.sink_allocated_bw = bw_needed; link->dpia_bw_alloc_config.response_ready = true;break ;case DPIA_EST_BW_CHANGED : -DC_LOG_DEBUG ("%s: *** ESTIMATED BW CHANGED for DP-TX Request ***\n" , __func__); - estimated = bw * (Kbps_TO_Gbps / link->dpia_bw_alloc_config.bw_granularity); - host_router_total_estimated_bw =get_host_router_total_bw (link,HOST_ROUTER_BW_ESTIMATED ); -// 1. If due to unplug of other sink -if (estimated == host_router_total_estimated_bw) { -// First update the estimated & max_bw fields -if (link->dpia_bw_alloc_config.estimated_bw < estimated) - link->dpia_bw_alloc_config.estimated_bw = estimated; - } -// 2. If due to realloc bw btw 2 dpia due to plug OR realloc unused Bw -else { -// We lost estimated bw usually due to plug event of other dpia - link->dpia_bw_alloc_config.estimated_bw = estimated; - } +DC_LOG_DEBUG ("%s: ESTIMATED BW CHANGED for link(%d)\n" , + __func__, link->link_index); +DC_LOG_DEBUG ("%s: current estimated_bw(%d), new estimated_bw(%d)\n" , + __func__, link->dpia_bw_alloc_config.estimated_bw, estimated); + + link->dpia_bw_alloc_config.estimated_bw = estimated;break ;case DPIA_BW_ALLOC_CAPS_CHANGED : -DC_LOG_DEBUG ("%s: *** BW ALLOC CAPABILITY CHANGED for DP-TX Request ***\n" , __func__); +DC_LOG_ERROR ("%s: BW ALLOC CAPABILITY CHANGED to Disabled for link(%d)\n" , + __func__, link->link_index); link->dpia_bw_alloc_config.bw_alloc_enabled = false;break ; }
@@ -409,11 +387,11 @@ int dpia_handle_usb4_bandwidth_allocation_for_link(struct dc_link *link, int peaset_usb4_req_bw_req (link, link->dpia_bw_alloc_config.sink_max_bw);do { -if (!(timeout >0 )) +if (timeout >0 ) timeout--;else break ; -fsleep (10 *1000 ); +msleep (10 ); }while (!get_cm_response_ready_flag (link));if (!timeout)
@@ -428,37 +406,36 @@ int dpia_handle_usb4_bandwidth_allocation_for_link(struct dc_link *link, int pea out:return ret; } -int link_dp_dpia_allocate_usb4_bandwidth_for_stream (struct dc_link *link,int req_bw) + +bool link_dp_dpia_allocate_usb4_bandwidth_for_stream (struct dc_link *link,int req_bw) { -int ret =0 ; +bool ret = false;uint8_t timeout =10 ; +DC_LOG_DEBUG ("%s: ENTER: link(%d), hpd_status(%d), current allocated_bw(%d), req_bw(%d)\n" , + __func__, link->link_index, link->hpd_status, + link->dpia_bw_alloc_config.sink_allocated_bw, req_bw); +if (!get_bw_alloc_proceed_flag (link)) goto out; -/* -* Sometimes stream uses same timing parameters as the already -* allocated max sink bw so no need to re-alloc -*/ -if (req_bw != link->dpia_bw_alloc_config.sink_allocated_bw) { -set_usb4_req_bw_req (link, req_bw); -do { -if (!(timeout >0 )) - timeout--; -else -break ; -udelay (10 *1000 ); - }while (!get_cm_response_ready_flag (link)); +set_usb4_req_bw_req (link, req_bw); +do { +if (timeout >0 ) + timeout--; +else +break ; +msleep (10 ); + }while (!get_cm_response_ready_flag (link)); -if (!timeout) - ret =0 ;// ERROR TIMEOUT waiting for response for allocating bw -else if (link->dpia_bw_alloc_config.sink_allocated_bw >0 ) - ret =get_host_router_total_bw (link,HOST_ROUTER_BW_ALLOCATED ); - } +if (timeout) + ret = true; out: +DC_LOG_DEBUG ("%s: EXIT: timeout(%d), ret(%d)\n" , __func__, timeout, ret);return ret; } +bool dpia_validate_usb4_bw (struct dc_link **link,int *bw_needed_per_dpia,const unsigned int num_dpias) {bool ret = true;
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.h +2 -2
@@ -59,9 +59,9 @@ bool link_dp_dpia_set_dptx_usb4_bw_alloc_support(struct dc_link *link);* @link: pointer to the dc_link struct instance * @req_bw: Bw requested by the stream * -* return: allocated bw else return 0 +* return: true if allocated successfully */ -int link_dp_dpia_allocate_usb4_bandwidth_for_stream (struct dc_link *link,int req_bw); +bool link_dp_dpia_allocate_usb4_bandwidth_for_stream (struct dc_link *link,int req_bw);/* * Handle the USB4 BW Allocation related functionality here:
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 75/88 drm/amdgpu: Let KFD sync with VM fences
In reply to Sasha LevinFrom: Felix Kuehling <[email protected]>
[ Upstream commit ec9ba4821fa52b5efdbc4cdf0a77497990655231 ]
Change the rules for amdgpu_sync_resv to let KFD synchronize with VM fences on page table reservations. This fixes intermittent memory corruption after evictions when using amdgpu_vm_handle_moved to update page tables for VM mappings managed through render nodes.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c +2 -1
@@ -191,7 +191,8 @@ static bool amdgpu_sync_test_fence(struct amdgpu_device *adev,/* Never sync to VM updates either. */ if (fence_owner ==AMDGPU_FENCE_OWNER_VM && - owner !=AMDGPU_FENCE_OWNER_UNDEFINED ) + owner !=AMDGPU_FENCE_OWNER_UNDEFINED && + owner !=AMDGPU_FENCE_OWNER_KFD )return false;/* Ignore fences depending on the sync mode */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 76/88 drm/amd/display: Fixing stream allocation regression
In reply to Sasha LevinFrom: Relja Vojvodic <[email protected]>
[ Upstream commit 292c2116b2ae84c7e799ae340981e60551b18f5e ]
For certain dual display configs that had one display using a 1080p mode, the DPM level used to drive the configs regressed from DPM 0 to DPM 3. This was caused by a missing check that should have only limited the pipe segments on non-phantom pipes. This caused issues with detile buffer allocation, which dissallow subvp from being used
--- drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource_helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource_helpers.c +1 -1
@@ -290,7 +290,7 @@ static void override_det_for_subvp(struct dc *dc, struct dc_state *context, uintfor (i =0 ; i < dc->res_pool->pipe_count; i++) {struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i]; -if (pipe_ctx->stream && pipe_ctx->plane_state && pipe_ctx->stream->mall_stream_config.type !=SUBVP_PHANTOM ) { +if (pipe_ctx->stream && pipe_ctx->plane_state && pipe_ctx->stream->mall_stream_config.type !=SUBVP_PHANTOM !=SUBVP_PHANTOM ) {if (pipe_ctx->stream->timing.v_addressable ==1080 && pipe_ctx->stream->timing.h_addressable ==1920 ) {if (pipe_segments[i] >4 ) pipe_segments[i] =4 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 77/88 Re-revert "drm/amd/display: Enable Replay for static screen use cases"
In reply to Sasha LevinFrom: Ivan Lipski <[email protected]>
[ Upstream commit d6398866a6b47e92319ef6efdb0126a4fbb7796a ]
This reverts commit 44e60b14d5a72f91fd0bdeae8da59ae37a3ca8e5.
Since, it causes a regression in which eDP displays with PSR support, but no Replay support (Sink support <= 0x03), fail to enable PSR and consequently all IGT amd_psr tests fail. So, revert this until a more suitable fix can be found.
This got brought back accidently with the backmerge.
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 22 ------------------- .../amd/display/amdgpu_dm/amdgpu_dm_crtc.c | 9 +------- drivers/gpu/drm/amd/include/amd_shared.h | 2 -- 3 files changed, 1 insertion(+), 32 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -22
@@ -65,7 +65,6 @@#include "amdgpu_dm_debugfs.h" #endif #include "amdgpu_dm_psr.h" -#include "amdgpu_dm_replay.h" #include "ivsrcid/ivsrcid_vislands30.h"
@@ -4345,7 +4344,6 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)enum dc_connection_type new_connection_type = dc_connection_none;const struct dc_plane_cap *plane;bool psr_feature_enabled = false; -bool replay_feature_enabled = false;int max_overlay = dm->dc->caps.max_slave_planes; dm->display_indexes_num = dm->dc->caps.max_streams;
@@ -4457,20 +4455,6 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) } } -if (!(amdgpu_dc_debug_mask &DC_DISABLE_REPLAY )) { -switch (adev->ip_versions[DCE_HWIP ][0 ]) { -case IP_VERSION (3 ,1 ,4 ): -case IP_VERSION (3 ,1 ,5 ): -case IP_VERSION (3 ,1 ,6 ): -case IP_VERSION (3 ,2 ,0 ): -case IP_VERSION (3 ,2 ,1 ): - replay_feature_enabled = true; -break ; -default : - replay_feature_enabled = amdgpu_dc_feature_mask &DC_REPLAY_MASK ; -break ; - } - }/* loops over all connectors on the board */ for (i =0 ; i < link_cnt; i++) {struct dc_link *link =NULL ;
@@ -4519,12 +4503,6 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)amdgpu_dm_update_connector_after_detect (aconnector);setup_backlight_device (dm, aconnector); -/* -* Disable psr if replay can be enabled -*/ -if (replay_feature_enabled &&amdgpu_dm_setup_replay (link, aconnector)) - psr_feature_enabled = false; -if (psr_feature_enabled)amdgpu_dm_set_psr_caps (link);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c +1 -8
@@ -29,7 +29,6 @@#include "dc.h" #include "amdgpu.h" #include "amdgpu_dm_psr.h" -#include "amdgpu_dm_replay.h" #include "amdgpu_dm_crtc.h" #include "amdgpu_dm_plane.h" #include "amdgpu_dm_trace.h"
@@ -124,12 +123,7 @@ static void amdgpu_dm_crtc_vblank_control_worker(struct work_struct *work)* fill_dc_dirty_rects(). */ if (vblank_work->stream && vblank_work->stream->link) { -/* -* Prioritize replay, instead of psr -*/ -if (vblank_work->stream->link->replay_settings.replay_feature_enabled) -amdgpu_dm_replay_enable (vblank_work->stream, false); -else if (vblank_work->enable) { +if (vblank_work->enable) {if (vblank_work->stream->link->psr_settings.psr_version <DC_PSR_VERSION_SU_1 && vblank_work->stream->link->psr_settings.psr_allow_active)amdgpu_dm_psr_disable (vblank_work->stream);
@@ -138,7 +132,6 @@ static void amdgpu_dm_crtc_vblank_control_worker(struct work_struct *work)#ifdef CONFIG_DRM_AMD_SECURE_DISPLAY !amdgpu_dm_crc_window_is_activated(&vblank_work->acrtc->base) && #endif - vblank_work->stream->link->panel_config.psr.disallow_replay && vblank_work->acrtc->dm_irq_params.allow_psr_entry) {amdgpu_dm_psr_enable (vblank_work->stream); }
drivers/gpu/drm/amd/include/amd_shared.h +0 -2
@@ -244,7 +244,6 @@ enum DC_FEATURE_MASK {DC_DISABLE_LTTPR_DP2_0 = (1 <<6 ),//0x40, disabled by default DC_PSR_ALLOW_SMU_OPT = (1 <<7 ),//0x80, disabled by default DC_PSR_ALLOW_MULTI_DISP_OPT = (1 << 8), //0x100, disabled by default - DC_REPLAY_MASK = (1 << 9), //0x200, disabled by default for dcn < 3.1.4 }; enum DC_DEBUG_MASK {
@@ -255,7 +254,6 @@ enum DC_DEBUG_MASK {DC_DISABLE_PSR =0x10 ,DC_FORCE_SUBVP_MCLK_SWITCH =0x20 ,DC_DISABLE_MPO =0x40 , -DC_DISABLE_REPLAY =0x50 , DC_ENABLE_DPIA_TRACE = 0x80, };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 78/88 drm/amdgpu: Fix possible NULL dereference in amdgpu_ras_query_error_status_helper()
In reply to Sasha LevinFrom: Srinivasan Shanmugam <[email protected]>
[ Upstream commit b8d55a90fd55b767c25687747e2b24abd1ef8680 ]
Return invalid error code -EINVAL for invalid block id.
Fixes the below:
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1183 amdgpu_ras_query_error_status_helper() error: we previously assumed 'info' could be null (see line 1176)
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +3 -0
@@ -1174,6 +1174,9 @@ static int amdgpu_ras_query_error_status_helper(struct amdgpu_device *adev,enum amdgpu_ras_block blk = info ? info->head.block :AMDGPU_RAS_BLOCK_COUNT ;struct amdgpu_ras_block_object *block_obj =NULL ; +if (blk ==AMDGPU_RAS_BLOCK_COUNT ) +return -EINVAL ; +if (error_query_mode ==AMDGPU_RAS_INVALID_ERROR_QUERY )return -EINVAL ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 79/88 drm/amdgpu: Fix variable 'mca_funcs' dereferenced before NULL check in 'amdgpu_mca_smu_get_mca_entry()'
In reply to Sasha LevinFrom: Srinivasan Shanmugam <[email protected]>
[ Upstream commit 4f32504a2f85a7b40fe149436881381f48e9c0c0 ]
Fixes the below:
drivers/gpu/drm/amd/amdgpu/amdgpu_mca.c:377 amdgpu_mca_smu_get_mca_entry() warn: variable dereferenced before check 'mca_funcs' (see line 368)
357 int amdgpu_mca_smu_get_mca_entry(struct amdgpu_device *adev,
enum amdgpu_mca_error_type type,
358 int idx, struct mca_bank_entry *entry)
359 {
360 const struct amdgpu_mca_smu_funcs *mca_funcs =
adev->mca.mca_funcs;
361 int count;
362
363 switch (type) {
364 case AMDGPU_MCA_ERROR_TYPE_UE:
365 count = mca_funcs->max_ue_count;
mca_funcs is dereferenced here.
366 break;
367 case AMDGPU_MCA_ERROR_TYPE_CE:
368 count = mca_funcs->max_ce_count;
mca_funcs is dereferenced here.
369 break;
370 default:
371 return -EINVAL;
372 }
373
374 if (idx >= count)
375 return -EINVAL;
376
377 if (mca_funcs && mca_funcs->mca_get_mca_entry)
^^^^^^^^^
Checked too late!
--- drivers/gpu/drm/amd/amdgpu/amdgpu_mca.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_mca.c +4 -4
@@ -351,6 +351,9 @@ int amdgpu_mca_smu_get_mca_entry(struct amdgpu_device *adev, enum amdgpu_mca_errconst struct amdgpu_mca_smu_funcs *mca_funcs = adev->mca.mca_funcs;int count; +if (!mca_funcs || !mca_funcs->mca_get_mca_entry) +return -EOPNOTSUPP ; +switch (type) {case AMDGPU_MCA_ERROR_TYPE_UE : count = mca_funcs->max_ue_count;
@@ -365,10 +368,7 @@ int amdgpu_mca_smu_get_mca_entry(struct amdgpu_device *adev, enum amdgpu_mca_errif (idx >= count)return -EINVAL ; -if (mca_funcs && mca_funcs->mca_get_mca_entry) -return mca_funcs->mca_get_mca_entry (adev, type, idx, entry); - -return -EOPNOTSUPP ; +return mca_funcs->mca_get_mca_entry (adev, type, idx, entry); }#if defined(CONFIG_DEBUG_FS )
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 80/88 drm/amdgpu: Fix '*fw' from request_firmware() not released in 'amdgpu_ucode_request()'
In reply to Sasha LevinFrom: Srinivasan Shanmugam <[email protected]>
[ Upstream commit 13a1851f923d9a7a78a477497295c2dfd16ad4a4 ]
Fixes the below:drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c:1404 amdgpu_ucode_request() warn: '*fw' from request_firmware() not released on lines: 1404.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +5 -1
@@ -1397,9 +1397,13 @@ int amdgpu_ucode_request(struct amdgpu_device *adev, const struct firmware **fw,if (err)return -ENODEV ; + err =amdgpu_ucode_validate (*fw); -if (err) +if (err) {dev_dbg (adev->dev,"\"%s\" failed to validate\n" , fw_name); +release_firmware (*fw); + *fw =NULL ; + }return err; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 81/88 drm/amdgpu: Drop 'fence' check in 'to_amdgpu_amdkfd_fence()'
In reply to Sasha LevinFrom: Srinivasan Shanmugam <[email protected]>
[ Upstream commit bf2ad4fb8adca89374b54b225d494e0b1956dbea ]
Return value of container_of(...) can't be null, so null check is not required for 'fence'. Hence drop its NULL check.
Fixes the below:drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c:93 to_amdgpu_amdkfd_fence() warn: can 'fence' even be NULL?
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c +1 -1
@@ -90,7 +90,7 @@ struct amdgpu_amdkfd_fence *to_amdgpu_amdkfd_fence(struct dma_fence *f)return NULL ; fence = container_of(f, struct amdgpu_amdkfd_fence, base); -if (fence && f->ops == &amdkfd_fence_ops) +if (f->ops == &amdkfd_fence_ops)return fence;return NULL ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 82/88 drm/amdkfd: Fix iterator used outside loop in 'kfd_add_peer_prop()'
In reply to Sasha LevinFrom: Srinivasan Shanmugam <[email protected]>
[ Upstream commit b1a428b45dc7e47c7acc2ad0d08d8a6dda910c4c ]
Fix the following about iterator use:drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_topology.c:1456 kfd_add_peer_prop() warn: iterator used outside loop: 'iolink3'
--- drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 24 ++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +13 -11
@@ -1449,17 +1449,19 @@ static int kfd_add_peer_prop(struct kfd_topology_device *kdev,/* CPU->CPU link*/ cpu_dev =kfd_topology_device_by_proximity_domain (iolink1->node_to);if (cpu_dev) { -list_for_each_entry (iolink3, &cpu_dev->io_link_props, list) -if (iolink3->node_to == iolink2->node_to) -break ; - - props->weight += iolink3->weight; - props->min_latency += iolink3->min_latency; - props->max_latency += iolink3->max_latency; - props->min_bandwidth =min (props->min_bandwidth, - iolink3->min_bandwidth); - props->max_bandwidth =min (props->max_bandwidth, - iolink3->max_bandwidth); +list_for_each_entry (iolink3, &cpu_dev->io_link_props, list) { +if (iolink3->node_to != iolink2->node_to) +continue ; + + props->weight += iolink3->weight; + props->min_latency += iolink3->min_latency; + props->max_latency += iolink3->max_latency; + props->min_bandwidth =min (props->min_bandwidth, + iolink3->min_bandwidth); + props->max_bandwidth =min (props->max_bandwidth, + iolink3->max_bandwidth); +break ; + } }else {WARN (1 ,"CPU node not found" ); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 83/88 Revert "drm/amdkfd: Relocate TBA/TMA to opposite side of VM hole"
In reply to Sasha LevinFrom: Kaibo Ma <[email protected]>
[ Upstream commit 0f35b0a7b8fa402adbffa2565047cdcc4c480153 ]
That commit causes NULL pointer dereferences in dmesgs when running applications using ROCm, including clinfo, blender, and PyTorch, since v6.6.1. Revert it to fix blender again.
This reverts commit 96c211f1f9ef82183493f4ceed4e347b52849149.
--- drivers/gpu/drm/amd/amdkfd/kfd_flat_memory.c | 26 ++++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_flat_memory.c +13 -13
@@ -330,12 +330,6 @@ static void kfd_init_apertures_vi(struct kfd_process_device *pdd, uint8_t id) pdd->gpuvm_limit = pdd->dev->kfd->shared_resources.gpuvm_size -1 ; -/* dGPUs: the reserved space for kernel -* before SVM -*/ - pdd->qpd.cwsr_base =SVM_CWSR_BASE ; - pdd->qpd.ib_base =SVM_IB_BASE ; - pdd->scratch_base =MAKE_SCRATCH_APP_BASE_VI (); pdd->scratch_limit =MAKE_SCRATCH_APP_LIMIT (pdd->scratch_base); }
@@ -345,18 +339,18 @@ static void kfd_init_apertures_v9(struct kfd_process_device *pdd, uint8_t id) pdd->lds_base =MAKE_LDS_APP_BASE_V9 (); pdd->lds_limit =MAKE_LDS_APP_LIMIT (pdd->lds_base); - pdd->gpuvm_base =PAGE_SIZE ; +/* Raven needs SVM to support graphic handle, etc. Leave the small +* reserved space before SVM on Raven as well, even though we don't +* have to. +* Set gpuvm_base and gpuvm_limit to CANONICAL addresses so that they +* are used in Thunk to reserve SVM. +*/ + pdd->gpuvm_base =SVM_USER_BASE ; pdd->gpuvm_limit = pdd->dev->kfd->shared_resources.gpuvm_size -1 ; pdd->scratch_base =MAKE_SCRATCH_APP_BASE_V9 (); pdd->scratch_limit =MAKE_SCRATCH_APP_LIMIT (pdd->scratch_base); - -/* -* Place TBA/TMA on opposite side of VM hole to prevent -* stray faults from triggering SVM on these pages. -*/ - pdd->qpd.cwsr_base = pdd->dev->kfd->shared_resources.gpuvm_size; }int kfd_init_apertures (struct kfd_process *process)
@@ -413,6 +407,12 @@ int kfd_init_apertures(struct kfd_process *process)return -EINVAL ; } } + +/* dGPUs: the reserved space for kernel +* before SVM +*/ + pdd->qpd.cwsr_base =SVM_CWSR_BASE ; + pdd->qpd.ib_base =SVM_IB_BASE ; }dev_dbg (kfd_device,"node id %u\n" , id);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 84/88 drm/amdgpu: apply the RV2 system aperture fix to RN/CZN as well
In reply to Sasha LevinFrom: Alex Deucher <[email protected]>
[ Upstream commit 16783d8ef08448815e149e40c82fc1e1fc41ddbf ]
These chips needs the same fix. This was previously not seen on then since the AGP aperture expanded the system aperture, but this showed up again when AGP was disabled.
--- drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c | 4 +++- drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c | 4 +++- drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c | 4 +++- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 8 ++++++-- 4 files changed, 15 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c +3 -1
@@ -102,7 +102,9 @@ static void gfxhub_v1_0_init_system_aperture_regs(struct amdgpu_device *adev)WREG32_SOC15_RLC (GC ,0 , mmMC_VM_SYSTEM_APERTURE_LOW_ADDR,min (adev->gmc.fb_start, adev->gmc.agp_start) >>18 ); -if (adev->apu_flags &AMD_APU_IS_RAVEN2 ) +if (adev->apu_flags & (AMD_APU_IS_RAVEN2 | +AMD_APU_IS_RENOIR | +AMD_APU_IS_GREEN_SARDINE ))/* * Raven2 has a HW issue that it is unable to use the * vram which is out of MC_VM_SYSTEM_APERTURE_HIGH_ADDR.
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c +3 -1
@@ -139,7 +139,9 @@ gfxhub_v1_2_xcc_init_system_aperture_regs(struct amdgpu_device *adev,WREG32_SOC15_RLC (GC ,GET_INST (GC , i), regMC_VM_SYSTEM_APERTURE_LOW_ADDR,min (adev->gmc.fb_start, adev->gmc.agp_start) >>18 ); -if (adev->apu_flags &AMD_APU_IS_RAVEN2 ) +if (adev->apu_flags & (AMD_APU_IS_RAVEN2 | +AMD_APU_IS_RENOIR | +AMD_APU_IS_GREEN_SARDINE ))/* * Raven2 has a HW issue that it is unable to use the * vram which is out of MC_VM_SYSTEM_APERTURE_HIGH_ADDR.
drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c +3 -1
@@ -96,7 +96,9 @@ static void mmhub_v1_0_init_system_aperture_regs(struct amdgpu_device *adev)WREG32_SOC15 (MMHUB ,0 , mmMC_VM_SYSTEM_APERTURE_LOW_ADDR,min (adev->gmc.fb_start, adev->gmc.agp_start) >>18 ); -if (adev->apu_flags &AMD_APU_IS_RAVEN2 ) +if (adev->apu_flags & (AMD_APU_IS_RAVEN2 | +AMD_APU_IS_RENOIR | +AMD_APU_IS_GREEN_SARDINE ))/* * Raven2 has a HW issue that it is unable to use the vram which * is out of MC_VM_SYSTEM_APERTURE_HIGH_ADDR. So here is the
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +6 -2
@@ -1257,7 +1257,9 @@ static void mmhub_read_system_context(struct amdgpu_device *adev, struct dc_phy_/* AGP aperture is disabled */ if (agp_bot > agp_top) { logical_addr_low = adev->gmc.fb_start >>18 ; -if (adev->apu_flags &AMD_APU_IS_RAVEN2 ) +if (adev->apu_flags & (AMD_APU_IS_RAVEN2 | +AMD_APU_IS_RENOIR | +AMD_APU_IS_GREEN_SARDINE ))/* * Raven2 has a HW issue that it is unable to use the vram which * is out of MC_VM_SYSTEM_APERTURE_HIGH_ADDR. So here is the
@@ -1269,7 +1271,9 @@ static void mmhub_read_system_context(struct amdgpu_device *adev, struct dc_phy_ logical_addr_high = adev->gmc.fb_end >>18 ; }else { logical_addr_low =min (adev->gmc.fb_start, adev->gmc.agp_start) >>18 ; -if (adev->apu_flags &AMD_APU_IS_RAVEN2 ) +if (adev->apu_flags & (AMD_APU_IS_RAVEN2 | +AMD_APU_IS_RENOIR | +AMD_APU_IS_GREEN_SARDINE ))/* * Raven2 has a HW issue that it is unable to use the vram which * is out of MC_VM_SYSTEM_APERTURE_HIGH_ADDR. So here is the
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 85/88 ALSA: hda/conexant: Fix headset auto detect fail in cx8070 and SN6140
In reply to Sasha LevinFrom: bo liu <[email protected]>
[ Upstream commit 7aeb259086487417f0fecf66e325bee133e8813a ]
When OMTP headset plugin the headset jack of CX8070 and SN6160 sound cards, the headset type detection circuit will recognize the headset type as CTIA. At this point, plugout and plugin the headset will get the correct headset type as OMTP.
The reason for the failure of headset type recognition is that the sound card creation will enable the VREF voltage of the headset mic, which interferes with the headset type automatic detection circuit. Plugout and plugin the headset will restart the headset detection and get the correct headset type.
The patch is disable the VREF voltage when the headset is not present, and will enable the VREF voltage when the headset is present.
--- sound/pci/hda/patch_conexant.c | 115 ++++++++++++++++++++++++++++++++- 1 file changed, 113 insertions(+), 2 deletions(-)
sound/pci/hda/patch_conexant.c +113 -2
@@ -21,6 +21,12 @@#include "hda_jack.h" #include "hda_generic.h" +enum { +CX_HEADSET_NOPRESENT =0 , +CX_HEADSET_PARTPRESENT , +CX_HEADSET_ALLPRESENT , +}; +struct conexant_spec {struct hda_gen_spec gen;
@@ -42,7 +48,8 @@ struct conexant_spec {unsigned int gpio_led;unsigned int gpio_mute_led_mask;unsigned int gpio_mic_led_mask; - +unsigned int headset_present_flag; +bool is_cx8070_sn6140; };
@@ -164,6 +171,27 @@ static void cxt_init_gpio_led(struct hda_codec *codec) } } +static void cx_fixup_headset_recog (struct hda_codec *codec) +{ +unsigned int mic_persent; + +/* fix some headset type recognize fail issue, such as EDIFIER headset */ +/* set micbiasd output current comparator threshold from 66% to 55%. */ +snd_hda_codec_write (codec,0x1c ,0 ,0x320 ,0x010 ); +/* set OFF voltage for DFET from -1.2V to -0.8V, set headset micbias registor +* value adjustment trim from 2.2K ohms to 2.0K ohms. +*/ +snd_hda_codec_write (codec,0x1c ,0 ,0x3b0 ,0xe10 ); +/* fix reboot headset type recognize fail issue */ + mic_persent =snd_hda_codec_read (codec,0x19 ,0 ,AC_VERB_GET_PIN_SENSE ,0x0 ); +if (mic_persent &AC_PINSENSE_PRESENCE ) +/* enable headset mic VREF */ +snd_hda_codec_write (codec,0x19 ,0 ,AC_VERB_SET_PIN_WIDGET_CONTROL ,0x24 ); +else +/* disable headset mic VREF */ +snd_hda_codec_write (codec,0x19 ,0 ,AC_VERB_SET_PIN_WIDGET_CONTROL ,0x20 ); +} +static int cx_auto_init (struct hda_codec *codec) {struct conexant_spec *spec = codec->spec;
@@ -174,6 +202,9 @@ static int cx_auto_init(struct hda_codec *codec)cxt_init_gpio_led (codec);snd_hda_apply_fixup (codec,HDA_FIXUP_ACT_INIT ); +if (spec->is_cx8070_sn6140) +cx_fixup_headset_recog (codec); +return 0 ; }
@@ -192,6 +223,77 @@ static void cx_auto_free(struct hda_codec *codec)snd_hda_gen_free (codec); } +static void cx_process_headset_plugin (struct hda_codec *codec) +{ +unsigned int val; +unsigned int count =0 ; + +/* Wait headset detect done. */ +do { + val =snd_hda_codec_read (codec,0x1c ,0 ,0xca0 ,0x0 ); +if (val &0x080 ) { +codec_dbg (codec,"headset type detect done!\n" ); +break ; + } +msleep (20 ); + count++; + }while (count <3 ); + val =snd_hda_codec_read (codec,0x1c ,0 ,0xcb0 ,0x0 ); +if (val &0x800 ) { +codec_dbg (codec,"headset plugin, type is CTIA\n" ); +snd_hda_codec_write (codec,0x19 ,0 ,AC_VERB_SET_PIN_WIDGET_CONTROL ,0x24 ); + }else if (val &0x400 ) { +codec_dbg (codec,"headset plugin, type is OMTP\n" ); +snd_hda_codec_write (codec,0x19 ,0 ,AC_VERB_SET_PIN_WIDGET_CONTROL ,0x24 ); + }else { +codec_dbg (codec,"headphone plugin\n" ); + } +} + +static void cx_update_headset_mic_vref (struct hda_codec *codec,unsigned int res) +{ +unsigned int phone_present, mic_persent, phone_tag, mic_tag; +struct conexant_spec *spec = codec->spec; + +/* In cx8070 and sn6140, the node 16 can only be config to headphone or disabled, +* the node 19 can only be config to microphone or disabled. +* Check hp&mic tag to process headset pulgin&plugout. +*/ + phone_tag =snd_hda_codec_read (codec,0x16 ,0 ,AC_VERB_GET_UNSOLICITED_RESPONSE ,0x0 ); + mic_tag =snd_hda_codec_read (codec,0x19 ,0 ,AC_VERB_GET_UNSOLICITED_RESPONSE ,0x0 ); +if ((phone_tag & (res >>AC_UNSOL_RES_TAG_SHIFT )) || + (mic_tag & (res >>AC_UNSOL_RES_TAG_SHIFT ))) { + phone_present =snd_hda_codec_read (codec,0x16 ,0 ,AC_VERB_GET_PIN_SENSE ,0x0 ); +if (!(phone_present &AC_PINSENSE_PRESENCE )) {/* headphone plugout */ + spec->headset_present_flag =CX_HEADSET_NOPRESENT ; +snd_hda_codec_write (codec,0x19 ,0 ,AC_VERB_SET_PIN_WIDGET_CONTROL ,0x20 ); +return ; + } +if (spec->headset_present_flag ==CX_HEADSET_NOPRESENT ) { + spec->headset_present_flag =CX_HEADSET_PARTPRESENT ; + }else if (spec->headset_present_flag ==CX_HEADSET_PARTPRESENT ) { + mic_persent =snd_hda_codec_read (codec,0x19 ,0 , +AC_VERB_GET_PIN_SENSE ,0x0 ); +/* headset is present */ +if ((phone_present &AC_PINSENSE_PRESENCE ) && + (mic_persent &AC_PINSENSE_PRESENCE )) { +cx_process_headset_plugin (codec); + spec->headset_present_flag =CX_HEADSET_ALLPRESENT ; + } + } + } +} + +static void cx_jack_unsol_event (struct hda_codec *codec,unsigned int res) +{ +struct conexant_spec *spec = codec->spec; + +if (spec->is_cx8070_sn6140) +cx_update_headset_mic_vref (codec, res); + +snd_hda_jack_unsol_event (codec, res); +} +#ifdef CONFIG_PM static int cx_auto_suspend (struct hda_codec *codec) {
@@ -205,7 +307,7 @@ static const struct hda_codec_ops cx_auto_patch_ops = { .build_pcms = snd_hda_gen_build_pcms, .init = cx_auto_init, .free = cx_auto_free, - .unsol_event = snd_hda_jack_unsol_event, + .unsol_event = cx_jack_unsol_event, #ifdef CONFIG_PM .suspend = cx_auto_suspend, .check_power_status = snd_hda_gen_check_power_status,
@@ -1042,6 +1144,15 @@ static int patch_conexant_auto(struct hda_codec *codec) codec->spec = spec; codec->patch_ops = cx_auto_patch_ops; +/* init cx8070/sn6140 flag and reset headset_present_flag */ +switch (codec->core.vendor_id) { +case 0x14f11f86 : +case 0x14f11f87 : + spec->is_cx8070_sn6140 = true; + spec->headset_present_flag =CX_HEADSET_NOPRESENT ; +break ; + } +cx_auto_parse_eapd (codec); spec->gen.own_eapd_ctl =1 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 86/88 ksmbd: set v2 lease version on lease upgrade
In reply to Sasha LevinFrom: Namjae Jeon <[email protected]>
[ Upstream commit bb05367a66a9990d2c561282f5620bb1dbe40c28 ]
If file opened with v2 lease is upgraded with v1 lease, smb server should response v2 lease create context to client.
This patch fix smb2.lease.v2_epoch2 test failure.
This test case assumes the following scenario:
1. smb2 create with v2 lease(R, LEASE1 key)
2. smb server return smb2 create response with v2 lease context(R,
LEASE1 key, epoch + 1)
3. smb2 create with v1 lease(RH, LEASE1 key)
4. smb server return smb2 create response with v2 lease context(RH,
LEASE1 key, epoch + 2)
i.e. If same client(same lease key) try to open a file that is being opened with v2 lease with v1 lease, smb server should return v2 lease.
--- fs/smb/server/oplock.c | 1 + 1 file changed, 1 insertion(+)
fs/smb/server/oplock.c +1 -0
@@ -1036,6 +1036,7 @@ static void copy_lease(struct oplock_info *op1, struct oplock_info *op2) lease2->duration = lease1->duration; lease2->flags = lease1->flags; lease2->epoch = lease1->epoch++; + lease2->version = lease1->version; }static int add_lease_global_list (struct oplock_info *opinfo)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 87/88 ksmbd: fix potential circular locking issue in smb2_set_ea()
In reply to Sasha LevinFrom: Namjae Jeon <[email protected]>
[ Upstream commit 6fc0a265e1b932e5e97a038f99e29400a93baad0 ]
smb2_set_ea() can be called in parent inode lock range. So add get_write argument to smb2_set_ea() not to call nested mnt_want_write().
--- fs/smb/server/smb2pdu.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
fs/smb/server/smb2pdu.c +4 -3
@@ -2311,11 +2311,12 @@ static noinline int create_smb2_pipe(struct ksmbd_work *work)* @eabuf: set info command buffer * @buf_len: set info command buffer length * @path: dentry path for get ea +* @get_write: get write access to a mount * * Return: 0 on success, otherwise error */ static int smb2_set_ea (struct smb2_ea_info *eabuf,unsigned int buf_len, -const struct path *path) +const struct path *path,bool get_write) {struct mnt_idmap *idmap =mnt_idmap (path->mnt);char *attr_name =NULL , *value;
@@ -3003,7 +3004,7 @@ int smb2_open(struct ksmbd_work *work) rc =smb2_set_ea (&ea_buf->ea,le32_to_cpu (ea_buf->ccontext.DataLength), - &path); + &path, false);if (rc == -EOPNOTSUPP ) rc =0 ;else if (rc)
@@ -5992,7 +5993,7 @@ static int smb2_set_info_file(struct ksmbd_work *work, struct ksmbd_file *fp,return -EINVAL ;return smb2_set_ea ((struct smb2_ea_info *)req->Buffer, - buf_len, &fp->filp->f_path); + buf_len, &fp->filp->f_path, true); }case FILE_POSITION_INFORMATION : {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 88/88 ksmbd: send lease break notification on FILE_RENAME_INFORMATION
In reply to Sasha LevinFrom: Namjae Jeon <[email protected]>
[ Upstream commit 3fc74c65b367476874da5fe6f633398674b78e5a ]
Send lease break notification on FILE_RENAME_INFORMATION request. This patch fix smb2.lease.v2_epoch2 test failure.
--- fs/smb/server/oplock.c | 9 +++++++-- fs/smb/server/smb2pdu.c | 1 + 2 files changed, 8 insertions(+), 2 deletions(-)
fs/smb/server/oplock.c +7 -2
@@ -546,6 +546,7 @@ static struct oplock_info *same_client_has_lease(struct ksmbd_inode *ci, atomic_read(&ci->sop_count)) == 1) {if (lease->state !=SMB2_LEASE_NONE_LE && lease->state == (lctx->req_state & lease->state)) { + lease->epoch++; lease->state |= lctx->req_state;if (lctx->req_state &SMB2_LEASE_WRITE_CACHING_LE )
@@ -556,13 +557,17 @@ static struct oplock_info *same_client_has_lease(struct ksmbd_inode *ci, atomic_read(&ci->sop_count)) > 1) {if (lctx->req_state == (SMB2_LEASE_READ_CACHING_LE | -SMB2_LEASE_HANDLE_CACHING_LE )) +SMB2_LEASE_HANDLE_CACHING_LE )) { + lease->epoch++; lease->state = lctx->req_state; + } }if (lctx->req_state && lease->state == -SMB2_LEASE_NONE_LE ) +SMB2_LEASE_NONE_LE ) { + lease->epoch++;lease_none_upgrade (opinfo, lctx->req_state); + } }read_lock (&ci->m_lock); }
fs/smb/server/smb2pdu.c +1 -0
@@ -5569,6 +5569,7 @@ static int smb2_rename(struct ksmbd_work *work,if (!file_info->ReplaceIfExists) flags =RENAME_NOREPLACE ; +smb_break_all_levII_oplock (work, fp,0 ); rc =ksmbd_vfs_rename (work, &fp->filp->f_path, new_name, flags); out:kfree (new_name);
Signature · 1 line
2.43.0
Re: [PATCH AUTOSEL 6.7 72/88] ALSA: hda/tas2781: add fixup for Lenovo 14ARB7
In reply to Sasha LevinHi Sasha,
This patch needs additional patches to work:
dcaca1b5f0d4 ALSA: hda/tas2781: annotate calibration data endianness c3ca4458cc2f ALSA: hda/tas2781: add TAS2563 support for 14ARB7 c021ca729fe8 ALSA: hda/tas2781: add configurable global i2c address 76f5f55c45b9 ALSA: hda/tas2781: add ptrs to calibration functions 68f7f3ff6c2a ALSA: hda/tas2781: configure the amp after firmware load
Please add these if possible, or drop this patch from 6.6 and 6.7.
Thanks,
Gergo
Quoted 61 lines · Sasha Levin
From: Gergo Koteles <[email protected]>
[ Upstream commit
b5cb53fd32779f3a971c45bcd997ae2608aa1086]The 14ARB7 has two tas2563 amplifier on i2c.
Connect it to the tas2781 driver.Signed-off-by Gergo Koteles <[email protected]>Link https://lore.kernel.org/r/abce9ee55689523562feb72383377171a489ddc7.1703891777.git.soyer@irl.hu open hereSigned-off-by Takashi Iwai <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- sound/pci/hda/patch_realtek.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)sound/pci/hda/patch_realtek.c +14
-0@@ -6984,6 +6984,12 @@ static void tas2781_fixup_i2c(struct hda_codec *cdc,tas2781_generic_fixup (cdc, action,"i2c" ,"TIAS2781" ); } +static void yoga7_14arb7_fixup_i2c (struct hda_codec *cdc, +const struct hda_fixup *fix,int action) +{ +tas2781_generic_fixup (cdc, action,"i2c" ,"INT8866" ); +} +/* for alc295_fixup_hp_top_speakers */ #include "hp_x360_helper.c" @@ -7454,6 +7460,7 @@ enum {ALC236_FIXUP_DELL_DUAL_CODECS ,ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI ,ALC287_FIXUP_TAS2781_I2C , +ALC287_FIXUP_YOGA7_14ARB7_I2C ,ALC245_FIXUP_HP_MUTE_LED_COEFBIT ,ALC245_FIXUP_HP_X360_MUTE_LEDS , ALC287_FIXUP_THINKPAD_I2S_SPK,@@ -9568,6 +9575,12 @@ static const struct hda_fixup alc269_fixups[] = { .chained = true, .chain_id = ALC269_FIXUP_THINKPAD_ACPI, }, + [ALC287_FIXUP_YOGA7_14ARB7_I2C] = { + .type = HDA_FIXUP_FUNC, + .v.func = yoga7_14arb7_fixup_i2c, + .chained = true, + .chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK, + }, [ALC245_FIXUP_HP_MUTE_LED_COEFBIT] = { .type = HDA_FIXUP_FUNC, .v.func = alc245_fixup_hp_mute_led_coefbit,@@ -10221,6 +10234,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x17aa ,0x3853 ,"Lenovo Yoga 7 15ITL5" ,ALC287_FIXUP_YOGA7_14ITL_SPEAKERS ),SND_PCI_QUIRK (0x17aa ,0x3855 ,"Legion 7 16ITHG6" ,ALC287_FIXUP_LEGION_16ITHG6 ),SND_PCI_QUIRK (0x17aa ,0x3869 ,"Lenovo Yoga7 14IAL7" ,ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN ), +SND_PCI_QUIRK (0x17aa ,0x3870 ,"Lenovo Yoga 7 14ARB7" ,ALC287_FIXUP_YOGA7_14ARB7_I2C ),SND_PCI_QUIRK (0x17aa ,0x387d ,"Yoga S780-16 pro Quad AAC" ,ALC287_FIXUP_TAS2781_I2C ),SND_PCI_QUIRK (0x17aa ,0x387e ,"Yoga S780-16 pro Quad YC" ,ALC287_FIXUP_TAS2781_I2C ), SND_PCI_QUIRK(0x17aa, 0x3881, "YB9 dual power mode2 YC", ALC287_FIXUP_TAS2781_I2C),