6.8.2-rc1 review
Subsystems (13)
Sasha Levin
maintainerPATCH 407/715 quota: Properly annotate i_dquot arrays with __rcu
In reply to Sasha LevinFrom: Jan Kara <[email protected]>
[ Upstream commit ccb49011bb2ebfd66164dbf68c5bff48917bb5ef ]
Dquots pointed to from i_dquot arrays in inodes are protected by dquot_srcu. Annotate them as such and change .get_dquots callback to return properly annotated pointer to make sparse happy.
--- fs/ext2/ext2.h | 2 +- fs/ext2/super.c | 2 +- fs/ext4/ext4.h | 2 +- fs/ext4/super.c | 2 +- fs/f2fs/f2fs.h | 2 +- fs/f2fs/super.c | 2 +- fs/jfs/jfs_incore.h | 2 +- fs/jfs/super.c | 2 +- fs/ocfs2/inode.h | 2 +- fs/ocfs2/super.c | 2 +- fs/quota/dquot.c | 3 +-- fs/reiserfs/reiserfs.h | 2 +- fs/reiserfs/super.c | 2 +- include/linux/fs.h | 2 +- include/linux/shmem_fs.h | 2 +- mm/shmem.c | 2 +- 16 files changed, 16 insertions(+), 17 deletions(-)
fs/ext2/ext2.h +1 -1
@@ -674,7 +674,7 @@ struct ext2_inode_info {struct inode vfs_inode;struct list_head i_orphan;/* unlinked but open inodes */ #ifdef CONFIG_QUOTA -struct dquot *i_dquot[MAXQUOTAS ]; +struct dquot __rcu *i_dquot[MAXQUOTAS ];#endif };
fs/ext2/super.c +1 -1
@@ -320,7 +320,7 @@ static ssize_t ext2_quota_read(struct super_block *sb, int type, char *data, sizstatic ssize_t ext2_quota_write (struct super_block *sb,int type,const char *data,size_t len,loff_t off);static int ext2_quota_on (struct super_block *sb,int type,int format_id,const struct path *path); -static struct dquot **ext2_get_dquots (struct inode *inode) +static struct dquot __rcu **ext2_get_dquots (struct inode *inode) {return EXT2_I (inode)->i_dquot; }
fs/ext4/ext4.h +1 -1
@@ -1158,7 +1158,7 @@ struct ext4_inode_info {tid_t i_datasync_tid;#ifdef CONFIG_QUOTA -struct dquot *i_dquot[MAXQUOTAS ]; +struct dquot __rcu *i_dquot[MAXQUOTAS ];#endif /* Precomputed uuid+inum+igen checksum for seeding inode checksums */
fs/ext4/super.c +1 -1
@@ -1600,7 +1600,7 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type,static int ext4_quota_enable (struct super_block *sb,int type,int format_id,unsigned int flags); -static struct dquot **ext4_get_dquots (struct inode *inode) +static struct dquot __rcu **ext4_get_dquots (struct inode *inode) {return EXT4_I (inode)->i_dquot; }
fs/f2fs/f2fs.h +1 -1
@@ -829,7 +829,7 @@ struct f2fs_inode_info {spinlock_t i_size_lock;/* protect last_disk_size */ #ifdef CONFIG_QUOTA -struct dquot *i_dquot[MAXQUOTAS ]; +struct dquot __rcu *i_dquot[MAXQUOTAS ];/* quota space reservation, managed internally by quota code */ qsize_t i_reserved_quota;
fs/f2fs/super.c +1 -1
@@ -2768,7 +2768,7 @@ int f2fs_dquot_initialize(struct inode *inode)return dquot_initialize (inode); } -static struct dquot **f2fs_get_dquots (struct inode *inode) +static struct dquot __rcu **f2fs_get_dquots (struct inode *inode) {return F2FS_I (inode)->i_dquot; }
fs/jfs/jfs_incore.h +1 -1
@@ -92,7 +92,7 @@ struct jfs_inode_info { } link; } u;#ifdef CONFIG_QUOTA -struct dquot *i_dquot[MAXQUOTAS ]; +struct dquot __rcu *i_dquot[MAXQUOTAS ];#endif u32 dev;/* will die when we get wide dev_t */ struct inode vfs_inode;
fs/jfs/super.c +1 -1
@@ -824,7 +824,7 @@ static ssize_t jfs_quota_write(struct super_block *sb, int type,return len - towrite; } -static struct dquot **jfs_get_dquots (struct inode *inode) +static struct dquot __rcu **jfs_get_dquots (struct inode *inode) {return JFS_IP (inode)->i_dquot; }
fs/ocfs2/inode.h +1 -1
@@ -65,7 +65,7 @@ struct ocfs2_inode_infotid_t i_sync_tid;tid_t i_datasync_tid; -struct dquot *i_dquot[MAXQUOTAS ]; +struct dquot __rcu *i_dquot[MAXQUOTAS ]; };/*
fs/ocfs2/super.c +1 -1
@@ -122,7 +122,7 @@ static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend);static int ocfs2_enable_quotas (struct ocfs2_super *osb);static void ocfs2_disable_quotas (struct ocfs2_super *osb); -static struct dquot **ocfs2_get_dquots (struct inode *inode) +static struct dquot __rcu **ocfs2_get_dquots (struct inode *inode) {return OCFS2_I (inode)->i_dquot; }
fs/quota/dquot.c +1 -2
@@ -1002,8 +1002,7 @@ EXPORT_SYMBOL(dqget);static inline struct dquot __rcu **i_dquot (struct inode *inode) { -/* Force __rcu for now until filesystems are fixed */ -return (struct dquot __rcu **)inode->i_sb->s_op->get_dquots (inode); +return inode->i_sb->s_op->get_dquots (inode); }static int dqinit_needed (struct inode *inode,int type)
fs/reiserfs/reiserfs.h +1 -1
@@ -97,7 +97,7 @@ struct reiserfs_inode_info {struct rw_semaphore i_xattr_sem;#endif #ifdef CONFIG_QUOTA -struct dquot *i_dquot[MAXQUOTAS ]; +struct dquot __rcu *i_dquot[MAXQUOTAS ];#endif struct inode vfs_inode;
fs/reiserfs/super.c +1 -1
@@ -802,7 +802,7 @@ static ssize_t reiserfs_quota_write(struct super_block *, int, const char *,static ssize_t reiserfs_quota_read (struct super_block *,int ,char *,size_t ,loff_t ); -static struct dquot **reiserfs_get_dquots (struct inode *inode) +static struct dquot __rcu **reiserfs_get_dquots (struct inode *inode) {return REISERFS_I (inode)->i_dquot; }
include/linux/fs.h +1 -1
@@ -2158,7 +2158,7 @@ struct super_operations {#ifdef CONFIG_QUOTA ssize_t (*quota_read)(struct super_block *,int ,char *,size_t ,loff_t );ssize_t (*quota_write)(struct super_block *,int ,const char *,size_t ,loff_t ); -struct dquot **(*get_dquots)(struct inode *); +struct dquot __rcu **(*get_dquots)(struct inode *);#endif long (*nr_cached_objects)(struct super_block *,struct shrink_control *);
include/linux/shmem_fs.h +1 -1
@@ -37,7 +37,7 @@ struct shmem_inode_info {unsigned int fsflags;/* for FS_IOC_[SG]ETFLAGS */ atomic_t stop_eviction;/* hold when working on inode */ #ifdef CONFIG_TMPFS_QUOTA -struct dquot *i_dquot[MAXQUOTAS ]; +struct dquot __rcu *i_dquot[MAXQUOTAS ];#endif struct inode vfs_inode; };
mm/shmem.c +1 -1
@@ -311,7 +311,7 @@ static void shmem_disable_quotas(struct super_block *sb)dquot_quota_off (sb, type); } -static struct dquot **shmem_get_dquots (struct inode *inode) +static struct dquot __rcu **shmem_get_dquots (struct inode *inode) {return SHMEM_I (inode)->i_dquot; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 408/715 ASoC: Intel: ssp-common: Add stub for sof_ssp_get_codec_name
In reply to Sasha LevinFrom: Charles Keepax <[email protected]>
[ Upstream commit c1469c3a8a306e5f1eab1ae9585640d08e183f87 ]
As this function is now used in sof_board_helpers it requires a build stub for the case SSP_COMMON is not built in.
--- sound/soc/intel/boards/sof_ssp_common.h | 8 ++++++++ 1 file changed, 8 insertions(+)
sound/soc/intel/boards/sof_ssp_common.h +8 -0
@@ -67,6 +67,14 @@ enum sof_ssp_codec {enum sof_ssp_codec sof_ssp_detect_codec_type (struct device *dev);enum sof_ssp_codec sof_ssp_detect_amp_type (struct device *dev); + +#if IS_ENABLED (CONFIG_SND_SOC_INTEL_SOF_SSP_COMMON )const char *sof_ssp_get_codec_name (enum sof_ssp_codec codec_type); +#else +static inline const char *sof_ssp_get_codec_name (enum sof_ssp_codec codec_type) +{ +return NULL ; +} +#endif #endif /* __SOF_SSP_COMMON_H */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 409/715 PCI/P2PDMA: Fix a sleeping issue in a RCU read section
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 1e5c66afd4a40bb7be17cb33cbb1a1085f727730 ]
It is not allowed to sleep within a RCU read section, so use GFP_ATOMIC instead of GFP_KERNEL here.
--- drivers/pci/p2pdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/p2pdma.c +1 -1
@@ -661,7 +661,7 @@ calc_map_type_and_dist(struct pci_dev *provider, struct pci_dev *client, p2pdma =rcu_dereference (provider->p2pdma);if (p2pdma)xa_store (&p2pdma->map_types,map_types_idx (client), -xa_mk_value (map_type),GFP_KERNEL ); +xa_mk_value (map_type),GFP_ATOMIC );rcu_read_unlock ();return map_type; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 410/715 PCI: switchtec: Fix an error handling path in switchtec_pci_probe()
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit dec529b0b0572b32f9eb91c882dd1f08ca657efb ]
The commit in Fixes changed the logic on how resources are released and introduced a new switchtec_exit_pci() that need to be called explicitly in order to undo a corresponding switchtec_init_pci().
This was done in the remove function, but not in the probe.
Fix the probe now.
--- drivers/pci/switch/switchtec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pci/switch/switchtec.c +3 -1
@@ -1672,7 +1672,7 @@ static int switchtec_pci_probe(struct pci_dev *pdev, rc =switchtec_init_isr (stdev);if (rc) {dev_err (&stdev->dev,"failed to init isr.\n" ); - goto err_put; + goto err_exit_pci; } iowrite32(SWITCHTEC_EVENT_CLEAR |
@@ -1693,6 +1693,8 @@ static int switchtec_pci_probe(struct pci_dev *pdev, err_devadd:stdev_kill (stdev); +err_exit_pci: +switchtec_exit_pci (stdev); err_put:ida_free (&switchtec_minor_ida,MINOR (stdev->dev.devt));put_device (&stdev->dev);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 411/715 crypto: xilinx - call finalize with bh disabled
In reply to Sasha LevinFrom: Quanyang Wang <[email protected]>
[ Upstream commit a853450bf4c752e664abab0b2fad395b7ad7701c ]
When calling crypto_finalize_request, BH should be disabled to avoid triggering the following calltrace:
------------[ cut here ]------------
WARNING: CPU: 2 PID: 74 at crypto/crypto_engine.c:58 crypto_finalize_request+0xa0/0x118
Modules linked in: cryptodev(O)
CPU: 2 PID: 74 Comm: firmware:zynqmp Tainted: G O 6.8.0-rc1-yocto-standard #323
Hardware name: ZynqMP ZCU102 Rev1.0 (DT)
pstate: 40000005 (nZcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : crypto_finalize_request+0xa0/0x118
lr : crypto_finalize_request+0x104/0x118
sp : ffffffc085353ce0
x29: ffffffc085353ce0 x28: 0000000000000000 x27: ffffff8808ea8688
x26: ffffffc081715038 x25: 0000000000000000 x24: ffffff880100db00
x23: ffffff880100da80 x22: 0000000000000000 x21: 0000000000000000
x20: ffffff8805b14000 x19: ffffff880100da80 x18: 0000000000010450
x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000
x14: 0000000000000003 x13: 0000000000000000 x12: ffffff880100dad0
x11: 0000000000000000 x10: ffffffc0832dcd08 x9 : ffffffc0812416d8
x8 : 00000000000001f4 x7 : ffffffc0830d2830 x6 : 0000000000000001
x5 : ffffffc082091000 x4 : ffffffc082091658 x3 : 0000000000000000
x2 : ffffffc7f9653000 x1 : 0000000000000000 x0 : ffffff8802d20000
Call trace:
crypto_finalize_request+0xa0/0x118
crypto_finalize_aead_request+0x18/0x30
zynqmp_handle_aes_req+0xcc/0x388
crypto_pump_work+0x168/0x2d8
kthread_worker_fn+0xfc/0x3a0
kthread+0x118/0x138
ret_from_fork+0x10/0x20
irq event stamp: 40
hardirqs last enabled at (39): [<ffffffc0812416f8>] _raw_spin_unlock_irqrestore+0x70/0xb0
hardirqs last disabled at (40): [<ffffffc08122d208>] el1_dbg+0x28/0x90
softirqs last enabled at (36): [<ffffffc080017dec>] kernel_neon_begin+0x8c/0xf0
softirqs last disabled at (34): [<ffffffc080017dc0>] kernel_neon_begin+0x60/0xf0
---[ end trace 0000000000000000 ]------ drivers/crypto/xilinx/zynqmp-aes-gcm.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/crypto/xilinx/zynqmp-aes-gcm.c +3 -0
@@ -231,7 +231,10 @@ static int zynqmp_handle_aes_req(struct crypto_engine *engine, err =zynqmp_aes_aead_cipher (areq); } +local_bh_disable ();crypto_finalize_aead_request (engine, areq, err); +local_bh_enable (); +return 0 ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 412/715 drivers/ps3: select VIDEO to provide cmdline functions
In reply to Sasha LevinFrom: Randy Dunlap <[email protected]>
[ Upstream commit 7edd06233958d9086a9e3eb723a8768d3c5a9ce1 ]
When VIDEO is not set, there is a build error. Fix that by selecting VIDEO for PS3_PS3AV.
ERROR: modpost: ".video_get_options" [drivers/ps3/ps3av_mod.ko] undefined!
--- arch/powerpc/platforms/ps3/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/platforms/ps3/Kconfig +1 -0
@@ -67,6 +67,7 @@ config PS3_VUART config PS3_PS3AV depends on PPC_PS3 tristate "PS3 AV settings driver" if PS3_ADVANCED + select VIDEO select PS3_VUART default y help
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 413/715 perf thread_map: Free strlist on normal path in thread_map__new_by_tid_str()
In reply to Sasha LevinFrom: Yang Jihong <[email protected]>
[ Upstream commit 1eb3d924e3c0b8c27388b0583a989d757866efb6 ]
slist needs to be freed in both error path and normal path in thread_map__new_by_tid_str().
--- tools/perf/util/thread_map.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/thread_map.c +1 -1
@@ -280,13 +280,13 @@ struct perf_thread_map *thread_map__new_by_tid_str(const char *tid_str) threads->nr = ntasks; } out: +strlist__delete (slist);if (threads)refcount_set (&threads->refcnt,1 );return threads; out_free_threads:zfree (&threads); -strlist__delete (slist); goto out; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 414/715 perf srcline: Add missed addr2line closes
In reply to Sasha LevinFrom: Ian Rogers <[email protected]>
[ Upstream commit c7ba9d18ae47924a6ea6a47ca139779f58eb83c0 ]
The child_process for addr2line sets in and out to -1 so that pipes get created. It is the caller's responsibility to close the pipes, finish_command doesn't do it. Add the missed closes.
--- tools/perf/util/srcline.c | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/util/srcline.c +2 -0
@@ -399,6 +399,8 @@ static void addr2line_subprocess_cleanup(struct child_process *a2l)kill (a2l->pid,SIGKILL );finish_command (a2l);/* ignore result, we don't care */ a2l->pid =-1 ; +close (a2l->in); +close (a2l->out); }free (a2l);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 415/715 dt-bindings: msm: qcom, mdss: Include ommited fam-b compatible
In reply to Sasha LevinFrom: Adam Skladowski <[email protected]>
[ Upstream commit 3b63880de42bd3cb79c2a99949135a8f2441c088 ]
During conversion 28nm-hpm-fam-b compat got lost, add it.
Patchwork: https://patchwork.freedesktop.org/patch/575290/
--- Documentation/devicetree/bindings/display/msm/qcom,mdss.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/display/msm/qcom,mdss.yaml +1 -0
@@ -127,6 +127,7 @@ patternProperties: - qcom,dsi-phy-20nm - qcom,dsi-phy-28nm-8226 - qcom,dsi-phy-28nm-hpm + - qcom,dsi-phy-28nm-hpm-fam-b - qcom,dsi-phy-28nm-lp - qcom,hdmi-phy-8084 - qcom,hdmi-phy-8660
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 416/715 drm/msm/dpu: fix the programming of INTF_CFG2_DATA_HCTL_EN
In reply to Sasha LevinFrom: Abhinav Kumar <[email protected]>
[ Upstream commit 2f4a67a3894e15c135125cb54edc5b43abc1b70e ]
Currently INTF_CFG2_DATA_HCTL_EN is coupled with the enablement of widebus but this is incorrect because we should be enabling this bit independent of widebus except for cases where compression is enabled in one pixel per clock mode.
Fix this by making the condition checks more explicit and enabling INTF_CFG2_DATA_HCTL_EN for all other cases when supported by DPU.
Patchwork: https://patchwork.freedesktop.org/patch/576722/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 7 +++++++ drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h | 7 +++++++ .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 1 + drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 15 +++++++++------ drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h | 1 + 5 files changed, 25 insertions(+), 6 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +7 -0
@@ -226,6 +226,13 @@ bool dpu_encoder_is_widebus_enabled(const struct drm_encoder *drm_enc)return dpu_enc->wide_bus_en; } +bool dpu_encoder_is_dsc_enabled (const struct drm_encoder *drm_enc) +{ +const struct dpu_encoder_virt *dpu_enc =to_dpu_encoder_virt (drm_enc); + +return dpu_enc->dsc ? true : false; +} +int dpu_encoder_get_crc_values_cnt (const struct drm_encoder *drm_enc) {struct dpu_encoder_virt *dpu_enc;
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h +7 -0
@@ -158,6 +158,13 @@ int dpu_encoder_get_vsync_count(struct drm_encoder *drm_enc);bool dpu_encoder_is_widebus_enabled (const struct drm_encoder *drm_enc); +/** +* dpu_encoder_is_dsc_enabled - indicate whether dsc is enabled +* for the encoder. +* @drm_enc: Pointer to previously created drm encoder structure +*/ +bool dpu_encoder_is_dsc_enabled (const struct drm_encoder *drm_enc); +/** * dpu_encoder_get_crc_values_cnt - get number of physical encoders contained * in virtual encoder that can collect CRC values
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c +1 -0
@@ -102,6 +102,7 @@ static void drm_mode_to_intf_timing_params( } timing->wide_bus_en =dpu_encoder_is_widebus_enabled (phys_enc->parent); + timing->compression_en =dpu_encoder_is_dsc_enabled (phys_enc->parent);/* * for DP, divide the horizonal parameters by 2 when
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +9 -6
@@ -163,13 +163,8 @@ static void dpu_hw_intf_setup_timing_engine(struct dpu_hw_intf *ctx, hsync_ctl = (hsync_period <<16 ) | p->hsync_pulse_width; display_hctl = (hsync_end_x <<16 ) | hsync_start_x; -/* -* DATA_HCTL_EN controls data timing which can be different from -* video timing. It is recommended to enable it for all cases, except -* if compression is enabled in 1 pixel per clock mode -*/ if (p->wide_bus_en) - intf_cfg2 |=INTF_CFG2_DATABUS_WIDEN |INTF_CFG2_DATA_HCTL_EN ; + intf_cfg2 |=INTF_CFG2_DATABUS_WIDEN ; data_width = p->width;
@@ -229,6 +224,14 @@ static void dpu_hw_intf_setup_timing_engine(struct dpu_hw_intf *ctx,DPU_REG_WRITE (c,INTF_CONFIG , intf_cfg);DPU_REG_WRITE (c,INTF_PANEL_FORMAT , panel_format);if (ctx->cap->features &BIT (DPU_DATA_HCTL_EN )) { +/* +* DATA_HCTL_EN controls data timing which can be different from +* video timing. It is recommended to enable it for all cases, except +* if compression is enabled in 1 pixel per clock mode +*/ +if (!(p->compression_en && !p->wide_bus_en)) + intf_cfg2 |=INTF_CFG2_DATA_HCTL_EN ; +DPU_REG_WRITE (c,INTF_CONFIG2 , intf_cfg2);DPU_REG_WRITE (c,INTF_DISPLAY_DATA_HCTL , display_data_hctl);DPU_REG_WRITE (c,INTF_ACTIVE_DATA_HCTL , active_data_hctl);
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h +1 -0
@@ -33,6 +33,7 @@ struct dpu_hw_intf_timing_params {u32 hsync_skew;bool wide_bus_en; +bool compression_en; };struct dpu_hw_intf_prog_fetch {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 417/715 drm/msm/dpu: Only enable DSC_MODE_MULTIPLEX if dsc_merge is enabled
In reply to Sasha LevinFrom: Marijn Suijten <[email protected]>
[ Upstream commit 06267d22f9ee6fd34150b6dcdb2fa6983e1a85bc ]
When the topology calls for two interfaces on the current fixed topology of 2 DSC blocks, or uses 1 DSC block for a single interface (e.g. SC7280 with only one DSC block), there should be no merging of DSC output.
This is already represented by the return value of dpu_encoder_use_dsc_merge(), but not yet used to correctly configure this flag.
Patchwork: https://patchwork.freedesktop.org/patch/577067/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +3 -1
@@ -1860,7 +1860,9 @@ static void dpu_encoder_prep_dsc(struct dpu_encoder_virt *dpu_enc, dsc_common_mode =0 ; pic_width = dsc->pic_width; - dsc_common_mode =DSC_MODE_MULTIPLEX |DSC_MODE_SPLIT_PANEL ; + dsc_common_mode =DSC_MODE_SPLIT_PANEL ; +if (dpu_encoder_use_dsc_merge (enc_master->parent)) + dsc_common_mode |=DSC_MODE_MULTIPLEX ;if (enc_master->intf_mode ==INTF_MODE_VIDEO ) dsc_common_mode |=DSC_MODE_VIDEO ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 418/715 drm/radeon/ni: Fix wrong firmware size logging in ni_init_microcode()
In reply to Sasha LevinFrom: Nikita Zhandarovich <[email protected]>
[ Upstream commit c4891d979c7668b195a0a75787967ec95a24ecef ]
Clean up a typo in pr_err() erroneously printing NI MC 'rdev->mc_fw->size' during SMC firmware load. Log 'rdev->smc_fw->size' instead.
Found by Linux Verification Center (linuxtesting.org) with static analysis tool SVACE.
--- drivers/gpu/drm/radeon/ni.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/ni.c +1 -1
@@ -813,7 +813,7 @@ int ni_init_microcode(struct radeon_device *rdev) err =0 ; }else if (rdev->smc_fw->size != smc_req_size) {pr_err ("ni_mc: Bogus length %zu in firmware \"%s\"\n" , - rdev->mc_fw->size, fw_name); + rdev->smc_fw->size, fw_name); err = -EINVAL ; } }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 419/715 drm/amd/display: fix NULL checks for adev->dm.dc in amdgpu_dm_fini()
In reply to Sasha LevinFrom: Nikita Zhandarovich <[email protected]>
[ Upstream commit 2a3cfb9a24a28da9cc13d2c525a76548865e182c ]
Since 'adev->dm.dc' in amdgpu_dm_fini() might turn out to be NULL before the call to dc_enable_dmub_notifications(), check beforehand to ensure there will not be a possible NULL-ptr-deref there.
Also, since commit 1e88eb1b2c25 ("drm/amd/display: Drop CONFIG_DRM_AMD_DC_HDCP") there are two separate checks for NULL in 'adev->dm.dc' before dc_deinit_callbacks() and dc_dmub_srv_destroy(). Clean up by combining them all under one 'if'.
Found by Linux Verification Center (linuxtesting.org) with static analysis tool SVACE.
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +7 -9
@@ -1929,17 +1929,15 @@ static void amdgpu_dm_fini(struct amdgpu_device *adev) adev->dm.hdcp_workqueue =NULL ; } -if (adev->dm.dc) +if (adev->dm.dc) {dc_deinit_callbacks (adev->dm.dc); - -if (adev->dm.dc)dc_dmub_srv_destroy (&adev->dm.dc->ctx->dmub_srv); - -if (dc_enable_dmub_notifications (adev->dm.dc)) { -kfree (adev->dm.dmub_notify); - adev->dm.dmub_notify =NULL ; -destroy_workqueue (adev->dm.delayed_hpd_wq); - adev->dm.delayed_hpd_wq =NULL ; +if (dc_enable_dmub_notifications (adev->dm.dc)) { +kfree (adev->dm.dmub_notify); + adev->dm.dmub_notify =NULL ; +destroy_workqueue (adev->dm.delayed_hpd_wq); + adev->dm.delayed_hpd_wq =NULL ; + } }if (adev->dm.dmub_bo)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 420/715 clk: renesas: r8a779g0: Correct PFC/GPIO parent clocks
In reply to Sasha LevinFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit abb3fa662b8f8eaed1590b0e7a4e19eda467cdd3 ]
According to the R-Car V4H Series Hardware User’s Manual Rev.1.00, the parent clock of the Pin Function (PFC/GPIO) module clocks is the CP clock.
Fix this by adding the missing CP clock, and correcting the PFC parents.
--- drivers/clk/renesas/r8a779g0-cpg-mssr.c | 11 ++++++----- include/dt-bindings/clock/r8a779g0-cpg-mssr.h | 1 + 2 files changed, 7 insertions(+), 5 deletions(-)
drivers/clk/renesas/r8a779g0-cpg-mssr.c +6 -5
@@ -22,7 +22,7 @@enum clk_ids {/* Core Clock Outputs exported to DT */ -LAST_DT_CORE_CLK =R8A779G0_CLK_R , +LAST_DT_CORE_CLK =R8A779G0_CLK_CP ,/* External Input Clocks */ CLK_EXTAL ,
@@ -141,6 +141,7 @@ static const struct cpg_core_clk r8a779g0_core_clks[] __initconst = {DEF_FIXED ("svd2_vip" ,R8A779G0_CLK_SVD2_VIP ,CLK_SV_VIP ,2 ,1 ),DEF_FIXED ("cbfusa" ,R8A779G0_CLK_CBFUSA ,CLK_EXTAL ,2 ,1 ),DEF_FIXED ("cpex" ,R8A779G0_CLK_CPEX ,CLK_EXTAL ,2 ,1 ), +DEF_FIXED ("cp" ,R8A779G0_CLK_CP ,CLK_EXTAL ,2 ,1 ),DEF_FIXED ("viobus" ,R8A779G0_CLK_VIOBUS ,CLK_VIO ,1 ,1 ),DEF_FIXED ("viobusd2" ,R8A779G0_CLK_VIOBUSD2 ,CLK_VIO ,2 ,1 ), DEF_FIXED("vcbus", R8A779G0_CLK_VCBUS, CLK_VC, 1, 1),
@@ -232,10 +233,10 @@ static const struct mssr_mod_clk r8a779g0_mod_clks[] __initconst = {DEF_MOD ("cmt1" ,911 ,R8A779G0_CLK_R ),DEF_MOD ("cmt2" ,912 ,R8A779G0_CLK_R ),DEF_MOD ("cmt3" ,913 ,R8A779G0_CLK_R ), -DEF_MOD ("pfc0" ,915 ,R8A779G0_CLK_CL16M ), -DEF_MOD ("pfc1" ,916 ,R8A779G0_CLK_CL16M ), -DEF_MOD ("pfc2" ,917 ,R8A779G0_CLK_CL16M ), -DEF_MOD ("pfc3" ,918 ,R8A779G0_CLK_CL16M ), +DEF_MOD ("pfc0" ,915 ,R8A779G0_CLK_CP ), +DEF_MOD ("pfc1" ,916 ,R8A779G0_CLK_CP ), +DEF_MOD ("pfc2" ,917 ,R8A779G0_CLK_CP ), +DEF_MOD ("pfc3" ,918 ,R8A779G0_CLK_CP ),DEF_MOD ("tsc" ,919 ,R8A779G0_CLK_CL16M ),DEF_MOD ("tsn" ,2723 ,R8A779G0_CLK_S0D4_HSC ), DEF_MOD("ssiu", 2926, R8A779G0_CLK_S0D6_PER),
include/dt-bindings/clock/r8a779g0-cpg-mssr.h +1 -0
@@ -86,5 +86,6 @@#define R8A779G0_CLK_CPEX 74#define R8A779G0_CLK_CBFUSA 75#define R8A779G0_CLK_R 76 +#define R8A779G0_CLK_CP 77#endif /* __DT_BINDINGS_CLOCK_R8A779G0_CPG_MSSR_H__ */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 421/715 clk: renesas: r8a779f0: Correct PFC/GPIO parent clock
In reply to Sasha LevinFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit d1b32a83a02d9433dbd8c5f4d6fc44aa597755bd ]
According to the R-Car S4 Series Hardware User’s Manual Rev.0.81, the parent clock of the Pin Function (PFC/GPIO) module clock is the CP clock.
As this clock is not documented to exist on R-Car S4, use the CPEX clock instead.
--- drivers/clk/renesas/r8a779f0-cpg-mssr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/renesas/r8a779f0-cpg-mssr.c +1 -1
@@ -161,7 +161,7 @@ static const struct mssr_mod_clk r8a779f0_mod_clks[] __initconst = {DEF_MOD ("cmt1" ,911 ,R8A779F0_CLK_R ),DEF_MOD ("cmt2" ,912 ,R8A779F0_CLK_R ),DEF_MOD ("cmt3" ,913 ,R8A779F0_CLK_R ), -DEF_MOD ("pfc0" ,915 ,R8A779F0_CLK_CL16M ), +DEF_MOD ("pfc0" ,915 ,R8A779F0_CLK_CPEX ),DEF_MOD ("tsc" ,919 ,R8A779F0_CLK_CL16M ),DEF_MOD ("rswitch2" ,1505 ,R8A779F0_CLK_RSW2 ), DEF_MOD("ether-serdes", 1506, R8A779F0_CLK_S0D2_HSC),
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 422/715 clk: renesas: r9a07g04[34]: Use SEL_SDHI1_STS status configuration for SD1 mux
In reply to Sasha LevinFrom: Claudiu Beznea <[email protected]>
[ Upstream commit 9b2a11c83859c06233049b134bd8ee974b284559 ]
The status configuration for SD1 mux clock is SEL_SDHI1_STS. Fix it.
--- drivers/clk/renesas/r9a07g043-cpg.c | 2 +- drivers/clk/renesas/r9a07g044-cpg.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/clk/renesas/r9a07g043-cpg.c +1 -1
@@ -138,7 +138,7 @@ static const struct cpg_core_clk r9a07g043_core_clks[] __initconst = {DEF_FIXED ("SPI1" ,R9A07G043_CLK_SPI1 ,CLK_DIV_PLL3_C ,1 ,4 ),DEF_SD_MUX ("SD0" ,R9A07G043_CLK_SD0 ,SEL_SDHI0 ,SEL_SDHI0_STS , sel_shdi, mtable_sdhi,0 , rzg2l_cpg_sd_clk_mux_notifier), -DEF_SD_MUX ("SD1" ,R9A07G043_CLK_SD1 ,SEL_SDHI1 ,SEL_SDHI0_STS , sel_shdi, +DEF_SD_MUX ("SD1" ,R9A07G043_CLK_SD1 ,SEL_SDHI1 ,SEL_SDHI1_STS , sel_shdi, mtable_sdhi,0 , rzg2l_cpg_sd_clk_mux_notifier),DEF_FIXED ("SD0_DIV4" ,CLK_SD0_DIV4 ,R9A07G043_CLK_SD0 ,1 ,4 ), DEF_FIXED("SD1_DIV4", CLK_SD1_DIV4, R9A07G043_CLK_SD1, 1, 4),
drivers/clk/renesas/r9a07g044-cpg.c +1 -1
@@ -178,7 +178,7 @@ static const struct {DEF_FIXED ("SPI1" ,R9A07G044_CLK_SPI1 ,CLK_DIV_PLL3_C ,1 ,4 ),DEF_SD_MUX ("SD0" ,R9A07G044_CLK_SD0 ,SEL_SDHI0 ,SEL_SDHI0_STS , sel_shdi, mtable_sdhi,0 , rzg2l_cpg_sd_clk_mux_notifier), -DEF_SD_MUX ("SD1" ,R9A07G044_CLK_SD1 ,SEL_SDHI1 ,SEL_SDHI0_STS , sel_shdi, +DEF_SD_MUX ("SD1" ,R9A07G044_CLK_SD1 ,SEL_SDHI1 ,SEL_SDHI1_STS , sel_shdi, mtable_sdhi,0 , rzg2l_cpg_sd_clk_mux_notifier),DEF_FIXED ("SD0_DIV4" ,CLK_SD0_DIV4 ,R9A07G044_CLK_SD0 ,1 ,4 ), DEF_FIXED("SD1_DIV4", CLK_SD1_DIV4, R9A07G044_CLK_SD1, 1, 4),
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 423/715 ALSA: seq: fix function cast warnings
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit d7bf73809849463f76de42aad62c850305dd6c5d ]
clang-16 points out a control flow integrity (kcfi) issue when event callbacks get converted to incompatible types:
sound/core/seq/seq_midi.c:135:30: error: cast from 'int (*)(struct snd_rawmidi_substream *, const char *, int)' to 'snd_seq_dump_func_t' (aka 'int (*)(void *, void *, int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
135 | snd_seq_dump_var_event(ev, (snd_seq_dump_func_t)dump_midi, substream);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/core/seq/seq_virmidi.c:83:31: error: cast from 'int (*)(struct snd_rawmidi_substream *, const unsigned char *, int)' to 'snd_seq_dump_func_t' (aka 'int (*)(void *, void *, int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
83 | snd_seq_dump_var_event(ev, (snd_seq_dump_func_t)snd_rawmidi_receive, vmidi->substream);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~For addressing those errors, introduce wrapper functions that are used for callbacks and bridge to the actual function call with pointer cast.
The code was originally added with the initial ALSA merge in linux-2.5.4.
[ the patch description shamelessly copied from Arnd's original patch
-- tiwai ]
--- sound/core/seq/seq_midi.c | 8 +++++++- sound/core/seq/seq_virmidi.c | 9 ++++++++- 2 files changed, 15 insertions(+), 2 deletions(-)
sound/core/seq/seq_midi.c +7 -1
@@ -113,6 +113,12 @@ static int dump_midi(struct snd_rawmidi_substream *substream, const char *buf, ireturn 0 ; } +/* callback for snd_seq_dump_var_event(), bridging to dump_midi() */ +static int __dump_midi (void *ptr,void *buf,int count) +{ +return dump_midi (ptr, buf, count); +} +static int event_process_midi (struct snd_seq_event *ev,int direct,void *private_data,int atomic,int hop) {
@@ -132,7 +138,7 @@ static int event_process_midi(struct snd_seq_event *ev, int direct,pr_debug ("ALSA: seq_midi: invalid sysex event flags = 0x%x\n" , ev->flags);return 0 ; } -snd_seq_dump_var_event (ev, (snd_seq_dump_func_t )dump_midi, substream); +snd_seq_dump_var_event (ev, __dump_midi, substream);snd_midi_event_reset_decode (msynth->parser); }else {if (msynth->parser ==NULL )
sound/core/seq/seq_virmidi.c +8 -1
@@ -62,6 +62,13 @@ static void snd_virmidi_init_event(struct snd_virmidi *vmidi,/* * decode input event and put to read buffer of each opened file */ + +/* callback for snd_seq_dump_var_event(), bridging to snd_rawmidi_receive() */ +static int dump_to_rawmidi (void *ptr,void *buf,int count) +{ +return snd_rawmidi_receive (ptr, buf, count); +} +static int snd_virmidi_dev_receive_event (struct snd_virmidi_dev *rdev,struct snd_seq_event *ev,bool atomic)
@@ -80,7 +87,7 @@ static int snd_virmidi_dev_receive_event(struct snd_virmidi_dev *rdev,if (ev->type ==SNDRV_SEQ_EVENT_SYSEX ) {if ((ev->flags &SNDRV_SEQ_EVENT_LENGTH_MASK ) !=SNDRV_SEQ_EVENT_LENGTH_VARIABLE )continue ; -snd_seq_dump_var_event (ev, (snd_seq_dump_func_t )snd_rawmidi_receive, vmidi->substream); +snd_seq_dump_var_event (ev, dump_to_rawmidi, vmidi->substream);snd_midi_event_reset_decode (vmidi->parser); }else { len =snd_midi_event_decode (vmidi->parser, msg,sizeof (msg), ev);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 424/715 perf expr: Fix "has_event" function for metric style events
In reply to Sasha LevinFrom: Ian Rogers <[email protected]>
[ Upstream commit 6dd76680b925228312756c13b9b983661b552a64 ]
Events in metrics cannot use '/' as a separator, it would be recognized as a divide, so they use '@'. The '@' is recognized in the metricgroups code and changed to '/', do the same in the has_event function so that the parsing is only tried without the @s.
--- tools/perf/util/expr.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
tools/perf/util/expr.c +19 -1
@@ -500,7 +500,25 @@ double expr__has_event(const struct expr_parse_ctx *ctx, bool compute_ids, const tmp =evlist__new ();if (!tmp)return NAN ; - ret =parse_event (tmp, id) ?0 :1 ; + +if (strchr (id,'@' )) { +char *tmp_id, *p; + + tmp_id =strdup (id); +if (!tmp_id) { + ret =NAN ; + goto out; + } + p =strchr (tmp_id,'@' ); + *p ='/' ; + p =strrchr (tmp_id,'@' ); + *p ='/' ; + ret =parse_event (tmp, tmp_id) ?0 :1 ; +free (tmp_id); + }else { + ret =parse_event (tmp, id) ?0 :1 ; + } +out:evlist__delete (tmp);return ret; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 425/715 perf stat: Avoid metric-only segv
In reply to Sasha LevinFrom: Ian Rogers <[email protected]>
[ Upstream commit 2543947c77e0e224bda86b4e7220c2f6714da463 ]
Cycles is recognized as part of a hard coded metric in stat-shadow.c, it may call print_metric_only with a NULL fmt string leading to a segfault. Handle the NULL fmt explicitly.
--- tools/perf/util/stat-display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/stat-display.c +1 -1
@@ -560,7 +560,7 @@ static void print_metric_only(struct perf_stat_config *config,if (color) mlen +=strlen (color) +sizeof (PERF_COLOR_RESET ) -1 ; -color_snprintf (str,sizeof (str), color ?:"" , fmt, val); +color_snprintf (str,sizeof (str), color ?:"" , fmt ?:"" , val);fprintf (out,"%*s " , mlen, str); os->first = false; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 426/715 perf metric: Don't remove scale from counts
In reply to Sasha LevinFrom: Ian Rogers <[email protected]>
[ Upstream commit 6d6be5eb45b423a37d746d3ee0fd0c78f76ead9f ]
Counts were switched from the scaled saved value form to the aggregated count to avoid double accounting. When this happened the removing of scaling for a count should have been removed, however, it wasn't and this wasn't observed as it normally doesn't matter because a counter's scale is 1. A problem was observed with RAPL events that are scaled.
--- tools/perf/util/stat-shadow.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
tools/perf/util/stat-shadow.c +1 -6
@@ -414,12 +414,7 @@ static int prepare_metric(struct evsel **metric_events, val =NAN ; source_count =0 ; }else { -/* -* If an event was scaled during stat gathering, -* reverse the scale before computing the -* metric. -*/ - val = aggr->counts.val * (1.0 / metric_events[i]->scale); + val = aggr->counts.val; source_count =evsel__source_count (metric_events[i]); } }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 427/715 ASoC: meson: aiu: fix function pointer type mismatch
In reply to Sasha LevinFrom: Jerome Brunet <[email protected]>
[ Upstream commit 98ac85a00f31d2e9d5452b825a9ed0153d934043 ]
clang-16 warns about casting functions to incompatible types, as is done here to call clk_disable_unprepare:
sound/soc/meson/aiu.c:243:12: error: cast from 'void (*)(struct clk *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
243 | (void(*)(void *))clk_disable_unprepare,
The pattern of getting, enabling and setting a disable callback for a clock can be replaced with devm_clk_get_enabled(), which also fixes this warning.
--- sound/soc/meson/aiu.c | 19 ++++--------------- sound/soc/meson/aiu.h | 1 - 2 files changed, 4 insertions(+), 16 deletions(-)
sound/soc/meson/aiu.c +4 -15
@@ -212,11 +212,12 @@ static const char * const aiu_spdif_ids[] = {static int aiu_clk_get (struct device *dev) {struct aiu *aiu =dev_get_drvdata (dev); +struct clk *pclk;int ret; - aiu->pclk =devm_clk_get (dev,"pclk" ); -if (IS_ERR (aiu->pclk)) -return dev_err_probe (dev,PTR_ERR (aiu->pclk),"Can't get the aiu pclk\n" ); + pclk =devm_clk_get_enabled (dev,"pclk" ); +if (IS_ERR (pclk)) +return dev_err_probe (dev,PTR_ERR (pclk),"Can't get the aiu pclk\n" ); aiu->spdif_mclk =devm_clk_get (dev,"spdif_mclk" );if (IS_ERR (aiu->spdif_mclk))
@@ -233,18 +234,6 @@ static int aiu_clk_get(struct device *dev)if (ret)return dev_err_probe (dev, ret,"Can't get the spdif clocks\n" ); - ret =clk_prepare_enable (aiu->pclk); -if (ret) { -dev_err (dev,"peripheral clock enable failed\n" ); -return ret; - } - - ret =devm_add_action_or_reset (dev, - (void (*)(void *))clk_disable_unprepare, - aiu->pclk); -if (ret) -dev_err (dev,"failed to add reset action on pclk" ); -return ret; }
sound/soc/meson/aiu.h +0 -1
@@ -33,7 +33,6 @@ struct aiu_platform_data { };struct aiu { -struct clk *pclk;struct clk *spdif_mclk;struct aiu_interface i2s;struct aiu_interface spdif;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 428/715 ASoC: meson: t9015: fix function pointer type mismatch
In reply to Sasha LevinFrom: Jerome Brunet <[email protected]>
[ Upstream commit 5ad992c71b6a8e8a547954addc7af9fbde6ca10a ]
clang-16 warns about casting functions to incompatible types, as is done here to call clk_disable_unprepare:
sound/soc/meson/t9015.c:274:4: error: cast from 'void (*)(struct clk *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
274 | (void(*)(void *))clk_disable_unprepare,
The pattern of getting, enabling and setting a disable callback for a clock can be replaced with devm_clk_get_enabled(), which also fixes this warning.
--- sound/soc/meson/t9015.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-)
sound/soc/meson/t9015.c +4 -16
@@ -48,7 +48,6 @@#define POWER_CFG 0x10struct t9015 { -struct clk *pclk;struct regulator *avdd; };
@@ -249,6 +248,7 @@ static int t9015_probe(struct platform_device *pdev)struct t9015 *priv;void __iomem *regs;struct regmap *regmap; +struct clk *pclk;int ret; priv =devm_kzalloc (dev,sizeof (*priv),GFP_KERNEL );
@@ -256,26 +256,14 @@ static int t9015_probe(struct platform_device *pdev)return -ENOMEM ;platform_set_drvdata (pdev, priv); - priv->pclk =devm_clk_get (dev,"pclk" ); -if (IS_ERR (priv->pclk)) -return dev_err_probe (dev,PTR_ERR (priv->pclk),"failed to get core clock\n" ); + pclk =devm_clk_get_enabled (dev,"pclk" ); +if (IS_ERR (pclk)) +return dev_err_probe (dev,PTR_ERR (pclk),"failed to get core clock\n" ); priv->avdd =devm_regulator_get (dev,"AVDD" );if (IS_ERR (priv->avdd))return dev_err_probe (dev,PTR_ERR (priv->avdd),"failed to AVDD\n" ); - ret =clk_prepare_enable (priv->pclk); -if (ret) { -dev_err (dev,"core clock enable failed\n" ); -return ret; - } - - ret =devm_add_action_or_reset (dev, - (void (*)(void *))clk_disable_unprepare, - priv->pclk); -if (ret) -return ret; - ret =device_reset (dev);if (ret) {dev_err (dev,"reset failed\n" );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 429/715 powerpc: Force inlining of arch_vmap_p{u/m}d_supported()
In reply to Sasha LevinFrom: Christophe Leroy <[email protected]>
[ Upstream commit c5aebb53b32460bc52680dd4e2a2f6b84d5ea521 ]
arch_vmap_pud_supported() and arch_vmap_pmd_supported() are expected to constant-fold to false when RADIX is not enabled.
Force inlining in order to avoid following failure which leads to unexpected call of non-existing pud_set_huge() and pmd_set_huge() on powerpc 8xx.
In function 'pud_huge_tests',
inlined from 'debug_vm_pgtable' at mm/debug_vm_pgtable.c:1399:2:./arch/powerpc/include/asm/vmalloc.h:9:33: warning: inlining failed in call to 'arch_vmap_pud_supported.isra': call is unlikely and code size would grow [-Winline]
9 | #define arch_vmap_pud_supported arch_vmap_pud_supported
| ^~~~~~~~~~~~~~~~~~~~~~~./arch/powerpc/include/asm/vmalloc.h:10:20: note: in expansion of macro 'arch_vmap_pud_supported'
10 | static inline bool arch_vmap_pud_supported(pgprot_t prot)
| ^~~~~~~~~~~~~~~~~~~~~~~
./arch/powerpc/include/asm/vmalloc.h:9:33: note: called from here
9 | #define arch_vmap_pud_supported arch_vmap_pud_supportedmm/debug_vm_pgtable.c:458:14: note: in expansion of macro 'arch_vmap_pud_supported'
458 | if (!arch_vmap_pud_supported(args->page_prot) ||
| ^~~~~~~~~~~~~~~~~~~~~~~
--- arch/powerpc/include/asm/vmalloc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/vmalloc.h +2 -2
@@ -7,14 +7,14 @@#ifdef CONFIG_HAVE_ARCH_HUGE_VMAP #define arch_vmap_pud_supported arch_vmap_pud_supported -static inline bool arch_vmap_pud_supported (pgprot_t prot) +static __always_inline bool arch_vmap_pud_supported(pgprot_t prot) {/* HPT does not cope with large pages in the vmalloc area */ return radix_enabled (); }#define arch_vmap_pmd_supported arch_vmap_pmd_supported -static inline bool arch_vmap_pmd_supported (pgprot_t prot) +static __always_inline bool arch_vmap_pmd_supported(pgprot_t prot) {return radix_enabled (); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 430/715 ASoC: SOF: Add some bounds checking to firmware data
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit 98f681b0f84cfc3a1d83287b77697679e0398306 ]
Smatch complains about "head->full_size - head->header_size" can underflow. To some extent, we're always going to have to trust the firmware a bit. However, it's easy enough to add a check for negatives, and let's add a upper bounds check as well.
--- sound/soc/sof/ipc3-loader.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/sof/ipc3-loader.c +2 -0
@@ -148,6 +148,8 @@ static size_t sof_ipc3_fw_parse_ext_man(struct snd_sof_dev *sdev) head = (struct sof_ext_man_header *)fw->data; remaining = head->full_size - head->header_size; +if (remaining <0 || remaining > sdev->basefw.fw->size) +return -EINVAL ; ext_man_size =ipc3_fw_ext_man_size (sdev, fw);/* Assert firmware starts with extended manifest */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 431/715 drm: ci: use clk_ignore_unused for apq8016
In reply to Sasha LevinFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit aa1267e673fe5307cf00d02add4017d2878598b6 ]
If the ADV7511 bridge driver is compiled as a module, while DRM_MSM is built-in, the clk_disable_unused congests with the runtime PM handling of the DSI PHY for the clk_prepare_lock(). This causes apq8016 runner to fail without completing any jobs ([1]). Drop the BM_CMDLINE which duplicate the command line from the .baremetal-igt-arm64 clause and enforce the clk_ignore_unused kernelarg instead to make apq8016 runner work.
[1] https://gitlab.freedesktop.org/drm/msm/-/jobs/54990475
--- drivers/gpu/drm/ci/test.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/ci/test.yml +4 -1
@@ -104,7 +104,10 @@ msm:apq8016: DRIVER_NAME: msm BM_DTB: https://${PIPELINE_ARTIFACTS_BASE}/arm64/apq8016-sbc-usb-host.dtb GPU_VERSION: apq8016 - BM_CMDLINE: "ip=dhcp console=ttyMSM0,115200n8 $BM_KERNEL_EXTRA_ARGS root=/dev/nfs rw nfsrootdebug nfsroot=,tcp,nfsvers=4.2 init=/init $BM_KERNELARGS" + # disabling unused clocks congests with the MDSS runtime PM trying to + # disable those clocks and causes boot to fail. + # Reproducer: DRM_MSM=y, DRM_I2C_ADV7511=m + BM_KERNEL_EXTRA_ARGS: clk_ignore_unused RUNNER_TAG: google-freedreno-db410c script: - ./install/bare-metal/fastboot.sh
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 432/715 NTB: fix possible name leak in ntb_register_device()
In reply to Sasha LevinFrom: Yang Yingliang <[email protected]>
[ Upstream commit aebfdfe39b9327a3077d0df8db3beb3160c9bdd0 ]
If device_register() fails in ntb_register_device(), the device name allocated by dev_set_name() should be freed. As per the comment in device_register(), callers should use put_device() to give up the reference in the error path. So fix this by calling put_device() in the error path so that the name can be freed in kobject_cleanup().
As a result of this, put_device() in the error path of ntb_register_device() is removed and the actual error is returned.
--- drivers/ntb/core.c | 8 +++++++- drivers/pci/endpoint/functions/pci-epf-vntb.c | 6 +----- 2 files changed, 8 insertions(+), 6 deletions(-)
drivers/ntb/core.c +7 -1
@@ -100,6 +100,8 @@ EXPORT_SYMBOL(ntb_unregister_client);int ntb_register_device (struct ntb_dev *ntb) { +int ret; +if (!ntb)return -EINVAL ;if (!ntb->pdev)
@@ -120,7 +122,11 @@ int ntb_register_device(struct ntb_dev *ntb) ntb->ctx_ops =NULL ;spin_lock_init (&ntb->ctx_lock); -return device_register (&ntb->dev); + ret =device_register (&ntb->dev); +if (ret) +put_device (&ntb->dev); + +return ret; }EXPORT_SYMBOL (ntb_register_device);
drivers/pci/endpoint/functions/pci-epf-vntb.c +1 -5
@@ -1275,15 +1275,11 @@ static int pci_vntb_probe(struct pci_dev *pdev, const struct pci_device_id *id) ret =ntb_register_device (&ndev->ntb);if (ret) {dev_err (dev,"Failed to register NTB device\n" ); - goto err_register_dev; +return ret; }dev_dbg (dev,"PCI Virtual NTB driver loaded\n" );return 0 ; - -err_register_dev: -put_device (&ndev->ntb.dev); -return -EINVAL ; }static struct pci_device_id pci_vntb_table[] = {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 433/715 media: cedrus: h265: Fix configuring bitstream size
In reply to Sasha LevinFrom: Jernej Skrabec <[email protected]>
[ Upstream commit 3a11887f7f11a6bb1f05e7f67b3ea20dadfec443 ]
bit_size field holds size of slice, not slice + header. Because of HW quirks, driver can't program in just slice, but also preceding header. But that means that currently used bit_size is wrong (too small). Instead, just use size of whole buffer. There is no harm in doing this.
--- drivers/staging/media/sunxi/cedrus/cedrus_h265.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/staging/media/sunxi/cedrus/cedrus_h265.c +4 -6
@@ -427,11 +427,11 @@ static int cedrus_h265_setup(struct cedrus_ctx *ctx, struct cedrus_run *run)unsigned int ctb_addr_x, ctb_addr_y;struct cedrus_buffer *cedrus_buf;dma_addr_t src_buf_addr; -dma_addr_t src_buf_end_addr;u32 chroma_log2_weight_denom;u32 num_entry_point_offsets;u32 output_pic_list_index;u32 pic_order_cnt[2 ]; +size_t slice_bytes;u8 padding;int count;u32 reg;
@@ -443,6 +443,7 @@ static int cedrus_h265_setup(struct cedrus_ctx *ctx, struct cedrus_run *run) pred_weight_table = &slice_params->pred_weight_table; num_entry_point_offsets = slice_params->num_entry_point_offsets; cedrus_buf =vb2_to_cedrus_buffer (&run->dst->vb2_buf); + slice_bytes =vb2_get_plane_payload (&run->src->vb2_buf,0 );/* * If entry points offsets are present, we should get them
@@ -490,7 +491,7 @@ static int cedrus_h265_setup(struct cedrus_ctx *ctx, struct cedrus_run *run)cedrus_write (dev,VE_DEC_H265_BITS_OFFSET ,0 ); - reg = slice_params->bit_size; + reg = slice_bytes *8 ;cedrus_write (dev,VE_DEC_H265_BITS_LEN , reg);/* Source beginning and end addresses. */
@@ -504,10 +505,7 @@ static int cedrus_h265_setup(struct cedrus_ctx *ctx, struct cedrus_run *run)cedrus_write (dev,VE_DEC_H265_BITS_ADDR , reg); - src_buf_end_addr = src_buf_addr + -DIV_ROUND_UP (slice_params->bit_size,8 ); - - reg =VE_DEC_H265_BITS_END_ADDR_BASE (src_buf_end_addr); + reg =VE_DEC_H265_BITS_END_ADDR_BASE (src_buf_addr + slice_bytes);cedrus_write (dev,VE_DEC_H265_BITS_END_ADDR , reg);/* Coding tree block address */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 434/715 media: sun8i-di: Fix coefficient writes
In reply to Sasha LevinFrom: Jernej Skrabec <[email protected]>
[ Upstream commit 794b581f8c6eb7b60fe468ccb96dd3cd38ff779f ]
Currently coefficients are applied only once, since they don't change. However, this is done before enable bit is set and thus it doesn't get applied properly.
Fix that by applying coefficients after enable bit is set. While this means that it will be done evey time, it doesn't bring much time penalty.
--- .../media/platform/sunxi/sun8i-di/sun8i-di.c | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-)
drivers/media/platform/sunxi/sun8i-di/sun8i-di.c +21 -21
@@ -66,6 +66,7 @@ static void deinterlace_device_run(void *priv)struct vb2_v4l2_buffer *src, *dst;unsigned int hstep, vstep;dma_addr_t addr; +int i; src =v4l2_m2m_next_src_buf (ctx->fh.m2m_ctx); dst =v4l2_m2m_next_dst_buf (ctx->fh.m2m_ctx);
@@ -160,6 +161,26 @@ static void deinterlace_device_run(void *priv)deinterlace_write (dev,DEINTERLACE_CH1_HORZ_FACT , hstep);deinterlace_write (dev,DEINTERLACE_CH1_VERT_FACT , vstep); +/* neutral filter coefficients */ +deinterlace_set_bits (dev,DEINTERLACE_FRM_CTRL , +DEINTERLACE_FRM_CTRL_COEF_ACCESS ); +readl_poll_timeout (dev->base +DEINTERLACE_STATUS , val, + val &DEINTERLACE_STATUS_COEF_STATUS ,2 ,40 ); + +for (i =0 ; i <32 ; i++) { +deinterlace_write (dev,DEINTERLACE_CH0_HORZ_COEF0 + i *4 , +DEINTERLACE_IDENTITY_COEF ); +deinterlace_write (dev,DEINTERLACE_CH0_VERT_COEF + i *4 , +DEINTERLACE_IDENTITY_COEF ); +deinterlace_write (dev,DEINTERLACE_CH1_HORZ_COEF0 + i *4 , +DEINTERLACE_IDENTITY_COEF ); +deinterlace_write (dev,DEINTERLACE_CH1_VERT_COEF + i *4 , +DEINTERLACE_IDENTITY_COEF ); + } + +deinterlace_clr_set_bits (dev,DEINTERLACE_FRM_CTRL , +DEINTERLACE_FRM_CTRL_COEF_ACCESS ,0 ); +deinterlace_clr_set_bits (dev,DEINTERLACE_FIELD_CTRL ,DEINTERLACE_FIELD_CTRL_FIELD_CNT_MSK ,DEINTERLACE_FIELD_CTRL_FIELD_CNT (ctx->field));
@@ -248,7 +269,6 @@ static irqreturn_t deinterlace_irq(int irq, void *data)static void deinterlace_init (struct deinterlace_dev *dev) {u32 val; -int i;deinterlace_write (dev,DEINTERLACE_BYPASS ,DEINTERLACE_BYPASS_CSC );
@@ -285,26 +305,6 @@ static void deinterlace_init(struct deinterlace_dev *dev)deinterlace_clr_set_bits (dev,DEINTERLACE_CHROMA_DIFF ,DEINTERLACE_CHROMA_DIFF_TH_MSK ,DEINTERLACE_CHROMA_DIFF_TH (5 )); - -/* neutral filter coefficients */ -deinterlace_set_bits (dev,DEINTERLACE_FRM_CTRL , -DEINTERLACE_FRM_CTRL_COEF_ACCESS ); -readl_poll_timeout (dev->base +DEINTERLACE_STATUS , val, - val &DEINTERLACE_STATUS_COEF_STATUS ,2 ,40 ); - -for (i =0 ; i <32 ; i++) { -deinterlace_write (dev,DEINTERLACE_CH0_HORZ_COEF0 + i *4 , -DEINTERLACE_IDENTITY_COEF ); -deinterlace_write (dev,DEINTERLACE_CH0_VERT_COEF + i *4 , -DEINTERLACE_IDENTITY_COEF ); -deinterlace_write (dev,DEINTERLACE_CH1_HORZ_COEF0 + i *4 , -DEINTERLACE_IDENTITY_COEF ); -deinterlace_write (dev,DEINTERLACE_CH1_VERT_COEF + i *4 , -DEINTERLACE_IDENTITY_COEF ); - } - -deinterlace_clr_set_bits (dev,DEINTERLACE_FRM_CTRL , -DEINTERLACE_FRM_CTRL_COEF_ACCESS ,0 ); }static inline struct deinterlace_ctx *deinterlace_file2ctx (struct file *file)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 435/715 media: sun8i-di: Fix power on/off sequences
In reply to Sasha LevinFrom: Jernej Skrabec <[email protected]>
[ Upstream commit cff104e33bad38f4b2c8d58816a7accfaa2879f9 ]
According to user manual, reset line should be deasserted before clocks are enabled. Also fix power down sequence to be reverse of that.
--- .../media/platform/sunxi/sun8i-di/sun8i-di.c | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-)
drivers/media/platform/sunxi/sun8i-di/sun8i-di.c +13 -12
@@ -929,11 +929,18 @@ static int deinterlace_runtime_resume(struct device *device)return ret; } + ret =reset_control_deassert (dev->rstc); +if (ret) { +dev_err (dev->dev,"Failed to apply reset\n" ); + + goto err_exclusive_rate; + } + ret =clk_prepare_enable (dev->bus_clk);if (ret) {dev_err (dev->dev,"Failed to enable bus clock\n" ); - goto err_exclusive_rate; + goto err_rst; } ret =clk_prepare_enable (dev->mod_clk);
@@ -950,23 +957,16 @@ static int deinterlace_runtime_resume(struct device *device) goto err_mod_clk; } - ret =reset_control_deassert (dev->rstc); -if (ret) { -dev_err (dev->dev,"Failed to apply reset\n" ); - - goto err_ram_clk; - } -deinterlace_init (dev);return 0 ; -err_ram_clk: -clk_disable_unprepare (dev->ram_clk); err_mod_clk:clk_disable_unprepare (dev->mod_clk); err_bus_clk:clk_disable_unprepare (dev->bus_clk); +err_rst: +reset_control_assert (dev->rstc); err_exclusive_rate:clk_rate_exclusive_put (dev->mod_clk);
@@ -977,11 +977,12 @@ static int deinterlace_runtime_suspend(struct device *device) {struct deinterlace_dev *dev =dev_get_drvdata (device); -reset_control_assert (dev->rstc); -clk_disable_unprepare (dev->ram_clk);clk_disable_unprepare (dev->mod_clk);clk_disable_unprepare (dev->bus_clk); + +reset_control_assert (dev->rstc); +clk_rate_exclusive_put (dev->mod_clk);return 0 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 436/715 media: sun8i-di: Fix chroma difference threshold
In reply to Sasha LevinFrom: Jernej Skrabec <[email protected]>
[ Upstream commit 856525e8db272b0ce6d9c6e6c2eeb97892b485a6 ]
While there is no good explanation what this value does, vendor driver uses value 31 for it. Align driver with it.
--- drivers/media/platform/sunxi/sun8i-di/sun8i-di.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/sunxi/sun8i-di/sun8i-di.c +1 -1
@@ -304,7 +304,7 @@ static void deinterlace_init(struct deinterlace_dev *dev)deinterlace_clr_set_bits (dev,DEINTERLACE_CHROMA_DIFF ,DEINTERLACE_CHROMA_DIFF_TH_MSK , -DEINTERLACE_CHROMA_DIFF_TH (5 )); +DEINTERLACE_CHROMA_DIFF_TH (31 )); }static inline struct deinterlace_ctx *deinterlace_file2ctx (struct file *file)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 437/715 staging: media: starfive: Set 16 bpp for capture_raw device
In reply to Sasha LevinFrom: Changhuang Liang <[email protected]>
[ Upstream commit a38cd27c9ee8c25308b71ea16393d0c231e9bde4 ]
For StarFive JH7110 Camera Subsystem, capture_raw video device output raw10 pixelformat requires 16bit of alignment.
--- drivers/staging/media/starfive/camss/stf-capture.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/media/starfive/camss/stf-capture.c +4 -4
@@ -20,28 +20,28 @@ static const struct stfcamss_format_info stf_wr_fmts[] = { .pixelformat = V4L2_PIX_FMT_SRGGB10, .planes = 1, .vsub = { 1 }, - .bpp = 10, + .bpp = 16, }, { .code = MEDIA_BUS_FMT_SGRBG10_1X10, .pixelformat = V4L2_PIX_FMT_SGRBG10, .planes = 1, .vsub = { 1 }, - .bpp = 10, + .bpp = 16, }, { .code = MEDIA_BUS_FMT_SGBRG10_1X10, .pixelformat = V4L2_PIX_FMT_SGBRG10, .planes = 1, .vsub = { 1 }, - .bpp = 10, + .bpp = 16, }, { .code = MEDIA_BUS_FMT_SBGGR10_1X10, .pixelformat = V4L2_PIX_FMT_SBGGR10, .planes = 1, .vsub = { 1 }, - .bpp = 10, + .bpp = 16, }, };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 438/715 media: imx: csc/scaler: fix v4l2_ctrl_handler memory leak
In reply to Sasha LevinFrom: Lucas Stach <[email protected]>
[ Upstream commit 4797a3dd46f220e6d83daf54d70c5b33db6deb01 ]
Free the memory allocated in v4l2_ctrl_handler_init on release.
--- drivers/staging/media/imx/imx-media-csc-scaler.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/media/imx/imx-media-csc-scaler.c +1 -0
@@ -803,6 +803,7 @@ static int ipu_csc_scaler_release(struct file *file)dev_dbg (priv->dev,"Releasing instance %p\n" , ctx); +v4l2_ctrl_handler_free (&ctx->ctrl_hdlr);v4l2_m2m_ctx_release (ctx->fh.m2m_ctx);v4l2_fh_del (&ctx->fh);v4l2_fh_exit (&ctx->fh);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 439/715 media: go7007: add check of return value of go7007_read_addr()
In reply to Sasha LevinFrom: Daniil Dulov <[email protected]>
[ Upstream commit 0b70530ee740861f4776ff724fcc25023df1799a ]
If go7007_read_addr() returns error channel is not assigned a value. In this case go to allocfail.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/media/usb/go7007/go7007-usb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/usb/go7007/go7007-usb.c +3 -1
@@ -1201,7 +1201,9 @@ static int go7007_usb_probe(struct usb_interface *intf,u16 channel;/* read channel number from GPIO[1:0] */ -go7007_read_addr (go,0x3c81 , &channel); +if (go7007_read_addr (go,0x3c81 , &channel)) + goto allocfail; + channel &=0x3 ; go->board_id =GO7007_BOARDID_ADLINK_MPG24 ; usb->board = board = &board_adlink_mpg24;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 440/715 media: pvrusb2: remove redundant NULL check
In reply to Sasha LevinFrom: Daniil Dulov <[email protected]>
[ Upstream commit 95ac1210fb2753f968ebce0730d4fbc553c2a3dc ]
Pointer dip->stream cannot be NULL due to a shift, thus remove redundant NULL check.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/media/usb/pvrusb2/pvrusb2-v4l2.c +0 -5
@@ -1198,11 +1198,6 @@ static void pvr2_v4l2_dev_init(struct pvr2_v4l2_dev *dip, dip->minor_type = pvr2_v4l_type_video; nr_ptr = video_nr; caps |=V4L2_CAP_VIDEO_CAPTURE |V4L2_CAP_AUDIO ; -if (!dip->stream) { -pr_err (KBUILD_MODNAME -": Failed to set up pvrusb2 v4l video dev due to missing stream instance\n" ); -return ; - }break ;case VFL_TYPE_VBI : dip->config = pvr2_config_vbi;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 441/715 media: videobuf2: Add missing doc comment for waiting_in_dqbuf
In reply to Sasha LevinFrom: Andrzej Pietrasiewicz <[email protected]>
[ Upstream commit 26a3a10342748862dcc8d22222563f6ca03d6ca3 ]
While at it rearrange other comments to match the order of struct members.
--- include/media/videobuf2-core.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
include/media/videobuf2-core.h +8 -5
@@ -72,6 +72,10 @@ struct vb2_buffer;* argument to other ops in this structure. * @put_userptr: inform the allocator that a USERPTR buffer will no longer * be used. +* @prepare: called every time the buffer is passed from userspace to the +* driver, useful for cache synchronisation, optional. +* @finish: called every time the buffer is passed back from the driver +* to the userspace, also optional. * @attach_dmabuf: attach a shared &struct dma_buf for a hardware operation; * used for DMABUF memory types; dev is the alloc device * dbuf is the shared dma_buf; returns ERR_PTR() on failure;
@@ -86,10 +90,6 @@ struct vb2_buffer;* dmabuf. * @unmap_dmabuf: releases access control to the dmabuf - allocator is notified * that this driver is done using the dmabuf for now. -* @prepare: called every time the buffer is passed from userspace to the -* driver, useful for cache synchronisation, optional. -* @finish: called every time the buffer is passed back from the driver -* to the userspace, also optional. * @vaddr: return a kernel virtual address to a given memory buffer * associated with the passed private structure or NULL if no * such mapping exists.
@@ -484,7 +484,6 @@ struct vb2_buf_ops {* caller. For example, for V4L2, it should match * the types defined on &enum v4l2_buf_type. * @io_modes: supported io methods (see &enum vb2_io_modes). -* @alloc_devs: &struct device memory type/allocator-specific per-plane device * @dev: device to use for the default allocation context if the driver * doesn't fill in the @alloc_devs array. * @dma_attrs: DMA attributes to use for the DMA.
@@ -553,6 +552,7 @@ struct vb2_buf_ops {* VIDIOC_REQBUFS will ensure at least @min_queued_buffers * buffers will be allocated. Note that VIDIOC_CREATE_BUFS will not * modify the requested buffer count. +* @alloc_devs: &struct device memory type/allocator-specific per-plane device */ /* * Private elements (won't appear at the uAPI book):
@@ -577,6 +577,9 @@ struct vb2_buf_ops {* @waiting_for_buffers: used in poll() to check if vb2 is still waiting for * buffers. Only set for capture queues if qbuf has not yet been * called since poll() needs to return %EPOLLERR in that situation. +* @waiting_in_dqbuf: set by the core for the duration of a blocking DQBUF, when +* it has to wait for a buffer to become available with vb2_queue->lock +* released. Used to prevent destroying the queue by other threads. * @is_multiplanar: set if buffer type is multiplanar * @is_output: set if buffer type is output * @copy_timestamp: set if vb2-core should set timestamps
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 442/715 media: pvrusb2: fix pvr2_stream_callback casts
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 30baa4a96b23add91a87305baaeba82c4e109e1f ]
clang-16 complains about a control flow integrity (KCFI) issue in pvrusb2, which casts three different prototypes into pvr2_stream_callback:
drivers/media/usb/pvrusb2/pvrusb2-v4l2.c:1070:30: error: cast from 'void (*)(struct pvr2_v4l2_fh *)' to 'pvr2_stream_callback' (aka 'void (*)(void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
1070 | pvr2_stream_set_callback(sp,(pvr2_stream_callback)pvr2_v4l2_notify,fh);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/usb/pvrusb2/pvrusb2-context.c:110:6: error: cast from 'void (*)(struct pvr2_context *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
110 | (void (*)(void *))pvr2_context_notify,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/usb/pvrusb2/pvrusb2-dvb.c:152:6: error: cast from 'void (*)(struct pvr2_dvb_adapter *)' to 'pvr2_stream_callback' (aka 'void (*)(void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
152 | (pvr2_stream_callback) pvr2_dvb_notify, adap);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Change the functions to actually take a void* argument so the cast is no longer needed.
--- drivers/media/usb/pvrusb2/pvrusb2-context.c | 8 ++++---- drivers/media/usb/pvrusb2/pvrusb2-dvb.c | 6 ++++-- drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 6 ++++-- 3 files changed, 12 insertions(+), 8 deletions(-)
drivers/media/usb/pvrusb2/pvrusb2-context.c +4 -4
@@ -90,8 +90,10 @@ static void pvr2_context_destroy(struct pvr2_context *mp) } -static void pvr2_context_notify (struct pvr2_context *mp) +static void pvr2_context_notify (void *ptr) { +struct pvr2_context *mp = ptr; +pvr2_context_set_notify (mp,!0 ); }
@@ -106,9 +108,7 @@ static void pvr2_context_check(struct pvr2_context *mp)pvr2_trace (PVR2_TRACE_CTXT ,"pvr2_context %p (initialize)" , mp);/* Finish hardware initialization */ -if (pvr2_hdw_initialize (mp->hdw, - (void (*)(void *))pvr2_context_notify, - mp)) { +if (pvr2_hdw_initialize (mp->hdw, pvr2_context_notify, mp)) { mp->video_stream.stream =pvr2_hdw_get_video_stream (mp->hdw);/* Trigger interface initialization. By doing this
drivers/media/usb/pvrusb2/pvrusb2-dvb.c +4 -2
@@ -88,8 +88,10 @@ static int pvr2_dvb_feed_thread(void *data)return stat; } -static void pvr2_dvb_notify (struct pvr2_dvb_adapter *adap) +static void pvr2_dvb_notify (void *ptr) { +struct pvr2_dvb_adapter *adap = ptr; +wake_up (&adap->buffer_wait_data); }
@@ -149,7 +151,7 @@ static int pvr2_dvb_stream_do_start(struct pvr2_dvb_adapter *adap) }pvr2_stream_set_callback (pvr->video_stream.stream, - (pvr2_stream_callback ) pvr2_dvb_notify, adap); + pvr2_dvb_notify, adap); ret =pvr2_stream_set_buffer_count (stream,PVR2_DVB_BUFFER_COUNT );if (ret <0 )return ret;
drivers/media/usb/pvrusb2/pvrusb2-v4l2.c +4 -2
@@ -1033,8 +1033,10 @@ static int pvr2_v4l2_open(struct file *file) } -static void pvr2_v4l2_notify (struct pvr2_v4l2_fh *fhp) +static void pvr2_v4l2_notify (void *ptr) { +struct pvr2_v4l2_fh *fhp = ptr; +wake_up (&fhp->wait_data); }
@@ -1067,7 +1069,7 @@ static int pvr2_v4l2_iosetup(struct pvr2_v4l2_fh *fh) hdw = fh->channel.mc_head->hdw; sp = fh->pdi->stream->stream; -pvr2_stream_set_callback (sp,(pvr2_stream_callback )pvr2_v4l2_notify,fh); +pvr2_stream_set_callback (sp, pvr2_v4l2_notify, fh);pvr2_hdw_set_stream_type (hdw,fh->pdi->config);if ((ret =pvr2_hdw_set_streaming (hdw,!0 )) <0 )return ret;return pvr2_ioread_set_enabled (fh->rhp,!0 );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 443/715 clk: qcom: dispcc-sdm845: Adjust internal GDSC wait times
In reply to Sasha LevinFrom: Konrad Dybcio <[email protected]>
[ Upstream commit 117e7dc697c2739d754db8fe0c1e2d4f1f5d5f82 ]
SDM845 downstream uses non-default values for GDSC internal waits. Program them accordingly to avoid surprises.
--- drivers/clk/qcom/dispcc-sdm845.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clk/qcom/dispcc-sdm845.c +2 -0
@@ -759,6 +759,8 @@ static struct clk_branch disp_cc_mdss_vsync_clk = {static struct gdsc mdss_gdsc = { .gdscr =0x3000 , + .en_few_wait_val =0x6 , + .en_rest_wait_val =0x5 , .pd = { .name ="mdss_gdsc" , },
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 444/715 drm/amd/display: Add 'replay' NULL check in 'edp_set_replay_allow_active()'
In reply to Sasha LevinFrom: Srinivasan Shanmugam <[email protected]>
[ Upstream commit f6aed043ee5d75b3d1bfc452b1a9584b63c8f76b ]
In the first if statement, we're checking if 'replay' is NULL. But in the second if statement, we're not checking if 'replay' is NULL again before calling replay->funcs->replay_set_power_opt().
if (replay == NULL && force_static)
return false;
...
if (link->replay_settings.replay_feature_enabled &&
replay->funcs->replay_set_power_opt) {
replay->funcs->replay_set_power_opt(replay, *power_opts, panel_inst);
link->replay_settings.replay_power_opt_active = *power_opts;
}If 'replay' is NULL, this will cause a null pointer dereference.
Fixes the below found by smatch:drivers/gpu/drm/amd/amdgpu/../display/dc/link/protocols/link_edp_panel_control.c:895 edp_set_replay_allow_active() error: we previously assumed 'replay' could be null (see line 887)
--- .../drm/amd/display/dc/link/protocols/link_edp_panel_control.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c +2 -1
@@ -892,7 +892,8 @@ bool edp_set_replay_allow_active(struct dc_link *link, const bool *allow_active,/* Set power optimization flag */ if (power_opts && link->replay_settings.replay_power_opt_active != *power_opts) { -if (link->replay_settings.replay_feature_enabled && replay->funcs->replay_set_power_opt) { +if (replay !=NULL && link->replay_settings.replay_feature_enabled && + replay->funcs->replay_set_power_opt) { replay->funcs->replay_set_power_opt (replay, *power_opts, panel_inst); link->replay_settings.replay_power_opt_active = *power_opts; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 445/715 drm/panel: boe-tv101wum-nl6: make use of prepare_prev_first
In reply to Sasha LevinFrom: Douglas Anderson <[email protected]>
[ Upstream commit 42a7a16bedc991190310a02dd202e29cfac52525 ]
The panel on sc7180-trogdor-wormdingler and sc7180-trogdor-quackingstick hasn't been coming up since commit 9e15123eca79 ("drm/msm/dsi: Stop unconditionally powering up DSI hosts at modeset"). Let's add "prepare_prev_first" as has been done for many other DSI panels.
--- drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c +2 -0
@@ -1871,6 +1871,8 @@ static int boe_panel_add(struct boe_panel *boe)gpiod_set_value (boe->enable_gpio,0 ); + boe->base.prepare_prev_first = true; +drm_panel_init (&boe->base, dev, &boe_panel_funcs,DRM_MODE_CONNECTOR_DSI ); err =of_drm_get_panel_orientation (dev->of_node, &boe->orientation);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 446/715 drm/msm/dpu: finalise global state object
In reply to Sasha LevinFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit 49e27d3c9cd67fd5851f8b5518645b9bf3d2c6c0 ]
Add calls to finalise global state object and corresponding lock.
Patchwork: https://patchwork.freedesktop.org/patch/570175/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +8 -0
@@ -374,6 +374,12 @@ static int dpu_kms_global_obj_init(struct dpu_kms *dpu_kms)return 0 ; } +static void dpu_kms_global_obj_fini (struct dpu_kms *dpu_kms) +{ +drm_atomic_private_obj_fini (&dpu_kms->global_state); +drm_modeset_lock_fini (&dpu_kms->global_state_lock); +} +static int dpu_kms_parse_data_bus_icc_path (struct dpu_kms *dpu_kms) {struct icc_path *path0;
@@ -801,6 +807,8 @@ static void _dpu_kms_hw_destroy(struct dpu_kms *dpu_kms) dpu_kms->hw_vbif[i] =NULL ; } +dpu_kms_global_obj_fini (dpu_kms); + dpu_kms->catalog =NULL ; dpu_kms->hw_mdp =NULL ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 447/715 drm/mediatek: dsi: Fix DSI RGB666 formats and definitions
In reply to Sasha LevinFrom: AngeloGioacchino Del Regno <[email protected]>
[ Upstream commit fae6f815505301b92d9113764f4d76d0bfe45607 ]
The register bits definitions for RGB666 formats are wrong in multiple
ways: first, in the DSI_PS_SEL bits region, the Packed 18-bits RGB666 format is selected with bit 1, while the Loosely Packed one is bit 2, and second - the definition name "LOOSELY_PS_18BIT_RGB666" is wrong because the loosely packed format is 24 bits instead!
Either way, functions mtk_dsi_ps_control_vact() and mtk_dsi_ps_control() do not even agree on the DSI_PS_SEL bit to set in DSI_PSCTRL: one sets loosely packed (24) on RGB666, the other sets packed (18), and the other way around for RGB666_PACKED.
Fixing this entire stack of issues is done in one go:
- Use the correct bit for the Loosely Packed RGB666 definition
- Rename LOOSELY_PS_18BIT_RGB666 to LOOSELY_PS_24BIT_RGB666
- Change ps_bpp_mode in mtk_dsi_ps_control_vact() to set:
- Loosely Packed, 24-bits for MIPI_DSI_FMT_RGB666
- Packed, 18-bits for MIPI_DSI_FMT_RGB666_PACKED
--- drivers/gpu/drm/mediatek/mtk_dsi.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/mediatek/mtk_dsi.c +5 -5
@@ -71,8 +71,8 @@#define DSI_PS_WC 0x3fff#define DSI_PS_SEL (3 << 16)#define PACKED_PS_16BIT_RGB565 (0 << 16) -#define LOOSELY_PS_18BIT_RGB666 (1 << 16) -#define PACKED_PS_18BIT_RGB666 (2 << 16) +#define PACKED_PS_18BIT_RGB666 (1 << 16) +#define LOOSELY_PS_24BIT_RGB666 (2 << 16)#define PACKED_PS_24BIT_RGB888 (3 << 16)#define DSI_VSA_NL 0x20
@@ -369,10 +369,10 @@ static void mtk_dsi_ps_control_vact(struct mtk_dsi *dsi) ps_bpp_mode |=PACKED_PS_24BIT_RGB888 ;break ;case MIPI_DSI_FMT_RGB666 : - ps_bpp_mode |=PACKED_PS_18BIT_RGB666 ; + ps_bpp_mode |=LOOSELY_PS_24BIT_RGB666 ;break ;case MIPI_DSI_FMT_RGB666_PACKED : - ps_bpp_mode |=LOOSELY_PS_18BIT_RGB666 ; + ps_bpp_mode |=PACKED_PS_18BIT_RGB666 ;break ;case MIPI_DSI_FMT_RGB565 : ps_bpp_mode |=PACKED_PS_16BIT_RGB565 ;
@@ -426,7 +426,7 @@ static void mtk_dsi_ps_control(struct mtk_dsi *dsi) dsi_tmp_buf_bpp =3 ;break ;case MIPI_DSI_FMT_RGB666 : - tmp_reg =LOOSELY_PS_18BIT_RGB666 ; + tmp_reg =LOOSELY_PS_24BIT_RGB666 ; dsi_tmp_buf_bpp =3 ;break ;case MIPI_DSI_FMT_RGB666_PACKED :
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 448/715 PCI: Mark 3ware-9650SE Root Port Extended Tags as broken
In reply to Sasha LevinFrom: Jörg Wedekind <[email protected]>
[ Upstream commit baf67aefbe7d7deafa59ca49612d163f8889934c ]
Per PCIe r6.1, sec 2.2.6.2 and 7.5.3.4, a Requester may not use 8-bit Tags unless its Extended Tag Field Enable is set, but all Receivers/Completers must handle 8-bit Tags correctly regardless of their Extended Tag Field Enable.
Some devices do not handle 8-bit Tags as Completers, so add a quirk for them. If we find such a device, we disable Extended Tags for the entire hierarchy to make peer-to-peer DMA possible.
The 3ware 9650SE seems to have issues with handling 8-bit tags. Mark it as broken.
This fixes PCI Parity Errors like :
3w-9xxx: scsi0: ERROR: (0x06:0x000C): PCI Parity Error: clearing. 3w-9xxx: scsi0: ERROR: (0x06:0x000D): PCI Abort: clearing. 3w-9xxx: scsi0: ERROR: (0x06:0x000E): Controller Queue Error: clearing. 3w-9xxx: scsi0: ERROR: (0x06:0x0010): Microcontroller Error: clearing.
--- drivers/pci/quirks.c | 1 + 1 file changed, 1 insertion(+)
drivers/pci/quirks.c +1 -0
@@ -5527,6 +5527,7 @@ static void quirk_no_ext_tags(struct pci_dev *pdev)pci_walk_bus (bridge->bus, pci_configure_extended_tags,NULL ); } +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_3WARE ,0x1004 , quirk_no_ext_tags);DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_SERVERWORKS ,0x0132 , quirk_no_ext_tags);DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_SERVERWORKS ,0x0140 , quirk_no_ext_tags);DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_SERVERWORKS ,0x0141 , quirk_no_ext_tags);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 449/715 powerpc/ps3: Fix lv1 hcall assembly for ELFv2 calling convention
In reply to Sasha LevinFrom: Nicholas Piggin <[email protected]>
[ Upstream commit 6735fef14c1f089ae43fd6d43add818b7ff682a8 ]
Stack-passed parameters begin at a different offset in the caller's stack in the ELFv2 ABI.
--- arch/powerpc/include/asm/ppc_asm.h | 6 ++++-- arch/powerpc/platforms/ps3/hvcall.S | 18 +++++++++--------- 2 files changed, 13 insertions(+), 11 deletions(-)
arch/powerpc/include/asm/ppc_asm.h +4 -2
@@ -201,11 +201,13 @@#ifdef CONFIG_PPC64_ELF_ABI_V2 #define STK_GOT 24 -#define __STK_PARAM (i) (32 + ((i)-3)*8) +#define STK_PARAM_AREA 32#else #define STK_GOT 40 -#define __STK_PARAM (i) (48 + ((i)-3)*8) +#define STK_PARAM_AREA 48#endif + +#define __STK_PARAM (i) (STK_PARAM_AREA + ((i)-3)*8)#define STK_PARAM (i) __STK_PARAM(__REG_##i)#ifdef CONFIG_PPC64_ELF_ABI_V2
arch/powerpc/platforms/ps3/hvcall.S +9 -9
@@ -714,7 +714,7 @@ _GLOBAL(_##API_NAME) \ std r4, 0(r11); \ ld r11, -16(r1); \ std r5, 0(r11); \ - ld r11, 48+8*8(r1); \ + ld r11, STK_PARAM_AREA+8*8(r1); \ std r6, 0(r11); \ \ ld r0, 16(r1); \
@@ -746,22 +746,22 @@ _GLOBAL(_##API_NAME) \ mflr r0; \ std r0, 16(r1); \ \ - std r10, 48+8*7(r1); \ + std r10, STK_PARAM_AREA+8*7(r1); \ \ li r11, API_NUMBER; \ lv1call; \ \ - ld r11, 48+8*7(r1); \ + ld r11, STK_PARAM_AREA+8*7(r1); \ std r4, 0(r11); \ - ld r11, 48+8*8(r1); \ + ld r11, STK_PARAM_AREA+8*8(r1); \ std r5, 0(r11); \ - ld r11, 48+8*9(r1); \ + ld r11, STK_PARAM_AREA+8*9(r1); \ std r6, 0(r11); \ - ld r11, 48+8*10(r1); \ + ld r11, STK_PARAM_AREA+8*10(r1); \ std r7, 0(r11); \ - ld r11, 48+8*11(r1); \ + ld r11, STK_PARAM_AREA+8*11(r1); \ std r8, 0(r11); \ - ld r11, 48+8*12(r1); \ + ld r11, STK_PARAM_AREA+8*12(r1); \ std r9, 0(r11); \ \ ld r0, 16(r1); \
@@ -777,7 +777,7 @@ _GLOBAL(_##API_NAME) \ li r11, API_NUMBER; \ lv1call; \ \ - ld r11, 48+8*8(r1); \ + ld r11, STK_PARAM_AREA+8*8(r1); \ std r4, 0(r11); \ \ ld r0, 16(r1); \
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 450/715 drm/bridge: adv7511: fix crash on irq during probe
In reply to Sasha LevinFrom: Mads Bligaard Nielsen <[email protected]>
[ Upstream commit aeedaee5ef5468caf59e2bb1265c2116e0c9a924 ]
Moved IRQ registration down to end of adv7511_probe().
If an IRQ already is pending during adv7511_probe (before adv7511_cec_init) then cec_received_msg_ts could crash using uninitialized data:
Unable to handle kernel read from unreadable memory at virtual address 00000000000003d5
Internal error: Oops: 96000004 [#1] PREEMPT_RT SMP
Call trace:
cec_received_msg_ts+0x48/0x990 [cec]
adv7511_cec_irq_process+0x1cc/0x308 [adv7511]
adv7511_irq_process+0xd8/0x120 [adv7511]
adv7511_irq_handler+0x1c/0x30 [adv7511]
irq_thread_fn+0x30/0xa0
irq_thread+0x14c/0x238
kthread+0x190/0x1a8--- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 22 ++++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +11 -11
@@ -1277,17 +1277,6 @@ static int adv7511_probe(struct i2c_client *i2c)INIT_WORK (&adv7511->hpd_work, adv7511_hpd_work); -if (i2c->irq) { -init_waitqueue_head (&adv7511->wq); - - ret =devm_request_threaded_irq (dev, i2c->irq,NULL , - adv7511_irq_handler, -IRQF_ONESHOT ,dev_name (dev), - adv7511); -if (ret) - goto err_unregister_cec; - } -adv7511_power_off (adv7511);i2c_set_clientdata (i2c, adv7511);
@@ -1311,6 +1300,17 @@ static int adv7511_probe(struct i2c_client *i2c)adv7511_audio_init (dev, adv7511); +if (i2c->irq) { +init_waitqueue_head (&adv7511->wq); + + ret =devm_request_threaded_irq (dev, i2c->irq,NULL , + adv7511_irq_handler, +IRQF_ONESHOT ,dev_name (dev), + adv7511); +if (ret) + goto err_unregister_audio; + } +if (adv7511->info->has_dsi) { ret =adv7533_attach_dsi (adv7511);if (ret)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 451/715 pinctrl: renesas: Allow the compiler to optimize away sh_pfc_pm
In reply to Sasha LevinFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit a6f06b909fee72c679c565adfa7f080f9595e336 ]
The conversion to DEFINE_NOIRQ_DEV_PM_OPS() lost the ability of the compiler to optimize away the struct dev_pm_ops object when it is not needed.
Fix this by replacing the use of pm_sleep_ptr() by a custom wrapper.
--- drivers/pinctrl/renesas/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pinctrl/renesas/core.c +3 -1
@@ -731,10 +731,12 @@ static int sh_pfc_resume_noirq(struct device *dev)sh_pfc_walk_regs (pfc, sh_pfc_restore_reg);return 0 ; } +#define pm_psci_sleep_ptr (_ptr) pm_sleep_ptr(_ptr)#else static int sh_pfc_suspend_init (struct sh_pfc *pfc) {return 0 ; }static int sh_pfc_suspend_noirq (struct device *dev) {return 0 ; }static int sh_pfc_resume_noirq (struct device *dev) {return 0 ; } +#define pm_psci_sleep_ptr (_ptr) PTR_IF(false, (_ptr))#endif /* CONFIG_ARM_PSCI_FW */ static DEFINE_NOIRQ_DEV_PM_OPS(sh_pfc_pm, sh_pfc_suspend_noirq, sh_pfc_resume_noirq);
@@ -1415,7 +1417,7 @@ static struct platform_driver sh_pfc_driver = { .driver = { .name = DRV_NAME, .of_match_table = of_match_ptr(sh_pfc_of_table), - .pm = pm_sleep_ptr(&sh_pfc_pm), + .pm = pm_psci_sleep_ptr(&sh_pfc_pm), }, };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 452/715 clk: hisilicon: hi3519: Release the correct number of gates in hi3519_clk_unregister()
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 74e39f526d95c0c119ada1874871ee328c59fbee ]
The gates are stored in 'hi3519_gate_clks', not 'hi3519_mux_clks'. This is also in line with how hisi_clk_register_gate() is called in the probe.
--- drivers/clk/hisilicon/clk-hi3519.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/hisilicon/clk-hi3519.c +1 -1
@@ -130,7 +130,7 @@ static void hi3519_clk_unregister(struct platform_device *pdev)of_clk_del_provider (pdev->dev.of_node);hisi_clk_unregister_gate (hi3519_gate_clks, -ARRAY_SIZE (hi3519_mux_clks), +ARRAY_SIZE (hi3519_gate_clks), crg->clk_data); hisi_clk_unregister_mux(hi3519_mux_clks, ARRAY_SIZE(hi3519_mux_clks),
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 453/715 clk: hisilicon: hi3559a: Fix an erroneous devm_kfree()
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 64c6a38136b74a2f18c42199830975edd9fbc379 ]
'p_clk' is an array allocated just before the for loop for all clk that need to be registered.
It is incremented at each loop iteration.
If a clk_register() call fails, 'p_clk' may point to something different from what should be freed.
The best we can do, is to avoid this wrong release of memory.
--- drivers/clk/hisilicon/clk-hi3559a.c | 1 - 1 file changed, 1 deletion(-)
drivers/clk/hisilicon/clk-hi3559a.c +0 -1
@@ -491,7 +491,6 @@ static void hisi_clk_register_pll(struct hi3559av100_pll_clock *clks, clk =clk_register (NULL , &p_clk->hw);if (IS_ERR (clk)) { -devm_kfree (dev, p_clk);dev_err (dev,"%s: failed to register clock %s\n" , __func__, clks[i].name);continue ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 454/715 clk: mediatek: mt8135: Fix an error handling path in clk_mt8135_apmixed_probe()
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 03c1c51eba6be49b42816af9db114553131af6c8 ]
If an error occurs after mtk_alloc_clk_data(), mtk_free_clk_data() should be called, as already done in the remove function.
--- drivers/clk/mediatek/clk-mt8135-apmixedsys.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/clk/mediatek/clk-mt8135-apmixedsys.c +3 -1
@@ -59,7 +59,7 @@ static int clk_mt8135_apmixed_probe(struct platform_device *pdev) ret =mtk_clk_register_plls (node, plls,ARRAY_SIZE (plls), clk_data);if (ret) -return ret; + goto free_clk_data; ret =of_clk_add_hw_provider (node, of_clk_hw_onecell_get, clk_data);if (ret)
@@ -69,6 +69,8 @@ static int clk_mt8135_apmixed_probe(struct platform_device *pdev) unregister_plls:mtk_clk_unregister_plls (plls,ARRAY_SIZE (plls), clk_data); +free_clk_data: +mtk_free_clk_data (clk_data);return ret; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 455/715 clk: mediatek: mt7622-apmixedsys: Fix an error handling path in clk_mt8135_apmixed_probe()
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit a32e88f2b20259f5fe4f8eed598bbc85dc4879ed ]
'clk_data' is allocated with mtk_devm_alloc_clk_data(). So calling mtk_free_clk_data() explicitly in the remove function would lead to a double-free.
Remove the redundant call.
--- drivers/clk/mediatek/clk-mt7622-apmixedsys.c | 1 - 1 file changed, 1 deletion(-)
drivers/clk/mediatek/clk-mt7622-apmixedsys.c +0 -1
@@ -127,7 +127,6 @@ static void clk_mt7622_apmixed_remove(struct platform_device *pdev)of_clk_del_provider (node);mtk_clk_unregister_gates (apmixed_clks,ARRAY_SIZE (apmixed_clks), clk_data);mtk_clk_unregister_plls (plls,ARRAY_SIZE (plls), clk_data); -mtk_free_clk_data (clk_data); }static const struct of_device_id of_match_clk_mt7622_apmixed[] = {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 456/715 clk: mediatek: mt8183: Correct parent of CLK_INFRA_SSPM_32K_SELF
In reply to Sasha LevinFrom: Chen-Yu Tsai <[email protected]>
[ Upstream commit a65083fa663a335008e34f65e184041174a9dc7e ]
CLK_INFRA_SSPM_32K_SELF has the "f_f26m_ck" clock assigned as its parent. This is inconsistent as the clock is part of a group that are all gates without dividers, and this makes the kernel think it runs at 26 MHz.
After clarification from MediaTek engineers, the correct parent is actually the system 32 KHz clock.
--- drivers/clk/mediatek/clk-mt8183.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/mediatek/clk-mt8183.c +1 -1
@@ -790,7 +790,7 @@ static const struct mtk_gate infra_clks[] = {/* infra_sspm_26m_self is main clock in co-processor, should not be closed in Linux. */ GATE_INFRA3_FLAGS (CLK_INFRA_SSPM_26M_SELF ,"infra_sspm_26m_self" ,"f_f26m_ck" ,3 ,CLK_IS_CRITICAL ),/* infra_sspm_32k_self is main clock in co-processor, should not be closed in Linux. */ -GATE_INFRA3_FLAGS (CLK_INFRA_SSPM_32K_SELF ,"infra_sspm_32k_self" ,"f_f26m_ck" ,4 ,CLK_IS_CRITICAL ), +GATE_INFRA3_FLAGS (CLK_INFRA_SSPM_32K_SELF ,"infra_sspm_32k_self" ,"clk32k" ,4 ,CLK_IS_CRITICAL ),GATE_INFRA3 (CLK_INFRA_UFS_AXI ,"infra_ufs_axi" ,"axi_sel" ,5 ),GATE_INFRA3 (CLK_INFRA_I2C6 ,"infra_i2c6" ,"i2c_sel" ,6 ), GATE_INFRA3(CLK_INFRA_AP_MSDC0, "infra_ap_msdc0", "msdc50_hclk_sel", 7),
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 457/715 clk: mediatek: mt7981-topckgen: flag SGM_REG_SEL as critical
In reply to Sasha LevinFrom: Daniel Golle <[email protected]>
[ Upstream commit aa690050c00a251ab69e3c5204d582833d0b958c ]
Without the SGM_REG_SEL clock enabled the cpu freezes if trying to access registers used by MT7981 clock drivers itself. Mark SGM_REG_SEL as critical to make sure it is always enabled to prevent freezes on boot even if the Ethernet driver which prepares and enables the clock is not loaded or probed at a later point.
--- drivers/clk/mediatek/clk-mt7981-topckgen.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/clk/mediatek/clk-mt7981-topckgen.c +3 -2
@@ -357,8 +357,9 @@ static const struct mtk_mux top_muxes[] = {MUX_GATE_CLR_SET_UPD (CLK_TOP_SGM_325M_SEL ,"sgm_325m_sel" , sgm_325m_parents,0x050 ,0x054 ,0x058 ,8 ,1 ,15 ,0x1C0 ,21 ), -MUX_GATE_CLR_SET_UPD (CLK_TOP_SGM_REG_SEL ,"sgm_reg_sel" , sgm_reg_parents, -0x050 ,0x054 ,0x058 ,16 ,1 ,23 ,0x1C0 ,22 ), +MUX_GATE_CLR_SET_UPD_FLAGS (CLK_TOP_SGM_REG_SEL ,"sgm_reg_sel" , sgm_reg_parents, +0x050 ,0x054 ,0x058 ,16 ,1 ,23 ,0x1C0 ,22 , +CLK_IS_CRITICAL |CLK_SET_RATE_PARENT ),MUX_GATE_CLR_SET_UPD (CLK_TOP_EIP97B_SEL ,"eip97b_sel" , eip97b_parents, 0x050, 0x054, 0x058, 24, 3, 31, 0x1C0, 23),/* CLK_CFG_6 */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 458/715 drm/tegra: put drm_gem_object ref on error in tegra_fb_create
In reply to Sasha LevinFrom: Fedor Pchelkin <[email protected]>
[ Upstream commit 32e5a120a5105bce01561978ee55aee8e40ac0dc ]
Inside tegra_fb_create(), drm_gem_object_lookup() increments ref count of the found object. But if the following size check fails then the last found object's ref count should be put there as the unreferencing loop can't detect this situation.
Found by Linux Verification Center (linuxtesting.org).
--- drivers/gpu/drm/tegra/fb.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/tegra/fb.c +1 -0
@@ -159,6 +159,7 @@ struct drm_framebuffer *tegra_fb_create(struct drm_device *drm,if (gem->size < size) { err = -EINVAL ; +drm_gem_object_put (gem); goto unreference; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 459/715 tty: mips_ejtag_fdc: Fix passing incompatible pointer type warning
In reply to Sasha LevinFrom: Serge Semin <[email protected]>
[ Upstream commit 188942f05ce45f80c06f7242ad7478bd204c3387 ]
mips_ejtag_fdc_encode() method expects having a first argument passed of the "u8 **" type, meanwhile the driver passes the "const char **" type. That causes the next build-warning:
drivers/tty/mips_ejtag_fdc.c: In function ‘mips_ejtag_fdc_console_write’:drivers/tty/mips_ejtag_fdc.c:343:32: error: passing argument 1 of ‘mips_ejtag_fdc_encode’ from incompatible pointer type [-Werror=incompatible-pointer-types]
word = mips_ejtag_fdc_encode(&buf_ptr, &buf_len, 1);
^
drivers/tty/mips_ejtag_fdc.c:216:24: note: expected ‘const u8 ** {aka const unsigned char **}’ but argument is of type ‘const char **’
static struct fdc_word mips_ejtag_fdc_encode(const u8 **ptrs,
^~~~~~~~~~~~~~~~~~~~~Fix it by altering the type of the pointer which is passed to the mips_ejtag_fdc_encode() method.
--- drivers/tty/mips_ejtag_fdc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/mips_ejtag_fdc.c +1 -1
@@ -309,7 +309,7 @@ static void mips_ejtag_fdc_console_write(struct console *c, const char *s,unsigned int i, buf_len, cpu;bool done_cr = false;char buf[4 ]; -const char *buf_ptr = buf; +const u8 *buf_ptr = buf;/* Number of bytes of input data encoded up to each byte in buf */ u8 inc[4 ];
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 460/715 media: ivsc: csi: Swap SINK and SOURCE pads
In reply to Sasha LevinFrom: Sakari Ailus <[email protected]>
[ Upstream commit 48f5fd8967f8dd01679fc1618b0cba02095cddc5 ]
This patch swaps SINK and SOURCE pads of the MEI CSI sub-device. While this does change the UAPI by swapping the pads, the driver has never been usable in upstream kernel as the Intel IPU6 driver it depends on any functionality has not yet been merged.
--- drivers/media/pci/intel/ivsc/mei_csi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/pci/intel/ivsc/mei_csi.c +2 -2
@@ -71,8 +71,8 @@ enum ivsc_privacy_status { };enum csi_pads { -CSI_PAD_SOURCE ,CSI_PAD_SINK , +CSI_PAD_SOURCE ,CSI_NUM_PADS };
@@ -587,7 +587,7 @@ static int mei_csi_notify_bound(struct v4l2_async_notifier *notifier, csi->remote_pad = pad;return media_create_pad_link (&subdev->entity, pad, - &csi->subdev.entity,1 , + &csi->subdev.entity,CSI_PAD_SINK ,MEDIA_LNK_FL_ENABLED |MEDIA_LNK_FL_IMMUTABLE ); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 461/715 media: i2c: imx290: Fix IMX920 typo
In reply to Sasha LevinFrom: Alexander Stein <[email protected]>
[ Upstream commit 6fc62efa266b0918c7b226f45c2eccfcf99a6d8e ]
Replace IMX920 by IMX290.
--- drivers/media/i2c/imx290.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/media/i2c/imx290.c +8 -8
@@ -150,10 +150,10 @@#define IMX290_PIXEL_ARRAY_WIDTH 1945#define IMX290_PIXEL_ARRAY_HEIGHT 1097 -#define IMX920_PIXEL_ARRAY_MARGIN_LEFT 12 -#define IMX920_PIXEL_ARRAY_MARGIN_RIGHT 13 -#define IMX920_PIXEL_ARRAY_MARGIN_TOP 8 -#define IMX920_PIXEL_ARRAY_MARGIN_BOTTOM 9 +#define IMX290_PIXEL_ARRAY_MARGIN_LEFT 12 +#define IMX290_PIXEL_ARRAY_MARGIN_RIGHT 13 +#define IMX290_PIXEL_ARRAY_MARGIN_TOP 8 +#define IMX290_PIXEL_ARRAY_MARGIN_BOTTOM 9#define IMX290_PIXEL_ARRAY_RECORDING_WIDTH 1920#define IMX290_PIXEL_ARRAY_RECORDING_HEIGHT 1080
@@ -1161,10 +1161,10 @@ static int imx290_get_selection(struct v4l2_subdev *sd,* The sensor moves the readout by 1 pixel based on flips to * keep the Bayer order the same. */ - sel->r.top =IMX920_PIXEL_ARRAY_MARGIN_TOP + sel->r.top =IMX290_PIXEL_ARRAY_MARGIN_TOP + (IMX290_PIXEL_ARRAY_RECORDING_HEIGHT - format->height) /2 + imx290->vflip->val; - sel->r.left =IMX920_PIXEL_ARRAY_MARGIN_LEFT + sel->r.left =IMX290_PIXEL_ARRAY_MARGIN_LEFT + (IMX290_PIXEL_ARRAY_RECORDING_WIDTH - format->width) /2 + imx290->hflip->val; sel->r.width = format->width;
@@ -1183,8 +1183,8 @@ static int imx290_get_selection(struct v4l2_subdev *sd,return 0 ;case V4L2_SEL_TGT_CROP_DEFAULT : - sel->r.top =IMX920_PIXEL_ARRAY_MARGIN_TOP ; - sel->r.left =IMX920_PIXEL_ARRAY_MARGIN_LEFT ; + sel->r.top =IMX290_PIXEL_ARRAY_MARGIN_TOP ; + sel->r.left =IMX290_PIXEL_ARRAY_MARGIN_LEFT ; sel->r.width =IMX290_PIXEL_ARRAY_RECORDING_WIDTH ; sel->r.height =IMX290_PIXEL_ARRAY_RECORDING_HEIGHT ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 462/715 mfd: syscon: Call of_node_put() only when of_parse_phandle() takes a ref
In reply to Sasha LevinFrom: Peter Griffin <[email protected]>
[ Upstream commit d2b0680cf3b05490b579e71b0df6e07451977745 ]
of_parse_phandle() returns a device_node with refcount incremented, which the callee needs to call of_node_put() on when done. We should only call of_node_put() when the property argument is provided though as otherwise nothing has taken a reference on the node.
--- drivers/mfd/syscon.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mfd/syscon.c +3 -1
@@ -238,7 +238,9 @@ struct regmap *syscon_regmap_lookup_by_phandle(struct device_node *np,return ERR_PTR (-ENODEV ); regmap =syscon_node_to_regmap (syscon_np); -of_node_put (syscon_np); + +if (property) +of_node_put (syscon_np);return regmap; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 463/715 mfd: altera-sysmgr: Call of_node_put() only when of_parse_phandle() takes a ref
In reply to Sasha LevinFrom: Peter Griffin <[email protected]>
[ Upstream commit e28c28a34ee9fa2ea671a20e5e7064e6220d55e7 ]
of_parse_phandle() returns a device_node with refcount incremented, which the callee needs to call of_node_put() on when done. We should only call of_node_put() when the property argument is provided though as otherwise nothing has taken a reference on the node.
--- drivers/mfd/altera-sysmgr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mfd/altera-sysmgr.c +3 -1
@@ -109,7 +109,9 @@ struct regmap *altr_sysmgr_regmap_lookup_by_phandle(struct device_node *np, dev =driver_find_device_by_of_node (&altr_sysmgr_driver.driver, (void *)sysmgr_np); -of_node_put (sysmgr_np); +if (property) +of_node_put (sysmgr_np); +if (!dev)return ERR_PTR (-EPROBE_DEFER );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 464/715 perf print-events: make is_event_supported() more robust
In reply to Sasha LevinFrom: Mark Rutland <[email protected]>
[ Upstream commit 25412c0364f7110faa6053c73e3fd47ca956b8c3 ]
Currently the perf tool doesn't detect support for extended event types on Apple M1/M2 systems, and will not auto-expand plain PERF_EVENT_TYPE hardware events into per-PMU events. This is due to the detection of extended event types not handling mandatory filters required by the M1/M2 PMU driver.
PMU drivers and the core perf_events code can require that perf_event_attr::exclude_* filters are configured in a specific way and may reject certain configurations of filters, for example:
(a) Many PMUs lack support for any event filtering, and require all perf_event_attr::exclude_* bits to be clear. This includes Alpha's CPU PMU, and ARM CPU PMUs prior to the introduction of PMUv2 in ARMv7,
(b) When /proc/sys/kernel/perf_event_paranoid >= 2, the perf core requires that perf_event_attr::exclude_kernel is set.
(c) The Apple M1/M2 PMU requires that perf_event_attr::exclude_guest is set as the hardware PMU does not count while a guest is running (but might be extended in future to do so).
In is_event_supported(), we try to account for cases (a) and (b), first attempting to open an event without any filters, and if this fails, retrying with perf_event_attr::exclude_kernel set. We do not account for case (c), or any other filters that drivers could theoretically require to be set.
Thus is_event_supported() will fail to detect support for any events targeting an Apple M1/M2 PMU, even where events would be supported with perf_event_attr:::exclude_guest set.
Since commit:
82fe2e45cdb00de4 ("perf pmus: Check if we can encode the PMU number in perf_event_attr.type")
... we use is_event_supported() to detect support for extended types, with the PMU ID encoded into the perf_event_attr::type. As above, on an Apple M1/M2 system this will always fail to detect that the event is supported, and consequently we fail to detect support for extended types even when these are supported, as they have been since commit:
5c816728651ae425 ("arm_pmu: Add PERF_PMU_CAP_EXTENDED_HW_TYPE capability")
Due to this, the perf tool will not automatically expand plain PERF_TYPE_HARDWARE events into per-PMU events, even when all the necessary kernel support is present.
This patch updates is_event_supported() to additionally try opening events with perf_event_attr::exclude_guest set, allowing support for events to be detected on Apple M1/M2 systems. I believe that this is sufficient for all contemporary CPU PMU drivers, though in future it may be necessary to check for other combinations of filter bits.
I've deliberately changed the check to not expect a specific error code for missing filters, as today ;the kernel may return a number of different error codes for missing filters (e.g. -EACCESS, -EINVAL, or -EOPNOTSUPP) depending on why and where the filter configuration is rejected, and retrying for any error is more robust.
Note that this does not remove the need for commit:
a24d9d9dc096fc0d ("perf parse-events: Make legacy events lower priority than sysfs/JSON")
... which is still necessary so that named-pmu/event/ events work on kernels without extended type support, even if the event name happens to be the same as a PERF_EVENT_TYPE_HARDWARE event (e.g. as is the case for the M1/M2 PMU's 'cycles' and 'instructions' events).
--- tools/perf/util/print-events.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-)
tools/perf/util/print-events.c +19 -8
@@ -232,7 +232,6 @@ void print_sdt_events(const struct print_callbacks *print_cb, void *print_state)bool is_event_supported (u8 type,u64 config) {bool ret = true; -int open_return;struct evsel *evsel;struct perf_event_attr attr = { .type = type,
@@ -246,20 +245,32 @@ bool is_event_supported(u8 type, u64 config) evsel =evsel__new (&attr);if (evsel) { - open_return =evsel__open (evsel,NULL , tmap); - ret = open_return >=0 ; + ret =evsel__open (evsel,NULL , tmap) >=0 ; -if (open_return == -EACCES ) { +if (!ret) {/* -* This happens if the paranoid value +* The event may fail to open if the paranoid value * /proc/sys/kernel/perf_event_paranoid is set to 2 -* Re-run with exclude_kernel set; we don't do that -* by default as some ARM machines do not support it. -* +* Re-run with exclude_kernel set; we don't do that by +* default as some ARM machines do not support it. */ evsel->core.attr.exclude_kernel =1 ; ret =evsel__open (evsel,NULL , tmap) >=0 ; } + +if (!ret) { +/* +* The event may fail to open if the PMU requires +* exclude_guest to be set (e.g. as the Apple M1 PMU +* requires). +* Re-run with exclude_guest set; we don't do that by +* default as it's equally legitimate for another PMU +* driver to require that exclude_guest is clear. +*/ + evsel->core.attr.exclude_guest =1 ; + ret =evsel__open (evsel,NULL , tmap) >=0 ; + } +evsel__delete (evsel); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 465/715 crypto: arm/sha - fix function cast warnings
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 53cc9baeb9bc2a187eb9c9790d30995148852b12 ]
clang-16 warns about casting between incompatible function types:
arch/arm/crypto/sha256_glue.c:37:5: error: cast from 'void (*)(u32 *, const void *, unsigned int)' (aka 'void (*)(unsigned int *, const void *, unsigned int)') to 'sha256_block_fn *' (aka 'void (*)(struct sha256_state *, const unsigned char *, int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
37 | (sha256_block_fn *)sha256_block_data_order);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/arm/crypto/sha512-glue.c:34:3: error: cast from 'void (*)(u64 *, const u8 *, int)' (aka 'void (*)(unsigned long long *, const unsigned char *, int)') to 'sha512_block_fn *' (aka 'void (*)(struct sha512_state *, const unsigned char *, int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
34 | (sha512_block_fn *)sha512_block_data_order);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Fix the prototypes for the assembler functions to match the typedef. The code already relies on the digest being the first part of the state structure, so there is no change in behavior.
--- arch/arm/crypto/sha256_glue.c | 13 +++++-------- arch/arm/crypto/sha512-glue.c | 12 +++++------- 2 files changed, 10 insertions(+), 15 deletions(-)
arch/arm/crypto/sha256_glue.c +5 -8
@@ -24,8 +24,8 @@#include "sha256_glue.h" -asmlinkage void sha256_block_data_order(u32 *digest, const void *data, -unsigned int num_blks); +asmlinkage void sha256_block_data_order(struct sha256_state *state, +const u8 *data,int num_blks);int crypto_sha256_arm_update (struct shash_desc *desc,const u8 *data,unsigned int len)
@@ -33,23 +33,20 @@ int crypto_sha256_arm_update(struct shash_desc *desc, const u8 *data,/* make sure casting to sha256_block_fn() is safe */ BUILD_BUG_ON (offsetof(struct sha256_state , state) !=0 ); -return sha256_base_do_update (desc, data, len, - (sha256_block_fn *)sha256_block_data_order); +return sha256_base_do_update (desc, data, len, sha256_block_data_order); }EXPORT_SYMBOL (crypto_sha256_arm_update);static int crypto_sha256_arm_final (struct shash_desc *desc,u8 *out) { -sha256_base_do_finalize (desc, - (sha256_block_fn *)sha256_block_data_order); +sha256_base_do_finalize (desc, sha256_block_data_order);return sha256_base_finish (desc, out); }int crypto_sha256_arm_finup (struct shash_desc *desc,const u8 *data,unsigned int len,u8 *out) { -sha256_base_do_update (desc, data, len, - (sha256_block_fn *)sha256_block_data_order); +sha256_base_do_update (desc, data, len, sha256_block_data_order);return crypto_sha256_arm_final (desc, out); }EXPORT_SYMBOL (crypto_sha256_arm_finup);
arch/arm/crypto/sha512-glue.c +5 -7
@@ -25,27 +25,25 @@ MODULE_ALIAS_CRYPTO("sha512");MODULE_ALIAS_CRYPTO ("sha384-arm" );MODULE_ALIAS_CRYPTO ("sha512-arm" ); -asmlinkage void sha512_block_data_order(u64 *state, u8 const *src, int blocks); +asmlinkage void sha512_block_data_order(struct sha512_state *state, +u8 const *src,int blocks);int sha512_arm_update (struct shash_desc *desc,const u8 *data,unsigned int len) { -return sha512_base_do_update (desc, data, len, - (sha512_block_fn *)sha512_block_data_order); +return sha512_base_do_update (desc, data, len, sha512_block_data_order); }static int sha512_arm_final (struct shash_desc *desc,u8 *out) { -sha512_base_do_finalize (desc, - (sha512_block_fn *)sha512_block_data_order); +sha512_base_do_finalize (desc, sha512_block_data_order);return sha512_base_finish (desc, out); }int sha512_arm_finup (struct shash_desc *desc,const u8 *data,unsigned int len,u8 *out) { -sha512_base_do_update (desc, data, len, - (sha512_block_fn *)sha512_block_data_order); +sha512_base_do_update (desc, data, len, sha512_block_data_order);return sha512_arm_final (desc, out); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 466/715 crypto: ccp - Avoid discarding errors in psp_send_platform_access_msg()
In reply to Sasha LevinFrom: Mario Limonciello <[email protected]>
[ Upstream commit 0e8fca2f12ceb77c3a6b6f210135031f264aa612 ]
Errors can potentially occur in the "processing" of PSP commands or commands can be processed successfully but still return an error code in the header.
This second case was being discarded because PSP communication worked but the command returned an error code in the payload header.
Capture both cases and return them to the caller as -EIO for the caller to investigate. The caller can detect the latter by looking at req->header->status.
--- drivers/crypto/ccp/platform-access.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/crypto/ccp/platform-access.c +9 -2
@@ -118,9 +118,16 @@ int psp_send_platform_access_msg(enum psp_platform_access_msg msg, goto unlock; } -/* Store the status in request header for caller to investigate */ +/* +* Read status from PSP. If status is non-zero, it indicates an error +* occurred during "processing" of the command. +* If status is zero, it indicates the command was "processed" +* successfully, but the result of the command is in the payload. +* Return both cases to the caller as -EIO to investigate. +*/ cmd_reg =ioread32 (cmd); - req->header.status =FIELD_GET (PSP_CMDRESP_STS , cmd_reg); +if (FIELD_GET (PSP_CMDRESP_STS , cmd_reg)) + req->header.status =FIELD_GET (PSP_CMDRESP_STS , cmd_reg);if (req->header.status) { ret = -EIO ; goto unlock;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 467/715 crypto: qat - remove unused macros in qat_comp_alg.c
In reply to Sasha LevinFrom: Adam Guerin <[email protected]>
[ Upstream commit dfff0e35fa5dd84ae75052ba129b0219d83e46dc ]
As a result of the removal of qat_zlib_deflate, some defines where not removed. Remove them.
This is to fix the following warning when compiling the QAT driver
using the clang compiler with CC=clang W=2:
drivers/crypto/intel/qat/qat_common/qat_comp_algs.c:21:9: warning: macro is not used [-Wunused-macros]
21 | #define QAT_RFC_1950_CM_OFFSET 4
| ^
drivers/crypto/intel/qat/qat_common/qat_comp_algs.c:16:9: warning: macro is not used [-Wunused-macros]
16 | #define QAT_RFC_1950_HDR_SIZE 2
| ^
drivers/crypto/intel/qat/qat_common/qat_comp_algs.c:17:9: warning: macro is not used [-Wunused-macros]
17 | #define QAT_RFC_1950_FOOTER_SIZE 4
| ^
drivers/crypto/intel/qat/qat_common/qat_comp_algs.c:22:9: warning: macro is not used [-Wunused-macros]
22 | #define QAT_RFC_1950_DICT_MASK 0x20
| ^
drivers/crypto/intel/qat/qat_common/qat_comp_algs.c:18:9: warning: macro is not used [-Wunused-macros]
18 | #define QAT_RFC_1950_CM_DEFLATE 8
| ^
drivers/crypto/intel/qat/qat_common/qat_comp_algs.c:20:9: warning: macro is not used [-Wunused-macros]
20 | #define QAT_RFC_1950_CM_MASK 0x0f
| ^
drivers/crypto/intel/qat/qat_common/qat_comp_algs.c:23:9: warning: macro is not used [-Wunused-macros]
23 | #define QAT_RFC_1950_COMP_HDR 0x785e
| ^
drivers/crypto/intel/qat/qat_common/qat_comp_algs.c:19:9: warning: macro is not used [-Wunused-macros]
19 | #define QAT_RFC_1950_CM_DEFLATE_CINFO_32K 7
| ^
--- drivers/crypto/intel/qat/qat_common/qat_comp_algs.c | 9 --------- 1 file changed, 9 deletions(-)
drivers/crypto/intel/qat/qat_common/qat_comp_algs.c +0 -9
@@ -13,15 +13,6 @@#include "qat_compression.h" #include "qat_algs_send.h" -#define QAT_RFC_1950_HDR_SIZE 2 -#define QAT_RFC_1950_FOOTER_SIZE 4 -#define QAT_RFC_1950_CM_DEFLATE 8 -#define QAT_RFC_1950_CM_DEFLATE_CINFO_32K 7 -#define QAT_RFC_1950_CM_MASK 0x0f -#define QAT_RFC_1950_CM_OFFSET 4 -#define QAT_RFC_1950_DICT_MASK 0x20 -#define QAT_RFC_1950_COMP_HDR 0x785e -static DEFINE_MUTEX (algs_lock);static unsigned int active_devs;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 468/715 crypto: qat - removed unused macro in adf_cnv_dbgfs.c
In reply to Sasha LevinFrom: Adam Guerin <[email protected]>
[ Upstream commit 9a5dcada14d5e027856a1bc38443e54111438da6 ]
This macro was added but never used, remove it.
This is to fix the following warning when compiling the QAT driver
using the clang compiler with CC=clang W=2:
drivers/crypto/intel/qat/qat_common/adf_cnv_dbgfs.c:19:9: warning: macro is not used [-Wunused-macros]
19 | #define CNV_SLICE_ERR_MASK GENMASK(7, 0)
| ^
--- drivers/crypto/intel/qat/qat_common/adf_cnv_dbgfs.c | 1 - 1 file changed, 1 deletion(-)
drivers/crypto/intel/qat/qat_common/adf_cnv_dbgfs.c +0 -1
@@ -16,7 +16,6 @@#define CNV_ERR_INFO_MASK GENMASK(11, 0)#define CNV_ERR_TYPE_MASK GENMASK(15, 12) -#define CNV_SLICE_ERR_MASK GENMASK(7, 0)#define CNV_SLICE_ERR_SIGN_BIT_INDEX 7#define CNV_DELTA_ERR_SIGN_BIT_INDEX 11
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 469/715 crypto: qat - avoid division by zero
In reply to Sasha LevinFrom: Adam Guerin <[email protected]>
[ Upstream commit f99fb7d660f7c818105803f1f1915396a14d18ad ]
Check if delta_us is not zero and return -EINVAL if it is. delta_us is unlikely to be zero as there is a sleep between the reads of the two timestamps.
This is to fix the following warning when compiling the QAT driver using clang scan-build:
drivers/crypto/intel/qat/qat_common/adf_clock.c:87:9: warning: Division by zero [core.DivideZero]
87 | temp = DIV_ROUND_CLOSEST_ULL(temp, delta_us);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--- drivers/crypto/intel/qat/qat_common/adf_clock.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/crypto/intel/qat/qat_common/adf_clock.c +3 -0
@@ -83,6 +83,9 @@ static int measure_clock(struct adf_accel_dev *accel_dev, u32 *frequency) } delta_us =timespec_to_us (&ts3) -timespec_to_us (&ts1); +if (!delta_us) +return -EINVAL ; + temp = (timestamp2 - timestamp1) *ME_CLK_DIVIDER *10 ; temp =DIV_ROUND_CLOSEST_ULL (temp, delta_us);/*
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 470/715 crypto: qat - remove double initialization of value
In reply to Sasha LevinFrom: Adam Guerin <[email protected]>
[ Upstream commit a66cf93ab33853f17b8cc33a99263dd0a383a1a1 ]
Remove double initialization of the reg variable.
This is to fix the following warning when compiling the QAT driver using clang scan-build:
drivers/crypto/intel/qat/qat_common/adf_gen4_ras.c:1010:6: warning: Value stored to 'reg' during its initialization is never read [deadcode.DeadStores]
1010 | u32 reg = ADF_CSR_RD(csr, ADF_GEN4_SSMCPPERR);
| ^~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/crypto/intel/qat/qat_common/adf_gen4_ras.c:1109:6: warning: Value stored to 'reg' during its initialization is never read [deadcode.DeadStores]
1109 | u32 reg = ADF_CSR_RD(csr, ADF_GEN4_SER_ERR_SSMSH);
| ^~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--- drivers/crypto/intel/qat/qat_common/adf_gen4_ras.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/crypto/intel/qat/qat_common/adf_gen4_ras.c +2 -4
@@ -1007,8 +1007,7 @@ static bool adf_handle_spppar_err(struct adf_accel_dev *accel_dev,static bool adf_handle_ssmcpppar_err (struct adf_accel_dev *accel_dev,void __iomem *csr,u32 iastatssm) { -u32 reg =ADF_CSR_RD (csr,ADF_GEN4_SSMCPPERR ); -u32 bits_num =BITS_PER_REG (reg); +u32 reg, bits_num =BITS_PER_REG (reg);bool reset_required = false;unsigned long errs_bits;u32 bit_iterator;
@@ -1106,8 +1105,7 @@ static bool adf_handle_rf_parr_err(struct adf_accel_dev *accel_dev,static bool adf_handle_ser_err_ssmsh (struct adf_accel_dev *accel_dev,void __iomem *csr,u32 iastatssm) { -u32 reg =ADF_CSR_RD (csr,ADF_GEN4_SER_ERR_SSMSH ); -u32 bits_num =BITS_PER_REG (reg); +u32 reg, bits_num =BITS_PER_REG (reg);bool reset_required = false;unsigned long errs_bits;u32 bit_iterator;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 471/715 crypto: qat - fix ring to service map for dcc in 4xxx
In reply to Sasha LevinFrom: Damian Muszynski <[email protected]>
[ Upstream commit df018f82002a8b4dc407bc9a6f416b9241d14415 ]
If a device is configured for data compression chaining (dcc), half of the engines are loaded with the symmetric crypto image and the rest are loaded with the compression image.
However, in such configuration all rings can handle compression requests.
Fix the ring to service mapping so that when a device is configured for dcc, the ring to service mapping reports that all rings in a bank can be used for compression.
--- drivers/crypto/intel/qat/qat_4xxx/adf_4xxx_hw_data.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/crypto/intel/qat/qat_4xxx/adf_4xxx_hw_data.c +8 -0
@@ -331,6 +331,13 @@ static u16 get_ring_to_svc_map(struct adf_accel_dev *accel_dev)if (!fw_config)return 0 ; +/* If dcc, all rings handle compression requests */ +if (adf_get_service_enabled (accel_dev) ==SVC_DCC ) { +for (i =0 ; i <RP_GROUP_COUNT ; i++) + rps[i] =COMP ; + goto set_mask; + } +for (i =0 ; i <RP_GROUP_COUNT ; i++) {switch (fw_config[i].ae_mask) {case ADF_AE_GROUP_0 :
@@ -359,6 +366,7 @@ static u16 get_ring_to_svc_map(struct adf_accel_dev *accel_dev) } } +set_mask: ring_to_svc_map = rps[RP_GROUP_0 ] <<ADF_CFG_SERV_RING_PAIR_0_SHIFT | rps[RP_GROUP_1 ] <<ADF_CFG_SERV_RING_PAIR_1_SHIFT | rps[RP_GROUP_0] << ADF_CFG_SERV_RING_PAIR_2_SHIFT |
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 472/715 crypto: qat - fix ring to service map for dcc in 420xx
In reply to Sasha LevinFrom: Damian Muszynski <[email protected]>
[ Upstream commit a20a6060e0dd57fecaf55487985aef28bd08c6bf ]
If a device is configured for data compression chaining (dcc), half of the engines are loaded with the symmetric crypto image and the rest are loaded with the compression image.
However, in such configuration all rings can handle compression requests.
Fix the ring to service mapping so that when a device is configured for dcc, the ring to service mapping reports that all rings in a bank can be used for compression.
--- drivers/crypto/intel/qat/qat_420xx/adf_420xx_hw_data.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/crypto/intel/qat/qat_420xx/adf_420xx_hw_data.c +8 -0
@@ -372,6 +372,13 @@ static u16 get_ring_to_svc_map(struct adf_accel_dev *accel_dev)if (!fw_config)return 0 ; +/* If dcc, all rings handle compression requests */ +if (adf_get_service_enabled (accel_dev) ==SVC_DCC ) { +for (i =0 ; i <RP_GROUP_COUNT ; i++) + rps[i] =COMP ; + goto set_mask; + } +for (i =0 ; i <RP_GROUP_COUNT ; i++) {switch (fw_config[i].ae_mask) {case ADF_AE_GROUP_0 :
@@ -400,6 +407,7 @@ static u16 get_ring_to_svc_map(struct adf_accel_dev *accel_dev) } } +set_mask: ring_to_svc_map = rps[RP_GROUP_0 ] <<ADF_CFG_SERV_RING_PAIR_0_SHIFT | rps[RP_GROUP_1 ] <<ADF_CFG_SERV_RING_PAIR_1_SHIFT | rps[RP_GROUP_0] << ADF_CFG_SERV_RING_PAIR_2_SHIFT |
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 473/715 crypto: jitter - fix CRYPTO_JITTERENTROPY help text
In reply to Sasha LevinFrom: Randy Dunlap <[email protected]>
[ Upstream commit e63df1ec9a16dd9e13e9068243e64876de06f795 ]
Correct various small problems in the help text:
a. change 2 spaces to ", "
b. finish an incomplete sentence
c. change non-working URL to working URL
--- crypto/Kconfig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
crypto/Kconfig +3 -2
@@ -1269,10 +1269,11 @@ config CRYPTO_JITTERENTROPY A non-physical non-deterministic ("true") RNG (e.g., an entropy source compliant with NIST SP800-90B) intended to provide a seed to a - deterministic RNG (e.g. per NIST SP800-90C). + deterministic RNG (e.g., per NIST SP800-90C). This RNG does not perform any cryptographic whitening of the generated + random numbers. - See https://www.chronox.de/jent.html + See https://www.chronox.de/jent/ if CRYPTO_JITTERENTROPY if CRYPTO_FIPS && EXPERT
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 474/715 drm/tidss: Fix initial plane zpos values
In reply to Sasha LevinFrom: Tomi Valkeinen <[email protected]>
[ Upstream commit 3ec948ccb2c4b99e8fbfdd950adbe92ea577b395 ]
When the driver sets up the zpos property it sets the default zpos value to the HW id of the plane. That is fine as such, but as on many DSS versions the driver arranges the DRM planes in a different order than the HW planes (to keep the non-scalable planes first), this leads to odd initial zpos values. An example is J721e, where the initial zpos values for DRM planes are 1, 3, 0, 2.
In theory the userspace should configure the zpos values properly when using multiple planes, and in that sense the initial zpos values shouldn't matter, but there's really no reason not to fix this and help the userspace apps which don't handle zpos perfectly. In particular, some versions of Weston seem to have issues dealing with the planes with the current default zpos values.
So let's change the zpos values for the DRM planes to 0, 1, 2, 3.
Another option would be to configure the planes marked as primary planes to zpos 0. On a two display system this would give us plane zpos values of 0, 0, 1, 2. The end result and behavior would be very similar in this option, and I'm not aware that this would actually help us in any way. So, to keep the code simple, I opted for the 0, 1, 2, 3 values.
--- drivers/gpu/drm/tidss/tidss_plane.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/tidss/tidss_plane.c +1 -1
@@ -213,7 +213,7 @@ struct tidss_plane *tidss_plane_create(struct tidss_device *tidss,drm_plane_helper_add (&tplane->plane, &tidss_plane_helper_funcs); -drm_plane_create_zpos_property (&tplane->plane, hw_plane_id,0 , +drm_plane_create_zpos_property (&tplane->plane, tidss->num_planes,0 , num_planes -1 ); ret = drm_plane_create_color_properties(&tplane->plane,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 475/715 drm/tidss: Fix sync-lost issue with two displays
In reply to Sasha LevinFrom: Tomi Valkeinen <[email protected]>
[ Upstream commit c079e2e113f2ec2803ba859bbb442a6ab82c96bd ]
A sync lost issue can be observed with two displays, when moving a plane from one disabled display to an another disabled display, and then enabling the display to which the plane was moved to. The exact requirements for this to trigger are not clear.
It looks like the issue is that the layers are left enabled in the first display's OVR registers. Even if the corresponding VP is disabled, it still causes an issue, as if the disabled VP and its OVR would still be in use, leading to the same VID being used by two OVRs. However, this is just speculation based on testing the DSS behavior.
Experimentation shows that as a workaround, we can disable all the layers in the OVR when disabling a VP. There should be no downside to this, as the OVR is anyway effectively disabled if its VP is disabled, and it seems to solve the sync lost issue.
However, there may be a bigger issue in play here, related to J721e erratum i2097 ("DSS: Disabling a Layer Connected to Overlay May Result in Synclost During the Next Frame"). Experimentation also shows that the OVR's CHANNELIN field has similar issue. So we may need to revisit this when we find out more about the core issue.
--- drivers/gpu/drm/tidss/tidss_crtc.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/gpu/drm/tidss/tidss_crtc.c +10 -0
@@ -265,6 +265,16 @@ static void tidss_crtc_atomic_disable(struct drm_crtc *crtc,reinit_completion (&tcrtc->framedone_completion); +/* +* If a layer is left enabled when the videoport is disabled, and the +* vid pipeline that was used for the layer is taken into use on +* another videoport, the DSS will report sync lost issues. Disable all +* the layers here as a work-around. +*/ +for (u32 layer =0 ; layer < tidss->feat->num_planes; layer++) +dispc_ovr_enable_layer (tidss->dispc, tcrtc->hw_videoport, layer, + false); +dispc_vp_disable (tidss->dispc, tcrtc->hw_videoport); if (!wait_for_completion_timeout(&tcrtc->framedone_completion,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 476/715 clk: imx: imx8mp: Fix SAI_MCLK_SEL definition
In reply to Sasha LevinFrom: Shengjiu Wang <[email protected]>
[ Upstream commit 13269dc6c70444528f0093585e3559cd2f38850a ]
There is SAI1, SAI2, SAI3, SAI5, SAI6, SAI7 existing in this block control, the order is discontinuous. The definition of SAI_MCLK_SEL(n) is not match with the usage of CLK_SAIn(n).
So define SAI##n##_MCLK_SEL separately to fix the issue.
--- drivers/clk/imx/clk-imx8mp-audiomix.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/clk/imx/clk-imx8mp-audiomix.c +8 -3
@@ -18,7 +18,12 @@#define CLKEN0 0x000#define CLKEN1 0x004 -#define SAI_MCLK_SEL (n) (0x300 + 4 * (n))/* n in 0..5 */ +#define SAI1_MCLK_SEL 0x300 +#define SAI2_MCLK_SEL 0x304 +#define SAI3_MCLK_SEL 0x308 +#define SAI5_MCLK_SEL 0x30C +#define SAI6_MCLK_SEL 0x310 +#define SAI7_MCLK_SEL 0x314#define PDM_SEL 0x318#define SAI_PLL_GNRL_CTL 0x400
@@ -95,13 +100,13 @@ static const struct clk_parent_data clk_imx8mp_audiomix_pll_bypass_sels[] = { IMX8MP_CLK_AUDIOMIX_SAI##n##_MCLK1_SEL, {}, \ clk_imx8mp_audiomix_sai##n##_mclk1_parents, \ ARRAY_SIZE(clk_imx8mp_audiomix_sai##n##_mclk1_parents), \ - SAI_MCLK_SEL(n), 1, 0 \ + SAI##n##_MCLK_SEL, 1, 0 \ }, { \ "sai"__stringify(n)"_mclk2_sel", \ IMX8MP_CLK_AUDIOMIX_SAI##n##_MCLK2_SEL, {}, \ clk_imx8mp_audiomix_sai_mclk2_parents, \ ARRAY_SIZE(clk_imx8mp_audiomix_sai_mclk2_parents), \ - SAI_MCLK_SEL(n), 4, 1 \ + SAI##n##_MCLK_SEL, 4, 1 \ }, { \ "sai"__stringify(n)"_ipg_cg", \ IMX8MP_CLK_AUDIOMIX_SAI##n##_IPG, \
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 477/715 mtd: maps: physmap-core: fix flash size larger than 32-bit
In reply to Sasha LevinFrom: Baruch Siach <[email protected]>
[ Upstream commit 3884f03edd34887514a0865a80769cd5362d5c3b ]
mtd-ram can potentially be larger than 4GB. get_bitmask_order() uses fls() that is not guaranteed to work with values larger than 32-bit. Specifically on aarch64 fls() returns 0 when all 32 LSB bits are clear. Use fls64() instead.
--- drivers/mtd/maps/physmap-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/maps/physmap-core.c +1 -1
@@ -518,7 +518,7 @@ static int physmap_flash_probe(struct platform_device *dev)if (!info->maps[i].phys) info->maps[i].phys = res->start; - info->win_order =get_bitmask_order (resource_size (res)) -1 ; + info->win_order =fls64 (resource_size (res)) -1 ; info->maps[i].size =BIT (info->win_order + (info->gpios ? info->gpios->ndescs :0 ));
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 478/715 mtd: rawnand: lpc32xx_mlc: fix irq handler prototype
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 347b828882e6334690e7003ce5e2fe5f233dc508 ]
clang-16 warns about mismatched function prototypes:
drivers/mtd/nand/raw/lpc32xx_mlc.c:783:29: error: cast from 'irqreturn_t (*)(int, struct lpc32xx_nand_host *)' (aka 'enum irqreturn (*)(int, struct lpc32xx_nand_host *)') to 'irq_handler_t' (aka 'enum irqreturn (*)(int, void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
Change the interrupt handler to the normal way of just passing a void* pointer and converting it inside the function..
--- drivers/mtd/nand/raw/lpc32xx_mlc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/mtd/nand/raw/lpc32xx_mlc.c +3 -2
@@ -303,8 +303,9 @@ static int lpc32xx_nand_device_ready(struct nand_chip *nand_chip)return 0 ; } -static irqreturn_t lpc3xxx_nand_irq (int irq,struct lpc32xx_nand_host *host) +static irqreturn_t lpc3xxx_nand_irq (int irq,void *data) { +struct lpc32xx_nand_host *host = data;uint8_t sr;/* Clear interrupt flag by reading status */
@@ -780,7 +781,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev) goto release_dma_chan; } -if (request_irq (host->irq, (irq_handler_t)&lpc3xxx_nand_irq, +if (request_irq (host->irq, &lpc3xxx_nand_irq,IRQF_TRIGGER_HIGH ,DRV_NAME , host)) {dev_err (&pdev->dev,"Error requesting NAND IRQ\n" ); res = -ENXIO ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 479/715 mtd: rawnand: brcmnand: exec_op helper functions return type fixes
In reply to Sasha LevinFrom: David Regan <[email protected]>
[ Upstream commit d4bba1501f72e8af09f2cde3d327147de1b69f5d ]
Fix return types for exec_op reset and status helper functions.
--- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/mtd/nand/raw/brcmnand/brcmnand.c +8 -4
@@ -625,7 +625,7 @@ enum {/* Only for v7.2 */ #define ACC_CONTROL_ECC_EXT_SHIFT 13 -static u8 brcmnand_status (struct brcmnand_host *host); +static int brcmnand_status (struct brcmnand_host *host);static inline bool brcmnand_non_mmio_ops (struct brcmnand_controller *ctrl) {
@@ -1690,7 +1690,7 @@ static int brcmnand_waitfunc(struct nand_chip *chip)INTFC_FLASH_STATUS ; } -static u8 brcmnand_status (struct brcmnand_host *host) +static int brcmnand_status (struct brcmnand_host *host) {struct nand_chip *chip = &host->chip;struct mtd_info *mtd =nand_to_mtd (chip);
@@ -1701,7 +1701,7 @@ static u8 brcmnand_status(struct brcmnand_host *host)return brcmnand_waitfunc (chip); } -static u8 brcmnand_reset (struct brcmnand_host *host) +static int brcmnand_reset (struct brcmnand_host *host) {struct nand_chip *chip = &host->chip;
@@ -2433,7 +2433,11 @@ static int brcmnand_exec_op(struct nand_chip *chip,if (brcmnand_op_is_status (op)) { status = op->instrs[1 ].ctx.data.buf.in; - *status =brcmnand_status (host); + ret =brcmnand_status (host); +if (ret <0 ) +return ret; + + *status = ret &0xFF ;return 0 ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 480/715 ASoC: meson: axg-tdm-interface: fix mclk setup without mclk-fs
In reply to Sasha LevinFrom: Jerome Brunet <[email protected]>
[ Upstream commit e3741a8d28a1137f8b19ae6f3d6e3be69a454a0a ]
By default, when mclk-fs is not provided, the tdm-interface driver requests an MCLK that is 4x the bit clock, SCLK.
However there is no justification for this:
* If the codec needs MCLK for its operation, mclk-fs is expected to be set according to the codec requirements.
* If the codec does not need MCLK the minimum is 2 * SCLK, because this is minimum the divider between SCLK and MCLK can do.
Multiplying by 4 may cause problems because the PLL limit may be reached sooner than it should, so use 2x instead.
--- sound/soc/meson/axg-tdm-interface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/meson/axg-tdm-interface.c +2 -2
@@ -264,8 +264,8 @@ static int axg_tdm_iface_set_sclk(struct snd_soc_dai *dai, srate = iface->slots * iface->slot_width *params_rate (params);if (!iface->mclk_rate) { -/* If no specific mclk is requested, default to bit clock * 4 */ -clk_set_rate (iface->mclk,4 * srate); +/* If no specific mclk is requested, default to bit clock * 2 */ +clk_set_rate (iface->mclk,2 * srate); }else {/* Check if we can actually get the bit clock from mclk */ if (iface->mclk_rate % srate) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 481/715 ASoC: meson: axg-tdm-interface: add frame rate constraint
In reply to Sasha LevinFrom: Jerome Brunet <[email protected]>
[ Upstream commit 59c6a3a43b221cc2a211181b1298e43b2c2df782 ]
According to Amlogic datasheets for the SoCs supported by this driver, the maximum bit clock rate is 100MHz.
The tdm interface allows the rates listed by the DAI driver, regardless of the number slots or their width. However, these will impact the bit clock rate.
Hitting the 100MHz limit is very unlikely for most use cases but it is possible.
For example with 32 slots / 32 bits wide, the maximum rate is no longer 384kHz but ~96kHz.
Add the constraint accordingly if the component is not already active. If it is active, the rate is already constrained by the first stream rate.
--- sound/soc/meson/axg-tdm-interface.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-)
sound/soc/meson/axg-tdm-interface.c +18 -7
@@ -12,6 +12,9 @@#include "axg-tdm.h" +/* Maximum bit clock frequency according the datasheets */ +#define MAX_SCLK 100000000/* Hz */ +enum {TDM_IFACE_PAD ,TDM_IFACE_LOOPBACK ,
@@ -153,19 +156,27 @@ static int axg_tdm_iface_startup(struct snd_pcm_substream *substream,return -EINVAL ; } -/* Apply component wide rate symmetry */ if (snd_soc_component_active (dai->component)) { +/* Apply component wide rate symmetry */ ret =snd_pcm_hw_constraint_single (substream->runtime,SNDRV_PCM_HW_PARAM_RATE , iface->rate); -if (ret <0 ) { -dev_err (dai->dev, -"can't set iface rate constraint\n" ); -return ret; - } + + }else { +/* Limit rate according to the slot number and width */ +unsigned int max_rate = +MAX_SCLK / (iface->slots * iface->slot_width); + ret =snd_pcm_hw_constraint_minmax (substream->runtime, +SNDRV_PCM_HW_PARAM_RATE , +0 , max_rate); } -return 0 ; +if (ret <0 ) +dev_err (dai->dev,"can't set iface rate constraint\n" ); +else + ret =0 ; + +return ret; } static int axg_tdm_iface_set_stream(struct snd_pcm_substream *substream,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 482/715 drm/msm/a6xx: specify UBWC config for sc7180
In reply to Sasha LevinFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit 0d7dfc79fb9b4b81f642f84796111f2bae8427e2 ]
Historically the Adreno driver has not been updating memory configuration registers on a618 (SC7180 platform) implying that the default configuration is fine. After the rework performed in the commit 8814455a0e54 ("drm/msm: Refactor UBWC config setting") the function a6xx_calc_ubwc_config() still contained this shortcut and did not calculate UBWC configuration. However the function which now actually updates hardware registers, a6xx_set_ubwc_config(), doesn't contain such check.
Rather than adding the check to a6xx_set_ubwc_config(), fill in the UBWC config for a618 (based on readings from SC7180).
Patchwork: https://patchwork.freedesktop.org/patch/579113/
--- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/msm/adreno/a6xx_gpu.c +1 -2
@@ -1292,9 +1292,8 @@ static void a6xx_calc_ubwc_config(struct adreno_gpu *gpu) gpu->ubwc_config.ubwc_mode =1 ; } -/* a618 is using the hw default values */ if (adreno_is_a618 (gpu)) -return ; + gpu->ubwc_config.highest_bank_bit =14 ;if (adreno_is_a619_holi (gpu)) gpu->ubwc_config.highest_bank_bit =13 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 483/715 drm/msm/a7xx: Fix LLC typo
In reply to Sasha LevinFrom: Rob Clark <[email protected]>
[ Upstream commit 0776ad9274d96d132131af66a5941df45b9d46b4 ]
We'd miss actually activating LLC.
Patchwork: https://patchwork.freedesktop.org/patch/573043/
--- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/adreno/a6xx_gpu.c +1 -1
@@ -2426,7 +2426,7 @@ static int a6xx_gmu_pm_resume(struct msm_gpu *gpu)msm_devfreq_resume (gpu); -adreno_is_a7xx (adreno_gpu) ? a7xx_llc_activate :a6xx_llc_activate (a6xx_gpu); +adreno_is_a7xx (adreno_gpu) ?a7xx_llc_activate (a6xx_gpu) :a6xx_llc_activate (a6xx_gpu);return ret; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 484/715 dt-bindings: arm-smmu: fix SM8[45]50 GPU SMMU if condition
In reply to Sasha LevinFrom: Neil Armstrong <[email protected]>
[ Upstream commit dc94d0cc718329a39ea2e986a123421a9203b471 ]
The if condition for the SM8[45]50 GPU SMMU is too large, add the other compatible strings to the condition to only allow the clocks for the GPU SMMU nodes.
Patchwork: https://patchwork.freedesktop.org/patch/578686/
--- .../devicetree/bindings/iommu/arm,smmu.yaml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/iommu/arm,smmu.yaml +11 -2
@@ -484,7 +484,12 @@ allOf: - if: properties: compatible: - const: qcom,sm8450-smmu-500 + items: + - const: qcom,sm8450-smmu-500 + - const: qcom,adreno-smmu + - const: qcom,smmu-500 + - const: arm,mmu-500 + then: properties: clock-names:
@@ -508,7 +513,11 @@ allOf: - if: properties: compatible: - const: qcom,sm8550-smmu-500 + items: + - const: qcom,sm8550-smmu-500 + - const: qcom,adreno-smmu + - const: qcom,smmu-500 + - const: arm,mmu-500 then: properties: clock-names:
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 485/715 perf pmu: Fix a potential memory leak in perf_pmu__lookup()
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit ef5de1613d7d92bdc975e6beb34bb0fa94f34078 ]
The commit in Fixes has reordered some code, but missed an error handling path.
'goto err' now, in order to avoid a memory leak in case of error.
--- tools/perf/util/pmu.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
tools/perf/util/pmu.c +3 -4
@@ -1019,10 +1019,9 @@ struct perf_pmu *perf_pmu__lookup(struct list_head *pmus, int dirfd, const char* type value and format definitions. Load both right * now. */ -if (pmu_format (pmu, dirfd, name)) { -free (pmu); -return NULL ; - } +if (pmu_format (pmu, dirfd, name)) + goto err; + pmu->is_core =is_pmu_core (name); pmu->cpus =pmu_cpumask (dirfd, name, pmu->is_core);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 486/715 HID: amd_sfh: Update HPD sensor structure elements
In reply to Sasha LevinFrom: Basavaraj Natikar <[email protected]>
[ Upstream commit bbf0dec30696638b8bdc28cb2f5bf23f8d760b52 ]
HPD sensor data is not populating properly because of wrong order of HPD sensor structure elements. So update the order of structure elements to match the HPD sensor data received from the firmware.
--- drivers/hid/amd-sfh-hid/amd_sfh_pcie.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/hid/amd-sfh-hid/amd_sfh_pcie.h +3 -3
@@ -90,10 +90,10 @@ enum mem_use_type {struct hpd_status {union {struct { -u32 human_presence_report :4 ; -u32 human_presence_actual :4 ; -u32 probablity :8 ;u32 object_distance :16 ; +u32 probablity :8 ; +u32 human_presence_actual :4 ; +u32 human_presence_report :4 ; } shpd;u32 val; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 487/715 HID: amd_sfh: Avoid disabling the interrupt
In reply to Sasha LevinFrom: Basavaraj Natikar <[email protected]>
[ Upstream commit c1db0073212ef39d5a46c2aea5e49bf884375ce4 ]
HP ProBook x360 435 G7 using older version of firmware which doesn't support disabling the interrupt for all commands. Hence avoid disabling the interrupt for that particular model.
--- drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 30 +++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-)
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c +27 -3
@@ -35,6 +35,8 @@ static int sensor_mask_override = -1;module_param_named (sensor_mask, sensor_mask_override, int,0444 );MODULE_PARM_DESC (sensor_mask,"override the detected sensors mask" ); +static bool intr_disable = true; +static int amd_sfh_wait_response_v2 (struct amd_mp2_dev *mp2,u8 sid,u32 sensor_sts) {union cmd_response cmd_resp;
@@ -55,7 +57,7 @@ static void amd_start_sensor_v2(struct amd_mp2_dev *privdata, struct amd_mp2_sen cmd_base.ul =0 ; cmd_base.cmd_v2.cmd_id =ENABLE_SENSOR ; - cmd_base.cmd_v2.intr_disable =1 ; + cmd_base.cmd_v2.intr_disable = intr_disable; cmd_base.cmd_v2.period = info.period; cmd_base.cmd_v2.sensor_id = info.sensor_idx; cmd_base.cmd_v2.length =16 ;
@@ -73,7 +75,7 @@ static void amd_stop_sensor_v2(struct amd_mp2_dev *privdata, u16 sensor_idx) cmd_base.ul =0 ; cmd_base.cmd_v2.cmd_id =DISABLE_SENSOR ; - cmd_base.cmd_v2.intr_disable =1 ; + cmd_base.cmd_v2.intr_disable = intr_disable; cmd_base.cmd_v2.period =0 ; cmd_base.cmd_v2.sensor_id = sensor_idx; cmd_base.cmd_v2.length =16 ;
@@ -87,7 +89,7 @@ static void amd_stop_all_sensor_v2(struct amd_mp2_dev *privdata)union sfh_cmd_base cmd_base; cmd_base.cmd_v2.cmd_id =STOP_ALL_SENSORS ; - cmd_base.cmd_v2.intr_disable =1 ; + cmd_base.cmd_v2.intr_disable = intr_disable; cmd_base.cmd_v2.period =0 ; cmd_base.cmd_v2.sensor_id =0 ;
@@ -292,6 +294,26 @@ int amd_sfh_irq_init(struct amd_mp2_dev *privdata)return 0 ; } +static int mp2_disable_intr (const struct dmi_system_id *id) +{ + intr_disable = false; +return 0 ; +} + +static const struct dmi_system_id dmi_sfh_table[] = { + { +/* +* https://bugzilla.kernel.org/show_bug.cgi?id=218104 +*/ + .callback = mp2_disable_intr, + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"HP" ), +DMI_MATCH (DMI_PRODUCT_NAME ,"HP ProBook x360 435 G7" ), + }, + }, + {} +}; +static const struct dmi_system_id dmi_nodevs[] = { {/*
@@ -315,6 +337,8 @@ static int amd_mp2_pci_probe(struct pci_dev *pdev, const struct pci_device_id *iif (dmi_first_match (dmi_nodevs))return -ENODEV ; +dmi_check_system (dmi_sfh_table); + privdata =devm_kzalloc (&pdev->dev,sizeof (*privdata),GFP_KERNEL );if (!privdata)return -ENOMEM ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 488/715 drm/amdgpu: Fix missing break in ATOM_ARG_IMM Case of atom_get_src_int()
In reply to Sasha LevinFrom: Srinivasan Shanmugam <[email protected]>
[ Upstream commit 7cf1ad2fe10634238b38442a851d89514cb14ea2 ]
Missing break statement in the ATOM_ARG_IMM case of a switch statement, adds the missing break statement, ensuring that the program's control flow is as intended.
Fixes the below:drivers/gpu/drm/amd/amdgpu/atom.c:323 atom_get_src_int() warn: ignoring unreachable code.
--- drivers/gpu/drm/amd/amdgpu/atom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/atom.c +1 -1
@@ -313,7 +313,7 @@ static uint32_t atom_get_src_int(atom_exec_context *ctx, uint8_t attr,DEBUG ("IMM 0x%02X\n" , val);return val; } -return 0 ; +break ;case ATOM_ARG_PLL : idx =U8 (*ptr); (*ptr)++;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 489/715 media: pvrusb2: fix uaf in pvr2_context_set_notify
In reply to Sasha LevinFrom: Edward Adam Davis <[email protected]>
[ Upstream commit 0a0b79ea55de8514e1750884e5fec77f9fdd01ee ]
[Syzbot reported]
BUG: KASAN: slab-use-after-free in pvr2_context_set_notify+0x2c4/0x310 drivers/media/usb/pvrusb2/pvrusb2-context.c:35 Read of size 4 at addr ffff888113aeb0d8 by task kworker/1:1/26 CPU: 1 PID: 26 Comm: kworker/1:1 Not tainted 6.8.0-rc1-syzkaller-00046-gf1a27f081c1f #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024 Workqueue: usb_hub_wq hub_event Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:377 [inline] print_report+0xc4/0x620 mm/kasan/report.c:488 kasan_report+0xda/0x110 mm/kasan/report.c:601 pvr2_context_set_notify+0x2c4/0x310 drivers/media/usb/pvrusb2/pvrusb2-context.c:35 pvr2_context_notify drivers/media/usb/pvrusb2/pvrusb2-context.c:95 [inline] pvr2_context_disconnect+0x94/0xb0 drivers/media/usb/pvrusb2/pvrusb2-context.c:272 Freed by task 906: kasan_save_stack+0x33/0x50 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 kasan_save_free_info+0x3f/0x60 mm/kasan/generic.c:640 poison_slab_object mm/kasan/common.c:241 [inline] __kasan_slab_free+0x106/0x1b0 mm/kasan/common.c:257 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2121 [inline] slab_free mm/slub.c:4299 [inline] kfree+0x105/0x340 mm/slub.c:4409 pvr2_context_check drivers/media/usb/pvrusb2/pvrusb2-context.c:137 [inline] pvr2_context_thread_func+0x69d/0x960 drivers/media/usb/pvrusb2/pvrusb2-context.c:158
[Analyze]
Task A set disconnect_flag = !0, which resulted in Task B's condition being met and releasing mp, leading to this issue.
[Fix]
Place the disconnect_flag assignment operation after all code in pvr2_context_disconnect() to avoid this issue.
--- drivers/media/usb/pvrusb2/pvrusb2-context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/pvrusb2/pvrusb2-context.c +1 -1
@@ -267,9 +267,9 @@ static void pvr2_context_exit(struct pvr2_context *mp)void pvr2_context_disconnect (struct pvr2_context *mp) {pvr2_hdw_disconnect (mp->hdw); - mp->disconnect_flag = !0 ;if (!pvr2_context_shutok ())pvr2_context_notify (mp); + mp->disconnect_flag = !0 ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 490/715 media: dvb-frontends: avoid stack overflow warnings with clang
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 7a4cf27d1f0538f779bf31b8c99eda394e277119 ]
A previous patch worked around a KASAN issue in stv0367, now a similar problem showed up with clang:
drivers/media/dvb-frontends/stv0367.c:1222:12: error: stack frame size (3624) exceeds limit (2048) in 'stv0367ter_set_frontend' [-Werror,-Wframe-larger-than]
1214 | static int stv0367ter_set_frontend(struct dvb_frontend *fe)
Rework the stv0367_writereg() function to be simpler and mark both register access functions as noinline_for_stack so the temporary i2c_msg structures do not get duplicated on the stack when KASAN_STACK is enabled.
--- drivers/media/dvb-frontends/stv0367.c | 34 +++++++-------------------- 1 file changed, 8 insertions(+), 26 deletions(-)
drivers/media/dvb-frontends/stv0367.c +8 -26
@@ -118,50 +118,32 @@ static const s32 stv0367cab_RF_LookUp2[RF_LOOKUP_TABLE2_SIZE][RF_LOOKUP_TABLE2_S } }; -static -int stv0367_writeregs (struct stv0367_state *state,u16 reg,u8 *data,int len) +static noinline_for_stack +int stv0367_writereg(struct stv0367_state *state, u16 reg, u8 data) { -u8 buf[MAX_XFER_SIZE ]; +u8 buf[3 ] = {MSB (reg),LSB (reg), data };struct i2c_msg msg = { .addr = state->config->demod_address, .flags =0 , .buf = buf, - .len = len +2 + .len =3 , };int ret; -if (2 + len >sizeof (buf)) { -printk (KERN_WARNING -"%s: i2c wr reg=%04x: len=%d is too big!\n" , -KBUILD_MODNAME , reg, len); -return -EINVAL ; - } - - - buf[0 ] =MSB (reg); - buf[1 ] =LSB (reg); -memcpy (buf +2 , data, len); -if (i2cdebug)printk (KERN_DEBUG "%s: [%02x] %02x: %02x\n" , __func__, - state->config->demod_address, reg, buf[2 ]); + state->config->demod_address, reg, data); ret =i2c_transfer (state->i2c, &msg,1 );if (ret !=1 )printk (KERN_ERR "%s: i2c write error! ([%02x] %02x: %02x)\n" , - __func__, state->config->demod_address, reg, buf[2 ]); + __func__, state->config->demod_address, reg, data);return (ret !=1 ) ? -EREMOTEIO :0 ; } -static int stv0367_writereg (struct stv0367_state *state,u16 reg,u8 data) -{ -u8 tmp = data;/* see gcc.gnu.org/bugzilla/show_bug.cgi?id=81715 */ - -return stv0367_writeregs (state, reg, &tmp,1 ); -} - -static u8 stv0367_readreg (struct stv0367_state *state,u16 reg) +static noinline_for_stack +u8 stv0367_readreg(struct stv0367_state *state, u16 reg) {u8 b0[] = {0 ,0 };u8 b1[] = {0 };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 491/715 media: go7007: fix a memleak in go7007_load_encoder
In reply to Sasha LevinFrom: Zhipeng Lu <[email protected]>
[ Upstream commit b9b683844b01d171a72b9c0419a2d760d946ee12 ]
In go7007_load_encoder, bounce(i.e. go->boot_fw), is allocated without a deallocation thereafter. After the following call chain:
saa7134_go7007_init
|-> go7007_boot_encoder
|-> go7007_load_encoder
|-> kfree(go)
go is freed and thus bounce is leaked.
--- drivers/media/usb/go7007/go7007-driver.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/media/usb/go7007/go7007-driver.c +5 -3
@@ -80,7 +80,7 @@ static int go7007_load_encoder(struct go7007 *go)const struct firmware *fw_entry;char fw_name[] ="go7007/go7007fw.bin" ;void *bounce; -int fw_len, rv =0 ; +int fw_len;u16 intr_val, intr_data;if (go->boot_fw ==NULL ) {
@@ -109,9 +109,11 @@ static int go7007_load_encoder(struct go7007 *go) go7007_read_interrupt(go, &intr_val, &intr_data) < 0 || (intr_val & ~0x1) != 0x5a5a) {v4l2_err (go,"error transferring firmware\n" ); - rv =-1 ; +kfree (go->boot_fw); + go->boot_fw =NULL ; +return -1 ; } -return rv; +return 0 ; }MODULE_FIRMWARE ("go7007/go7007fw.bin" );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 492/715 media: ttpci: fix two memleaks in budget_av_attach
In reply to Sasha LevinFrom: Zhipeng Lu <[email protected]>
[ Upstream commit d0b07f712bf61e1a3cf23c87c663791c42e50837 ]
When saa7146_register_device and saa7146_vv_init fails, budget_av_attach should free the resources it allocates, like the error-handling of ttpci_budget_init does. Besides, there are two fixme comment refers to such deallocations.
--- drivers/media/pci/ttpci/budget-av.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/media/pci/ttpci/budget-av.c +5 -3
@@ -1463,7 +1463,8 @@ static int budget_av_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio budget_av->has_saa7113 =1 ; err =saa7146_vv_init (dev, &vv_data);if (err !=0 ) { -/* fixme: proper cleanup here */ +ttpci_budget_deinit (&budget_av->budget); +kfree (budget_av);ERR ("cannot init vv subsystem\n" );return err; }
@@ -1472,9 +1473,10 @@ static int budget_av_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio vv_data.vid_ops.vidioc_s_input = vidioc_s_input;if ((err =saa7146_register_device (&budget_av->vd, dev,"knc1" ,VFL_TYPE_VIDEO ))) { -/* fixme: proper cleanup here */ -ERR ("cannot register capture v4l2 device\n" );saa7146_vv_release (dev); +ttpci_budget_deinit (&budget_av->budget); +kfree (budget_av); +ERR ("cannot register capture v4l2 device\n" );return err; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 493/715 media: mediatek: vcodec: avoid -Wcast-function-type-strict warning
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit bfb1b99802ef16045402deb855c197591dc78886 ]
The ipi handler here tries hard to maintain const-ness of its argument, but by doing that causes a warning about function type casts:
drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_vpu.c:38:32: error: cast from 'mtk_vcodec_ipi_handler' (aka 'void (*)(void *, unsigned int, void *)') to 'ipi_handler_t' (aka 'void (*)(const void *, unsigned int, void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
38 | ipi_handler_t handler_const = (ipi_handler_t)handler;
| ^~~~~~~~~~~~~~~~~~~~~~Remove the hack and just use a non-const argument.
--- drivers/media/platform/mediatek/mdp/mtk_mdp_vpu.c | 2 +- .../mediatek/vcodec/common/mtk_vcodec_fw_vpu.c | 10 +--------- drivers/media/platform/mediatek/vpu/mtk_vpu.c | 2 +- drivers/media/platform/mediatek/vpu/mtk_vpu.h | 2 +- 4 files changed, 4 insertions(+), 12 deletions(-)
drivers/media/platform/mediatek/mdp/mtk_mdp_vpu.c +1 -1
@@ -26,7 +26,7 @@ static void mtk_mdp_vpu_handle_init_ack(const struct mdp_ipi_comm_ack *msg) vpu->inst_addr = msg->vpu_inst_addr; } -static void mtk_mdp_vpu_ipi_handler (const void *data,unsigned int len, +static void mtk_mdp_vpu_ipi_handler (void *data,unsigned int len,void *priv) {const struct mdp_ipi_comm_ack *msg = data;
drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_vpu.c +1 -9
@@ -29,15 +29,7 @@ static int mtk_vcodec_vpu_set_ipi_register(struct mtk_vcodec_fw *fw, int id,mtk_vcodec_ipi_handler handler, const char *name, void *priv) { -/* -* The handler we receive takes a void * as its first argument. We -* cannot change this because it needs to be passed down to the rproc -* subsystem when SCP is used. VPU takes a const argument, which is -* more constrained, so the conversion below is safe. -*/ - ipi_handler_t handler_const = (ipi_handler_t)handler; - -return vpu_ipi_register (fw->pdev, id, handler_const, name, priv); + return vpu_ipi_register(fw->pdev, id, handler, name, priv); } static int mtk_vcodec_vpu_ipi_send(struct mtk_vcodec_fw *fw, int id, void *buf,
drivers/media/platform/mediatek/vpu/mtk_vpu.c +1 -1
@@ -635,7 +635,7 @@ int vpu_load_firmware(struct platform_device *pdev) }EXPORT_SYMBOL_GPL (vpu_load_firmware); -static void vpu_init_ipi_handler (const void *data,unsigned int len,void *priv) +static void vpu_init_ipi_handler (void *data,unsigned int len,void *priv) {struct mtk_vpu *vpu = priv;const struct vpu_run *run = data;
drivers/media/platform/mediatek/vpu/mtk_vpu.h +1 -1
@@ -17,7 +17,7 @@* VPU interfaces with other blocks by share memory and interrupt. */ -typedef void (*ipi_handler_t ) (const void *data, +typedef void (*ipi_handler_t ) (void *data,unsigned int len,void *priv);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 494/715 arm64: ftrace: Don't forbid CALL_OPS+CC_OPTIMIZE_FOR_SIZE with Clang
In reply to Sasha LevinFrom: Stephen Boyd <[email protected]>
[ Upstream commit a743f26d03a96593c0f3d05dc26b388f45de67c9 ]
Per commit b3f11af9b2ce ("arm64: ftrace: forbid CALL_OPS with CC_OPTIMIZE_FOR_SIZE"), GCC is silently ignoring -falign-functions=N when passed -Os, causing functions to be improperly aligned. This doesn't seem to be a problem with Clang though, where enabling CALL_OPS with CC_OPTIMIZE_FOR_SIZE doesn't spit out any warnings at boot about misaligned patch-sites. Only forbid CALL_OPS if GCC is used and we're optimizing for size so that CALL_OPS can be used with clang optimizing for size.
--- arch/arm64/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/Kconfig +1 -1
@@ -198,7 +198,7 @@ config ARM64 if DYNAMIC_FTRACE_WITH_ARGS && DYNAMIC_FTRACE_WITH_CALL_OPS select HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS \ if (DYNAMIC_FTRACE_WITH_ARGS && !CFI_CLANG && \ - !CC_OPTIMIZE_FOR_SIZE) + (CC_IS_CLANG || !CC_OPTIMIZE_FOR_SIZE)) select FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY \ if DYNAMIC_FTRACE_WITH_ARGS select HAVE_SAMPLE_FTRACE_DIRECT
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 495/715 drm/tests: helpers: Include missing drm_drv header
In reply to Sasha LevinFrom: Maxime Ripard <[email protected]>
[ Upstream commit 73984daf07a1a89ace8f0db6dd2d640654ebbbee ]
We have a few functions declared in our kunit helpers header, some of them dereferencing the struct drm_driver.
However, we don't include the drm_drv.h header file defining that structure, leading to compilation errors if we don't include both headers.
--- include/drm/drm_kunit_helpers.h | 2 ++ 1 file changed, 2 insertions(+)
include/drm/drm_kunit_helpers.h +2 -0
@@ -3,6 +3,8 @@#ifndef DRM_KUNIT_HELPERS_H_ #define DRM_KUNIT_HELPERS_H_ +#include <drm/drm_drv.h> +#include <linux/device.h> #include <kunit/test.h>
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 496/715 drm/amd/pm: Fix esm reg mask use to get pcie speed
In reply to Sasha LevinFrom: Asad Kamal <[email protected]>
[ Upstream commit b485b899e5b8f83723833feca30a1a1e3df778df ]
Fix mask used for esm ctrl register to get pcie link speed on smu_v11_0_3, smu_v13_0_2 & smu_v13_0_6
--- drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c | 4 ++-- drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 4 ++-- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c +2 -2
@@ -2272,8 +2272,8 @@ static uint16_t arcturus_get_current_pcie_link_speed(struct smu_context *smu)/* TODO: confirm this on real target */ esm_ctrl =RREG32_PCIE (smnPCIE_ESM_CTRL); -if ((esm_ctrl >>15 ) &0x1FFFF ) -return (uint16_t )(((esm_ctrl >>8 ) &0x3F ) +128 ); +if ((esm_ctrl >>15 ) &0x1 ) +return (uint16_t )(((esm_ctrl >>8 ) &0x7F ) +128 );return smu_v11_0_get_current_pcie_link_speed (smu); }
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +2 -2
@@ -1682,8 +1682,8 @@ static int aldebaran_get_current_pcie_link_speed(struct smu_context *smu)/* TODO: confirm this on real target */ esm_ctrl =RREG32_PCIE (smnPCIE_ESM_CTRL); -if ((esm_ctrl >>15 ) &0x1FFFF ) -return (((esm_ctrl >>8 ) &0x3F ) +128 ); +if ((esm_ctrl >>15 ) &0x1 ) +return (((esm_ctrl >>8 ) &0x7F ) +128 );return smu_v13_0_get_current_pcie_link_speed (smu); }
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +2 -2
@@ -2060,8 +2060,8 @@ static int smu_v13_0_6_get_current_pcie_link_speed(struct smu_context *smu)/* TODO: confirm this on real target */ esm_ctrl =RREG32_PCIE (smnPCIE_ESM_CTRL); -if ((esm_ctrl >>15 ) &0x1FFFF ) -return (((esm_ctrl >>8 ) &0x3F ) +128 ); +if ((esm_ctrl >>15 ) &0x1 ) +return (((esm_ctrl >>8 ) &0x7F ) +128 ); speed_level = (RREG32_PCIE (smnPCIE_LC_SPEED_CNTL) &PCIE_LC_SPEED_CNTL__LC_CURRENT_DATA_RATE_MASK )
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 497/715 gpio: nomadik: fix offset bug in nmk_pmx_set()
In reply to Sasha LevinFrom: Théo Lebrun <[email protected]>
[ Upstream commit 53cf6b72e074864b94ade97dcb6f30b5ac1a82dc ]
Previously, the statement looked like:
slpm[x] &= ~BIT(g->grp.pins[i]);
Where:
- slpm is a unsigned int pointer;
- g->grp.pins[i] is a pin number. It can grow to more than 32.
The expected shift amount is a pin bank offset.
This bug does not occur on every group or pin: the altsetting must be NMK_GPIO_ALT_C and the pin must be 32 or above. It might have occured. For example, in pinctrl-nomadik-db8500.c, pin group i2c3_c_2 has the right altsetting and pins 229 and 230.
--- drivers/pinctrl/nomadik/pinctrl-nomadik.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/pinctrl/nomadik/pinctrl-nomadik.c +4 -2
@@ -1579,8 +1579,10 @@ static int nmk_pmx_set(struct pinctrl_dev *pctldev, unsigned function,* Then mask the pins that need to be sleeping now when we're * switching to the ALT C function. */ -for (i =0 ; i < g->grp.npins; i++) - slpm[g->grp.pins[i] /NMK_GPIO_PER_CHIP ] &= ~BIT (g->grp.pins[i]); +for (i =0 ; i < g->grp.npins; i++) { +unsigned int bit = g->grp.pins[i] %NMK_GPIO_PER_CHIP ; + slpm[g->grp.pins[i] /NMK_GPIO_PER_CHIP ] &= ~BIT (bit); + }nmk_gpio_glitch_slpm_init (slpm); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 498/715 drm/mediatek: Fix a null pointer crash in mtk_drm_crtc_finish_page_flip
In reply to Sasha LevinFrom: Hsin-Yi Wang <[email protected]>
[ Upstream commit c958e86e9cc1b48cac004a6e245154dfba8e163b ]
It's possible that mtk_crtc->event is NULL inmtk_drm_crtc_finish_page_flip().
pending_needs_vblank value is set by mtk_crtc->event, but in mtk_drm_crtc_atomic_flush(), it's is not guarded by the same lock in mtk_drm_finish_page_flip(), thus a race condition happens.
Consider the following case:
CPU1 CPU2
step 1:mtk_drm_crtc_atomic_begin()mtk_crtc->event is not null,
step 1:
mtk_drm_crtc_atomic_flush:
mtk_drm_crtc_update_config(
!!mtk_crtc->event)step 2:mtk_crtc_ddp_irq ->mtk_drm_finish_page_flip:
lockmtk_crtc->event set to null,pending_needs_vblank set to false
unlock
pending_needs_vblank set to true,
step 2:
mtk_crtc_ddp_irq -> mtk_drm_finish_page_flip called again, pending_needs_vblank is still true //null pointer
Instead of guarding the entire mtk_drm_crtc_atomic_flush(), it's more efficient to just check if mtk_crtc->event is null before use.
--- drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +7 -5
@@ -95,11 +95,13 @@ static void mtk_drm_crtc_finish_page_flip(struct mtk_drm_crtc *mtk_crtc)struct drm_crtc *crtc = &mtk_crtc->base;unsigned long flags; -spin_lock_irqsave (&crtc->dev->event_lock, flags); -drm_crtc_send_vblank_event (crtc, mtk_crtc->event); -drm_crtc_vblank_put (crtc); - mtk_crtc->event =NULL ; -spin_unlock_irqrestore (&crtc->dev->event_lock, flags); +if (mtk_crtc->event) { +spin_lock_irqsave (&crtc->dev->event_lock, flags); +drm_crtc_send_vblank_event (crtc, mtk_crtc->event); +drm_crtc_vblank_put (crtc); + mtk_crtc->event =NULL ; +spin_unlock_irqrestore (&crtc->dev->event_lock, flags); + } }static void mtk_drm_finish_page_flip (struct mtk_drm_crtc *mtk_crtc)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 499/715 mfd: cs42l43: Fix wrong register defaults
In reply to Sasha LevinFrom: Maciej Strozek <[email protected]>
[ Upstream commit c9e1e505cde1a8ddd0968b4d54ec2ea1937dfe00 ]
A few regs have unnecessary values in defaults, change them to match the datasheet
--- drivers/mfd/cs42l43.c | 68 +++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 34 deletions(-)
drivers/mfd/cs42l43.c +34 -34
@@ -131,38 +131,38 @@ const struct reg_default cs42l43_reg_default[CS42L43_N_DEFAULTS] = { { CS42L43_ASP_TX_CH4_CTRL, 0x00170091 }, { CS42L43_ASP_TX_CH5_CTRL, 0x001700C1 }, { CS42L43_ASP_TX_CH6_CTRL, 0x001700F1 }, - { CS42L43_ASPTX1_INPUT, 0x00800000 }, - { CS42L43_ASPTX2_INPUT, 0x00800000 }, - { CS42L43_ASPTX3_INPUT, 0x00800000 }, - { CS42L43_ASPTX4_INPUT, 0x00800000 }, - { CS42L43_ASPTX5_INPUT, 0x00800000 }, - { CS42L43_ASPTX6_INPUT, 0x00800000 }, - { CS42L43_SWIRE_DP1_CH1_INPUT, 0x00800000 }, - { CS42L43_SWIRE_DP1_CH2_INPUT, 0x00800000 }, - { CS42L43_SWIRE_DP1_CH3_INPUT, 0x00800000 }, - { CS42L43_SWIRE_DP1_CH4_INPUT, 0x00800000 }, - { CS42L43_SWIRE_DP2_CH1_INPUT, 0x00800000 }, - { CS42L43_SWIRE_DP2_CH2_INPUT, 0x00800000 }, - { CS42L43_SWIRE_DP3_CH1_INPUT, 0x00800000 }, - { CS42L43_SWIRE_DP3_CH2_INPUT, 0x00800000 }, - { CS42L43_SWIRE_DP4_CH1_INPUT, 0x00800000 }, - { CS42L43_SWIRE_DP4_CH2_INPUT, 0x00800000 }, - { CS42L43_ASRC_INT1_INPUT1, 0x00800000 }, - { CS42L43_ASRC_INT2_INPUT1, 0x00800000 }, - { CS42L43_ASRC_INT3_INPUT1, 0x00800000 }, - { CS42L43_ASRC_INT4_INPUT1, 0x00800000 }, - { CS42L43_ASRC_DEC1_INPUT1, 0x00800000 }, - { CS42L43_ASRC_DEC2_INPUT1, 0x00800000 }, - { CS42L43_ASRC_DEC3_INPUT1, 0x00800000 }, - { CS42L43_ASRC_DEC4_INPUT1, 0x00800000 }, - { CS42L43_ISRC1INT1_INPUT1, 0x00800000 }, - { CS42L43_ISRC1INT2_INPUT1, 0x00800000 }, - { CS42L43_ISRC1DEC1_INPUT1, 0x00800000 }, - { CS42L43_ISRC1DEC2_INPUT1, 0x00800000 }, - { CS42L43_ISRC2INT1_INPUT1, 0x00800000 }, - { CS42L43_ISRC2INT2_INPUT1, 0x00800000 }, - { CS42L43_ISRC2DEC1_INPUT1, 0x00800000 }, - { CS42L43_ISRC2DEC2_INPUT1, 0x00800000 }, + { CS42L43_ASPTX1_INPUT, 0x00000000 }, + { CS42L43_ASPTX2_INPUT, 0x00000000 }, + { CS42L43_ASPTX3_INPUT, 0x00000000 }, + { CS42L43_ASPTX4_INPUT, 0x00000000 }, + { CS42L43_ASPTX5_INPUT, 0x00000000 }, + { CS42L43_ASPTX6_INPUT, 0x00000000 }, + { CS42L43_SWIRE_DP1_CH1_INPUT, 0x00000000 }, + { CS42L43_SWIRE_DP1_CH2_INPUT, 0x00000000 }, + { CS42L43_SWIRE_DP1_CH3_INPUT, 0x00000000 }, + { CS42L43_SWIRE_DP1_CH4_INPUT, 0x00000000 }, + { CS42L43_SWIRE_DP2_CH1_INPUT, 0x00000000 }, + { CS42L43_SWIRE_DP2_CH2_INPUT, 0x00000000 }, + { CS42L43_SWIRE_DP3_CH1_INPUT, 0x00000000 }, + { CS42L43_SWIRE_DP3_CH2_INPUT, 0x00000000 }, + { CS42L43_SWIRE_DP4_CH1_INPUT, 0x00000000 }, + { CS42L43_SWIRE_DP4_CH2_INPUT, 0x00000000 }, + { CS42L43_ASRC_INT1_INPUT1, 0x00000000 }, + { CS42L43_ASRC_INT2_INPUT1, 0x00000000 }, + { CS42L43_ASRC_INT3_INPUT1, 0x00000000 }, + { CS42L43_ASRC_INT4_INPUT1, 0x00000000 }, + { CS42L43_ASRC_DEC1_INPUT1, 0x00000000 }, + { CS42L43_ASRC_DEC2_INPUT1, 0x00000000 }, + { CS42L43_ASRC_DEC3_INPUT1, 0x00000000 }, + { CS42L43_ASRC_DEC4_INPUT1, 0x00000000 }, + { CS42L43_ISRC1INT1_INPUT1, 0x00000000 }, + { CS42L43_ISRC1INT2_INPUT1, 0x00000000 }, + { CS42L43_ISRC1DEC1_INPUT1, 0x00000000 }, + { CS42L43_ISRC1DEC2_INPUT1, 0x00000000 }, + { CS42L43_ISRC2INT1_INPUT1, 0x00000000 }, + { CS42L43_ISRC2INT2_INPUT1, 0x00000000 }, + { CS42L43_ISRC2DEC1_INPUT1, 0x00000000 }, + { CS42L43_ISRC2DEC2_INPUT1, 0x00000000 }, { CS42L43_EQ1MIX_INPUT1, 0x00800000 }, { CS42L43_EQ1MIX_INPUT2, 0x00800000 }, { CS42L43_EQ1MIX_INPUT3, 0x00800000 },
@@ -171,8 +171,8 @@ const struct reg_default cs42l43_reg_default[CS42L43_N_DEFAULTS] = { { CS42L43_EQ2MIX_INPUT2, 0x00800000 }, { CS42L43_EQ2MIX_INPUT3, 0x00800000 }, { CS42L43_EQ2MIX_INPUT4, 0x00800000 }, - { CS42L43_SPDIF1_INPUT1, 0x00800000 }, - { CS42L43_SPDIF2_INPUT1, 0x00800000 }, + { CS42L43_SPDIF1_INPUT1, 0x00000000 }, + { CS42L43_SPDIF2_INPUT1, 0x00000000 }, { CS42L43_AMP1MIX_INPUT1, 0x00800000 }, { CS42L43_AMP1MIX_INPUT2, 0x00800000 }, { CS42L43_AMP1MIX_INPUT3, 0x00800000 },
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 500/715 powerpc/32: fix ADB_CUDA kconfig warning
In reply to Sasha LevinFrom: Michael Ellerman <[email protected]>
[ Upstream commit b72c066ba85a131091498a15a62d6068997278a4 ]
Fix a (randconfig) kconfig warning by correcting the select statement:
WARNING: unmet direct dependencies detected for ADB_CUDA
Depends on [n]: MACINTOSH_DRIVERS [=n] && (ADB [=n] || PPC_PMAC [=y]) && !PPC_PMAC64 [=n] Selected by [y]:
- PPC_PMAC [=y] && PPC_BOOK3S [=y] && CPU_BIG_ENDIAN [=y] && POWER_RESET [=y] && PPC32 [=y]
The PPC32 isn't needed because ADB depends on (PPC_PMAC && PPC32).
Tested: Randy Dunlap <[email protected]>
--- arch/powerpc/platforms/powermac/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/platforms/powermac/Kconfig +1 -1
@@ -2,7 +2,7 @@ config PPC_PMAC bool "Apple PowerMac based machines" depends on PPC_BOOK3S && CPU_BIG_ENDIAN - select ADB_CUDA if POWER_RESET && PPC32 + select ADB_CUDA if POWER_RESET && ADB select MPIC select FORCE_PCI select PPC_INDIRECT_PCI if PPC32
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 501/715 powerpc/pseries: Fix potential memleak in papr_get_attr()
In reply to Sasha LevinFrom: Qiheng Lin <[email protected]>
[ Upstream commit cda9c0d556283e2d4adaa9960b2dc19b16156bae ]
buf is allocated in papr_get_attr(), and krealloc() of buf could fail. We need to free the original buf in the case of failure.
--- arch/powerpc/platforms/pseries/papr_platform_attributes.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
arch/powerpc/platforms/pseries/papr_platform_attributes.c +5 -3
@@ -101,10 +101,12 @@ static int papr_get_attr(u64 id, struct energy_scale_attribute *esi) esi_buf_size =ESI_HDR_SIZE + (CURR_MAX_ESI_ATTRS * max_esi_attrs); temp_buf =krealloc (buf, esi_buf_size,GFP_KERNEL ); -if (temp_buf) +if (temp_buf) { buf = temp_buf; -else -return -ENOMEM ; + }else { + ret = -ENOMEM ; + goto out_buf; + } goto retry; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 502/715 powerpc/hv-gpci: Fix the H_GET_PERF_COUNTER_INFO hcall return value checks
In reply to Sasha LevinFrom: Kajol Jain <[email protected]>
[ Upstream commit ad86d7ee43b22aa2ed60fb982ae94b285c1be671 ]
Running event hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles,phys_processor_idx=0/ in one of the system throws below error:
---Logs---
# perf list | grep hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles,phys_processor_idx=?/[Kernel PMU event]
# perf stat -v -e hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles,phys_processor_idx=0/ sleep 2 Using CPUID 00800200 Control descriptor is not initialized Warning: hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles,phys_processor_idx=0/ event is not supported by the kernel. failed to read counter hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles,phys_processor_idx=0/
Performance counter stats for 'system wide':
<not supported> hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles,phys_processor_idx=0/
2.000700771 seconds time elapsed
The above error is because of the hcall failure as required permission "Enable Performance Information Collection" is not set. Based on current code, single_gpci_request function did not check the error type incase hcall fails and by default returns EINVAL. But we can have other reasons for hcall failures like H_AUTHORITY/H_PARAMETER with detail_rc as GEN_BUF_TOO_SMALL, for which we need to act accordingly.
Fix this issue by adding new checks in the single_gpci_request and h_gpci_event_init functions.
Result after fix patch changes:
# perf stat -e hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles,phys_processor_idx=0/ sleep 2 Error: No permission to enable hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles,phys_processor_idx=0/ event.
--- arch/powerpc/perf/hv-gpci.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-)
arch/powerpc/perf/hv-gpci.c +27 -2
@@ -695,6 +695,20 @@ static unsigned long single_gpci_request(u32 req, u32 starting_index, ret =plpar_hcall_norets (H_GET_PERF_COUNTER_INFO ,virt_to_phys (arg),HGPCI_REQ_BUFFER_SIZE ); + +/* +* ret value as 'H_PARAMETER' with detail_rc as 'GEN_BUF_TOO_SMALL', +* specifies that the current buffer size cannot accommodate +* all the information and a partial buffer returned. +* Since in this function we are only accessing data for a given starting index, +* we don't need to accommodate whole data and can get required count by +* accessing first entry data. +* Hence hcall fails only incase the ret value is other than H_SUCCESS or +* H_PARAMETER with detail_rc value as GEN_BUF_TOO_SMALL(0x1B). +*/ +if (ret ==H_PARAMETER &&be32_to_cpu (arg->params.detail_rc) ==0x1B ) + ret =0 ; +if (ret) {pr_devel ("hcall failed: 0x%lx\n" , ret); goto out;
@@ -759,6 +773,7 @@ static int h_gpci_event_init(struct perf_event *event) {u64 count;u8 length; +unsigned long ret;/* Not our event */ if (event->attr.type != event->pmu->type)
@@ -789,13 +804,23 @@ static int h_gpci_event_init(struct perf_event *event) }/* check if the request works... */ -if (single_gpci_request (event_get_request (event), + ret =single_gpci_request (event_get_request (event),event_get_starting_index (event),event_get_secondary_index (event),event_get_counter_info_version (event),event_get_offset (event), length, - &count)) { + &count); + +/* +* ret value as H_AUTHORITY implies that partition is not permitted to retrieve +* performance information, and required to set +* "Enable Performance Information Collection" option. +*/ +if (ret ==H_AUTHORITY ) +return -EPERM ; + +if (ret) {pr_devel ("gpci hcall failed\n" );return -EINVAL ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 503/715 clk: qcom: gcc-ipq5018: fix 'enable_reg' offset of 'gcc_gmac0_sys_clk'
In reply to Sasha LevinFrom: Gabor Juhos <[email protected]>
[ Upstream commit f982adcc1b1c02a3114f68ac73c811cbfabe90fa ]
The value of the 'enable_reg' field in the 'gcc_gmac0_sys_clk' clock definition seems wrong as it is greater than the 'max_register' value defined in the regmap configuration. Additionally, all other gmac specific branch clock definitions within the driver uses the same value both for the 'enable_reg' and for the 'halt_reg' fields.
Due to the lack of documentation the correct value is not known. Looking into the downstream driver does not help either, as that uses the same (presumably wrong) value [1].
Nevertheless, change the 'enable_reg' field of 'gcc_gmac0_sys_clk' to use the value from the 'halt_reg' field so it follows the pattern used in other gmac clock definitions. The change is based on the assumption that the register layout of this clock is the same as the other gmac clocks.
--- drivers/clk/qcom/gcc-ipq5018.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/gcc-ipq5018.c +1 -1
@@ -1754,7 +1754,7 @@ static struct clk_branch gcc_gmac0_sys_clk = { .halt_check = BRANCH_HALT_DELAY, .halt_bit = 31, .clkr = { - .enable_reg = 0x683190, + .enable_reg = 0x68190, .enable_mask = BIT(0), .hw.init = &(struct clk_init_data) { .name = "gcc_gmac0_sys_clk",
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 504/715 clk: qcom: gcc-ipq5018: fix 'halt_reg' offset of 'gcc_pcie1_pipe_clk'
In reply to Sasha LevinFrom: Gabor Juhos <[email protected]>
[ Upstream commit 11b752ac5a07cbfd95592fac5237a02f45662926 ]
The following table shows the values of the 'halt_reg' and the 'enable_reg' fields from the pcie clocks defined in the current driver:
clock halt_reg enable_reg
gcc_pcie0_ahb_clk 0x75010 0x75010 gcc_pcie0_aux_clk 0x75014 0x75014 gcc_pcie0_axi_m_clk 0x75008 0x75008 gcc_pcie0_axi_s_bridge_clk 0x75048 0x75048 gcc_pcie0_axi_s_clk 0x7500c 0x7500c gcc_pcie0_pipe_clk 0x75018 0x75018
gcc_pcie1_ahb_clk 0x76010 0x76010 gcc_pcie1_aux_clk 0x76014 0x76014 gcc_pcie1_axi_m_clk 0x76008 0x76008 gcc_pcie1_axi_s_bridge_clk 0x76048 0x76048 gcc_pcie1_axi_s_clk 0x7600c 0x7600c gcc_pcie1_pipe_clk 8* 0x76018
Based on the table, it is quite likely that the pcie0 and the pci1 clocks are using the same register layout, however it seems that the value of the 'halt_reg' field in the 'gcc_pcie1_pipe_clk' clock is wrong.
In the downstream driver [1], the same '0x76018' value is used for both the 'halt_reg' and for the 'enable_reg' fields of the 'gcc_pcie1_pipe_clk' clock.
Update the current driver to use the same value used downstream as probably that is the correct value.
--- drivers/clk/qcom/gcc-ipq5018.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/gcc-ipq5018.c +1 -1
@@ -2180,7 +2180,7 @@ static struct clk_branch gcc_pcie1_axi_s_clk = { };static struct clk_branch gcc_pcie1_pipe_clk = { - .halt_reg =8 , + .halt_reg =0x76018 , .halt_check =BRANCH_HALT_DELAY , .halt_bit =31 , .clkr = {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 505/715 clk: qcom: gcc-ipq5018: fix register offset for GCC_UBI0_AXI_ARES reset
In reply to Sasha LevinFrom: Gabor Juhos <[email protected]>
[ Upstream commit 7d474b43087aa356d714d39870c90d77fc6f1186 ]
The current register offset used for the GCC_UBI0_AXI_ARES reset seems wrong. Or at least, the downstream driver uses [1] the same offset which is used for other the GCC_UBI0_*_ARES resets.
Change the code to use the same offset used in the downstream driver and also specify the reset bit explicitly to use the same format as the followup entries.
--- drivers/clk/qcom/gcc-ipq5018.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/gcc-ipq5018.c +1 -1
@@ -3632,7 +3632,7 @@ static const struct qcom_reset_map gcc_ipq5018_resets[] = { [GCC_SYSTEM_NOC_BCR] = { 0x26000, 0 }, [GCC_TCSR_BCR] = { 0x28000, 0 }, [GCC_TLMM_BCR] = { 0x34000, 0 }, - [GCC_UBI0_AXI_ARES] = { 0x680}, + [GCC_UBI0_AXI_ARES] = { 0x68010, 0 }, [GCC_UBI0_AHB_ARES] = { 0x68010, 1 }, [GCC_UBI0_NC_AXI_ARES] = { 0x68010, 2 }, [GCC_UBI0_DBG_ARES] = { 0x68010, 3 },
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 506/715 perf vendor events amd: Fix Zen 4 cache latency events
In reply to Sasha LevinFrom: Sandipan Das <[email protected]>
[ Upstream commit 498d3486376befe4e82b5334d44bbc86b1982ee4 ]
L3PMCx0AC and L3PMCx0AD, used in l3_xi_sampled_latency* events, have a quirk that requires them to be programmed with SliceId set to 0x3. Without this, the events do not count at all and affects dependent metrics such as l3_read_miss_latency.
If ThreadMask is not specified, the amd-uncore driver internally sets ThreadMask to 0x3, EnAllCores to 0x1 and EnAllSlices to 0x1 but does not set SliceId. Since SliceId must also be set to 0x3 in this case, specify all the other fields explicitly.
E.g.
$ sudo perf stat -e l3_xi_sampled_latency.all,l3_xi_sampled_latency_requests.all -a sleep 1
Before:
Performance counter stats for 'system wide':
0 l3_xi_sampled_latency.all
0 l3_xi_sampled_latency_requests.all
1.005155399 seconds time elapsedAfter:
Performance counter stats for 'system wide':
921,446 l3_xi_sampled_latency.all
54,210 l3_xi_sampled_latency_requests.all
1.005664472 seconds time elapsed--- .../pmu-events/arch/x86/amdzen4/cache.json | 56 +++++++++++++++++++ tools/perf/pmu-events/jevents.py | 4 ++ 2 files changed, 60 insertions(+)
tools/perf/pmu-events/arch/x86/amdzen4/cache.json +56 -0
@@ -676,6 +676,10 @@ "EventCode": "0xac", "BriefDescription": "Average sampled latency when data is sourced from DRAM in the same NUMA node.", "UMask": "0x01", + "EnAllCores": "0x1", + "EnAllSlices": "0x1", + "SliceId": "0x3", + "ThreadMask": "0x3", "Unit": "L3PMC" }, {
@@ -683,6 +687,10 @@ "EventCode": "0xac", "BriefDescription": "Average sampled latency when data is sourced from DRAM in a different NUMA node.", "UMask": "0x02", + "EnAllCores": "0x1", + "EnAllSlices": "0x1", + "SliceId": "0x3", + "ThreadMask": "0x3", "Unit": "L3PMC" }, {
@@ -690,6 +698,10 @@ "EventCode": "0xac", "BriefDescription": "Average sampled latency when data is sourced from another CCX's cache when the address was in the same NUMA node.", "UMask": "0x04", + "EnAllCores": "0x1", + "EnAllSlices": "0x1", + "SliceId": "0x3", + "ThreadMask": "0x3", "Unit": "L3PMC" }, {
@@ -697,6 +709,10 @@ "EventCode": "0xac", "BriefDescription": "Average sampled latency when data is sourced from another CCX's cache when the address was in a different NUMA node.", "UMask": "0x08", + "EnAllCores": "0x1", + "EnAllSlices": "0x1", + "SliceId": "0x3", + "ThreadMask": "0x3", "Unit": "L3PMC" }, {
@@ -704,6 +720,10 @@ "EventCode": "0xac", "BriefDescription": "Average sampled latency when data is sourced from extension memory (CXL) in the same NUMA node.", "UMask": "0x10", + "EnAllCores": "0x1", + "EnAllSlices": "0x1", + "SliceId": "0x3", + "ThreadMask": "0x3", "Unit": "L3PMC" }, {
@@ -711,6 +731,10 @@ "EventCode": "0xac", "BriefDescription": "Average sampled latency when data is sourced from extension memory (CXL) in a different NUMA node.", "UMask": "0x20", + "EnAllCores": "0x1", + "EnAllSlices": "0x1", + "SliceId": "0x3", + "ThreadMask": "0x3", "Unit": "L3PMC" }, {
@@ -718,6 +742,10 @@ "EventCode": "0xac", "BriefDescription": "Average sampled latency from all data sources.", "UMask": "0x3f", + "EnAllCores": "0x1", + "EnAllSlices": "0x1", + "SliceId": "0x3", + "ThreadMask": "0x3", "Unit": "L3PMC" }, {
@@ -725,6 +753,10 @@ "EventCode": "0xad", "BriefDescription": "L3 cache fill requests sourced from DRAM in the same NUMA node.", "UMask": "0x01", + "EnAllCores": "0x1", + "EnAllSlices": "0x1", + "SliceId": "0x3", + "ThreadMask": "0x3", "Unit": "L3PMC" }, {
@@ -732,6 +764,10 @@ "EventCode": "0xad", "BriefDescription": "L3 cache fill requests sourced from DRAM in a different NUMA node.", "UMask": "0x02", + "EnAllCores": "0x1", + "EnAllSlices": "0x1", + "SliceId": "0x3", + "ThreadMask": "0x3", "Unit": "L3PMC" }, {
@@ -739,6 +775,10 @@ "EventCode": "0xad", "BriefDescription": "L3 cache fill requests sourced from another CCX's cache when the address was in the same NUMA node.", "UMask": "0x04", + "EnAllCores": "0x1", + "EnAllSlices": "0x1", + "SliceId": "0x3", + "ThreadMask": "0x3", "Unit": "L3PMC" }, {
@@ -746,6 +786,10 @@ "EventCode": "0xad", "BriefDescription": "L3 cache fill requests sourced from another CCX's cache when the address was in a different NUMA node.", "UMask": "0x08", + "EnAllCores": "0x1", + "EnAllSlices": "0x1", + "SliceId": "0x3", + "ThreadMask": "0x3", "Unit": "L3PMC" }, {
@@ -753,6 +797,10 @@ "EventCode": "0xad", "BriefDescription": "L3 cache fill requests sourced from extension memory (CXL) in the same NUMA node.", "UMask": "0x10", + "EnAllCores": "0x1", + "EnAllSlices": "0x1", + "SliceId": "0x3", + "ThreadMask": "0x3", "Unit": "L3PMC" }, {
@@ -760,6 +808,10 @@ "EventCode": "0xad", "BriefDescription": "L3 cache fill requests sourced from extension memory (CXL) in a different NUMA node.", "UMask": "0x20", + "EnAllCores": "0x1", + "EnAllSlices": "0x1", + "SliceId": "0x3", + "ThreadMask": "0x3", "Unit": "L3PMC" }, {
@@ -767,6 +819,10 @@ "EventCode": "0xad", "BriefDescription": "L3 cache fill requests sourced from all data sources.", "UMask": "0x3f", + "EnAllCores": "0x1", + "EnAllSlices": "0x1", + "SliceId": "0x3", + "ThreadMask": "0x3", "Unit": "L3PMC" } ]
tools/perf/pmu-events/jevents.py +4 -0
@@ -356,6 +356,10 @@ class JsonEvent: ('UMask', 'umask='), ('NodeType', 'type='), ('RdWrMask', 'rdwrmask='), + ('EnAllCores', 'enallcores='), + ('EnAllSlices', 'enallslices='), + ('SliceId', 'sliceid='), + ('ThreadMask', 'threadmask='), ] for key, value in event_fields: if key in jd and jd[key] != '0':
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 507/715 drm/msm/dpu: allow certain formats for CDM for DP
In reply to Sasha LevinFrom: Paloma Arellano <[email protected]>
[ Upstream commit 32b6ff95b91240e632f55be35c6ccd4bbe7434e4 ]
CDM block supports formats other than H1V2 for DP. Since we are now adding support for CDM over DP, relax the checks to allow all other formats for DP other than H1V2.
Changes in v2:
- Add fixes tag
- Move patch to top of series
Patchwork: https://patchwork.freedesktop.org/patch/579606/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_cdm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_cdm.c +1 -1
@@ -186,7 +186,7 @@ static int dpu_hw_cdm_enable(struct dpu_hw_cdm *ctx, struct dpu_hw_cdm_cfg *cdm)dpu_hw_cdm_setup_cdwn (ctx, cdm);if (cdm->output_type ==CDM_CDWN_OUTPUT_HDMI ) { -if (fmt->chroma_sample !=DPU_CHROMA_H1V2 ) +if (fmt->chroma_sample ==DPU_CHROMA_H1V2 )return -EINVAL ;/*unsupported format */ opmode =CDM_HDMI_PACK_OP_MODE_EN ; opmode |= (fmt->chroma_sample <<1 );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 508/715 drm/msm/dpu: add division of drm_display_mode's hskew parameter
In reply to Sasha LevinFrom: Paloma Arellano <[email protected]>
[ Upstream commit 551ee0f210991d25f336bc27262353bfe99d3eed ]
Setting up the timing engine when the physical encoder has a split role neglects dividing the drm_display_mode's hskew parameter. Let's fix this since this must also be done in preparation for implementing YUV420 over DP.
Patchwork: https://patchwork.freedesktop.org/patch/579605/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c +4 -2
@@ -260,12 +260,14 @@ static void dpu_encoder_phys_vid_setup_timing_engine( mode.htotal >>=1 ; mode.hsync_start >>=1 ; mode.hsync_end >>=1 ; + mode.hskew >>=1 ;DPU_DEBUG_VIDENC (phys_enc, -"split_role %d, halve horizontal %d %d %d %d\n" , +"split_role %d, halve horizontal %d %d %d %d %d\n" , phys_enc->split_role, mode.hdisplay, mode.htotal, - mode.hsync_start, mode.hsync_end); + mode.hsync_start, mode.hsync_end, + mode.hskew); }drm_mode_to_intf_timing_params (phys_enc, &mode, &timing_params);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 509/715 media: usbtv: Remove useless locks in usbtv_video_free()
In reply to Sasha LevinFrom: Benjamin Gaignard <[email protected]>
[ Upstream commit 65e6a2773d655172143cc0b927cdc89549842895 ]
Remove locks calls in usbtv_video_free() because are useless and may led to a deadlock as reported here:
https://syzkaller.appspot.com/x/bisect.txt?x=166dc872180000
Also remove usbtv_stop() call since it will be called when unregistering the device.
Before 'c838530d230b' this issue would only be noticed if you disconnect while streaming and now it is noticeable even when disconnecting while not streaming.
--- drivers/media/usb/usbtv/usbtv-video.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/media/usb/usbtv/usbtv-video.c +0 -7
@@ -963,15 +963,8 @@ int usbtv_video_init(struct usbtv *usbtv)void usbtv_video_free (struct usbtv *usbtv) { -mutex_lock (&usbtv->vb2q_lock); -mutex_lock (&usbtv->v4l2_lock); - -usbtv_stop (usbtv);vb2_video_unregister_device (&usbtv->vdev);v4l2_device_disconnect (&usbtv->v4l2_dev); -mutex_unlock (&usbtv->v4l2_lock); -mutex_unlock (&usbtv->vb2q_lock); -v4l2_device_put (&usbtv->v4l2_dev); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 510/715 drm/xe: Fix ref counting leak on page fault
In reply to Sasha LevinFrom: Matthew Brost <[email protected]>
[ Upstream commit f7da398935f7ddabf1a098714593e032c875cd74 ]
If a page fault occurs on VM not in fault a ref can be leaked. Fix this.
--- drivers/gpu/drm/xe/xe_gt_pagefault.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/xe_gt_pagefault.c +4 -2
@@ -146,10 +146,12 @@ static int handle_pagefault(struct xe_gt *gt, struct pagefault *pf)/* ASID to VM */ mutex_lock (&xe->usm.lock); vm =xa_load (&xe->usm.asid_to_vm, pf->asid); -if (vm) +if (vm &&xe_vm_in_fault_mode (vm))xe_vm_get (vm); +else + vm =NULL ;mutex_unlock (&xe->usm.lock); -if (!vm || !xe_vm_in_fault_mode (vm)) +if (!vm)return -EINVAL ; retry_userptr:
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 511/715 drm/xe: Replace 'grouped target' in Makefile with pattern rule
In reply to Sasha LevinFrom: Dafna Hirschfeld <[email protected]>
[ Upstream commit e62d2e00780b4a465c77d2229837495fcbc480d3 ]
Since 'grouped target' is used only in 'make' 4.3, it should be avoided. Replace it with 'multi-target pattern rule' which has the same behavior.
--- drivers/gpu/drm/xe/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/Makefile +2 -1
@@ -42,7 +42,8 @@ generated_oob := $(obj)/generated/xe_wa_oob.c $(obj)/generated/xe_wa_oob.h quiet_cmd_wa_oob = GEN $(notdir $(generated_oob)) cmd_wa_oob = mkdir -p $(@D); $^ $(generated_oob) -$(generated_oob) &: $(obj)/xe_gen_wa_oob $(srctree)/$(src)/xe_wa_oob.rules +$(obj)/generated/%_wa_oob.c $(obj)/generated/%_wa_oob.h: $(obj)/xe_gen_wa_oob \ + $(srctree)/$(src)/xe_wa_oob.rules $(call cmd,wa_oob) uses_generated_oob := \
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 512/715 lib/stackdepot: fix first entry having a 0-handle
In reply to Sasha LevinFrom: Oscar Salvador <[email protected]>
[ Upstream commit 3ee34eabac2abb6b1b6fcdebffe18870719ad000 ]
Patch series "page_owner: print stacks and their outstanding allocations", v10.
page_owner is a great debug functionality tool that lets us know about all pages that have been allocated/freed and their specific stacktrace. This comes very handy when debugging memory leaks, since with some scripting we can see the outstanding allocations, which might point to a memory leak.
In my experience, that is one of the most useful cases, but it can get really tedious to screen through all pages and try to reconstruct the stack <-> allocated/freed relationship, becoming most of the time a daunting and slow process when we have tons of allocation/free operations.
This patchset aims to ease that by adding a new functionality into page_owner. This functionality creates a new directory called 'page_owner_stacks' under 'sys/kernel//debug' with a read-only file called 'show_stacks', which prints out all the stacks followed by their outstanding number of allocations (being that the times the stacktrace has allocated but not freed yet). This gives us a clear and a quick overview of stacks <-> allocated/free.
We take advantage of the new refcount_f field that stack_record struct gained, and increment/decrement the stack refcount on every __set_page_owner() (alloc operation) and __reset_page_owner (free operation) call.
Unfortunately, we cannot use the new stackdepot api STACK_DEPOT_FLAG_GET because it does not fulfill page_owner needs, meaning we would have to special case things, at which point makes more sense for page_owner to do its own {dec,inc}rementing of the stacks. E.g: Using STACK_DEPOT_FLAG_PUT, once the refcount reaches 0, such stack gets evicted, so page_owner would lose information.
This patchset also creates a new file called 'set_threshold' within 'page_owner_stacks' directory, and by writing a value to it, the stacks which refcount is below such value will be filtered out.
A PoC can be found below:
# cat /sys/kernel/debug/page_owner_stacks/show_stacks > page_owner_full_stacks.txt # head -40 page_owner_full_stacks.txt prep_new_page+0xa9/0x120 get_page_from_freelist+0x801/0x2210 __alloc_pages+0x18b/0x350 alloc_pages_mpol+0x91/0x1f0 folio_alloc+0x14/0x50 filemap_alloc_folio+0xb2/0x100 page_cache_ra_unbounded+0x96/0x180 filemap_get_pages+0xfd/0x590 filemap_read+0xcc/0x330 blkdev_read_iter+0xb8/0x150 vfs_read+0x285/0x320 ksys_read+0xa5/0xe0 do_syscall_64+0x80/0x160 entry_SYSCALL_64_after_hwframe+0x6e/0x76 stack_count: 521
prep_new_page+0xa9/0x120 get_page_from_freelist+0x801/0x2210 __alloc_pages+0x18b/0x350 alloc_pages_mpol+0x91/0x1f0 folio_alloc+0x14/0x50 filemap_alloc_folio+0xb2/0x100 __filemap_get_folio+0x14a/0x490 ext4_write_begin+0xbd/0x4b0 [ext4] generic_perform_write+0xc1/0x1e0 ext4_buffered_write_iter+0x68/0xe0 [ext4] ext4_file_write_iter+0x70/0x740 [ext4] vfs_write+0x33d/0x420 ksys_write+0xa5/0xe0 do_syscall_64+0x80/0x160 entry_SYSCALL_64_after_hwframe+0x6e/0x76 stack_count: 4609
...
...
# echo 5000 > /sys/kernel/debug/page_owner_stacks/set_threshold # cat /sys/kernel/debug/page_owner_stacks/show_stacks > page_owner_full_stacks_5000.txt # head -40 page_owner_full_stacks_5000.txt prep_new_page+0xa9/0x120 get_page_from_freelist+0x801/0x2210 __alloc_pages+0x18b/0x350 alloc_pages_mpol+0x91/0x1f0 folio_alloc+0x14/0x50 filemap_alloc_folio+0xb2/0x100 __filemap_get_folio+0x14a/0x490 ext4_write_begin+0xbd/0x4b0 [ext4] generic_perform_write+0xc1/0x1e0 ext4_buffered_write_iter+0x68/0xe0 [ext4] ext4_file_write_iter+0x70/0x740 [ext4] vfs_write+0x33d/0x420 ksys_pwrite64+0x75/0x90 do_syscall_64+0x80/0x160 entry_SYSCALL_64_after_hwframe+0x6e/0x76 stack_count: 6781
prep_new_page+0xa9/0x120 get_page_from_freelist+0x801/0x2210 __alloc_pages+0x18b/0x350 pcpu_populate_chunk+0xec/0x350 pcpu_balance_workfn+0x2d1/0x4a0 process_scheduled_works+0x84/0x380 worker_thread+0x12a/0x2a0 kthread+0xe3/0x110 ret_from_fork+0x30/0x50 ret_from_fork_asm+0x1b/0x30 stack_count: 8641
This patch (of 7):
The very first entry of stack_record gets a handle of 0, but this is wrong because stackdepot treats a 0-handle as a non-valid one. E.g: See the check in stack_depot_fetch()
Fix this by adding and offset of 1.
This bug has been lurking since the very beginning of stackdepot, but no one really cared as it seems. Because of that I am not adding a Fixes tag.
Stable-dep-of: dc24559472a6 ("lib/stackdepot: off by one in depot_fetch_stack()")
--- lib/stackdepot.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
lib/stackdepot.c +9 -7
@@ -45,15 +45,16 @@#define DEPOT_POOL_INDEX_BITS (DEPOT_HANDLE_BITS - DEPOT_OFFSET_BITS - \ STACK_DEPOT_EXTRA_BITS)#define DEPOT_POOLS_CAP 8192 +/* The pool_index is offset by 1 so the first record does not have a 0 handle. */ #define DEPOT_MAX_POOLS \ - (((1LL << (DEPOT_POOL_INDEX_BITS)) < DEPOT_POOLS_CAP) ? \ - (1LL << (DEPOT_POOL_INDEX_BITS)) : DEPOT_POOLS_CAP) + (((1LL << (DEPOT_POOL_INDEX_BITS)) - 1 < DEPOT_POOLS_CAP) ? \ + (1LL << (DEPOT_POOL_INDEX_BITS)) - 1 : DEPOT_POOLS_CAP)/* Compact structure that stores a reference to a stack. */ union handle_parts {depot_stack_handle_t handle;struct { -u32 pool_index :DEPOT_POOL_INDEX_BITS ; +u32 pool_index :DEPOT_POOL_INDEX_BITS ;/* pool_index is offset by 1 */ u32 offset :DEPOT_OFFSET_BITS ;u32 extra :STACK_DEPOT_EXTRA_BITS ; };
@@ -372,7 +373,7 @@ static struct stack_record *depot_pop_free_pool(void **prealloc, size_t size) stack = current_pool + pool_offset;/* Pre-initialize handle once. */ - stack->handle.pool_index = pool_index; + stack->handle.pool_index = pool_index +1 ; stack->handle.offset = pool_offset >>DEPOT_STACK_ALIGN ; stack->handle.extra =0 ;INIT_LIST_HEAD (&stack->hash_list);
@@ -483,18 +484,19 @@ static struct stack_record *depot_fetch_stack(depot_stack_handle_t handle)const int pools_num_cached =READ_ONCE (pools_num);union handle_parts parts = { .handle = handle };void *pool; +u32 pool_index = parts.pool_index -1 ;size_t offset = parts.offset <<DEPOT_STACK_ALIGN ;struct stack_record *stack;lockdep_assert_not_held (&pool_lock); -if (parts.pool_index > pools_num_cached) { +if (pool_index > pools_num_cached) {WARN (1 ,"pool index %d out of bounds (%d) for stack id %08x\n" , - parts.pool_index, pools_num_cached, handle); + pool_index, pools_num_cached, handle);return NULL ; } - pool = stack_pools[parts.pool_index]; + pool = stack_pools[pool_index];if (WARN_ON (!pool))return NULL ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 513/715 lib/stackdepot: off by one in depot_fetch_stack()
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit dc24559472a682eb124e869cb110e7a2fd857322 ]
The stack_pools[] array has DEPOT_MAX_POOLS. The "pools_num" tracks the number of pools which are initialized. See depot_init_pool() for more details.
If pool_index == pools_num_cached, this will read one element beyond what we want. If not all the pools are initialized, then the pool will be NULL, triggering a WARN(), and if they are all initialized it will read one element beyond the end of the array.
--- lib/stackdepot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/stackdepot.c +1 -1
@@ -490,7 +490,7 @@ static struct stack_record *depot_fetch_stack(depot_stack_handle_t handle)lockdep_assert_not_held (&pool_lock); -if (pool_index > pools_num_cached) { +if (pool_index >= pools_num_cached) {WARN (1 ,"pool index %d out of bounds (%d) for stack id %08x\n" , pool_index, pools_num_cached, handle);return NULL ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 514/715 modules: wait do_free_init correctly
In reply to Sasha LevinFrom: Changbin Du <[email protected]>
[ Upstream commit 8f8cd6c0a43ed637e620bbe45a8d0e0c2f4d5130 ]
The synchronization here is to ensure the ordering of freeing of a module init so that it happens before W+X checking. It is worth noting it is not that the freeing was not happening, it is just that our sanity checkers raced against the permission checkers which assume init memory is already gone.
Commit 1a7b7d922081 ("modules: Use vmalloc special flag") moved calling do_free_init() into a global workqueue instead of relying on it being called through call_rcu(..., do_free_init), which used to allowed us call do_free_init() asynchronously after the end of a subsequent grace period. The move to a global workqueue broke the gaurantees for code which needed to be sure the do_free_init() would complete with rcu_barrier(). To fix this callers which used to rely on rcu_barrier() must now instead use flush_work(&init_free_wq).
Without this fix, we still could encounter false positive reports in W+X checking since the rcu_barrier() here can not ensure the ordering now.
Even worse, the rcu_barrier() can introduce significant delay. Eric Chanudet reported that the rcu_barrier introduces ~0.1s delay on a PREEMPT_RT kernel.
[ 0.291444] Freeing unused kernel memory: 5568K [ 0.402442] Run /sbin/init as init process
With this fix, the above delay can be eliminated.
--- include/linux/moduleloader.h | 8 ++++++++ init/main.c | 5 +++-- kernel/module/main.c | 9 +++++++-- 3 files changed, 18 insertions(+), 4 deletions(-)
include/linux/moduleloader.h +8 -0
@@ -115,6 +115,14 @@ int module_finalize(const Elf_Ehdr *hdr,const Elf_Shdr *sechdrs, struct module *mod); +#ifdef CONFIG_MODULES +void flush_module_init_free_work (void ); +#else +static inline void flush_module_init_free_work (void ) +{ +} +#endif +/* Any cleanup needed when module leaves. */ void module_arch_cleanup (struct module *mod);
init/main.c +3 -2
@@ -88,6 +88,7 @@#include <linux/sched/task_stack.h> #include <linux/context_tracking.h> #include <linux/random.h> +#include <linux/moduleloader.h> #include <linux/list.h> #include <linux/integrity.h> #include <linux/proc_ns.h>
@@ -1402,11 +1403,11 @@ static void mark_readonly(void)if (rodata_enabled) {/* * load_module() results in W+X mappings, which are cleaned -* up with call_rcu(). Let's make sure that queued work is +* up with init_free_wq. Let's make sure that queued work is * flushed so that we don't hit false positives looking for * insecure pages which are W+X. */ -rcu_barrier (); +flush_module_init_free_work ();mark_rodata_ro ();rodata_test (); }else
kernel/module/main.c +7 -2
@@ -2489,6 +2489,11 @@ static void do_free_init(struct work_struct *w) } } +void flush_module_init_free_work (void ) +{ +flush_work (&init_free_wq); +} +#undef MODULE_PARAM_PREFIX#define MODULE_PARAM_PREFIX "module."/* Default value for module->async_probe_requested */
@@ -2593,8 +2598,8 @@ static noinline int do_init_module(struct module *mod)* Note that module_alloc() on most architectures creates W+X page * mappings which won't be cleaned up until do_free_init() runs. Any * code such as mark_rodata_ro() which depends on those mappings to -* be cleaned up needs to sync with the queued work - ie -* rcu_barrier() +* be cleaned up needs to sync with the queued work by invoking +* flush_module_init_free_work(). */ if (llist_add (&freeinit->node, &init_free_list))schedule_work (&init_free_wq);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 515/715 mfd: cs42l43: Fix wrong GPIO_FN_SEL and SPI_CLK_CONFIG1 defaults
In reply to Sasha LevinFrom: Maciej Strozek <[email protected]>
[ Upstream commit 78334c343bef528b911da83a6b041d15a1a72efb ]
Two regs have wrong values in existing fields, change them to match the datasheet.
--- drivers/mfd/cs42l43.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mfd/cs42l43.c +2 -2
@@ -84,7 +84,7 @@ const struct reg_default cs42l43_reg_default[CS42L43_N_DEFAULTS] = { { CS42L43_DRV_CTRL_5, 0x136C00C0 }, { CS42L43_GPIO_CTRL1, 0x00000707 }, { CS42L43_GPIO_CTRL2, 0x00000000 }, - { CS42L43_GPIO_FN_SEL, 0x00000000 }, + { CS42L43_GPIO_FN_SEL, 0x00000004 }, { CS42L43_MCLK_SRC_SEL, 0x00000000 }, { CS42L43_SAMPLE_RATE1, 0x00000003 }, { CS42L43_SAMPLE_RATE2, 0x00000003 },
@@ -217,7 +217,7 @@ const struct reg_default cs42l43_reg_default[CS42L43_N_DEFAULTS] = { { CS42L43_CTRL_REG, 0x00000006 }, { CS42L43_FDIV_FRAC, 0x40000000 }, { CS42L43_CAL_RATIO, 0x00000080 }, - { CS42L43_SPI_CLK_CONFIG1, 0x00000000 }, + { CS42L43_SPI_CLK_CONFIG1, 0x00000001 }, { CS42L43_SPI_CONFIG1, 0x00000000 }, { CS42L43_SPI_CONFIG2, 0x00000000 }, { CS42L43_SPI_CONFIG3, 0x00000001 },
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 516/715 power: supply: mm8013: fix "not charging" detection
In reply to Sasha LevinFrom: Thomas Weißschuh <[email protected]>
[ Upstream commit cd38a0acca734a1117663d6f0da579d3965b6c93 ]
The charge_behaviours property is meant as a control-knob that can be changed by the user.
Page 23 of [0] which documents the flag CHG_INH as follows:
CHG_INH : Charge Inhibit When the current is more than or equal to charge
threshold current,
charge inhibit temperature (upper/lower limit) :1 charge permission temperature or the current is less than charge threshold current :0
So this is pure read-only information which is better represented as POWER_SUPPLY_STATUS_NOT_CHARGING.
--- drivers/power/supply/mm8013.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
drivers/power/supply/mm8013.c +2 -11
@@ -71,7 +71,6 @@ static int mm8013_checkdevice(struct mm8013_chip *chip)static enum power_supply_property mm8013_battery_props[] = {POWER_SUPPLY_PROP_CAPACITY , -POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR ,POWER_SUPPLY_PROP_CHARGE_FULL ,POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN ,POWER_SUPPLY_PROP_CHARGE_NOW ,
@@ -103,16 +102,6 @@ static int mm8013_get_property(struct power_supply *psy, val->intval = regval;break ; -case POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR : - ret =regmap_read (chip->regmap,REG_FLAGS , ®val); -if (ret <0 ) -return ret; - -if (regval &MM8013_FLAG_CHG_INH ) - val->intval =POWER_SUPPLY_CHARGE_BEHAVIOUR_INHIBIT_CHARGE ; -else - val->intval =POWER_SUPPLY_CHARGE_BEHAVIOUR_AUTO ; -break ;case POWER_SUPPLY_PROP_CHARGE_FULL : ret =regmap_read (chip->regmap,REG_FULL_CHARGE_CAPACITY , ®val);if (ret <0 )
@@ -187,6 +176,8 @@ static int mm8013_get_property(struct power_supply *psy,if (regval &MM8013_FLAG_DSG ) val->intval =POWER_SUPPLY_STATUS_DISCHARGING ; +else if (regval &MM8013_FLAG_CHG_INH ) + val->intval =POWER_SUPPLY_STATUS_NOT_CHARGING ;else if (regval &MM8013_FLAG_CHG ) val->intval =POWER_SUPPLY_STATUS_CHARGING ;else if (regval &MM8013_FLAG_FC )
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 517/715 powerpc/embedded6xx: Fix no previous prototype for avr_uart_send() etc.
In reply to Sasha LevinFrom: Michael Ellerman <[email protected]>
[ Upstream commit 20933531be0577cdd782216858c26150dbc7936f ]
Move the prototypes into mpc10x.h which is included by all the relevant C files, fixes:
arch/powerpc/platforms/embedded6xx/ls_uart.c:59:6: error: no previous prototype for 'avr_uart_configure' arch/powerpc/platforms/embedded6xx/ls_uart.c:82:6: error: no previous prototype for 'avr_uart_send'
--- arch/powerpc/platforms/embedded6xx/linkstation.c | 3 --- arch/powerpc/platforms/embedded6xx/mpc10x.h | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-)
arch/powerpc/platforms/embedded6xx/linkstation.c +0 -3
@@ -99,9 +99,6 @@ static void __init linkstation_init_IRQ(void)mpic_init (mpic); } -extern void avr_uart_configure (void ); -extern void avr_uart_send (const char ); -static void __noreturn linkstation_restart (char *cmd) {local_irq_disable ();
arch/powerpc/platforms/embedded6xx/mpc10x.h +3 -0
@@ -156,4 +156,7 @@ int mpc10x_disable_store_gathering(struct pci_controller *hose);/* For MPC107 boards that use the built-in openpic */ void mpc10x_set_openpic (void ); +void avr_uart_configure (void ); +void avr_uart_send (const char c); +#endif /* __PPC_KERNEL_MPC10X_H */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 518/715 powerpc/4xx: Fix warp_gpio_leds build failure
In reply to Sasha LevinFrom: Michael Ellerman <[email protected]>
[ Upstream commit 5b9e00a6004cf837c43fdb8d5290df619de78024 ]
The 44x/warp_defconfig build fails with:
arch/powerpc/platforms/44x/warp.c:109:15: error: variable ‘warp_gpio_leds’ has initializer but incomplete type
109 | static struct platform_device warp_gpio_leds = {
| ^~~~~~~~~~~~~~~Fix it by including platform_device.h.
--- arch/powerpc/platforms/44x/warp.c | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/platforms/44x/warp.c +1 -0
@@ -8,6 +8,7 @@#include <linux/err.h> #include <linux/init.h> #include <linux/of_platform.h> +#include <linux/platform_device.h> #include <linux/kthread.h> #include <linux/leds.h> #include <linux/i2c.h>
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 519/715 RISC-V: KVM: Forward SEED CSR access to user space
In reply to Sasha LevinFrom: Anup Patel <[email protected]>
[ Upstream commit d808f0b1be4888a87524164bc7dad2242734de38 ]
The SEED CSR access from VS/VU mode (guest) will always trap to HS-mode (KVM) when Zkr extension is available to the Guest/VM.
Forward this CSR access to KVM user space so that it can be emulated based on the method chosen by VMM.
--- arch/riscv/kvm/vcpu_insn.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
arch/riscv/kvm/vcpu_insn.c +13 -0
@@ -7,6 +7,8 @@#include <linux/bitops.h> #include <linux/kvm_host.h> +#include <asm/cpufeature.h> +#define INSN_OPCODE_MASK 0x007c#define INSN_OPCODE_SHIFT 2#define INSN_OPCODE_SYSTEM 28
@@ -213,9 +215,20 @@ struct csr_func { unsigned long wr_mask); }; +static int seed_csr_rmw (struct kvm_vcpu *vcpu,unsigned int csr_num, +unsigned long *val,unsigned long new_val, +unsigned long wr_mask) +{ +if (!riscv_isa_extension_available (vcpu->arch.isa,ZKR )) +return KVM_INSN_ILLEGAL_TRAP ; + +return KVM_INSN_EXIT_TO_USER_SPACE ; +} +static const struct csr_func csr_funcs[] = { KVM_RISCV_VCPU_AIA_CSR_FUNCS KVM_RISCV_VCPU_HPMCOUNTER_CSR_FUNCS + { .base =CSR_SEED , .count =1 , .func = seed_csr_rmw }, };/**
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 520/715 leds: aw2013: Unlock mutex before destroying it
In reply to Sasha LevinFrom: George Stark <[email protected]>
[ Upstream commit 6969d0a2ba1adc9ba6a49b9805f24080896c255c ]
In the probe() callback in case of error mutex is destroyed being locked which is not allowed so unlock the mutex before destroying.
--- drivers/leds/leds-aw2013.c | 1 + 1 file changed, 1 insertion(+)
drivers/leds/leds-aw2013.c +1 -0
@@ -405,6 +405,7 @@ static int aw2013_probe(struct i2c_client *client) chip->regulators); error: +mutex_unlock (&chip->mutex);mutex_destroy (&chip->mutex);return ret; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 521/715 leds: sgm3140: Add missing timer cleanup and flash gpio control
In reply to Sasha LevinFrom: Ondrej Jirman <[email protected]>
[ Upstream commit 205c29887a333ee4b37596e6533373e38cb23947 ]
Enabling strobe and then setting brightness to 0 causes the driver to enter invalid state after strobe end timer fires. We should cancel strobe mode resources when changing brightness (aka torch mode).
--- drivers/leds/flash/leds-sgm3140.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/leds/flash/leds-sgm3140.c +3 -0
@@ -114,8 +114,11 @@ static int sgm3140_brightness_set(struct led_classdev *led_cdev, "failed to enable regulator: %d\n", ret);return ret; } +gpiod_set_value_cansleep (priv->flash_gpio,0 );gpiod_set_value_cansleep (priv->enable_gpio,1 ); }else { +del_timer_sync (&priv->powerdown_timer); +gpiod_set_value_cansleep (priv->flash_gpio,0 );gpiod_set_value_cansleep (priv->enable_gpio,0 ); ret =regulator_disable (priv->vin_regulator);if (ret) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 522/715 backlight: hx8357: Fix potential NULL pointer dereference
In reply to Sasha LevinFrom: Andy Shevchenko <[email protected]>
[ Upstream commit b1ba8bcb2d1ffce11b308ce166c9cc28d989e3b9 ]
The "im" pins are optional. Add missing check in the hx8357_probe().
--- drivers/video/backlight/hx8357.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/video/backlight/hx8357.c +6 -4
@@ -609,11 +609,13 @@ static int hx8357_probe(struct spi_device *spi) lcd->im_pins =devm_gpiod_get_array_optional (dev,"im" ,GPIOD_OUT_LOW );if (IS_ERR (lcd->im_pins))return dev_err_probe (dev,PTR_ERR (lcd->im_pins),"failed to request im GPIOs\n" ); -if (lcd->im_pins->ndescs <HX8357_NUM_IM_PINS ) -return dev_err_probe (dev, -EINVAL ,"not enough im GPIOs\n" ); +if (lcd->im_pins) { +if (lcd->im_pins->ndescs <HX8357_NUM_IM_PINS ) +return dev_err_probe (dev, -EINVAL ,"not enough im GPIOs\n" ); -for (i =0 ; i <HX8357_NUM_IM_PINS ; i++) -gpiod_set_consumer_name (lcd->im_pins->desc[i],"im_pins" ); +for (i =0 ; i <HX8357_NUM_IM_PINS ; i++) +gpiod_set_consumer_name (lcd->im_pins->desc[i],"im_pins" ); + } lcdev =devm_lcd_device_register (&spi->dev,"mxsfb" , &spi->dev, lcd, &hx8357_ops);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 523/715 backlight: ktz8866: Correct the check for of_property_read_u32
In reply to Sasha LevinFrom: Jianhua Lu <[email protected]>
[ Upstream commit f1ac3c9825f99c93a9833beee6b78aa386e55b0b ]
of_property_read_u32 returns 0 when success, so reverse the return value to get the true value.
--- drivers/video/backlight/ktz8866.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/video/backlight/ktz8866.c +3 -3
@@ -97,20 +97,20 @@ static void ktz8866_init(struct ktz8866 *ktz) {unsigned int val =0 ; -if (of_property_read_u32 (ktz->client->dev.of_node,"current-num-sinks" , &val)) +if (!of_property_read_u32 (ktz->client->dev.of_node,"current-num-sinks" , &val))ktz8866_write (ktz,BL_EN ,BIT (val) -1 );else /* Enable all 6 current sinks if the number of current sinks isn't specified. */ ktz8866_write (ktz,BL_EN ,BIT (6 ) -1 ); -if (of_property_read_u32 (ktz->client->dev.of_node,"kinetic,current-ramp-delay-ms" , &val)) { +if (!of_property_read_u32 (ktz->client->dev.of_node,"kinetic,current-ramp-delay-ms" , &val)) {if (val <=128 )ktz8866_write (ktz,BL_CFG2 ,BIT (7 ) | (ilog2 (val) <<3 ) |PWM_HYST );else ktz8866_write (ktz,BL_CFG2 ,BIT (7 ) | ((5 + val /64 ) <<3 ) |PWM_HYST ); } -if (of_property_read_u32 (ktz->client->dev.of_node,"kinetic,led-enable-ramp-delay-ms" , &val)) { +if (!of_property_read_u32 (ktz->client->dev.of_node,"kinetic,led-enable-ramp-delay-ms" , &val)) {if (val ==0 )ktz8866_write (ktz,BL_DIMMING ,0 );else {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 524/715 backlight: lm3630a: Initialize backlight_properties on init
In reply to Sasha LevinFrom: Luca Weiss <[email protected]>
[ Upstream commit ad9aeb0e3aa90ebdad5fabf9c21783740eb95907 ]
The backlight_properties struct should be initialized to zero before using, otherwise there will be some random values in the struct.
--- drivers/video/backlight/lm3630a_bl.c | 1 + 1 file changed, 1 insertion(+)
drivers/video/backlight/lm3630a_bl.c +1 -0
@@ -343,6 +343,7 @@ static int lm3630a_backlight_register(struct lm3630a_chip *pchip)struct backlight_properties props;const char *label; +memset (&props,0 ,sizeof (struct backlight_properties )); props.type =BACKLIGHT_RAW ;if (pdata->leda_ctrl !=LM3630A_LEDA_DISABLE ) { props.brightness = pdata->leda_init_brt;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 525/715 backlight: lm3630a: Don't set bl->props.brightness in get_brightness
In reply to Sasha LevinFrom: Luca Weiss <[email protected]>
[ Upstream commit 4bf7ddd2d2f0f8826f25f74c7eba4e2c323a1446 ]
There's no need to set bl->props.brightness, the get_brightness function is just supposed to return the current brightness and not touch the struct.
With that done we can also remove the 'goto out' and just return the value.
--- drivers/video/backlight/lm3630a_bl.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
drivers/video/backlight/lm3630a_bl.c +4 -10
@@ -233,7 +233,7 @@ static int lm3630a_bank_a_get_brightness(struct backlight_device *bl)if (rval <0 ) goto out_i2c_err; brightness |= rval; - goto out; +return brightness; }/* disable sleep */
@@ -244,11 +244,8 @@ static int lm3630a_bank_a_get_brightness(struct backlight_device *bl) rval =lm3630a_read (pchip,REG_BRT_A );if (rval <0 ) goto out_i2c_err; - brightness = rval; +return rval; -out: - bl->props.brightness = brightness; -return bl->props.brightness; out_i2c_err:dev_err (pchip->dev,"i2c failed to access register\n" );return 0 ;
@@ -310,7 +307,7 @@ static int lm3630a_bank_b_get_brightness(struct backlight_device *bl)if (rval <0 ) goto out_i2c_err; brightness |= rval; - goto out; +return brightness; }/* disable sleep */
@@ -321,11 +318,8 @@ static int lm3630a_bank_b_get_brightness(struct backlight_device *bl) rval =lm3630a_read (pchip,REG_BRT_B );if (rval <0 ) goto out_i2c_err; - brightness = rval; +return rval; -out: - bl->props.brightness = brightness; -return bl->props.brightness; out_i2c_err:dev_err (pchip->dev,"i2c failed to access register\n" );return 0 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 526/715 backlight: da9052: Fully initialize backlight_properties during probe
In reply to Sasha LevinFrom: Daniel Thompson <[email protected]>
[ Upstream commit 0285e9efaee8276305db5c52a59baf84e9731556 ]
props is stack allocated and the fields that are not explcitly set by the probe function need to be zeroed or we'll get undefined behaviour (especially so power/blank states)!
--- drivers/video/backlight/da9052_bl.c | 1 + 1 file changed, 1 insertion(+)
drivers/video/backlight/da9052_bl.c +1 -0
@@ -117,6 +117,7 @@ static int da9052_backlight_probe(struct platform_device *pdev) wleds->led_reg =platform_get_device_id (pdev)->driver_data; wleds->state =DA9052_WLEDS_OFF ; +memset (&props,0 ,sizeof (struct backlight_properties )); props.type =BACKLIGHT_RAW ; props.max_brightness =DA9052_MAX_BRIGHTNESS ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 527/715 backlight: lm3639: Fully initialize backlight_properties during probe
In reply to Sasha LevinFrom: Daniel Thompson <[email protected]>
[ Upstream commit abb5a5d951fbea3feb5c4ba179b89bb96a1d3462 ]
props is stack allocated and the fields that are not explcitly set by the probe function need to be zeroed or we'll get undefined behaviour (especially so power/blank states)!
--- drivers/video/backlight/lm3639_bl.c | 1 + 1 file changed, 1 insertion(+)
drivers/video/backlight/lm3639_bl.c +1 -0
@@ -338,6 +338,7 @@ static int lm3639_probe(struct i2c_client *client) }/* backlight */ +memset (&props,0 ,sizeof (struct backlight_properties )); props.type =BACKLIGHT_RAW ; props.brightness = pdata->init_brt_led; props.max_brightness = pdata->max_brt_led;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 528/715 backlight: lp8788: Fully initialize backlight_properties during probe
In reply to Sasha LevinFrom: Daniel Thompson <[email protected]>
[ Upstream commit 392346827fbe8a7fd573dfb145170d7949f639a6 ]
props is stack allocated and the fields that are not explcitly set by the probe function need to be zeroed or we'll get undefined behaviour (especially so power/blank states)!
--- drivers/video/backlight/lp8788_bl.c | 1 + 1 file changed, 1 insertion(+)
drivers/video/backlight/lp8788_bl.c +1 -0
@@ -191,6 +191,7 @@ static int lp8788_backlight_register(struct lp8788_bl *bl)int init_brt;char *name; +memset (&props,0 ,sizeof (struct backlight_properties )); props.type =BACKLIGHT_PLATFORM ; props.max_brightness =MAX_BRIGHTNESS ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 529/715 arch/powerpc: Remove <linux/fb.h> from backlight code
In reply to Sasha LevinFrom: Thomas Zimmermann <[email protected]>
[ Upstream commit 838f865802b9f26135ea7df4e30f89ac2f50c23e ]
Replace <linux/fb.h> with a forward declaration in <asm/backlight.h> to resolve an unnecessary dependency. Remove pmac_backlight_curve_lookup() and struct fb_info from source and header files. The function and the framebuffer struct are unused. No functional changes.
v3:
* Add Fixes tag (Christophe)
* fix typos in commit message (Jani)
--- arch/powerpc/include/asm/backlight.h | 5 ++-- arch/powerpc/platforms/powermac/backlight.c | 26 --------------------- 2 files changed, 2 insertions(+), 29 deletions(-)
arch/powerpc/include/asm/backlight.h +2 -3
@@ -10,15 +10,14 @@#define __ASM_POWERPC_BACKLIGHT_H#ifdef __KERNEL__ -#include <linux/fb.h> #include <linux/mutex.h> +struct backlight_device ; +/* For locking instructions, see the implementation file */ extern struct backlight_device *pmac_backlight;extern struct mutex pmac_backlight_mutex; -extern int pmac_backlight_curve_lookup (struct fb_info *info,int value); -extern int pmac_has_backlight_type (const char *type);extern void pmac_backlight_key (int direction);
arch/powerpc/platforms/powermac/backlight.c +0 -26
@@ -9,7 +9,6 @@*/ #include <linux/kernel.h> -#include <linux/fb.h> #include <linux/backlight.h> #include <linux/adb.h> #include <linux/pmu.h>
@@ -72,31 +71,6 @@ int pmac_has_backlight_type(const char *type)return 0 ; } -int pmac_backlight_curve_lookup (struct fb_info *info,int value) -{ -int level = (FB_BACKLIGHT_LEVELS -1 ); - -if (info && info->bl_dev) { -int i, max =0 ; - -/* Look for biggest value */ -for (i =0 ; i <FB_BACKLIGHT_LEVELS ; i++) - max =max ((int )info->bl_curve[i], max); - -/* Look for nearest value */ -for (i =0 ; i <FB_BACKLIGHT_LEVELS ; i++) { -int diff =abs (info->bl_curve[i] - value); -if (diff < max) { - max = diff; - level = i; - } - } - - } - -return level; -} -static void pmac_backlight_key_worker (struct work_struct *work) {if (atomic_read (&kernel_backlight_disabled))
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 530/715 sparc32: Use generic cmpdi2/ucmpdi2 variants
In reply to Sasha LevinFrom: Sam Ravnborg <[email protected]>
[ Upstream commit 802a8874a3889a4a0d218d4f73e5855c96d5b8a8 ]
Use the generic variants - the implementation is the same. As a nice side-effect fix the following warnings:
cmpdi2.c: warning: no previous prototype for '__cmpdi2' [-Wmissing-prototypes] ucmpdi2.c: warning: no previous prototype for '__ucmpdi2' [-Wmissing-prototypes]
--- arch/sparc/Kconfig | 2 ++ arch/sparc/lib/Makefile | 4 ++-- arch/sparc/lib/cmpdi2.c | 28 ---------------------------- arch/sparc/lib/ucmpdi2.c | 20 -------------------- 4 files changed, 4 insertions(+), 50 deletions(-) delete mode 100644 arch/sparc/lib/cmpdi2.c delete mode 100644 arch/sparc/lib/ucmpdi2.c
arch/sparc/Kconfig +2 -0
@@ -57,6 +57,8 @@ config SPARC32 select CLZ_TAB select DMA_DIRECT_REMAP select GENERIC_ATOMIC64 + select GENERIC_LIB_CMPDI2 + select GENERIC_LIB_UCMPDI2 select HAVE_UID16 select LOCK_MM_AND_FIND_VMA select OLD_SIGACTION
arch/sparc/lib/Makefile +2 -2
@@ -14,7 +14,7 @@ lib-$(CONFIG_SPARC32) += divdi3.o udivdi3.o lib-$(CONFIG_SPARC32) += copy_user.o locks.o lib-$(CONFIG_SPARC64) += atomic_64.o lib-$(CONFIG_SPARC32) += lshrdi3.o ashldi3.o -lib-$(CONFIG_SPARC32) += muldi3.o bitext.o cmpdi2.o +lib-$(CONFIG_SPARC32) += muldi3.o bitext.o lib-$(CONFIG_SPARC64) += multi3.o lib-$(CONFIG_SPARC64) += fls.o lib-$(CONFIG_SPARC64) += fls64.o
@@ -51,5 +51,5 @@ lib-$(CONFIG_SPARC64) += copy_in_user.o memmove.o lib-$(CONFIG_SPARC64) += mcount.o ipcsum.o xor.o hweight.o ffs.o obj-$(CONFIG_SPARC64) += iomap.o -obj-$(CONFIG_SPARC32) += atomic32.o ucmpdi2.o +obj-$(CONFIG_SPARC32) += atomic32.o obj-$(CONFIG_SPARC64) += PeeCeeI.o
arch/sparc/lib/cmpdi2.c deleted +0 -28
@@ -1,28 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include <linux/module.h> - -#include "libgcc.h" - -word_type __cmpdi2 (long long a,long long b) -{ -const DWunion au = { - .ll = a - }; -const DWunion bu = { - .ll = b - }; - -if (au.s.high < bu.s.high) -return 0 ; -else if (au.s.high > bu.s.high) -return 2 ; - -if ((unsigned int ) au.s.low < (unsigned int ) bu.s.low) -return 0 ; -else if ((unsigned int ) au.s.low > (unsigned int ) bu.s.low) -return 2 ; - -return 1 ; -} - -EXPORT_SYMBOL (__cmpdi2);
arch/sparc/lib/ucmpdi2.c deleted +0 -20
@@ -1,20 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include <linux/module.h> -#include "libgcc.h" - -word_type __ucmpdi2 (unsigned long long a,unsigned long long b) -{ -const DWunion au = {.ll = a}; -const DWunion bu = {.ll = b}; - -if ((unsigned int ) au.s.high < (unsigned int ) bu.s.high) -return 0 ; -else if ((unsigned int ) au.s.high > (unsigned int ) bu.s.high) -return 2 ; -if ((unsigned int ) au.s.low < (unsigned int ) bu.s.low) -return 0 ; -else if ((unsigned int ) au.s.low > (unsigned int ) bu.s.low) -return 2 ; -return 1 ; -} -EXPORT_SYMBOL (__ucmpdi2);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 531/715 mtd: maps: sun_uflash: Declare uflash_devinit static
In reply to Sasha LevinFrom: Sam Ravnborg <[email protected]>
[ Upstream commit 6892982316846d4c40d12b0641d59519d868a784 ]
This fixes the following warning:
sun_uflash.c:50:5: error: no previous prototype for 'uflash_devinit'
--- drivers/mtd/maps/sun_uflash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/maps/sun_uflash.c +1 -1
@@ -47,7 +47,7 @@ struct map_info uflash_map_templ = { .bankwidth = UFLASH_BUSWIDTH, }; -int uflash_devinit (struct platform_device *op,struct device_node *dp) +static int uflash_devinit (struct platform_device *op,struct device_node *dp) {struct uflash_dev *up;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 532/715 sparc32: Do not select GENERIC_ISA_DMA
In reply to Sasha LevinFrom: Sam Ravnborg <[email protected]>
[ Upstream commit 99bd9a4f87926e12ce60796d7db1d6b226aca5e3 ]
sparc32 do not support generic isa dma, so do not select the symbol.
This fixes the following warnings:
dma.c:70:5: error: no previous prototype for 'request_dma' [-Werror=missing-prototypes] dma.c:88:6: error: no previous prototype for 'free_dma' [-Werror=missing-prototypes]
--- arch/sparc/Kconfig | 4 ---- 1 file changed, 4 deletions(-)
arch/sparc/Kconfig +0 -4
@@ -142,10 +142,6 @@ config HIGHMEM default y if SPARC32 select KMAP_LOCAL -config GENERIC_ISA_DMA - bool - default y if SPARC32 - config PGTABLE_LEVELS default 4 if 64BIT default 3
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 533/715 sparc32: Fix section mismatch in leon_pci_grpci
In reply to Sasha LevinFrom: Sam Ravnborg <[email protected]>
[ Upstream commit 24338a6ae13cb743ced77da1b3a12c83f08a0c96 ]
Passing a datastructre marked _initconst to platform_driver_register() is wrong. Drop the __initconst notation.
This fixes the following warnings:
WARNING: modpost: vmlinux: section mismatch in reference: grpci1_of_driver+0x30 (section: .data) -> grpci1_of_match (section: .init.rodata)
WARNING: modpost: vmlinux: section mismatch in reference: grpci2_of_driver+0x30 (section: .data) -> grpci2_of_match (section: .init.rodata)
--- arch/sparc/kernel/leon_pci_grpci1.c | 2 +- arch/sparc/kernel/leon_pci_grpci2.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/sparc/kernel/leon_pci_grpci1.c +1 -1
@@ -697,7 +697,7 @@ static int grpci1_of_probe(struct platform_device *ofdev)return err; } -static const struct of_device_id grpci1_of_match[]__initconst = { +static const struct of_device_id grpci1_of_match[] = { { .name ="GAISLER_PCIFBRG" , },
arch/sparc/kernel/leon_pci_grpci2.c +1 -1
@@ -889,7 +889,7 @@ static int grpci2_of_probe(struct platform_device *ofdev)return err; } -static const struct of_device_id grpci2_of_match[]__initconst = { +static const struct of_device_id grpci2_of_match[] = { { .name ="GAISLER_GRPCI2" , },
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 534/715 clk: Fix clk_core_get NULL dereference
In reply to Sasha LevinFrom: Bryan O'Donoghue <[email protected]>
[ Upstream commit e97fe4901e0f59a0bfd524578fe3768f8ca42428 ]
It is possible for clk_core_get to dereference a NULL in the following sequence:
clk_core_get()
of_clk_get_hw_from_clkspec()
__of_clk_get_hw_from_provider()
__clk_get_hw()__clk_get_hw() can return NULL which is dereferenced by clk_core_get() at hw->core.
Prior to commit dde4eff47c82 ("clk: Look for parents with clkdev based clk_lookups") the check IS_ERR_OR_NULL() was performed which would have caught the NULL.
Reading the description of this function it talks about returning NULL but that cannot be so at the moment.
Update the function to check for hw before dereferencing it and return NULL if hw is NULL.
--- drivers/clk/clk.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/clk/clk.c +3 -0
@@ -418,6 +418,9 @@ static struct clk_core *clk_core_get(struct clk_core *core, u8 p_index)if (IS_ERR (hw))return ERR_CAST (hw); +if (!hw) +return NULL ; +return hw->core; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 535/715 clk: zynq: Prevent null pointer dereference caused by kmalloc failure
In reply to Sasha LevinFrom: Duoming Zhou <[email protected]>
[ Upstream commit 7938e9ce39d6779d2f85d822cc930f73420e54a6 ]
The kmalloc() in zynq_clk_setup() will return null if the physical memory has run out. As a result, if we use snprintf() to write data to the null address, the null pointer dereference bug will happen.
This patch uses a stack variable to replace the kmalloc().
--- drivers/clk/zynq/clkc.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/clk/zynq/clkc.c +3 -5
@@ -42,6 +42,7 @@ static void __iomem *zynq_clkc_base;#define SLCR_SWDT_CLK_SEL (zynq_clkc_base + 0x204)#define NUM_MIO_PINS 54 +#define CLK_NAME_LEN 16#define DBG_CLK_CTRL_CLKACT_TRC BIT(0)#define DBG_CLK_CTRL_CPU_1XCLKACT BIT(1)
@@ -215,7 +216,7 @@ static void __init zynq_clk_setup(struct device_node *np)int i;u32 tmp;int ret; -char *clk_name; +char clk_name[CLK_NAME_LEN ];unsigned int fclk_enable =0 ;const char *clk_output_name[clk_max];const char *cpu_parents[4 ];
@@ -426,12 +427,10 @@ static void __init zynq_clk_setup(struct device_node *np)"gem1_emio_mux" ,CLK_SET_RATE_PARENT , SLCR_GEM1_CLK_CTRL, 0, 0, &gem1clk_lock); - tmp =strlen ("mio_clk_00x" ); - clk_name =kmalloc (tmp,GFP_KERNEL );for (i =0 ; i <NUM_MIO_PINS ; i++) {int idx; -snprintf (clk_name, tmp,"mio_clk_%2.2d" , i); +snprintf (clk_name,CLK_NAME_LEN ,"mio_clk_%2.2d" , i); idx =of_property_match_string (np,"clock-names" , clk_name);if (idx >=0 ) can_mio_mux_parents[i] = of_clk_get_parent_name(np,
@@ -439,7 +438,6 @@ static void __init zynq_clk_setup(struct device_node *np)else can_mio_mux_parents[i] = dummy_nm; } -kfree (clk_name);clk_register_mux (NULL ,"can_mux" , periph_parents,4 ,CLK_SET_RATE_NO_REPARENT ,SLCR_CAN_CLK_CTRL ,4 ,2 ,0 , &canclk_lock);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 536/715 PCI: brcmstb: Fix broken brcm_pcie_mdio_write() polling
In reply to Sasha LevinFrom: Jonathan Bell <[email protected]>
[ Upstream commit 039741a8d7c9a01c1bc84a5ac5aa770a5e138a30 ]
The MDIO_WT_DONE() macro tests bit 31, which is always 0 (== done) as readw_poll_timeout_atomic() does a 16-bit read. Replace with the readl variant.
--- drivers/pci/controller/pcie-brcmstb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/pcie-brcmstb.c +1 -1
@@ -336,7 +336,7 @@ static int brcm_pcie_mdio_write(void __iomem *base, u8 port,readl (base +PCIE_RC_DL_MDIO_ADDR );writel (MDIO_DATA_DONE_MASK | wrdata, base +PCIE_RC_DL_MDIO_WR_DATA ); - err =readw_poll_timeout_atomic (base +PCIE_RC_DL_MDIO_WR_DATA , data, + err =readl_poll_timeout_atomic (base +PCIE_RC_DL_MDIO_WR_DATA , data,MDIO_WT_DONE (data),10 ,100 );return err; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 537/715 cifs: Fix writeback data corruption
In reply to Sasha LevinFrom: David Howells <[email protected]>
[ Upstream commit f3dc1bdb6b0b0693562c7c54a6c28bafa608ba3c ]
cifs writeback doesn't correctly handle the case where cifs_extend_writeback() hits a point where it is considering an additional folio, but this would overrun the wsize - at which point it drops out of the xarray scanning loop and calls xas_pause(). The problem is that xas_pause() advances the loop counter - thereby skipping that page.
What needs to happen is for xas_reset() to be called any time we decide we don't want to process the page we're looking at, but rather send the request we are building and start a new one.
Fix this by copying and adapting the netfslib writepages code as a temporary measure, with cifs writeback intending to be offloaded to netfslib in the near future.
This also fixes the issue with the use of filemap_get_folios_tag() causing retry of a bunch of pages which the extender already dealt with.
This can be tested by creating, say, a 64K file somewhere not on cifs (otherwise copy-offload may get underfoot), mounting a cifs share with a wsize of 64000, copying the file to it and then comparing the original file and the copy:
dd if=/dev/urandom of=/tmp/64K bs=64k count=1
mount //192.168.6.1/test /mnt -o user=...,pass=...,wsize=64000
cp /tmp/64K /mnt/64K
cmp /tmp/64K /mnt/64KWithout the fix, the cmp fails at position 64000 (or shortly thereafter).
--- fs/smb/client/file.c | 283 ++++++++++++++++++++++++------------------- 1 file changed, 157 insertions(+), 126 deletions(-)
fs/smb/client/file.c +157 -126
@@ -2624,20 +2624,20 @@ static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to)* dirty pages if possible, but don't sleep while doing so. */ static void cifs_extend_writeback (struct address_space *mapping, +struct xa_state *xas,long *_count,loff_t start,int max_pages, -size_t max_len, -unsigned int *_len) +loff_t max_len, +size_t *_len) {struct folio_batch batch;struct folio *folio; -unsigned int psize, nr_pages; -size_t len = *_len; -pgoff_t index = (start + len) /PAGE_SIZE ; +unsigned int nr_pages; +pgoff_t index = (start + *_len) /PAGE_SIZE ; +size_t len;bool stop = true;unsigned int i; -XA_STATE (xas, &mapping->i_pages, index);folio_batch_init (&batch);
@@ -2648,54 +2648,64 @@ static void cifs_extend_writeback(struct address_space *mapping,*/ rcu_read_lock (); -xas_for_each (&xas, folio,ULONG_MAX ) { +xas_for_each (xas, folio,ULONG_MAX ) { stop = true; -if (xas_retry (&xas, folio)) +if (xas_retry (xas, folio))continue ;if (xa_is_value (folio))break ; -if (folio->index != index) +if (folio->index != index) { +xas_reset (xas);break ; + } +if (!folio_try_get_rcu (folio)) { -xas_reset (&xas); +xas_reset (xas);continue ; } nr_pages =folio_nr_pages (folio); -if (nr_pages > max_pages) +if (nr_pages > max_pages) { +xas_reset (xas);break ; + }/* Has the page moved or been split? */ -if (unlikely (folio !=xas_reload (&xas))) { +if (unlikely (folio !=xas_reload (xas))) {folio_put (folio); +xas_reset (xas);break ; }if (!folio_trylock (folio)) {folio_put (folio); +xas_reset (xas);break ; } -if (!folio_test_dirty (folio) ||folio_test_writeback (folio)) { +if (!folio_test_dirty (folio) || +folio_test_writeback (folio)) {folio_unlock (folio);folio_put (folio); +xas_reset (xas);break ; } max_pages -= nr_pages; - psize =folio_size (folio); - len += psize; + len =folio_size (folio); stop = false; -if (max_pages <=0 || len >= max_len || *_count <=0 ) - stop = true; index += nr_pages; + *_count -= nr_pages; + *_len += len; +if (max_pages <=0 || *_len >= max_len || *_count <=0 ) + stop = true; +if (!folio_batch_add (&batch, folio))break ;if (stop)break ; } -if (!stop) -xas_pause (&xas); +xas_pause (xas);rcu_read_unlock ();/* Now, if we obtained any pages, we can shift them to being
@@ -2712,16 +2722,12 @@ static void cifs_extend_writeback(struct address_space *mapping,if (!folio_clear_dirty_for_io (folio))WARN_ON (1 );folio_start_writeback (folio); - - *_count -=folio_nr_pages (folio);folio_unlock (folio); }folio_batch_release (&batch);cond_resched (); }while (!stop); - - *_len = len; }/*
@@ -2729,8 +2735,10 @@ static void cifs_extend_writeback(struct address_space *mapping,*/ static ssize_t cifs_write_back_from_locked_folio (struct address_space *mapping,struct writeback_control *wbc, +struct xa_state *xas,struct folio *folio, -loff_t start,loff_t end) +unsigned long long start, +unsigned long long end) {struct inode *inode = mapping->host;struct TCP_Server_Info *server;
@@ -2739,17 +2747,18 @@ static ssize_t cifs_write_back_from_locked_folio(struct address_space *mapping,struct cifs_credits credits_on_stack;struct cifs_credits *credits = &credits_on_stack;struct cifsFileInfo *cfile =NULL ; -unsigned int xid, wsize, len; -loff_t i_size =i_size_read (inode); -size_t max_len; +unsigned long long i_size =i_size_read (inode), max_len; +unsigned int xid, wsize; +size_t len =folio_size (folio);long count = wbc->nr_to_write;int rc;/* The folio should be locked, dirty and not undergoing writeback. */ +if (!folio_clear_dirty_for_io (folio)) +WARN_ON_ONCE (1 );folio_start_writeback (folio); count -=folio_nr_pages (folio); - len =folio_size (folio); xid =get_xid (); server =cifs_pick_channel (cifs_sb_master_tcon (cifs_sb)->ses);
@@ -2779,9 +2788,10 @@ static ssize_t cifs_write_back_from_locked_folio(struct address_space *mapping, wdata->server = server; cfile =NULL ; -/* Find all consecutive lockable dirty pages, stopping when we find a -* page that is not immediately lockable, is not dirty or is missing, -* or we reach the end of the range. +/* Find all consecutive lockable dirty pages that have contiguous +* written regions, stopping when we find a page that is not +* immediately lockable, is not dirty or is missing, or we reach the +* end of the range. */ if (start < i_size) {/* Trim the write to the EOF; the extra data is ignored. Also
@@ -2801,19 +2811,18 @@ static ssize_t cifs_write_back_from_locked_folio(struct address_space *mapping, max_pages -=folio_nr_pages (folio);if (max_pages >0 ) -cifs_extend_writeback (mapping, &count, start, +cifs_extend_writeback (mapping, xas, &count, start, max_pages, max_len, &len); } - len =min_t (loff_t, len, max_len); } - - wdata->bytes = len; + len = min_t(unsigned long long, len, i_size - start);/* We now have a contiguous set of dirty pages, each with writeback * set; the first page is still locked at this point, but all the rest * have been unlocked. */ folio_unlock (folio); + wdata->bytes = len;if (start < i_size) { iov_iter_xarray(&wdata->iter, ITER_SOURCE, &mapping->i_pages,
@@ -2864,102 +2873,118 @@ static ssize_t cifs_write_back_from_locked_folio(struct address_space *mapping,/* * write a region of pages back to the server */ -static int cifs_writepages_region (struct address_space *mapping, -struct writeback_control *wbc, -loff_t start,loff_t end,loff_t *_next) +static ssize_t cifs_writepages_begin (struct address_space *mapping, +struct writeback_control *wbc, +struct xa_state *xas, +unsigned long long *_start, +unsigned long long end) { -struct folio_batch fbatch; +struct folio *folio; +unsigned long long start = *_start; +ssize_t ret;int skips =0 ; -folio_batch_init (&fbatch); -do { -int nr; -pgoff_t index = start /PAGE_SIZE ; +search_again: +/* Find the first dirty page. */ +rcu_read_lock (); - nr =filemap_get_folios_tag (mapping, &index, end /PAGE_SIZE , -PAGECACHE_TAG_DIRTY , &fbatch); -if (!nr) +for (;;) { + folio =xas_find_marked (xas, end /PAGE_SIZE ,PAGECACHE_TAG_DIRTY ); +if (xas_retry (xas, folio) ||xa_is_value (folio)) +continue ; +if (!folio)break ; -for (int i =0 ; i < nr; i++) { -ssize_t ret; -struct folio *folio = fbatch.folios[i]; +if (!folio_try_get_rcu (folio)) { +xas_reset (xas); +continue ; + } -redo_folio: - start =folio_pos (folio);/* May regress with THPs */ +if (unlikely (folio !=xas_reload (xas))) { +folio_put (folio); +xas_reset (xas); +continue ; + } -/* At this point we hold neither the i_pages lock nor the -* page lock: the page may be truncated or invalidated -* (changing page->mapping to NULL), or even swizzled -* back from swapper_space to tmpfs file mapping -*/ -if (wbc->sync_mode !=WB_SYNC_NONE ) { - ret =folio_lock_killable (folio); -if (ret <0 ) - goto write_error; - }else { -if (!folio_trylock (folio)) - goto skip_write; - } +xas_pause (xas); +break ; + } +rcu_read_unlock (); +if (!folio) +return 0 ; -if (folio->mapping != mapping || - !folio_test_dirty (folio)) { - start +=folio_size (folio); -folio_unlock (folio); -continue ; - } + start =folio_pos (folio);/* May regress with THPs */ -if (folio_test_writeback (folio) || -folio_test_fscache (folio)) { -folio_unlock (folio); -if (wbc->sync_mode ==WB_SYNC_NONE ) - goto skip_write; +/* At this point we hold neither the i_pages lock nor the page lock: +* the page may be truncated or invalidated (changing page->mapping to +* NULL), or even swizzled back from swapper_space to tmpfs file +* mapping +*/ +lock_again: +if (wbc->sync_mode !=WB_SYNC_NONE ) { + ret =folio_lock_killable (folio); +if (ret <0 ) +return ret; + }else { +if (!folio_trylock (folio)) + goto search_again; + } -folio_wait_writeback (folio); +if (folio->mapping != mapping || + !folio_test_dirty (folio)) { + start +=folio_size (folio); +folio_unlock (folio); + goto search_again; + } + +if (folio_test_writeback (folio) || +folio_test_fscache (folio)) { +folio_unlock (folio); +if (wbc->sync_mode !=WB_SYNC_NONE ) { +folio_wait_writeback (folio);#ifdef CONFIG_CIFS_FSCACHE -folio_wait_fscache (folio); +folio_wait_fscache (folio);#endif - goto redo_folio; - } - -if (!folio_clear_dirty_for_io (folio)) -/* We hold the page lock - it should've been dirty. */ -WARN_ON (1 ); - - ret =cifs_write_back_from_locked_folio (mapping, wbc, folio, start, end); -if (ret <0 ) - goto write_error; - - start += ret; -continue ; - -write_error: -folio_batch_release (&fbatch); - *_next = start; -return ret; + goto lock_again; + } -skip_write: -/* -* Too many skipped writes, or need to reschedule? -* Treat it as a write error without an error code. -*/ + start +=folio_size (folio); +if (wbc->sync_mode ==WB_SYNC_NONE ) {if (skips >=5 ||need_resched ()) { ret =0 ; - goto write_error; + goto out; } - -/* Otherwise, just skip that folio and go on to the next */ skips++; - start +=folio_size (folio); -continue ; } + goto search_again; + } -folio_batch_release (&fbatch); -cond_resched (); - }while (wbc->nr_to_write >0 ); + ret =cifs_write_back_from_locked_folio (mapping, wbc, xas, folio, start, end); +out: +if (ret >0 ) + *_start = start + ret; +return ret; +} - *_next = start; -return 0 ; +/* +* Write a region of pages back to the server +*/ +static int cifs_writepages_region (struct address_space *mapping, +struct writeback_control *wbc, +unsigned long long *_start, +unsigned long long end) +{ +ssize_t ret; + +XA_STATE (xas, &mapping->i_pages, *_start /PAGE_SIZE ); + +do { + ret =cifs_writepages_begin (mapping, wbc, &xas, _start, end); +if (ret >0 && wbc->nr_to_write >0 ) +cond_resched (); + }while (ret >0 && wbc->nr_to_write >0 ); + +return ret >0 ?0 : ret; }/*
@@ -2968,7 +2993,7 @@ static int cifs_writepages_region(struct address_space *mapping,static int cifs_writepages (struct address_space *mapping,struct writeback_control *wbc) { -loff_t start, next; +loff_t start, end;int ret;/* We have to be careful as we can end up racing with setattr()
@@ -2976,28 +3001,34 @@ static int cifs_writepages(struct address_space *mapping,* to prevent it. */ -if (wbc->range_cyclic) { +if (wbc->range_cyclic && mapping->writeback_index) { start = mapping->writeback_index *PAGE_SIZE ; - ret =cifs_writepages_region (mapping, wbc, start,LLONG_MAX , &next); -if (ret ==0 ) { - mapping->writeback_index = next /PAGE_SIZE ; -if (start >0 && wbc->nr_to_write >0 ) { - ret =cifs_writepages_region (mapping, wbc,0 , - start, &next); -if (ret ==0 ) - mapping->writeback_index = - next /PAGE_SIZE ; - } + ret =cifs_writepages_region (mapping, wbc, &start,LLONG_MAX ); +if (ret <0 ) + goto out; + +if (wbc->nr_to_write <=0 ) { + mapping->writeback_index = start /PAGE_SIZE ; + goto out; } + + start =0 ; + end = mapping->writeback_index *PAGE_SIZE ; + mapping->writeback_index =0 ; + ret =cifs_writepages_region (mapping, wbc, &start, end); +if (ret ==0 ) + mapping->writeback_index = start /PAGE_SIZE ; }else if (wbc->range_start ==0 && wbc->range_end ==LLONG_MAX ) { - ret =cifs_writepages_region (mapping, wbc,0 ,LLONG_MAX , &next); + start =0 ; + ret =cifs_writepages_region (mapping, wbc, &start,LLONG_MAX );if (wbc->nr_to_write >0 && ret ==0 ) - mapping->writeback_index = next /PAGE_SIZE ; + mapping->writeback_index = start /PAGE_SIZE ; }else { - ret =cifs_writepages_region (mapping, wbc, - wbc->range_start, wbc->range_end, &next); + start = wbc->range_start; + ret =cifs_writepages_region (mapping, wbc, &start, wbc->range_end); } +out:return ret; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 538/715 ALSA: hda/realtek: fix ALC285 issues on HP Envy x360 laptops
In reply to Sasha LevinFrom: Athaariq Ardhiansyah <[email protected]>
[ Upstream commit c062166995c9e57d5cd508b332898f79da319802 ]
Realtek codec on HP Envy laptop series are heavily modified by vendor. Therefore, need intervention to make it work properly. The patch fixes:
- B&O soundbar speakers (between lid and keyboard) activation
- Enable LED on mute button
- Add missing process coefficient which affects the output amplifier
- Volume control synchronization between B&O soundbar and side speakers
- Unmute headset output on several HP Envy models
- Auto-enable headset mic when plugged
This patch was tested on HP Envy x360 13-AR0107AU with Realtek ALC285
The only unsolved problem is output amplifier of all built-in speakers is too weak, which causes volume of built-in speakers cannot be loud as vendor's proprietary driver due to missing _DSD parameter in the firmware. The solution is currently on research. Expected to has another patch in the future.
Potential fix to related issues, need test before close those issues:
- https://bugzilla.kernel.org/show_bug.cgi?id=189331
- https://bugzilla.kernel.org/show_bug.cgi?id=216632
- https://bugzilla.kernel.org/show_bug.cgi?id=216311
- https://bugzilla.kernel.org/show_bug.cgi?id=213507
Message-ID: <[email protected]>
--- sound/pci/hda/patch_realtek.c | 63 +++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+)
sound/pci/hda/patch_realtek.c +63 -0
@@ -6696,6 +6696,60 @@ static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec, } } +static void alc285_fixup_hp_envy_x360 (struct hda_codec *codec, +const struct hda_fixup *fix, +int action) +{ +static const struct coef_fw coefs[] = { +WRITE_COEF (0x08 ,0x6a0c ),WRITE_COEF (0x0d ,0xa023 ), +WRITE_COEF (0x10 ,0x0320 ),WRITE_COEF (0x1a ,0x8c03 ), +WRITE_COEF (0x25 ,0x1800 ),WRITE_COEF (0x26 ,0x003a ), +WRITE_COEF (0x28 ,0x1dfe ),WRITE_COEF (0x29 ,0xb014 ), +WRITE_COEF (0x2b ,0x1dfe ),WRITE_COEF (0x37 ,0xfe15 ), +WRITE_COEF (0x38 ,0x7909 ),WRITE_COEF (0x45 ,0xd489 ), +WRITE_COEF (0x46 ,0x00f4 ),WRITE_COEF (0x4a ,0x21e0 ), +WRITE_COEF (0x66 ,0x03f0 ),WRITE_COEF (0x67 ,0x1000 ), +WRITE_COEF (0x6e ,0x1005 ), { } + }; + +static const struct hda_pintbl pincfgs[] = { + {0x12 ,0xb7a60130 },/* Internal microphone*/ + {0x14 ,0x90170150 },/* B&O soundbar speakers */ + {0x17 ,0x90170153 },/* Side speakers */ + {0x19 ,0x03a11040 },/* Headset microphone */ + { } + }; + +switch (action) { +case HDA_FIXUP_ACT_PRE_PROBE : +snd_hda_apply_pincfgs (codec, pincfgs); + +/* Fixes volume control problem for side speakers */ +alc295_fixup_disable_dac3 (codec, fix, action); + +/* Fixes no sound from headset speaker */ +snd_hda_codec_amp_stereo (codec,0x21 ,HDA_OUTPUT ,0 ,-1 ,0 ); + +/* Auto-enable headset mic when plugged */ +snd_hda_jack_set_gating_jack (codec,0x19 ,0x21 ); + +/* Headset mic volume enhancement */ +snd_hda_codec_set_pin_target (codec,0x19 ,PIN_VREF50 ); +break ; +case HDA_FIXUP_ACT_INIT : +alc_process_coef_fw (codec, coefs); +break ; +case HDA_FIXUP_ACT_BUILD : +rename_ctl (codec,"Bass Speaker Playback Volume" , +"B&O-Tuned Playback Volume" ); +rename_ctl (codec,"Front Playback Switch" , +"B&O Soundbar Playback Switch" ); +rename_ctl (codec,"Bass Speaker Playback Switch" , +"Side Speaker Playback Switch" ); +break ; + } +} +/* for hda_fixup_thinkpad_acpi() */ #include "thinkpad_helper.c"
@@ -7297,6 +7351,7 @@ enum {ALC280_FIXUP_HP_9480M ,ALC245_FIXUP_HP_X360_AMP ,ALC285_FIXUP_HP_SPECTRE_X360_EB1 , +ALC285_FIXUP_HP_ENVY_X360 ,ALC288_FIXUP_DELL_HEADSET_MODE ,ALC288_FIXUP_DELL1_MIC_NO_PRESENCE , ALC288_FIXUP_DELL_XPS_13,
@@ -9273,6 +9328,12 @@ static const struct hda_fixup alc269_fixups[] = { .type = HDA_FIXUP_FUNC, .v.func = alc285_fixup_hp_spectre_x360_eb1 }, + [ALC285_FIXUP_HP_ENVY_X360] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc285_fixup_hp_envy_x360, + .chained = true, + .chain_id = ALC285_FIXUP_HP_GPIO_AMP_INIT, + }, [ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = { .type = HDA_FIXUP_FUNC, .v.func = alc285_fixup_ideapad_s740_coef,
@@ -9861,6 +9922,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x84e7 ,"HP Pavilion 15" ,ALC269_FIXUP_HP_MUTE_LED_MIC3 ),SND_PCI_QUIRK (0x103c ,0x8519 ,"HP Spectre x360 15-df0xxx" ,ALC285_FIXUP_HP_SPECTRE_X360 ),SND_PCI_QUIRK (0x103c ,0x8537 ,"HP ProBook 440 G6" ,ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF ), +SND_PCI_QUIRK (0x103c ,0x85de ,"HP Envy x360 13-ar0xxx" ,ALC285_FIXUP_HP_ENVY_X360 ),SND_PCI_QUIRK (0x103c ,0x860f ,"HP ZBook 15 G6" ,ALC285_FIXUP_HP_GPIO_AMP_INIT ),SND_PCI_QUIRK (0x103c ,0x861f ,"HP Elite Dragonfly G1" ,ALC285_FIXUP_HP_GPIO_AMP_INIT ), SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
@@ -10559,6 +10621,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = { {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"}, {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"}, {.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"}, + {.id = ALC285_FIXUP_HP_ENVY_X360, .name = "alc285-hp-envy-x360"}, {.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"}, {.id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN, .name = "alc287-yoga9-bass-spk-pin"}, {.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 539/715 ALSA: hda/tas2781: use dev_dbg in system_resume
In reply to Sasha LevinFrom: Gergo Koteles <[email protected]>
[ Upstream commit c850c9121cc8de867ce3ac36b9ae9d05f62bef14 ]
The system_resume function uses dev_info for tracing, but the other pm functions use dev_dbg.
Use dev_dbg as the other pm functions.
Message-ID: <140f3c689c9eb5874e6eb48a570fcd8207f06a41.1709918447.git.soyer@irl.hu>
--- sound/pci/hda/tas2781_hda_i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/hda/tas2781_hda_i2c.c +1 -1
@@ -900,7 +900,7 @@ static int tas2781_system_resume(struct device *dev)struct tas2781_hda *tas_hda =dev_get_drvdata (dev);int i, ret; -dev_info (tas_hda->priv->dev,"System Resume\n" ); +dev_dbg (tas_hda->priv->dev,"System Resume\n" ); ret =pm_runtime_force_resume (dev);if (ret)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 540/715 ALSA: hda/tas2781: add lock to system_suspend
In reply to Sasha LevinFrom: Gergo Koteles <[email protected]>
[ Upstream commit c58e6ed55a1bb9811d6d936d001b068bb0419467 ]
Add the missing lock around tasdevice_tuning_switch().
Message-ID: <c666da13d4bc48cd1ab1357479e0c6096541372c.1709918447.git.soyer@irl.hu>
--- sound/pci/hda/tas2781_hda_i2c.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/pci/hda/tas2781_hda_i2c.c +4 -0
@@ -885,9 +885,13 @@ static int tas2781_system_suspend(struct device *dev)if (ret)return ret; +mutex_lock (&tas_hda->priv->codec_lock); +/* Shutdown chip before system suspend */ tasdevice_tuning_switch (tas_hda->priv,1 ); +mutex_unlock (&tas_hda->priv->codec_lock); +/* * Reset GPIO may be shared, so cannot reset here. * However beyond this point, amps may be powered down.
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 541/715 ALSA: hda/tas2781: do not reset cur_* values in runtime_suspend
In reply to Sasha LevinFrom: Gergo Koteles <[email protected]>
[ Upstream commit bec7760a6c5fa59593dac264fa0c628e46815986 ]
The amplifier doesn't loose register state in software shutdown mode, so there is no need to reset the cur_* values.
Without these resets, the amplifier can be turned on after runtime_suspend without waiting for the program and profile to be restored.
Message-ID: <aa27ae084150988bf6a0ead7e3403bc485d790f8.1709918447.git.soyer@irl.hu>
--- sound/pci/hda/tas2781_hda_i2c.c | 7 ------- 1 file changed, 7 deletions(-)
sound/pci/hda/tas2781_hda_i2c.c +0 -7
@@ -832,7 +832,6 @@ static void tas2781_hda_i2c_remove(struct i2c_client *clt)static int tas2781_runtime_suspend (struct device *dev) {struct tas2781_hda *tas_hda =dev_get_drvdata (dev); -int i;dev_dbg (tas_hda->dev,"Runtime Suspend\n" );
@@ -843,12 +842,6 @@ static int tas2781_runtime_suspend(struct device *dev) tas_hda->priv->playback_started = false; } -for (i =0 ; i < tas_hda->priv->ndev; i++) { - tas_hda->priv->tasdevice[i].cur_book =-1 ; - tas_hda->priv->tasdevice[i].cur_prog =-1 ; - tas_hda->priv->tasdevice[i].cur_conf =-1 ; - } -mutex_unlock (&tas_hda->priv->codec_lock);return 0 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 542/715 ALSA: hda/tas2781: do not call pm_runtime_force_* in system_resume/suspend
In reply to Sasha LevinFrom: Gergo Koteles <[email protected]>
[ Upstream commit 5f51de7e30c7282162a631af8a425b54a4576346 ]
The runtime_resume function calls prmg_load and apply_calibration functions, but system_resume also calls them, so calling pm_runtime_force_resume before reset is unnecessary.
For consistency, do not call the pm_runtime_force_suspend in system_suspend, as runtime_suspend does the same.
Message-ID: <d0b4cc1248b9d375d59c009563da42d60d69eac3.1709918447.git.soyer@irl.hu>
--- sound/pci/hda/tas2781_hda_i2c.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
sound/pci/hda/tas2781_hda_i2c.c +1 -10
@@ -870,14 +870,9 @@ static int tas2781_runtime_resume(struct device *dev)static int tas2781_system_suspend (struct device *dev) {struct tas2781_hda *tas_hda =dev_get_drvdata (dev); -int ret;dev_dbg (tas_hda->priv->dev,"System Suspend\n" ); - ret =pm_runtime_force_suspend (dev); -if (ret) -return ret; -mutex_lock (&tas_hda->priv->codec_lock);/* Shutdown chip before system suspend */
@@ -895,14 +890,10 @@ static int tas2781_system_suspend(struct device *dev)static int tas2781_system_resume (struct device *dev) {struct tas2781_hda *tas_hda =dev_get_drvdata (dev); -int i, ret; +int i;dev_dbg (tas_hda->priv->dev,"System Resume\n" ); - ret =pm_runtime_force_resume (dev); -if (ret) -return ret; -mutex_lock (&tas_hda->priv->codec_lock);for (i =0 ; i < tas_hda->priv->ndev; i++) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 543/715 ALSA: hda/tas2781: restore power state after system_resume
In reply to Sasha LevinFrom: Gergo Koteles <[email protected]>
[ Upstream commit 9fc91a6fe37c78ef301aed4251f7e50b8524e72d ]
After system_resume the amplifers will remain off, even if they were on before system_suspend.
Use playback_started bool to save the playback state, and restore power state based on it.
Message-ID: <1742b61901781826f6e6212ffe1d21af542d134a.1709918447.git.soyer@irl.hu>
--- sound/pci/hda/tas2781_hda_i2c.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
sound/pci/hda/tas2781_hda_i2c.c +12 -1
@@ -160,11 +160,13 @@ static void tas2781_hda_playback_hook(struct device *dev, int action)pm_runtime_get_sync (dev);mutex_lock (&tas_hda->priv->codec_lock);tasdevice_tuning_switch (tas_hda->priv,0 ); + tas_hda->priv->playback_started = true;mutex_unlock (&tas_hda->priv->codec_lock);break ;case HDA_GEN_PCM_ACT_CLOSE :mutex_lock (&tas_hda->priv->codec_lock);tasdevice_tuning_switch (tas_hda->priv,1 ); + tas_hda->priv->playback_started = false;mutex_unlock (&tas_hda->priv->codec_lock);pm_runtime_mark_last_busy (dev);
@@ -666,6 +668,7 @@ static void tasdev_fw_ready(const struct firmware *fmw, void *context)tasdevice_save_calibration (tas_priv);tasdevice_tuning_switch (tas_hda->priv,0 ); + tas_hda->priv->playback_started = true; out:mutex_unlock (&tas_hda->priv->codec_lock);
@@ -837,6 +840,9 @@ static int tas2781_runtime_suspend(struct device *dev)mutex_lock (&tas_hda->priv->codec_lock); +/* The driver powers up the amplifiers at module load time. +* Stop the playback if it's unused. +*/ if (tas_hda->priv->playback_started) {tasdevice_tuning_switch (tas_hda->priv,1 ); tas_hda->priv->playback_started = false;
@@ -876,7 +882,8 @@ static int tas2781_system_suspend(struct device *dev)mutex_lock (&tas_hda->priv->codec_lock);/* Shutdown chip before system suspend */ -tasdevice_tuning_switch (tas_hda->priv,1 ); +if (tas_hda->priv->playback_started) +tasdevice_tuning_switch (tas_hda->priv,1 );mutex_unlock (&tas_hda->priv->codec_lock);
@@ -908,6 +915,10 @@ static int tas2781_system_resume(struct device *dev)* calibrated data inside algo. */ tasdevice_apply_calibration (tas_hda->priv); + +if (tas_hda->priv->playback_started) +tasdevice_tuning_switch (tas_hda->priv,0 ); +mutex_unlock (&tas_hda->priv->codec_lock);return 0 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 544/715 ALSA: scarlett2: Fix Scarlett 4th Gen 4i4 low-voltage detection
In reply to Sasha LevinFrom: "Geoffrey D. Bennett" <[email protected]>
[ Upstream commit 6ef1f08b53fdb6f5f00f17f85a60b3247d77fa54 ]
The value currently being read to determine the low-voltage state is actually the front panel state. Fix the code to use the correct offset for the low-voltage state.
Message-ID: <[email protected]>
--- sound/usb/mixer_scarlett2.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
sound/usb/mixer_scarlett2.c +7 -8
@@ -415,7 +415,7 @@ enum {SCARLETT2_CONFIG_INPUT_SELECT_SWITCH ,SCARLETT2_CONFIG_INPUT_LINK_SWITCH ,SCARLETT2_CONFIG_POWER_EXT , -SCARLETT2_CONFIG_POWER_STATUS , +SCARLETT2_CONFIG_POWER_LOW ,SCARLETT2_CONFIG_PCM_INPUT_SWITCH ,SCARLETT2_CONFIG_DIRECT_MONITOR_GAIN ,SCARLETT2_CONFIG_COUNT
@@ -723,8 +723,8 @@ static const struct scarlett2_config_set scarlett2_config_set_gen4_4i4 = { [SCARLETT2_CONFIG_POWER_EXT ] = { .offset = 0x168 }, - [SCARLETT2_CONFIG_POWER_STATUS ] = { - .offset =0x66 } + [SCARLETT2_CONFIG_POWER_LOW ] = { + .offset =0x16d } } };
@@ -6294,8 +6294,7 @@ static int scarlett2_update_power_status(struct usb_mixer_interface *mixer) {struct scarlett2_data *private = mixer->private_data;int err; -u8 power_ext; -u8 power_status; +u8 power_ext, power_low; private->power_status_updated =0 ;
@@ -6304,12 +6303,12 @@ static int scarlett2_update_power_status(struct usb_mixer_interface *mixer)if (err <0 )return err; - err =scarlett2_usb_get_config (mixer,SCARLETT2_CONFIG_POWER_STATUS , -1 , &power_status); + err =scarlett2_usb_get_config (mixer,SCARLETT2_CONFIG_POWER_LOW , +1 , &power_low);if (err <0 )return err; -if (power_status >1 ) +if (power_low) private->power_status =SCARLETT2_POWER_STATUS_FAIL ;else if (power_ext) private->power_status =SCARLETT2_POWER_STATUS_EXT ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 545/715 ALSA: scarlett2: Fix Scarlett 4th Gen autogain status values
In reply to Sasha LevinFrom: "Geoffrey D. Bennett" <[email protected]>
[ Upstream commit be157c4683a91857d3fdf319117c9b9dc6e8a849 ]
The meanings of the raw_auto_gain_status values were originally guessed through experimentation, but the official names have now been discovered. Update the autogain status control strings accordingly.
Message-ID: <[email protected]>
--- sound/usb/mixer_scarlett2.c | 62 ++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 28 deletions(-)
sound/usb/mixer_scarlett2.c +34 -28
@@ -284,14 +284,22 @@ static const char *const scarlett2_dim_mute_names[SCARLETT2_DIM_MUTE_COUNT] = { "Mute Playback Switch", "Dim Playback Switch" }; -/* Autogain Status Values */ -enum { -SCARLETT2_AUTOGAIN_STATUS_STOPPED , -SCARLETT2_AUTOGAIN_STATUS_RUNNING , -SCARLETT2_AUTOGAIN_STATUS_FAILED , -SCARLETT2_AUTOGAIN_STATUS_CANCELLED , -SCARLETT2_AUTOGAIN_STATUS_UNKNOWN , -SCARLETT2_AUTOGAIN_STATUS_COUNT +/* The autogain_status is set based on the autogain_switch and +* raw_autogain_status values. +* +* If autogain_switch is set, autogain_status is set to 0 (Running). +* The other status values are from the raw_autogain_status value + 1. +*/ +static const char *const scarlett2_autogain_status_texts[] = { +"Running" , +"Success" , +"SuccessDRover" , +"WarnMinGainLimit" , +"FailDRunder" , +"FailMaxGainLimit" , +"FailClipped" , +"Cancelled" , +"Invalid" };/* Power Status Values */
@@ -2835,9 +2843,9 @@ static int scarlett2_autogain_is_running(struct scarlett2_data *private) {int i; +/* autogain_status[] is 0 if autogain is running */ for (i =0 ; i < private->info->gain_input_count; i++) -if (private->autogain_status[i] == -SCARLETT2_AUTOGAIN_STATUS_RUNNING ) +if (!private->autogain_status[i])return 1 ;return 0 ;
@@ -2867,25 +2875,25 @@ static int scarlett2_update_autogain(struct usb_mixer_interface *mixer)return err;/* Translate autogain_switch and raw_autogain_status into -* autogain_status +* autogain_status. +* +* When autogain_switch[] is set, the status is the first +* element in scarlett2_autogain_status_texts[] (Running). The +* subsequent elements correspond to the status value from the +* device (raw_autogain_status[]) + 1. The last element is +* "Invalid", in case the device reports a status outside the +* range of scarlett2_autogain_status_texts[]. */ for (i =0 ; i < info->gain_input_count; i++)if (private->autogain_switch[i]) + private->autogain_status[i] =0 ; +else if (raw_autogain_status[i] < +ARRAY_SIZE (scarlett2_autogain_status_texts) -1 ) private->autogain_status[i] = -SCARLETT2_AUTOGAIN_STATUS_RUNNING ; -else if (raw_autogain_status[i] ==0 ) - private->autogain_status[i] = -SCARLETT2_AUTOGAIN_STATUS_STOPPED ; -else if (raw_autogain_status[i] >=2 && - raw_autogain_status[i] <=5 ) - private->autogain_status[i] = -SCARLETT2_AUTOGAIN_STATUS_FAILED ; -else if (raw_autogain_status[i] ==6 ) - private->autogain_status[i] = -SCARLETT2_AUTOGAIN_STATUS_CANCELLED ; + raw_autogain_status[i] +1 ;else private->autogain_status[i] = -SCARLETT2_AUTOGAIN_STATUS_UNKNOWN ; +ARRAY_SIZE (scarlett2_autogain_status_texts) -1 ;return 0 ; }
@@ -3111,12 +3119,10 @@ static int scarlett2_autogain_switch_ctl_put(static int scarlett2_autogain_status_ctl_info (struct snd_kcontrol *kctl,struct snd_ctl_elem_info *uinfo) { -static const char *const values[SCARLETT2_AUTOGAIN_STATUS_COUNT ] = { -"Stopped" ,"Running" ,"Failed" ,"Cancelled" ,"Unknown" - }; -return snd_ctl_enum_info ( - uinfo,1 ,SCARLETT2_AUTOGAIN_STATUS_COUNT , values); + uinfo,1 , +ARRAY_SIZE (scarlett2_autogain_status_texts), + scarlett2_autogain_status_texts); }static const struct snd_kcontrol_new scarlett2_autogain_switch_ctl = {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 546/715 ALSA: scarlett2: Fix Scarlett 4th Gen input gain range
In reply to Sasha LevinFrom: "Geoffrey D. Bennett" <[email protected]>
[ Upstream commit a45cf0a0834779c741ac204c0320469e9aaef006 ]
The input gain range TLV was declared as -70dB to 0dB, but the preamp gain range is actually 0dB to +70dB. Rename SCARLETT2_GAIN_BIAS to SCARLETT2_MAX_GAIN and update the TLV to fix.
Message-ID: <[email protected]>
--- sound/usb/mixer_scarlett2.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
sound/usb/mixer_scarlett2.c +5 -3
@@ -173,7 +173,9 @@/* some gui mixers can't handle negative ctl values */ #define SCARLETT2_VOLUME_BIAS 127 -#define SCARLETT2_GAIN_BIAS 70 + +/* maximum preamp input gain */ +#define SCARLETT2_MAX_GAIN 70/* mixer range from -80dB to +6dB in 0.5dB steps */ #define SCARLETT2_MIXER_MIN_DB -80
@@ -3464,7 +3466,7 @@ static int scarlett2_input_gain_ctl_info(struct snd_kcontrol *kctl, uinfo->type =SNDRV_CTL_ELEM_TYPE_INTEGER ; uinfo->count = elem->channels; uinfo->value.integer.min =0 ; - uinfo->value.integer.max =SCARLETT2_GAIN_BIAS ; + uinfo->value.integer.max =SCARLETT2_MAX_GAIN ; uinfo->value.integer.step =1 ; unlock:
@@ -3541,7 +3543,7 @@ static int scarlett2_input_gain_ctl_put(struct snd_kcontrol *kctl, }static const DECLARE_TLV_DB_MINMAX ( - db_scale_scarlett2_gain, -SCARLETT2_GAIN_BIAS * 100, 0 + db_scale_scarlett2_gain, 0, SCARLETT2_MAX_GAIN * 100 );static const struct snd_kcontrol_new scarlett2_input_gain_ctl = {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 547/715 ALSA: scarlett2: Fix Scarlett 4th Gen input gain range again
In reply to Sasha LevinFrom: "Geoffrey D. Bennett" <[email protected]>
[ Upstream commit 6719cd5e45111449f4021e08f2e488f17a9b292b ]
The 4th Gen input preamp gain range is 0dB to +69dB, although the control values range from 0 to 70. Replace SCARLETT2_MAX_GAIN with SCARLETT2_MAX_GAIN_VALUE and SCARLETT2_MAX_GAIN_DB, and update the TLV again.
Message-ID: <[email protected]>
--- sound/usb/mixer_scarlett2.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
sound/usb/mixer_scarlett2.c +7 -4
@@ -174,8 +174,11 @@/* some gui mixers can't handle negative ctl values */ #define SCARLETT2_VOLUME_BIAS 127 -/* maximum preamp input gain */ -#define SCARLETT2_MAX_GAIN 70 +/* maximum preamp input gain and value +* values are from 0 to 70, preamp gain is from 0 to 69 dB +*/ +#define SCARLETT2_MAX_GAIN_VALUE 70 +#define SCARLETT2_MAX_GAIN_DB 69/* mixer range from -80dB to +6dB in 0.5dB steps */ #define SCARLETT2_MIXER_MIN_DB -80
@@ -3466,7 +3469,7 @@ static int scarlett2_input_gain_ctl_info(struct snd_kcontrol *kctl, uinfo->type =SNDRV_CTL_ELEM_TYPE_INTEGER ; uinfo->count = elem->channels; uinfo->value.integer.min =0 ; - uinfo->value.integer.max =SCARLETT2_MAX_GAIN ; + uinfo->value.integer.max =SCARLETT2_MAX_GAIN_VALUE ; uinfo->value.integer.step =1 ; unlock:
@@ -3543,7 +3546,7 @@ static int scarlett2_input_gain_ctl_put(struct snd_kcontrol *kctl, }static const DECLARE_TLV_DB_MINMAX ( - db_scale_scarlett2_gain, 0, SCARLETT2_MAX_GAIN * 100 + db_scale_scarlett2_gain, 0, SCARLETT2_MAX_GAIN_DB * 100 );static const struct snd_kcontrol_new scarlett2_input_gain_ctl = {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 548/715 mips: cm: Convert __mips_cm_l2sync_phys_base() to weak function
In reply to Sasha LevinFrom: Serge Semin <[email protected]>
[ Upstream commit 8bc8db2ab2832daabdd06feeabdd511dc9575bb6 ]
The __mips_cm_l2sync_phys_base() and mips_cm_l2sync_phys_base() couple was introduced in commit 9f98f3dd0c51 ("MIPS: Add generic CM probe & access code") where the former method was a weak implementation of the later function. Such design pattern permitted to re-define the original method and to use the weak implementation in the new function. A similar approach was introduced in the framework of another arch-specific programmable
interface: mips_cm_phys_base() and __mips_cm_phys_base(). The only difference is that the underscored method of the later couple was declared in the "asm/mips-cm.h" header file, but it wasn't done for the CM L2-sync methods in the subject. Due to the missing global function declaration the "missing prototype" warning was spotted in the framework of the commit 9a2036724cd6 ("mips: mark local function static if possible") and fixed just be re-qualifying the weak method as static. Doing that broke what was originally implied by having the weak implementation globally defined.
Let's fix the broken CM2 L2-sync arch-interface by dropping the static qualifier and, seeing the implemented pattern hasn't been used for over 10 years but will be required soon (see the link for the discussion around it), converting it to a single weakly defined method:mips_cm_l2sync_phys_base().
--- arch/mips/include/asm/mips-cm.h | 13 +++++++++++++ arch/mips/kernel/mips-cm.c | 5 +---- 2 files changed, 14 insertions(+), 4 deletions(-)
arch/mips/include/asm/mips-cm.h +13 -0
@@ -33,6 +33,19 @@ extern void __iomem *mips_cm_l2sync_base;*/ extern phys_addr_t __mips_cm_phys_base (void ); +/** +* mips_cm_l2sync_phys_base - retrieve the physical base address of the CM +* L2-sync region +* +* This function returns the physical base address of the Coherence Manager +* L2-cache only region. It provides a default implementation which reads the +* CMGCRL2OnlySyncBase register where available or returns a 4K region just +* behind the CM GCR base address. It may be overridden by platforms which +* determine this address in a different way by defining a function with the +* same prototype. +*/ +extern phys_addr_t mips_cm_l2sync_phys_base (void ); +/* * mips_cm_is64 - determine CM register width *
arch/mips/kernel/mips-cm.c +1 -4
@@ -201,7 +201,7 @@ phys_addr_t __mips_cm_phys_base(void)phys_addr_t mips_cm_phys_base (void ) __attribute__((weak,alias ("__mips_cm_phys_base" ))); -static phys_addr_t __mips_cm_l2sync_phys_base (void ) +phys_addr_t __weak mips_cm_l2sync_phys_base (void ) {u32 base_reg;
@@ -217,9 +217,6 @@ static phys_addr_t __mips_cm_l2sync_phys_base(void)return mips_cm_phys_base () +MIPS_CM_GCR_SIZE ; } -phys_addr_t mips_cm_l2sync_phys_base (void ) - __attribute__((weak,alias ("__mips_cm_l2sync_phys_base" ))); -static void mips_cm_probe_l2sync (void ) {unsigned major_rev;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 549/715 platform/x86/intel/pmc/lnl: Remove SSRAM support
In reply to Sasha LevinFrom: "David E. Box" <[email protected]>
[ Upstream commit e6ba4acde44957dc9bdc3222b5739217a102752d ]
A recent PMC firmware change in Lunar Lake caused the pmc_core driver to fail to probe. This is due to a change in the GUID for PMC telemetry coming from the SSRAM device. Until a final release is ready this value may change again. In the meantime, disable the SSRAM support for Lunar Lake so the driver can load and provide some basic functionality.
--- drivers/platform/x86/intel/pmc/lnl.c | 40 ++++------------------------ 1 file changed, 5 insertions(+), 35 deletions(-)
drivers/platform/x86/intel/pmc/lnl.c +5 -35
@@ -13,21 +13,6 @@#include "core.h" -#define SOCM_LPM_REQ_GUID 0x11594920 - -#define PMC_DEVID_SOCM 0xa87f - -static const u8 LNL_LPM_REG_INDEX [] = {0 ,4 ,5 ,6 ,8 ,9 ,10 ,11 ,12 ,13 ,14 ,15 ,16 ,20 }; - -static struct pmc_info lnl_pmc_info_list[] = { - { - .guid =SOCM_LPM_REQ_GUID , - .devid =PMC_DEVID_SOCM , - .map = &lnl_socm_reg_map, - }, - {} -}; -const struct pmc_bit_map lnl_ltr_show_map[] = { {"SOUTHPORT_A" ,CNP_PMC_LTR_SPA }, {"SOUTHPORT_B" ,CNP_PMC_LTR_SPB },
@@ -490,7 +475,6 @@ const struct pmc_reg_map lnl_socm_reg_map = { .lpm_sts = lnl_lpm_maps, .lpm_status_offset = MTL_LPM_STATUS_OFFSET, .lpm_live_status_offset = MTL_LPM_LIVE_STATUS_OFFSET, - .lpm_reg_index = LNL_LPM_REG_INDEX, };#define LNL_NPU_PCI_DEV 0x643e
@@ -517,33 +501,19 @@ static int lnl_resume(struct pmc_dev *pmcdev)int lnl_core_init (struct pmc_dev *pmcdev) {int ret; -int func =2 ; -bool ssram_init = true;struct pmc *pmc = pmcdev->pmcs[PMC_IDX_SOC ];lnl_d3_fixup (); pmcdev->suspend = cnl_suspend; pmcdev->resume = lnl_resume; - pmcdev->regmap_list = lnl_pmc_info_list; - ret =pmc_core_ssram_init (pmcdev, func); - -/* If regbase not assigned, set map and discover using legacy method */ -if (ret) { - ssram_init = false; - pmc->map = &lnl_socm_reg_map; - ret =get_primary_reg_base (pmc); -if (ret) -return ret; - } -pmc_core_get_low_power_modes (pmcdev); + pmc->map = &lnl_socm_reg_map; + ret =get_primary_reg_base (pmc); +if (ret) +return ret; -if (ssram_init) { - ret =pmc_core_ssram_get_lpm_reqs (pmcdev); -if (ret) -return ret; - } +pmc_core_get_low_power_modes (pmcdev);return 0 ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 550/715 platform/x86/intel/pmc/arl: Put GNA device in D3
In reply to Sasha LevinFrom: "David E. Box" <[email protected]>
[ Upstream commit ac2d1fd9688fcdfba5acc815fb2b13fec83e5dad ]
As is the case on Meteor Lake, the Gaussian & Neural Accelerator (GNA) device is powered by BIOS to D0 by default. If no driver is loaded, this will cause the Package C state to be limited to PC2, leading to significant power consumption and decrease in batter life. Put the GNA device in D3 by default if no driver is loaded for it.
--- drivers/platform/x86/intel/pmc/arl.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/platform/x86/intel/pmc/arl.c +2 -0
@@ -673,6 +673,7 @@ static struct pmc_info arl_pmc_info_list[] = { };#define ARL_NPU_PCI_DEV 0xad1d +#define ARL_GNA_PCI_DEV 0xae4c/* * Set power state of select devices that do not have drivers to D3 * so that they do not block Package C entry.
@@ -680,6 +681,7 @@ static struct pmc_info arl_pmc_info_list[] = {static void arl_d3_fixup (void ) {pmc_core_set_device_d3 (ARL_NPU_PCI_DEV ); +pmc_core_set_device_d3 (ARL_GNA_PCI_DEV ); }static int arl_resume (struct pmc_dev *pmcdev)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 551/715 platform/x86/amd/pmf: Do not use readl() for policy buffer access
In reply to Sasha LevinFrom: Armin Wolf <[email protected]>
[ Upstream commit e42dddce83a0578a518cb7078930c8269a6083af ]
The policy buffer is allocated using normal memory allocation functions, so readl() should not be used on it.
Compile-tested only.
--- drivers/platform/x86/amd/pmf/tee-if.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/amd/pmf/tee-if.c +2 -2
@@ -249,8 +249,8 @@ static int amd_pmf_start_policy_engine(struct amd_pmf_dev *dev)u32 cookie, length;int res; - cookie =readl (dev->policy_buf +POLICY_COOKIE_OFFSET ); - length =readl (dev->policy_buf +POLICY_COOKIE_LEN ); + cookie = *(u32 *)(dev->policy_buf +POLICY_COOKIE_OFFSET ); + length = *(u32 *)(dev->policy_buf +POLICY_COOKIE_LEN );if (cookie !=POLICY_SIGN_COOKIE || !length) {dev_dbg (dev->dev,"cookie doesn't match\n" );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 552/715 ALSA: usb-audio: Stop parsing channels bits when all channels are found.
In reply to Sasha LevinFrom: Johan Carlsson <[email protected]>
[ Upstream commit a39d51ff1f52cd0b6fe7d379ac93bd8b4237d1b7 ]
If a usb audio device sets more bits than the amount of channels it could write outside of the map array.
Message-ID: <[email protected]>
--- sound/usb/stream.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
sound/usb/stream.c +4 -1
@@ -300,9 +300,12 @@ static struct snd_pcm_chmap_elem *convert_chmap(int channels, unsigned int bits, c =0 ;if (bits) { -for (; bits && *maps; maps++, bits >>=1 ) +for (; bits && *maps; maps++, bits >>=1 ) {if (bits &1 ) chmap->map[c++] = *maps; +if (c == chmap->channels) +break ; + } }else {/* If we're missing wChannelConfig, then guess something to make sure the channel map is not skipped entirely */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 553/715 phy: qcom: qmp-usb: split USB-C PHY driver
In reply to Sasha LevinFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit 19281571a4d5b6049dad9318db081af48818b1d2 ]
In preparation to adding Type-C handling for MSM8998, QCM2290 and SM6115 platforms, create new QMP USB-C PHY driver by splitting mentioned platforms to a separate file. In future it will also be extended with support for the DisplayPort handling. It will also be reused later for such platforms as SDM660, SM6125, SM6150.
Stable-dep-of: 01b086ccdeff ("phy: qcom: qmp-usbc: handle CLAMP register in a correct way")
--- drivers/phy/qualcomm/Makefile | 2 +- drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 266 ------ drivers/phy/qualcomm/phy-qcom-qmp-usbc.c | 1078 ++++++++++++++++++++++ 3 files changed, 1079 insertions(+), 267 deletions(-) create mode 100644 drivers/phy/qualcomm/phy-qcom-qmp-usbc.c
drivers/phy/qualcomm/Makefile +1 -1
@@ -7,7 +7,7 @@ obj-$(CONFIG_PHY_QCOM_IPQ806X_SATA) += phy-qcom-ipq806x-sata.o obj-$(CONFIG_PHY_QCOM_M31_USB) += phy-qcom-m31.o obj-$(CONFIG_PHY_QCOM_PCIE2) += phy-qcom-pcie2.o -obj-$(CONFIG_PHY_QCOM_QMP_COMBO) += phy-qcom-qmp-combo.o +obj-$(CONFIG_PHY_QCOM_QMP_COMBO) += phy-qcom-qmp-combo.o phy-qcom-qmp-usbc.o obj-$(CONFIG_PHY_QCOM_QMP_PCIE) += phy-qcom-qmp-pcie.o obj-$(CONFIG_PHY_QCOM_QMP_PCIE_8996) += phy-qcom-qmp-pcie-msm8996.o obj-$(CONFIG_PHY_QCOM_QMP_UFS) += phy-qcom-qmp-ufs.o
drivers/phy/qualcomm/phy-qcom-qmp-usb.c +0 -266
314 lines not on this page · raw message
drivers/phy/qualcomm/phy-qcom-qmp-usbc.c new file +1078 -0
1,078 lines not on this page · raw message
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 554/715 phy: qcom: qmp-usbc: add support for the Type-C handling
In reply to Sasha LevinFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit dfdaba27b4660ec26de955cf4459499ddb005e2d ]
The USB-C PHYs on the msm8998, QCM2290 and SM6115 platforms use special register to control which lanes of the Type-C port are used for the SuperSpeed USB connection. Mimic the qmp-combo driver and handle this register.
Stable-dep-of: 01b086ccdeff ("phy: qcom: qmp-usbc: handle CLAMP register in a correct way")
--- drivers/phy/qualcomm/phy-qcom-qmp-usbc.c | 97 +++++++++++++++++++++++- 1 file changed, 94 insertions(+), 3 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-usbc.c +94 -3
@@ -18,6 +18,8 @@#include <linux/regulator/consumer.h> #include <linux/reset.h> #include <linux/slab.h> +#include <linux/usb/typec.h> +#include <linux/usb/typec_mux.h> #include "phy-qcom-qmp.h" #include "phy-qcom-qmp-pcs-misc-v3.h"
@@ -374,11 +376,17 @@ struct qmp_usbc {struct reset_control_bulk_data *resets;struct regulator_bulk_data *vregs; +struct mutex phy_mutex; +enum phy_mode mode; +unsigned int usb_init_count;struct phy *phy;struct clk_fixed_rate pipe_clk_fixed; + +struct typec_switch_dev *sw; +enum typec_orientation orientation; };static inline void qphy_setbits (void __iomem *base,u32 offset,u32 val)
@@ -497,6 +505,7 @@ static int qmp_usbc_init(struct phy *phy)struct qmp_usbc *qmp =phy_get_drvdata (phy);const struct qmp_phy_cfg *cfg = qmp->cfg;void __iomem *pcs = qmp->pcs; +u32 val =0 ;int ret; ret =regulator_bulk_enable (cfg->num_vregs, qmp->vregs);
@@ -523,6 +532,14 @@ static int qmp_usbc_init(struct phy *phy)qphy_setbits (pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL ],SW_PWRDN ); +#define SW_PORTSELECT_VAL BIT(0) +#define SW_PORTSELECT_MUX BIT(1) +/* Use software based port select and switch on typec orientation */ + val =SW_PORTSELECT_MUX ; +if (qmp->orientation ==TYPEC_ORIENTATION_REVERSE ) + val |=SW_PORTSELECT_VAL ; +writel (val, qmp->pcs_misc); +return 0 ; err_assert_reset:
@@ -620,23 +637,34 @@ static int qmp_usbc_power_off(struct phy *phy)static int qmp_usbc_enable (struct phy *phy) { +struct qmp_usbc *qmp =phy_get_drvdata (phy);int ret; +mutex_lock (&qmp->phy_mutex); + ret =qmp_usbc_init (phy);if (ret) -return ret; + goto out_unlock; ret =qmp_usbc_power_on (phy); -if (ret) +if (ret) {qmp_usbc_exit (phy); + goto out_unlock; + } + + qmp->usb_init_count++; +out_unlock: +mutex_unlock (&qmp->phy_mutex);return ret; }static int qmp_usbc_disable (struct phy *phy) { +struct qmp_usbc *qmp =phy_get_drvdata (phy);int ret; + qmp->usb_init_count--; ret =qmp_usbc_power_off (phy);if (ret)return ret;
@@ -874,6 +902,61 @@ static int phy_pipe_clk_register(struct qmp_usbc *qmp, struct device_node *np)return devm_add_action_or_reset (qmp->dev, phy_clk_release_provider, np); } +#if IS_ENABLED (CONFIG_TYPEC ) +static int qmp_usbc_typec_switch_set (struct typec_switch_dev *sw, +enum typec_orientation orientation) +{ +struct qmp_usbc *qmp =typec_switch_get_drvdata (sw); + +if (orientation == qmp->orientation || orientation ==TYPEC_ORIENTATION_NONE ) +return 0 ; + +mutex_lock (&qmp->phy_mutex); + qmp->orientation = orientation; + +if (qmp->usb_init_count) { +qmp_usbc_power_off (qmp->phy); +qmp_usbc_exit (qmp->phy); + +qmp_usbc_init (qmp->phy); +qmp_usbc_power_on (qmp->phy); + } + +mutex_unlock (&qmp->phy_mutex); + +return 0 ; +} + +static void qmp_usbc_typec_unregister (void *data) +{ +struct qmp_usbc *qmp = data; + +typec_switch_unregister (qmp->sw); +} + +static int qmp_usbc_typec_switch_register (struct qmp_usbc *qmp) +{ +struct typec_switch_desc sw_desc = {}; +struct device *dev = qmp->dev; + + sw_desc.drvdata = qmp; + sw_desc.fwnode = dev->fwnode; + sw_desc.set = qmp_usbc_typec_switch_set; + qmp->sw =typec_switch_register (dev, &sw_desc); +if (IS_ERR (qmp->sw)) { +dev_err (dev,"Unable to register typec switch: %pe\n" , qmp->sw); +return PTR_ERR (qmp->sw); + } + +return devm_add_action_or_reset (dev, qmp_usbc_typec_unregister, qmp); +} +#else +static int qmp_usbc_typec_switch_register (struct qmp_usbc *qmp) +{ +return 0 ; +} +#endif +static int qmp_usbc_parse_dt_legacy (struct qmp_usbc *qmp,struct device_node *np) {struct platform_device *pdev =to_platform_device (qmp->dev);
@@ -994,16 +1077,24 @@ static int qmp_usbc_probe(struct platform_device *pdev) qmp->dev = dev; + qmp->orientation =TYPEC_ORIENTATION_NORMAL ; + qmp->cfg =of_device_get_match_data (dev);if (!qmp->cfg)return -EINVAL ; +mutex_init (&qmp->phy_mutex); + ret =qmp_usbc_vreg_init (qmp);if (ret)return ret; + ret =qmp_usbc_typec_switch_register (qmp); +if (ret) +return ret; +/* Check for legacy binding with child node. */ - np =of_get_next_available_child (dev->of_node,NULL ); + np =of_get_child_by_name (dev->of_node,"phy" );if (np) { ret =qmp_usbc_parse_dt_legacy (qmp, np); }else {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 555/715 phy: qcom: qmp-usbc: handle CLAMP register in a correct way
In reply to Sasha LevinFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit 01b086ccdeffac96f107228d581e0925e1c83f87 ]
The QMP USB PHYs on msm8998, qcm2290 and some other platforms don't have the PCS_MISC_CLAMP_ENABLE register. Instead they need to toggle the register in the TCSR space. Make the new phy-qcom-qmp-usbc driver correctly handle the clamp register.
--- drivers/phy/qualcomm/phy-qcom-qmp-usbc.c | 48 ++++++++++++++++++------ 1 file changed, 37 insertions(+), 11 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-usbc.c +37 -11
@@ -10,11 +10,13 @@#include <linux/io.h> #include <linux/iopoll.h> #include <linux/kernel.h> +#include <linux/mfd/syscon.h> #include <linux/module.h> #include <linux/of.h> #include <linux/of_address.h> #include <linux/phy/phy.h> #include <linux/platform_device.h> +#include <linux/regmap.h> #include <linux/regulator/consumer.h> #include <linux/reset.h> #include <linux/slab.h>
@@ -56,9 +58,6 @@/* QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR register bits */ #define IRQ_CLEAR BIT(0) -/* QPHY_V3_PCS_MISC_CLAMP_ENABLE register bits */ -#define CLAMP_EN BIT(0)/* enables i/o clamp_n */ -#define PHY_INIT_COMPLETE_TIMEOUT 10000struct qmp_phy_init_tbl {
@@ -94,7 +93,6 @@ enum qphy_reg_layout {QPHY_PCS_AUTONOMOUS_MODE_CTRL ,QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR ,QPHY_PCS_POWER_DOWN_CONTROL , -QPHY_PCS_MISC_CLAMP_ENABLE ,/* Keep last to ensure regs_layout arrays are properly initialized */ QPHY_LAYOUT_SIZE };
@@ -106,7 +104,6 @@ static const unsigned int qmp_v3_usb3phy_regs_layout[QPHY_LAYOUT_SIZE] = { [QPHY_PCS_AUTONOMOUS_MODE_CTRL] = QPHY_V3_PCS_AUTONOMOUS_MODE_CTRL, [QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR] = QPHY_V3_PCS_LFPS_RXTERM_IRQ_CLEAR, [QPHY_PCS_POWER_DOWN_CONTROL] = QPHY_V3_PCS_POWER_DOWN_CONTROL, - [QPHY_PCS_MISC_CLAMP_ENABLE] = QPHY_V3_PCS_MISC_CLAMP_ENABLE, };static const unsigned int qmp_v3_usb3phy_regs_layout_qcm2290[QPHY_LAYOUT_SIZE ] = {
@@ -369,6 +366,9 @@ struct qmp_usbc {void __iomem *tx2;void __iomem *rx2; +struct regmap *tcsr_map; +u32 vls_clamp_reg; +struct clk *pipe_clk;struct clk_bulk_data *clks;int num_clks;
@@ -691,7 +691,6 @@ static void qmp_usbc_enable_autonomous_mode(struct qmp_usbc *qmp) {const struct qmp_phy_cfg *cfg = qmp->cfg;void __iomem *pcs = qmp->pcs; -void __iomem *pcs_misc = qmp->pcs_misc;u32 intr_mask; if (qmp->mode == PHY_MODE_USB_HOST_SS ||
@@ -712,19 +711,18 @@ static void qmp_usbc_enable_autonomous_mode(struct qmp_usbc *qmp)qphy_setbits (pcs, cfg->regs[QPHY_PCS_AUTONOMOUS_MODE_CTRL ], intr_mask);/* Enable i/o clamp_n for autonomous mode */ -if (pcs_misc && cfg->regs[QPHY_PCS_MISC_CLAMP_ENABLE ]) -qphy_clrbits (pcs_misc, cfg->regs[QPHY_PCS_MISC_CLAMP_ENABLE ],CLAMP_EN ); +if (qmp->tcsr_map && qmp->vls_clamp_reg) +regmap_write (qmp->tcsr_map, qmp->vls_clamp_reg,1 ); }static void qmp_usbc_disable_autonomous_mode (struct qmp_usbc *qmp) {const struct qmp_phy_cfg *cfg = qmp->cfg;void __iomem *pcs = qmp->pcs; -void __iomem *pcs_misc = qmp->pcs_misc;/* Disable i/o clamp_n on resume for normal mode */ -if (pcs_misc && cfg->regs[QPHY_PCS_MISC_CLAMP_ENABLE ]) -qphy_setbits (pcs_misc, cfg->regs[QPHY_PCS_MISC_CLAMP_ENABLE ],CLAMP_EN ); +if (qmp->tcsr_map && qmp->vls_clamp_reg) +regmap_write (qmp->tcsr_map, qmp->vls_clamp_reg,0 );qphy_clrbits (pcs, cfg->regs[QPHY_PCS_AUTONOMOUS_MODE_CTRL ],ARCVR_DTCT_EN |ARCVR_DTCT_EVENT_SEL |ALFPS_DTCT_EN );
@@ -1063,6 +1061,30 @@ static int qmp_usbc_parse_dt(struct qmp_usbc *qmp)return 0 ; } +static int qmp_usbc_parse_vls_clamp (struct qmp_usbc *qmp) +{ +struct of_phandle_args tcsr_args; +struct device *dev = qmp->dev; +int ret; + +/* for backwards compatibility ignore if there is no property */ + ret =of_parse_phandle_with_fixed_args (dev->of_node,"qcom,tcsr-reg" ,1 ,0 , + &tcsr_args); +if (ret == -ENOENT ) +return 0 ; +else if (ret <0 ) +return dev_err_probe (dev, ret,"Failed to parse qcom,tcsr-reg\n" ); + + qmp->tcsr_map =syscon_node_to_regmap (tcsr_args.np); +of_node_put (tcsr_args.np); +if (IS_ERR (qmp->tcsr_map)) +return PTR_ERR (qmp->tcsr_map); + + qmp->vls_clamp_reg = tcsr_args.args[0 ]; + +return 0 ; +} +static int qmp_usbc_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;
@@ -1093,6 +1115,10 @@ static int qmp_usbc_probe(struct platform_device *pdev)if (ret)return ret; + ret =qmp_usbc_parse_vls_clamp (qmp); +if (ret) +return ret; +/* Check for legacy binding with child node. */ np =of_get_child_by_name (dev->of_node,"phy" );if (np) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 556/715 scsi: hisi_sas: Fix a deadlock issue related to automatic dump
In reply to Sasha LevinFrom: Yihang Li <[email protected]>
[ Upstream commit 3c4f53b2c341ec6428b98cb51a89a09b025d0953 ]
If we issue a disabling PHY command, the device attached with it will go offline, if a 2 bit ECC error occurs at the same time, a hung task may be found:
[ 4613.652388] INFO: task kworker/u256:0:165233 blocked for more than 120 seconds. [ 4613.666297] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 4613.674809] task:kworker/u256:0 state:D stack: 0 pid:165233 ppid: 2 flags:0x00000208 [ 4613.683959] Workqueue: 0000:74:02.0_disco_q sas_revalidate_domain [libsas] [ 4613.691518] Call trace: [ 4613.694678] __switch_to+0xf8/0x17c [ 4613.698872] __schedule+0x660/0xee0 [ 4613.703063] schedule+0xac/0x240 [ 4613.706994] schedule_timeout+0x500/0x610 [ 4613.711705] __down+0x128/0x36c [ 4613.715548] down+0x240/0x2d0 [ 4613.719221] hisi_sas_internal_abort_timeout+0x1bc/0x260 [hisi_sas_main] [ 4613.726618] sas_execute_internal_abort+0x144/0x310 [libsas] [ 4613.732976] sas_execute_internal_abort_dev+0x44/0x60 [libsas] [ 4613.739504] hisi_sas_internal_task_abort_dev.isra.0+0xbc/0x1b0 [hisi_sas_main] [ 4613.747499] hisi_sas_dev_gone+0x174/0x250 [hisi_sas_main] [ 4613.753682] sas_notify_lldd_dev_gone+0xec/0x2e0 [libsas] [ 4613.759781] sas_unregister_common_dev+0x4c/0x7a0 [libsas] [ 4613.765962] sas_destruct_devices+0xb8/0x120 [libsas] [ 4613.771709] sas_do_revalidate_domain.constprop.0+0x1b8/0x31c [libsas] [ 4613.778930] sas_revalidate_domain+0x60/0xa4 [libsas] [ 4613.784716] process_one_work+0x248/0x950 [ 4613.789424] worker_thread+0x318/0x934 [ 4613.793878] kthread+0x190/0x200 [ 4613.797810] ret_from_fork+0x10/0x18 [ 4613.802121] INFO: task kworker/u256:4:316722 blocked for more than 120 seconds. [ 4613.816026] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 4613.824538] task:kworker/u256:4 state:D stack: 0 pid:316722 ppid: 2 flags:0x00000208 [ 4613.833670] Workqueue: 0000:74:02.0 hisi_sas_rst_work_handler [hisi_sas_main] [ 4613.841491] Call trace: [ 4613.844647] __switch_to+0xf8/0x17c [ 4613.848852] __schedule+0x660/0xee0 [ 4613.853052] schedule+0xac/0x240 [ 4613.856984] schedule_timeout+0x500/0x610 [ 4613.861695] __down+0x128/0x36c [ 4613.865542] down+0x240/0x2d0 [ 4613.869216] hisi_sas_controller_prereset+0x58/0x1fc [hisi_sas_main] [ 4613.876324] hisi_sas_rst_work_handler+0x40/0x8c [hisi_sas_main] [ 4613.883019] process_one_work+0x248/0x950 [ 4613.887732] worker_thread+0x318/0x934 [ 4613.892204] kthread+0x190/0x200 [ 4613.896118] ret_from_fork+0x10/0x18 [ 4613.900423] INFO: task kworker/u256:1:348985 blocked for more than 121 seconds. [ 4613.914341] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 4613.922852] task:kworker/u256:1 state:D stack: 0 pid:348985 ppid: 2 flags:0x00000208 [ 4613.931984] Workqueue: 0000:74:02.0_event_q sas_port_event_worker [libsas] [ 4613.939549] Call trace: [ 4613.942702] __switch_to+0xf8/0x17c [ 4613.946892] __schedule+0x660/0xee0 [ 4613.951083] schedule+0xac/0x240 [ 4613.955015] schedule_timeout+0x500/0x610 [ 4613.959725] wait_for_common+0x200/0x610 [ 4613.964349] wait_for_completion+0x3c/0x5c [ 4613.969146] flush_workqueue+0x198/0x790 [ 4613.973776] sas_porte_broadcast_rcvd+0x1e8/0x320 [libsas] [ 4613.979960] sas_port_event_worker+0x54/0xa0 [libsas] [ 4613.985708] process_one_work+0x248/0x950 [ 4613.990420] worker_thread+0x318/0x934 [ 4613.994868] kthread+0x190/0x200 [ 4613.998800] ret_from_fork+0x10/0x18
This is because when the device goes offline, we obtain the hisi_hba semaphore and send the ABORT_DEV command to the device. However, the internal abort timed out due to the 2 bit ECC error and triggers automatic dump. In addition, since the hisi_hba semaphore has been obtained, the dump cannot be executed and the controller cannot be reset.
Therefore, the deadlocks occur on the following circular dependencies:hisi_sas_dev_gone() -> down() -> hisi_sas_internal_task_abort_dev() -> ... -> hisi_sas_internal_abort_timeout() -> down().
The deadlock is triggered only when the timeout occurs during device goes offline. To fix this issue, use .rst_ha_timeout to distinguish the scenario where a device goes offline from other scenarios.
--- drivers/scsi/hisi_sas/hisi_sas_main.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/scsi/hisi_sas/hisi_sas_main.c +10 -2
@@ -1962,9 +1962,17 @@ static bool hisi_sas_internal_abort_timeout(struct sas_task *task,struct hisi_sas_internal_abort_data *timeout = data;if (hisi_sas_debugfs_enable && hisi_hba->debugfs_itct[0 ].itct) { -down (&hisi_hba->sem); +/* +* If timeout occurs in device gone scenario, to avoid +* circular dependency like: +* hisi_sas_dev_gone() -> down() -> ... -> +* hisi_sas_internal_abort_timeout() -> down(). +*/ +if (!timeout->rst_ha_timeout) +down (&hisi_hba->sem); hisi_hba->hw->debugfs_snapshot_regs (hisi_hba); -up (&hisi_hba->sem); +if (!timeout->rst_ha_timeout) +up (&hisi_hba->sem); }if (task->task_state_flags &SAS_TASK_STATE_DONE ) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 557/715 RDMA/irdma: Remove duplicate assignment
In reply to Sasha LevinFrom: Mustafa Ismail <[email protected]>
[ Upstream commit 926e8ea4b8dac84f6d14a4b60d0653f1f2ba9431 ]
Remove the unneeded assignment of the qp_num which is already set in irdma_create_qp().
--- drivers/infiniband/hw/irdma/verbs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/infiniband/hw/irdma/verbs.c +1 -2
@@ -719,7 +719,6 @@ static int irdma_setup_kmode_qp(struct irdma_device *iwdev, info->rq_pa + (ukinfo->rq_depth *IRDMA_QP_WQE_MIN_SIZE ); ukinfo->sq_size = ukinfo->sq_depth >> ukinfo->sq_shift; ukinfo->rq_size = ukinfo->rq_depth >> ukinfo->rq_shift; - ukinfo->qp_id = iwqp->ibqp.qp_num; iwqp->max_send_wr = (ukinfo->sq_depth -IRDMA_SQ_RSVD ) >> ukinfo->sq_shift; iwqp->max_recv_wr = (ukinfo->rq_depth -IRDMA_RQ_RSVD ) >> ukinfo->rq_shift;
@@ -944,7 +943,7 @@ static int irdma_create_qp(struct ib_qp *ibqp, iwqp->host_ctx.size =IRDMA_QP_CTX_SIZE ; init_info.pd = &iwpd->sc_pd; - init_info.qp_uk_init_info.qp_id = iwqp->ibqp.qp_num; + init_info.qp_uk_init_info.qp_id = qp_num;if (!rdma_protocol_roce (&iwdev->ibdev,1 )) init_info.qp_uk_init_info.first_sq_wq =1 ; iwqp->ctx_info.qp_compl_ctx = (uintptr_t )qp;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 558/715 RDMA/srpt: Do not register event handler until srpt device is fully setup
In reply to Sasha LevinFrom: William Kucharski <[email protected]>
[ Upstream commit c21a8870c98611e8f892511825c9607f1e2cd456 ]
Upon rare occasions, KASAN reports a use-after-free Write in srpt_refresh_port().
This seems to be because an event handler is registered before the srpt device is fully setup and a race condition upon error may leave a partially setup event handler in place.
Instead, only register the event handler after srpt device initialization is complete.
--- drivers/infiniband/ulp/srpt/ib_srpt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/infiniband/ulp/srpt/ib_srpt.c +1 -2
@@ -3209,7 +3209,6 @@ static int srpt_add_one(struct ib_device *device)INIT_IB_EVENT_HANDLER (&sdev->event_handler, sdev->device, srpt_event_handler); -ib_register_event_handler (&sdev->event_handler);for (i =1 ; i <= sdev->device->phys_port_cnt; i++) { sport = &sdev->port[i -1 ];
@@ -3232,6 +3231,7 @@ static int srpt_add_one(struct ib_device *device) } } +ib_register_event_handler (&sdev->event_handler);spin_lock (&srpt_dev_lock);list_add_tail (&sdev->list, &srpt_dev_list);spin_unlock (&srpt_dev_lock);
@@ -3242,7 +3242,6 @@ static int srpt_add_one(struct ib_device *device) err_port:srpt_unregister_mad_agent (sdev, i); -ib_unregister_event_handler (&sdev->event_handler); err_cm:if (sdev->cm_id)ib_destroy_cm_id (sdev->cm_id);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 559/715 f2fs: compress: fix to guarantee persisting compressed blocks by CP
In reply to Sasha LevinFrom: Chao Yu <[email protected]>
[ Upstream commit 8a430dd49e9cb021372b0ad91e60aeef9c6ced00 ]
If data block in compressed cluster is not persisted with metadata during checkpoint, after SPOR, the data may be corrupted, let's guarantee to write compressed page by checkpoint.
--- fs/f2fs/compress.c | 4 +++- fs/f2fs/data.c | 17 +++++++++-------- fs/f2fs/f2fs.h | 4 +++- 3 files changed, 15 insertions(+), 10 deletions(-)
fs/f2fs/compress.c +3 -1
@@ -1418,6 +1418,8 @@ void f2fs_compress_write_end_io(struct bio *bio, struct page *page)struct f2fs_sb_info *sbi = bio->bi_private;struct compress_io_ctx *cic = (struct compress_io_ctx *)page_private (page); +enum count_type type =WB_DATA_TYPE (page, +f2fs_is_compressed_page (page));int i;if (unlikely (bio->bi_status))
@@ -1425,7 +1427,7 @@ void f2fs_compress_write_end_io(struct bio *bio, struct page *page)f2fs_compress_free_page (page); -dec_page_count (sbi,F2FS_WB_DATA ); +dec_page_count (sbi, type);if (atomic_dec_return (&cic->pending_pages))return ;
fs/f2fs/data.c +9 -8
@@ -48,7 +48,7 @@ void f2fs_destroy_bioset(void)bioset_exit (&f2fs_bioset); } -static bool __is_cp_guaranteed (struct page *page) +bool f2fs_is_cp_guaranteed (struct page *page) {struct address_space *mapping = page->mapping;struct inode *inode;
@@ -65,8 +65,6 @@ static bool __is_cp_guaranteed(struct page *page) S_ISDIR(inode->i_mode))return true; -if (f2fs_is_compressed_page (page)) -return false;if ((S_ISREG (inode->i_mode) &&IS_NOQUOTA (inode)) ||page_private_gcing (page))return true;
@@ -338,7 +336,7 @@ static void f2fs_write_end_io(struct bio *bio)bio_for_each_segment_all (bvec, bio, iter_all) {struct page *page = bvec->bv_page; -enum count_type type =WB_DATA_TYPE (page); +enum count_type type =WB_DATA_TYPE (page, false);if (page_private_dummy (page)) {clear_page_private_dummy (page);
@@ -762,7 +760,7 @@ int f2fs_submit_page_bio(struct f2fs_io_info *fio)wbc_account_cgroup_owner (fio->io_wbc, fio->page,PAGE_SIZE );inc_page_count (fio->sbi,is_read_io (fio->op) ? -__read_io_type (page) :WB_DATA_TYPE (fio->page)); +__read_io_type (page) :WB_DATA_TYPE (fio->page, false));if (is_read_io (bio_op (bio)))f2fs_submit_read_bio (fio->sbi, bio, fio->type);
@@ -973,7 +971,7 @@ int f2fs_merge_page_bio(struct f2fs_io_info *fio)if (fio->io_wbc)wbc_account_cgroup_owner (fio->io_wbc, fio->page,PAGE_SIZE ); -inc_page_count (fio->sbi,WB_DATA_TYPE (page)); +inc_page_count (fio->sbi,WB_DATA_TYPE (page, false)); *fio->last_block = fio->new_blkaddr; *fio->bio = bio;
@@ -1007,6 +1005,7 @@ void f2fs_submit_page_write(struct f2fs_io_info *fio)enum page_type btype =PAGE_TYPE_OF_BIO (fio->type);struct f2fs_bio_info *io = sbi->write_io[btype] + fio->temp;struct page *bio_page; +enum count_type type;f2fs_bug_on (sbi,is_read_io (fio->op));
@@ -1046,7 +1045,8 @@ void f2fs_submit_page_write(struct f2fs_io_info *fio)/* set submitted = true as a return value */ fio->submitted =1 ; -inc_page_count (sbi,WB_DATA_TYPE (bio_page)); + type =WB_DATA_TYPE (bio_page, fio->compressed_page); +inc_page_count (sbi, type); if (io->bio && (!io_is_mergeable(sbi, io->bio, io, fio, io->last_block_in_bio,
@@ -1059,7 +1059,8 @@ void f2fs_submit_page_write(struct f2fs_io_info *fio)if (F2FS_IO_ALIGNED (sbi) && (fio->type ==DATA || fio->type ==NODE ) && fio->new_blkaddr &F2FS_IO_SIZE_MASK (sbi)) { -dec_page_count (sbi,WB_DATA_TYPE (bio_page)); +dec_page_count (sbi,WB_DATA_TYPE (bio_page, + fio->compressed_page)); fio->retry =1 ; goto skip; }
fs/f2fs/f2fs.h +3 -1
@@ -1080,7 +1080,8 @@ struct f2fs_sm_info {* f2fs monitors the number of several block types such as on-writeback, * dirty dentry blocks, dirty node blocks, and dirty meta blocks. */ -#define WB_DATA_TYPE (p) (__is_cp_guaranteed(p) ? F2FS_WB_CP_DATA : F2FS_WB_DATA) +#define WB_DATA_TYPE (p, f) \ + (f || f2fs_is_cp_guaranteed(p) ? F2FS_WB_CP_DATA : F2FS_WB_DATA)enum count_type {F2FS_DIRTY_DENTS ,F2FS_DIRTY_DATA ,
@@ -3804,6 +3805,7 @@ void f2fs_init_ckpt_req_control(struct f2fs_sb_info *sbi);*/ int __init f2fs_init_bioset (void );void f2fs_destroy_bioset (void ); +bool f2fs_is_cp_guaranteed (struct page *page);int f2fs_init_bio_entry_cache (void );void f2fs_destroy_bio_entry_cache (void ); void f2fs_submit_read_bio(struct f2fs_sb_info *sbi, struct bio *bio,
Signature · 1 line
2.43.0