6.6.163-rc1 review
Subsystems (6)
Greg Kroah-Hartman
maintainerPATCH 2304/3318 crypto: ccp - kill v3 IRQ tasklet during teardown
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiale Yao <[email protected]>
[ Upstream commit b72a639bdee6e07d8091718ac3e451d9c5cba1b5 ]
On PCI devices using MSI-X, ccp_irq_handler() schedules irq_tasklet. The teardown paths release the IRQ but do not drain a tasklet that was already queued, so it can access ccp after the device-managed allocation has been released.
Kill the tasklet after releasing the IRQ in both the initialization error path and ccp_destroy().
--- drivers/crypto/ccp/ccp-dev-v3.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/crypto/ccp/ccp-dev-v3.c +4 -0
@@ -506,6 +506,8 @@ static int ccp_init(struct ccp_device *ccp)kthread_stop (ccp->cmd_q[i].kthread);sp_free_ccp_irq (ccp->sp, ccp); +if (ccp->use_tasklet) +tasklet_kill (&ccp->irq_tasklet); e_pool:for (i =0 ; i < ccp->cmd_q_count; i++)
@@ -545,6 +547,8 @@ static void ccp_destroy(struct ccp_device *ccp)kthread_stop (ccp->cmd_q[i].kthread);sp_free_ccp_irq (ccp->sp, ccp); +if (ccp->use_tasklet) +tasklet_kill (&ccp->irq_tasklet);for (i =0 ; i < ccp->cmd_q_count; i++)dma_pool_destroy (ccp->cmd_q[i].dma_pool);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2305/3318 crypto: ccp - kill v5 IRQ tasklet during teardown
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiale Yao <[email protected]>
[ Upstream commit 67aefeccc4101a93627f36abbd049f191b54f903 ]
On PCI devices using MSI-X, ccp5_irq_handler() schedules irq_tasklet. The teardown paths release the IRQ but do not drain a tasklet that was already queued, so it can access ccp after the device-managed allocation has been released.
Kill the tasklet after releasing the IRQ in both the initialization error path and ccp5_destroy().
--- drivers/crypto/ccp/ccp-dev-v5.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/crypto/ccp/ccp-dev-v5.c +4 -0
@@ -995,6 +995,8 @@ static int ccp5_init(struct ccp_device *ccp) e_irq:sp_free_ccp_irq (ccp->sp, ccp); +if (ccp->use_tasklet) +tasklet_kill (&ccp->irq_tasklet); e_pool:for (i =0 ; i < ccp->cmd_q_count; i++)
@@ -1046,6 +1048,8 @@ static void ccp5_destroy(struct ccp_device *ccp)kthread_stop (ccp->cmd_q[i].kthread);sp_free_ccp_irq (ccp->sp, ccp); +if (ccp->use_tasklet) +tasklet_kill (&ccp->irq_tasklet);/* Flush the cmd and backlog queue */ while (!list_empty (&ccp->cmd)) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2306/3318 RDMA/mlx5: Guard steering anchor resource destruction on create error
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li RongQing <[email protected]>
[ Upstream commit 193aaf5b57f05d9f0403cfdaff3eda3b8d11ec13 ]
The steering anchor resources are shared between anchors with the same priority and are protected by rule_goto_table_ref.
When steering anchor creation succeeds but uverbs_copy_to() fails, the error path drops the reference acquired for the new anchor. However, it unconditionally calls mlx5_steering_anchor_destroy_res(), even when other anchors are still using the shared resources.
This can destroy the shared flow table, flow groups, and rules while existing anchors still hold references to them, resulting in a use-after-free when those anchors are subsequently cleaned up.
Only destroy the shared resources when dropping the reference makes rule_goto_table_ref zero, consistent with the existing cleanup path.
--- drivers/infiniband/hw/mlx5/fs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/hw/mlx5/fs.c +2 -2
@@ -2466,8 +2466,8 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_STEERING_ANCHOR_CREATE)(return 0 ; destroy_res: - --ft_prio->anchor.rule_goto_table_ref; -mlx5_steering_anchor_destroy_res (ft_prio); +if (!--ft_prio->anchor.rule_goto_table_ref) +mlx5_steering_anchor_destroy_res (ft_prio); put_flow_table:put_flow_table (dev, ft_prio, true); free_obj:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2307/3318 swim: Assert strobe with stable outputs
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit adcc410bfb41715fef198a0975db4ed594a49bb7 ]
Inside Macintosh says, "Be sure that you don't change CA0-CA2 or SEL while LSTRB is high". Unfortunately, those bits do change. The CA0-CA2 outputs become inputs when (LSTRB << 4) | LSTRB gets written to the phase register. Then LSTRB is driven low (with CA0-CA2 bits set).
This is a problem because the drive interprets a STEP command as an EJECT command when these pins float high. This occurs intermittently, perhaps because interrupts are disabled and the race condition happens to end well. However, when I add code to step the heads with interrupts enabled, the disk always ejects.
Keep the four phase pin directions set to output and hold their levels constant during LSTRB signalling. Introduce the PHASE_PIN_DIRECTION macro to separate the pin configuration from the logic level changes.
--- drivers/block/swim.c | 62 ++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 31 deletions(-)
drivers/block/swim.c +31 -31
@@ -87,37 +87,37 @@ struct iwm {#define iwm_write (base, reg, v) out_8(&(base)->reg, (v))#define iwm_read (base, reg) in_8(&(base)->reg) -/* bits in phase register */ +/* Bits in phase register */ -#define SEEK_POSITIVE 0x070 -#define SEEK_NEGATIVE 0x074 -#define STEP 0x071 -#define MOTOR_ON 0x072 -#define MOTOR_OFF 0x076 -#define INDEX 0x073 -#define EJECT 0x077 -#define SETMFM 0x171 -#define SETGCR 0x175 - -#define RELAX 0x033 -#define LSTRB 0x008 - -#define CA_MASK 0x077 +#define RELAX 0x03 +#define LSTRB 0x08 +#define CA_MASK 0x07 +#define PHASE_PIN_DIR 0xF0/* Select values for swim_select and swim_readbit */ -#define READ_DATA_0 0x074 -#define ONEMEG_DRIVE 0x075 -#define SINGLE_SIDED 0x076 -#define DRIVE_PRESENT 0x077 -#define DISK_IN 0x170 -#define WRITE_PROT 0x171 -#define TRACK_ZERO 0x172 -#define TACHO 0x173 -#define READ_DATA_1 0x174 -#define GCR_MODE 0x175 -#define SEEK_COMPLETE 0x176 -#define TWOMEG_MEDIA 0x177 +#define SEEK_POSITIVE 0x000 +#define SEEK_NEGATIVE 0x004 +#define STEP 0x001 +#define MOTOR_ON 0x002 +#define MOTOR_OFF 0x006 +#define INDEX 0x003 +#define EJECT 0x007 +#define SETMFM 0x101 +#define SETGCR 0x105 + +#define READ_DATA_0 0x004 +#define ONEMEG_DRIVE 0x005 +#define SINGLE_SIDED 0x006 +#define DRIVE_PRESENT 0x007 +#define DISK_IN 0x100 +#define WRITE_PROT 0x101 +#define TRACK_ZERO 0x102 +#define TACHO 0x103 +#define READ_DATA_1 0x104 +#define GCR_MODE 0x105 +#define SEEK_COMPLETE 0x106 +#define TWOMEG_MEDIA 0x107/* Bits in handshake register */
@@ -269,11 +269,11 @@ static inline int get_swim_mode(struct swim __iomem *base)static inline void swim_select (struct swim __iomem *base,int sel) { -swim_write (base, phase,RELAX ); +swim_write (base, phase,RELAX |PHASE_PIN_DIR );via1_set_head (sel &0x100 ); -swim_write (base, phase, sel &CA_MASK ); +swim_write (base, phase, (sel &CA_MASK ) |PHASE_PIN_DIR ); }static inline void swim_action (struct swim __iomem *base,int action)
@@ -284,9 +284,9 @@ static inline void swim_action(struct swim __iomem *base, int action)swim_select (base, action);udelay (1 ); -swim_write (base, phase, (LSTRB <<4 ) |LSTRB ); +swim_write (base, phase,LSTRB | action |PHASE_PIN_DIR );udelay (1 ); -swim_write (base, phase, (LSTRB <<4 ) | ((~LSTRB ) &0x0F )); +swim_write (base, phase, action |PHASE_PIN_DIR );udelay (1 );local_irq_restore (flags);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2308/3318 swim: Select appropriate drive once only
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit a2d22b3f25c388f9fbce7bf36a45a8900dce4aa3 ]
Before turning off the spindle motor, call swim_drive() to select the appropriate drive. Remove the swim_drive() call from swim_add_floppy() because it was already called by swim_floppy_init().
--- drivers/block/swim.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/block/swim.c +3 -3
@@ -679,8 +679,10 @@ static void floppy_release(struct gendisk *disk)else if (fs->ref_count >0 ) --fs->ref_count; -if (fs->ref_count ==0 ) +if (fs->ref_count ==0 ) { +swim_drive (base, fs->location);swim_motor (base,OFF ); + }mutex_unlock (&swim_mutex); }
@@ -752,8 +754,6 @@ static int swim_add_floppy(struct swim_priv *swd, enum drive_location location) fs->location = location; -swim_drive (base, location); -swim_motor (base,OFF ); fs->type =HD_MEDIA ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2309/3318 swim: Enable the drive when probing
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit 57d88c8f4ea34a4dd7c5351bd026e225c7283f3f ]
According to the ISM spec, the MOTON bit "causes the Enable 1 and Enable 2 signals to be turned on to the drive." It doesn't actually turn on the motor. When selecting a drive, enable MOTON. Disable it upon eject or release. This fixes detection of the Sony FDHD drive.
--- drivers/block/swim.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/block/swim.c +15 -3
@@ -154,8 +154,9 @@ struct iwm {/*----------------------------------------------------------------------------*/ enum drive_location { -INTERNAL_DRIVE =0x02 , -EXTERNAL_DRIVE =0x04 , +NO_DRIVE =0 , +INTERNAL_DRIVE =BIT (1 ), +EXTERNAL_DRIVE =BIT (2 ), };enum media_type {
@@ -311,9 +312,15 @@ static inline void swim_drive(struct swim __iomem *base,if (location ==INTERNAL_DRIVE ) {swim_write (base, mode0,EXTERNAL_DRIVE );/* clear drive 1 bit */ swim_write (base, mode1,INTERNAL_DRIVE );/* set drive 0 bit */ +swim_write (base, mode1,MOTON ); }else if (location ==EXTERNAL_DRIVE ) {swim_write (base, mode0,INTERNAL_DRIVE );/* clear drive 0 bit */ swim_write (base, mode1,EXTERNAL_DRIVE );/* set drive 1 bit */ +swim_write (base, mode1,MOTON ); + }else { +swim_write (base, mode0,INTERNAL_DRIVE ); +swim_write (base, mode0,EXTERNAL_DRIVE ); +swim_write (base, mode0,MOTON ); } }
@@ -447,6 +454,7 @@ static int floppy_eject(struct floppy_state *fs)swim_drive (base, fs->location);swim_motor (base,OFF );swim_eject (base); +swim_drive (base,NO_DRIVE ); fs->disk_in =0 ; fs->ejected =1 ;
@@ -652,8 +660,10 @@ static int floppy_open(struct gendisk *disk, blk_mode_t mode)else if (fs->ref_count >0 ) --fs->ref_count; -if (fs->ref_count ==0 ) +if (fs->ref_count ==0 ) {swim_motor (base,OFF ); +swim_drive (base,NO_DRIVE ); + }return err; }
@@ -682,6 +692,7 @@ static void floppy_release(struct gendisk *disk)if (fs->ref_count ==0 ) {swim_drive (base, fs->location);swim_motor (base,OFF ); +swim_drive (base,NO_DRIVE ); }mutex_unlock (&swim_mutex); }
@@ -801,6 +812,7 @@ static int swim_floppy_init(struct swim_priv *swd)if (swim_readbit (base,DRIVE_PRESENT ) && !swim_readbit (base,ONEMEG_DRIVE ))swim_add_floppy (swd,EXTERNAL_DRIVE ); +swim_drive (base,NO_DRIVE );/* register floppy drives */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2310/3318 swim: Dont disable drive after every sector
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit 05a7c4b197279cfb3ec3df26146ce085a2438aec ]
This fixes multi-sector reads on a Sony drive. The Mitsubishi drive doesn't seem to care either way.
--- drivers/block/swim.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/block/swim.c +0 -4
@@ -473,8 +473,6 @@ static inline int swim_read_sector(struct floppy_state *fs,short i;swim_track (fs, track); - -swim_write (base, mode1,MOTON );swim_head (base, side);swim_write (base, mode0, side);
@@ -490,8 +488,6 @@ static inline int swim_read_sector(struct floppy_state *fs, }local_irq_restore (flags); -swim_write (base, mode0,MOTON ); -if ((header.side != side) || (header.track != track) || (header.sector != sector))return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2311/3318 swim: Perform ISM/IWM mode switching according to specs
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit 52981bb358d1b5c38040b00f81e2cf973f9148ad ]
The SWIM spec says, "MOTOREN must be low to switch modes" and "after switching from ISM to IWM, the very first command must be a clear L7".
The ISM spec says, MOTOREN "must not be cleared until after the Action bit is cleared". Perform those operations in the correct sequence.
When switching to ISM mode, the Mode register has to be selected with a particular sequence of bit flips. Set q7 low then q6 low then mtrOff.
--- drivers/block/swim.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/block/swim.c +7 -3
@@ -149,6 +149,7 @@ struct iwm {#define ACTION 0x08#define WRITE_MODE 0x10#define HEDSEL 0x20 +#define ISM_SELECT 0x40#define MOTON 0x80/*----------------------------------------------------------------------------*/
@@ -223,18 +224,21 @@ extern int swim_read_sector_data(struct swim __iomem *base,static DEFINE_MUTEX (swim_mutex);static inline void set_swim_mode (struct swim __iomem *base,int enable) { -struct iwm __iomem *iwm_base; +struct iwm __iomem *iwm_base = (struct iwm __iomem *)base;unsigned long flags;if (!enable) { -swim_write (base, mode0,0xf8 ); +swim_write (base, mode0,ACTION ); +swim_write (base, mode0,ENBL1 |ENBL2 |MOTON ); +swim_write (base, mode0,ISM_SELECT ); +iwm_read (iwm_base, q7L);return ; } - iwm_base = (struct iwm __iomem *)base;local_irq_save (flags);iwm_read (iwm_base, q7L); +iwm_read (iwm_base, q6L);iwm_read (iwm_base, mtrOff);iwm_read (iwm_base, q6H);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2312/3318 swim: Configure parameter memory
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit 994a778d966592d0e211deaf6e436fcb21413935 ]
The original SWIM chip has a 16 byte memory to store parameters which control read/write timing. The SWIM 2 chip retains the last 4 parameters which control write pre-compensation, but omits the first 12. Hence SWIM 2 can perform reads without any parameter memory setup but SWIM 1 cannot.
Configure the SWIM parameter memory with the appropriate values so that SWIM 1 can read too. The parameters used here were observed in SWIM chip memory, using Macsbug, while MacOS was reading from an MFM floppy disk.
--- drivers/block/swim.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/block/swim.c +13 -0
@@ -796,12 +796,25 @@ static void swim_cleanup_floppy_disk(struct floppy_state *fs)blk_mq_free_tag_set (&fs->tag_set); } +static void swim_set_parameters (struct swim __iomem *base) +{ +unsigned int i; +static const u8 mem[] = {0x18 ,0x41 ,0x2e ,0x2e ,0x18 ,0x18 ,0x1b ,0x1b , +0x2f ,0x2f ,0x19 ,0x19 ,0x97 ,0x1b ,0x57 ,0x3b , }; + +swim_write (base, mode0,0 );/* reset parameter memory index */ +for (i =0 ; i <16 ; ++i) +swim_write (base, parameter, mem[i]); +} +static int swim_floppy_init (struct swim_priv *swd) {int err;int drive;struct swim __iomem *base = swd->base; +swim_set_parameters (base); +/* scan floppy drives */ swim_drive (base,INTERNAL_DRIVE );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2313/3318 swim: Dont start motor until medium is present
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit dbbaaae83cb277d76e70426c0f0ce289e867ed77 ]
The spindle motor should not be running when a disk is to be inserted. Don't start the motor while the drive is empty.
--- drivers/block/swim.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/block/swim.c +4 -2
@@ -631,8 +631,7 @@ static int floppy_open(struct gendisk *disk, blk_mode_t mode)swim_write (base, setup,S_IBM_DRIVE |S_FCLK_DIV2 );udelay (10 );swim_drive (base, fs->location); -swim_motor (base,ON ); -swim_action (base,SETMFM ); +if (fs->ejected)setup_medium (fs);if (!fs->disk_in) {
@@ -640,6 +639,9 @@ static int floppy_open(struct gendisk *disk, blk_mode_t mode) goto out; } +swim_motor (base,ON ); +swim_action (base,SETMFM ); +set_capacity (fs->disk, fs->total_secs);if (mode &BLK_OPEN_NDELAY )
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2314/3318 swim: Recalibrate when drive is probed
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit ba087774a1493ade524f8a783461fa8be9c75039 ]
Track zero recalibration can be slow and is normally done only once i.e. during system POST or boot-up. Recalibrate once after the drive is probed rather than every time the device is opened. Don't register the drive if recalibration fails. Park the heads before ejecting.
--- drivers/block/swim.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-)
drivers/block/swim.c +17 -20
@@ -412,6 +412,7 @@ static inline int swim_track00(struct swim __iomem *base)if (swim_readbit (base,TRACK_ZERO ))return 0 ; +pr_err ("swim: track zero recalibration failed\n" );return -1 ; }
@@ -456,6 +457,7 @@ static int floppy_eject(struct floppy_state *fs)struct swim __iomem *base = fs->swd->base;swim_drive (base, fs->location); +swim_track (fs,40 );swim_motor (base,OFF );swim_eject (base);swim_drive (base,NO_DRIVE );
@@ -596,13 +598,6 @@ static void setup_medium(struct floppy_state *fs)struct floppy_struct *g; fs->disk_in =1 ; fs->write_protected =swim_readbit (base,WRITE_PROT ); - -if (swim_track00 (base)) -printk (KERN_ERR -"SWIM: cannot move floppy head to track 0\n" ); - -swim_track00 (base); - fs->type =swim_readbit (base,TWOMEG_MEDIA ) ?HD_MEDIA :DD_MEDIA ; fs->head_number =swim_readbit (base,SINGLE_SIDED ) ?1 :2 ;
@@ -610,7 +605,6 @@ static void setup_medium(struct floppy_state *fs) fs->total_secs = g->size; fs->secpercyl = g->head * g->sect; fs->secpertrack = g->sect; - fs->track =0 ; }else { fs->disk_in =0 ; }
@@ -760,24 +754,33 @@ static const struct block_device_operations floppy_fops = { .check_events = floppy_check_events, }; -static int swim_add_floppy (struct swim_priv *swd,enum drive_location location) +static void swim_add_floppy (struct swim_priv *swd,enum drive_location location) {struct floppy_state *fs = &swd->unit[swd->floppy_count];struct swim __iomem *base = swd->base; - fs->location = location; +swim_drive (base, location); +if (!swim_readbit (base,DRIVE_PRESENT ) || +swim_readbit (base,ONEMEG_DRIVE )) + goto out; +if (swim_readbit (base,DISK_IN )) +swim_motor (base,ON ); +if (swim_track00 (base)) + goto out; -swim_motor (base,OFF ); + fs->location = location; fs->type =HD_MEDIA ; fs->head_number =2 ; fs->ref_count =0 ; fs->ejected =1 ; + fs->track =0 ; swd->floppy_count++; -return 0 ; +out: +swim_motor (base,OFF ); }static const struct blk_mq_ops swim_mq_ops = {
@@ -819,14 +822,8 @@ static int swim_floppy_init(struct swim_priv *swd)/* scan floppy drives */ -swim_drive (base,INTERNAL_DRIVE ); -if (swim_readbit (base,DRIVE_PRESENT ) && - !swim_readbit (base,ONEMEG_DRIVE )) -swim_add_floppy (swd,INTERNAL_DRIVE ); -swim_drive (base,EXTERNAL_DRIVE ); -if (swim_readbit (base,DRIVE_PRESENT ) && - !swim_readbit (base,ONEMEG_DRIVE )) -swim_add_floppy (swd,EXTERNAL_DRIVE ); +swim_add_floppy (swd,INTERNAL_DRIVE ); +swim_add_floppy (swd,EXTERNAL_DRIVE );swim_drive (base,NO_DRIVE );/* register floppy drives */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2315/3318 swim: Add track zero recalibration delay
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit b9c1095048537cc9563f12d0a24f2f0df129e4d5 ]
The UPD72070 spec indicates that the track zero sensor can take 3 ms to stabilize following a STEP command so add a call to msleep(). Remove the duplicate swim_readbit() call as there's no need for that once the sensor signal has stabilized.
--- drivers/block/swim.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/block/swim.c +4 -5
@@ -402,16 +402,15 @@ static inline int swim_track00(struct swim __iomem *base)for (try =0 ; try <100 ; try++) {swim_select (base,RELAX ); +msleep (3 ); +if (swim_readbit (base,TRACK_ZERO )) -break ; +return 0 ;if (swim_step (base)) -return -1 ; +break ; } -if (swim_readbit (base,TRACK_ZERO )) -return 0 ; -pr_err ("swim: track zero recalibration failed\n" );return -1 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2316/3318 swim: Handle FIFO timeout error
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit 2e9bcbecee68431b689d16b23bc5529db686f8d4 ]
When polling the FIFO for a mark byte in the sector header, don't return zero if the timeout counter has expired, return an error code.
--- drivers/block/swim_asm.S | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/block/swim_asm.S +1 -2
@@ -79,7 +79,7 @@ wait_addr_mark_byte: tstb %a2@ dbmi %d2, wait_addr_mark_byte - bpl header_exit + bpl signal_nonyb moveb %a3@, %d3 cmpb %a0@+, %d3
@@ -136,7 +136,6 @@ crc1: tstb %a2@ tstb %a3@(read_error - read_mark) -header_exit: moveq #0, %d0 moveb #0x18, %a3@(write_mode0 - read_mark) rts
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2317/3318 swim: Check for CRC errors
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit 01bff87152e6748fbac9ccd645d3d5f490d75ddc ]
After reading either the sector header or sector data, examine that flag in the handshake register which holds the result of the CRC calculation. CRC validation has to take place with the last byte still in the FIFO. This flag can't be checked by the caller because by then all bytes will have been retrieved from the FIFO. Return an error code when appropriate.
--- drivers/block/swim_asm.S | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/block/swim_asm.S +10 -0
@@ -42,6 +42,8 @@ .equ max_retry, 40 .equ sector_size, 512 + .equ .Lhr_crc_error, 0x02 + .global swim_read_sector_header swim_read_sector_header: link %a6, #0
@@ -134,6 +136,10 @@ crc1: tstb %a2@ moveb %a3@, %a4@(o_crc1) + moveb %a2@, %d5 + andb #.Lhr_crc_error, %d5 + bne signal_nonyb + tstb %a3@(read_error - read_mark) moveq #0, %d0
@@ -226,6 +232,10 @@ data_crc1: moveb %a3@, %d5 + moveb %a2@, %d5 + andb #.Lhr_crc_error, %d5 + bne data_exit + tstb %a3@(read_error - read_mark) moveb #0x18, %a3@(write_mode0 - read_mark)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2318/3318 swim: Simplify return value initialization
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit 385a44e78702762e2fce796cf37b6f465d86a87f ]
Initialize the error result once only. Update the result only after a successful read.
Stable-dep-of: d66bdef0a308 ("swim: Check error register during sector read")
--- drivers/block/swim_asm.S | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/block/swim_asm.S +3 -8
@@ -49,6 +49,7 @@ swim_read_sector_header: link %a6, #0 moveml %d1-%d5/%a0-%a4,%sp@- movel %a6@(0x0c), %a4 + moveq #-1, %d0 bsr mfm_read_addrmark moveml %sp@+, %d1-%d5/%a0-%a4 unlk %a6
@@ -63,7 +64,6 @@ mfm_read_addrmark: movel %a6@(0x08), %a3 lea %a3@(read_handshake), %a2 lea %a3@(read_mark), %a3 - moveq #-1, %d0 movew #seek_time, %d2 wait_header_init:
@@ -143,10 +143,7 @@ crc1: tstb %a2@ tstb %a3@(read_error - read_mark) moveq #0, %d0 - moveb #0x18, %a3@(write_mode0 - read_mark) - rts signal_nonyb: - moveq #-1, %d0 moveb #0x18, %a3@(write_mode0 - read_mark) rts
@@ -155,6 +152,7 @@ swim_read_sector_data: link %a6, #0 moveml %d1-%d5/%a0-%a5,%sp@- movel %a6@(0x0c), %a4 + moveq #-1, %d0 bsr mfm_read_data moveml %sp@+, %d1-%d5/%a0-%a5 unlk %a6
@@ -238,15 +236,12 @@ data_crc1: tstb %a3@(read_error - read_mark) - moveb #0x18, %a3@(write_mode0 - read_mark) - /* return number of bytes read */ movel #sector_size, %d0 addw #1, %d4 subl %d4, %d0 - rts + data_exit: moveb #0x18, %a3@(write_mode0 - read_mark) - moveq #-1, %d0 rts
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2319/3318 swim: Check error register during sector read
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit d66bdef0a3083fed1a0fc4f0ee1c85b26476b21c ]
Clear the error register only once before a sector read operation. Don't clear it afterwards -- the caller needs it. Check the error register in swim_read_sector() and return the appropriate error when necessary. Fully validate the sector header. Don't terminate the search loop early just because an erroneous sector header showed up.
--- drivers/block/swim.c | 13 +++++++------ drivers/block/swim_asm.S | 8 -------- 2 files changed, 7 insertions(+), 14 deletions(-)
drivers/block/swim.c +7 -6
@@ -483,20 +483,21 @@ static inline int swim_read_sector(struct floppy_state *fs,local_irq_save (flags);for (i =0 ; i <36 ; i++) { - ret =swim_read_sector_header (base, &header); -if (!ret && (header.sector == sector)) { +if (swim_read_sector_header (base, &header) || +swim_read (base, error) || header.track != track || + header.side != side || header.size !=2 ) +continue ; +if (header.sector == sector) {/* found */ ret =swim_read_sector_data (base, buffer); +if (swim_read (base, error)) + ret = -EIO ;break ; } }local_irq_restore (flags); -if ((header.side != side) || (header.track != track) || - (header.sector != sector)) -return 0 ; -return ret; }
drivers/block/swim_asm.S +0 -8
@@ -67,7 +67,6 @@ mfm_read_addrmark: movew #seek_time, %d2 wait_header_init: - tstb %a3@(read_error - read_mark) moveb #0x18, %a3@(write_mode0 - read_mark) moveb #0x01, %a3@(write_mode1 - read_mark) moveb #0x01, %a3@(write_mode0 - read_mark)
@@ -140,8 +139,6 @@ crc1: tstb %a2@ andb #.Lhr_crc_error, %d5 bne signal_nonyb - tstb %a3@(read_error - read_mark) - moveq #0, %d0 signal_nonyb: moveb #0x18, %a3@(write_mode0 - read_mark)
@@ -166,7 +163,6 @@ mfm_read_data: movew #seek_time, %d2 wait_data_init: - tstb %a3@(read_error - read_mark) moveb #0x18, %a3@(write_mode0 - read_mark) moveb #0x01, %a3@(write_mode1 - read_mark) moveb #0x01, %a3@(write_mode0 - read_mark)
@@ -191,8 +187,6 @@ wait_data_mark_byte: /* read data */ - tstb %a3@(read_error - read_mark) - movel #sector_size-1, %d4 /* sector size */ read_new_data: movew #max_retry, %d2
@@ -234,8 +228,6 @@ data_crc1: andb #.Lhr_crc_error, %d5 bne data_exit - tstb %a3@(read_error - read_mark) - /* return number of bytes read */ movel #sector_size, %d0
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2320/3318 swim: Dont use the mark register to read data
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit cb7923133ec18e67e2d6718e29426a4423af6b73 ]
If an unexpected mark byte were to be read from the data register, an error would be flagged. But no error gets flagged when such a byte is read from the mark register, which is misleading. Always use the data register except when a mark byte is expected.
--- drivers/block/swim_asm.S | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
drivers/block/swim_asm.S +11 -10
@@ -47,11 +47,11 @@ .global swim_read_sector_header swim_read_sector_header: link %a6, #0 - moveml %d1-%d5/%a0-%a4,%sp@- + moveml %d1-%d5/%a0-%a5,%sp@- movel %a6@(0x0c), %a4 moveq #-1, %d0 bsr mfm_read_addrmark - moveml %sp@+, %d1-%d5/%a0-%a4 + moveml %sp@+, %d1-%d5/%a0-%a5 unlk %a6 rts
@@ -63,6 +63,7 @@ sector_data_mark: mfm_read_addrmark: movel %a6@(0x08), %a3 lea %a3@(read_handshake), %a2 + lea %a3@(read_data), %a5 lea %a3@(read_mark), %a3 movew #seek_time, %d2
@@ -93,7 +94,7 @@ amark0: tstb %a2@ dbmi %d2, amark0 bpl signal_nonyb - moveb %a3@, %a4@(o_track) + moveb %a5@, %a4@(o_track) moveq #max_retry, %d2
@@ -101,7 +102,7 @@ amark1: tstb %a2@ dbmi %d2, amark1 bpl signal_nonyb - moveb %a3@, %a4@(o_side) + moveb %a5@, %a4@(o_side) moveq #max_retry, %d2
@@ -109,7 +110,7 @@ amark2: tstb %a2@ dbmi %d2, amark2 bpl signal_nonyb - moveb %a3@, %a4@(o_sector) + moveb %a5@, %a4@(o_sector) moveq #max_retry, %d2
@@ -117,7 +118,7 @@ amark3: tstb %a2@ dbmi %d2, amark3 bpl signal_nonyb - moveb %a3@, %a4@(o_size) + moveb %a5@, %a4@(o_size) moveq #max_retry, %d2
@@ -125,7 +126,7 @@ crc0: tstb %a2@ dbmi %d2, crc0 bpl signal_nonyb - moveb %a3@, %a4@(o_crc0) + moveb %a5@, %a4@(o_crc0) moveq #max_retry, %d2
@@ -133,7 +134,7 @@ crc1: tstb %a2@ dbmi %d2, crc1 bpl signal_nonyb - moveb %a3@, %a4@(o_crc1) + moveb %a5@, %a4@(o_crc1) moveb %a2@, %d5 andb #.Lhr_crc_error, %d5
@@ -212,7 +213,7 @@ data_crc0: dbmi %d2, data_crc0 bpl data_exit - moveb %a3@, %d5 + moveb %a5@, %d5 moveq #max_retry, %d2
@@ -222,7 +223,7 @@ data_crc1: dbmi %d2, data_crc1 bpl data_exit - moveb %a3@, %d5 + moveb %a5@, %d5 moveb %a2@, %d5 andb #.Lhr_crc_error, %d5
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2321/3318 swim: Fix buffer overflow
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit a54870a4ae4962acf341eb6ca010cae02af1a6ea ]
The effect of this bug can be observed as swim_read_sector_data() inexplicably returning -5, or an error flag indicating that a mark byte was read from the data register, or other odd behviour.
When copying bytes from the chip FIFO to the read buffer, the driver keeps count of the remaining buffer space using register %d4. A counter in register %d2 serves as a timeout. The driver polls (%a2), the handshake register, until flags indicate that byte(s) have arrived in the FIFO.
movel #sector_size-1, %d4
read_new_data:
movew #max_retry, %d2
read_data_loop:
moveb %a2@, %d5
andb #0xc0, %d5
dbne %d2, read_data_loop
beq data_exit
moveb %a5@, %a4@+
andb #0x40, %d5
dbne %d4, read_new_data
beq exit_loopNote that the exit_loop branch depends upon a flag in the handshake register and not on the remaining buffer space. Hence there may be no branch to exit_loop after %d4 is decremented to -1 (i.e. full buffer).
moveb %a5@, %a4@+
dbra %d4, read_new_dataexit_loop:
Here is a second decrement of %d4 which can now reach -2. But the buffer bounds check is a comparison with -1, which is now ineffective. Hence the loop will continue copying until %d2 eventually reaches -1.
Fix this bug by terminating the loop as soon as %d4 or %d2 reach -1. Reset the timeout whenever a byte is copied.
--- drivers/block/swim_asm.S | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/block/swim_asm.S +9 -7
@@ -43,6 +43,8 @@ .equ sector_size, 512 .equ .Lhr_crc_error, 0x02 + .equ .Lhr_fifo_2bytes, 0x40 + .equ .Lhr_fifo_1byte, 0x80 .global swim_read_sector_header swim_read_sector_header:
@@ -189,20 +191,20 @@ wait_data_mark_byte: /* read data */ movel #sector_size-1, %d4 /* sector size */ -read_new_data: movew #max_retry, %d2 read_data_loop: moveb %a2@, %d5 - andb #0xc0, %d5 + andb #(.Lhr_fifo_1byte + .Lhr_fifo_2bytes), %d5 dbne %d2, read_data_loop beq data_exit + moveq #max_retry, %d2 moveb %a5@, %a4@+ - andb #0x40, %d5 - dbne %d4, read_new_data - beq exit_loop + dbra %d4, 1f + bra data_crc0 +1: andb #.Lhr_fifo_2bytes, %d5 + beq read_data_loop moveb %a5@, %a4@+ - dbra %d4, read_new_data -exit_loop: + dbra %d4, read_data_loop /* read CRC */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2322/3318 swim: Remove redundant RELAX actions
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit 04cb277e6841b55b950b42063fe11501b5d1676a ]
Wherever we have a swim_select() or swim_readbit() call there is an implicit RELAX. That means the caller doesn't have to do it. Remove the redundant code.
BTW, Inside Macintosh says, "Be sure [...] that CA0 and CA1 are set high before changing SEL." Hence the RELAX found in swim_select(). The SwimIII driver in mkLinux also has that. But the swim3.c driver in Linux is odd:
it scatters RELAX actions around as though SEL was not actually under its control... In anycase, swim.c really does control SEL so there's no need for that here.
Stable-dep-of: b736189c93c9 ("swim: Deduplicate polling loops")
--- drivers/block/swim.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/block/swim.c +1 -7
@@ -337,7 +337,6 @@ static inline void swim_motor(struct swim __iomem *base,swim_action (base,MOTOR_ON );for (i =0 ; i <2 *HZ ; i++) { -swim_select (base,RELAX );if (swim_readbit (base,MOTOR_ON ))break ;set_current_state (TASK_INTERRUPTIBLE );
@@ -345,7 +344,7 @@ static inline void swim_motor(struct swim __iomem *base, } }else if (action ==OFF ) {swim_action (base,MOTOR_OFF ); -swim_select (base,RELAX ); +swim_write (base, phase,RELAX |PHASE_PIN_DIR ); } }
@@ -356,13 +355,11 @@ static inline void swim_eject(struct swim __iomem *base)swim_action (base,EJECT );for (i =0 ; i <2 *HZ ; i++) { -swim_select (base,RELAX );if (!swim_readbit (base,DISK_IN ))break ;set_current_state (TASK_INTERRUPTIBLE );schedule_timeout (1 ); } -swim_select (base,RELAX ); }static inline void swim_head (struct swim __iomem *base,enum head head)
@@ -386,7 +383,6 @@ static inline int swim_step(struct swim __iomem *base)set_current_state (TASK_INTERRUPTIBLE );schedule_timeout (1 ); -swim_select (base,RELAX );if (!swim_readbit (base,STEP ))return 0 ; }
@@ -400,8 +396,6 @@ static inline int swim_track00(struct swim __iomem *base)swim_action (base,SEEK_NEGATIVE );for (try =0 ; try <100 ; try++) { - -swim_select (base,RELAX );msleep (3 );if (swim_readbit (base,TRACK_ZERO ))
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2323/3318 swim: Deduplicate polling loops
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit b736189c93c9ad1056521a4229ec2f252b714b5a ]
Replace duplicated polling loops with poll_timeout_us(). Change the interruptible sleep to uninterruptible because signal delivery shouldn't be allowed to shorten delays required by the drive hardware.
Change the timeout for the !STEP transition to 20 ms in accordance with the maximum interval required by the UPD72070 spec. The existing 1 second timeout is impractical considering the number of steps in a typical seek.
Change the return type of swim_readbit() to bool because that way the bit names make sense i.e. the reader doesn't have to remember to invert the active-low logic used for drive signals.
--- drivers/block/swim.c | 39 ++++++++------------------------------- 1 file changed, 8 insertions(+), 31 deletions(-)
drivers/block/swim.c +8 -31
@@ -19,6 +19,7 @@#include <linux/major.h> #include <linux/mutex.h> #include <linux/hdreg.h> +#include <linux/iopoll.h> #include <linux/kernel.h> #include <linux/delay.h> #include <linux/platform_device.h>
@@ -297,7 +298,7 @@ static inline void swim_action(struct swim __iomem *base, int action)local_irq_restore (flags); } -static inline int swim_readbit (struct swim __iomem *base,int bit) +static inline bool swim_readbit (struct swim __iomem *base,int bit) {int stat;
@@ -310,6 +311,9 @@ static inline int swim_readbit(struct swim __iomem *base, int bit)return (stat &SENSE ) ==0 ; } +#define swim_readbit_timeout (base, bit, val, timeout_us) \ + poll_timeout_us(, swim_readbit(base, bit) == val, 1000, timeout_us, false) +static inline void swim_drive (struct swim __iomem *base,enum drive_location location) {
@@ -332,16 +336,8 @@ static inline void swim_motor(struct swim __iomem *base, enum motor_action action) {if (action ==ON ) { -int i; -swim_action (base,MOTOR_ON ); - -for (i =0 ; i <2 *HZ ; i++) { -if (swim_readbit (base,MOTOR_ON )) -break ; -set_current_state (TASK_INTERRUPTIBLE ); -schedule_timeout (1 ); - } +swim_readbit_timeout (base,MOTOR_ON , true,2000 *1000 ); }else if (action ==OFF ) {swim_action (base,MOTOR_OFF );swim_write (base, phase,RELAX |PHASE_PIN_DIR );
@@ -350,16 +346,8 @@ static inline void swim_motor(struct swim __iomem *base,static inline void swim_eject (struct swim __iomem *base) { -int i; -swim_action (base,EJECT ); - -for (i =0 ; i <2 *HZ ; i++) { -if (!swim_readbit (base,DISK_IN )) -break ; -set_current_state (TASK_INTERRUPTIBLE ); -schedule_timeout (1 ); - } +swim_readbit_timeout (base,DISK_IN , false,2000 *1000 ); }static inline void swim_head (struct swim __iomem *base,enum head head)
@@ -374,19 +362,8 @@ static inline void swim_head(struct swim __iomem *base, enum head head)static inline int swim_step (struct swim __iomem *base) { -int wait; -swim_action (base,STEP ); - -for (wait =0 ; wait <HZ ; wait++) { - -set_current_state (TASK_INTERRUPTIBLE ); -schedule_timeout (1 ); - -if (!swim_readbit (base,STEP )) -return 0 ; - } -return -1 ; +return swim_readbit_timeout (base,STEP , false,20 *1000 ); }static inline int swim_track00 (struct swim __iomem *base)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2324/3318 swim: Check drive ready bit
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit abae04f5bed924590e98fe1519566a6e0144e6b5 ]
The drive provides a readiness signal that has to be tested before certain commands are issued to the drive. Rename the SEEK_COMPLETE flag as READY because that's how it's known in the documentation as well as the mkLinux source code.
Poll for that signal after stepping the heads and also after switching to MFM mode, as that's what mkLinux does. Check for readiness when stepping because testing shows that some drives require this.
--- drivers/block/swim.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-)
drivers/block/swim.c +22 -7
@@ -117,7 +117,7 @@ struct iwm {#define TACHO 0x103#define READ_DATA_1 0x104#define GCR_MODE 0x105 -#define SEEK_COMPLETE 0x106 +#define READY 0x106#define TWOMEG_MEDIA 0x107/* Bits in handshake register */
@@ -314,6 +314,14 @@ static inline bool swim_readbit(struct swim __iomem *base, int bit)#define swim_readbit_timeout (base, bit, val, timeout_us) \ poll_timeout_us(, swim_readbit(base, bit) == val, 1000, timeout_us, false) +#define swim_READY_timeout (base) \ +({ \ + int ret = swim_readbit_timeout(base, READY, true, 1000 * 1000); \ + if (ret) \ + printk(KERN_DEBUG "%s: drive not ready\n", __func__); \ + ret; \ +}) +static inline void swim_drive (struct swim __iomem *base,enum drive_location location) {
@@ -352,8 +360,6 @@ static inline void swim_eject(struct swim __iomem *base)static inline void swim_head (struct swim __iomem *base,enum head head) { -/* wait drive is ready */ -if (head ==UPPER_HEAD )swim_select (base,READ_DATA_1 );else if (head ==LOWER_HEAD )
@@ -388,20 +394,25 @@ static inline int swim_track00(struct swim __iomem *base)static inline int swim_seek (struct swim __iomem *base,int step) { -if (step ==0 ) -return 0 ; -if (step <0 ) {swim_action (base,SEEK_NEGATIVE ); step = -step; - }else + }else if (step >0 )swim_action (base,SEEK_POSITIVE ); +swim_READY_timeout (base); + +if (step ==0 ) +return 0 ; +for ( ; step >0 ; step--) {if (swim_step (base))return -1 ; } +msleep (30 ); +swim_READY_timeout (base); +return 0 ; }
@@ -483,6 +494,8 @@ static blk_status_t floppy_read_sectors(struct floppy_state *fs,swim_drive (base, fs->location); +swim_READY_timeout (base); +for (i = req_sector; i < req_sector + sectors_nb; i++) {int x; track = i / fs->secpercyl;
@@ -606,6 +619,8 @@ static int floppy_open(struct gendisk *disk, blk_mode_t mode)swim_motor (base,ON );swim_action (base,SETMFM ); +msleep (30 ); +swim_READY_timeout (base);set_capacity (fs->disk, fs->total_secs);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2325/3318 swim: Revisit delays
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit bbcd3e38a4f355d6b0320f3f6916df96c109f2ad ]
AFAIK, timing requirements for the various FDHD drive mechanisms aren't well documented. But we do have the UPD72070 spec and secondary sources like swim3.c and mkLinux source code. This patch is needed to satisfy the requirements in the UPD72070 spec and follows mkLinux.
Change the LSTRB pulse to 2 microseconds, because this is what mkLinux does. Inside Macintosh says, "Hold LSTRB high for at least one usec but not more than one msec".
When a disk is ejected, pause before de-asserting /ENBL. Wait 150 us after the STEP command for valid signalling. Pause for 1 us after setting the step direction before sending the STEP command.
--- drivers/block/swim.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/block/swim.c +5 -1
@@ -291,7 +291,7 @@ static inline void swim_action(struct swim __iomem *base, int action)swim_select (base, action);udelay (1 );swim_write (base, phase,LSTRB | action |PHASE_PIN_DIR ); -udelay (1 ); +udelay (2 );swim_write (base, phase, action |PHASE_PIN_DIR );udelay (1 );
@@ -338,6 +338,7 @@ static inline void swim_drive(struct swim __iomem *base,swim_write (base, mode0,EXTERNAL_DRIVE );swim_write (base, mode0,MOTON ); } +udelay (1 ); } static inline void swim_motor(struct swim __iomem *base,
@@ -356,6 +357,7 @@ static inline void swim_eject(struct swim __iomem *base) {swim_action (base,EJECT );swim_readbit_timeout (base,DISK_IN , false,2000 *1000 ); +msleep (1 ); }static inline void swim_head (struct swim __iomem *base,enum head head)
@@ -369,6 +371,7 @@ static inline void swim_head(struct swim __iomem *base, enum head head)static inline int swim_step (struct swim __iomem *base) {swim_action (base,STEP ); +udelay (150 );return swim_readbit_timeout (base,STEP , false,20 *1000 ); }
@@ -399,6 +402,7 @@ static inline int swim_seek(struct swim __iomem *base, int step) step = -step; }else if (step >0 )swim_action (base,SEEK_POSITIVE ); +udelay (1 );swim_READY_timeout (base);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2326/3318 swim: Dont search beyond the first data mark
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit 79eafa4ccb74be023fd2cae87d75425d6eb903bb ]
The ISM chip does an automatic MFM gap/sync search when the Action bit is first set. That search may stop at any of a) post-index gap, b) address field gap or c) data field gap. To find the next sector header, the driver need not search at all. It only has to validate the mark bytes.
Once the sector address mark has been validated, swim_read_sector_data() is called to read the sector contents. Between the sector address and data fields lies an intra-sector gap followed by a data field mark. After this mark is validated, the 512-byte data area is read into the IO request buffer.
Problem is, if any byte in the data field mark is mis-read, the driver searches the whole sector and then reaches the data field mark in the following sector. The wrong sector is then read into the buffer, and swim_read_sector_data() returns success. The request is silently corrupted.
The existing limit on polling loop iterations does constrain the search distance but is inherently tied to CPU speed. This is probably the reason why corruption was only observed on a 68030 system.
Discontinue the mark search when the mark bytes fail validation.
--- drivers/block/swim_asm.S | 73 ++++++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 33 deletions(-)
drivers/block/swim_asm.S +40 -33
@@ -41,18 +41,45 @@ .equ seek_time, 30000 .equ max_retry, 40 .equ sector_size, 512 + .equ .Lmark_sequence_len, 4 .equ .Lhr_crc_error, 0x02 .equ .Lhr_fifo_2bytes, 0x40 .equ .Lhr_fifo_1byte, 0x80 +.Lmfm_mark_check: + /* + * This subroutine reads and validates a mark byte sequence. + * On entry, %a1 and %d4 shall hold the location and length (resp.) + * of the mark byte array. + * %a2 and %a3 shall hold the locations of the handshake and mark + * registers. + * Returns zero in %d1 for success. + */ + + moveq #-1, %d1 + subq #1, %d4 + movew #seek_time, %d2 + +5: tstb %a2@ + dbmi %d2, 5b + bpl 6f + + moveb %a3@, %d3 + cmpb %a1@+, %d3 + dbne %d4, 5b + bne 6f + + moveq #0, %d1 +6: rts + .global swim_read_sector_header swim_read_sector_header: link %a6, #0 moveml %d1-%d5/%a0-%a5,%sp@- movel %a6@(0x0c), %a4 moveq #-1, %d0 - bsr mfm_read_addrmark + bsr .Lmfm_read_header moveml %sp@+, %d1-%d5/%a0-%a5 unlk %a6 rts
@@ -62,33 +89,25 @@ sector_address_mark: sector_data_mark: .byte 0xa1, 0xa1, 0xa1, 0xfb -mfm_read_addrmark: +.Lmfm_read_header: movel %a6@(0x08), %a3 lea %a3@(read_handshake), %a2 lea %a3@(read_data), %a5 lea %a3@(read_mark), %a3 - movew #seek_time, %d2 -wait_header_init: moveb #0x18, %a3@(write_mode0 - read_mark) moveb #0x01, %a3@(write_mode1 - read_mark) moveb #0x01, %a3@(write_mode0 - read_mark) tstb %a3@(read_error - read_mark) moveb #0x08, %a3@(write_mode1 - read_mark) - lea sector_address_mark, %a0 - moveq #3, %d1 - -wait_addr_mark_byte: - - tstb %a2@ - dbmi %d2, wait_addr_mark_byte - bpl signal_nonyb + lea sector_address_mark, %a1 + moveq #.Lmark_sequence_len, %d4 + bsr .Lmfm_mark_check + tstl %d1 + bne signal_nonyb - moveb %a3@, %d3 - cmpb %a0@+, %d3 - dbne %d1, wait_addr_mark_byte - bne wait_header_init + /* read header */ moveq #max_retry, %d2
@@ -163,30 +182,18 @@ mfm_read_data: lea %a3@(read_handshake), %a2 lea %a3@(read_data), %a5 lea %a3@(read_mark), %a3 - movew #seek_time, %d2 -wait_data_init: moveb #0x18, %a3@(write_mode0 - read_mark) moveb #0x01, %a3@(write_mode1 - read_mark) moveb #0x01, %a3@(write_mode0 - read_mark) tstb %a3@(read_error - read_mark) moveb #0x08, %a3@(write_mode1 - read_mark) - lea sector_data_mark, %a0 - moveq #3, %d1 - - /* wait data address mark */ - -wait_data_mark_byte: - - tstb %a2@ - dbmi %d2, wait_data_mark_byte - bpl data_exit - - moveb %a3@, %d3 - cmpb %a0@+, %d3 - dbne %d1, wait_data_mark_byte - bne wait_data_init + lea sector_data_mark, %a1 + moveq #.Lmark_sequence_len, %d4 + bsr .Lmfm_mark_check + tstl %d1 + bne data_exit /* read data */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2327/3318 media: i2c: ov5648: Fix a data race on state->streaming
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ginger Li <[email protected]>
[ Upstream commit 76c8ffbe1b9bc0ee4c977180e3f498352de0d01e ]
ov5648_s_stream() updates state->streaming after it has released sensor->mutex, while ov5648_resume() reads that field with sensor->mutex held. A concurrent resume can therefore observe a stale streaming state and leave the sensor in standby while the software believes that it is streaming, or the other way around.
Keep the update inside the sensor->mutex protected section that already programs the standby mode.
--- drivers/media/i2c/ov5648.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/i2c/ov5648.c +2 -2
@@ -2145,13 +2145,13 @@ static int ov5648_s_stream(struct v4l2_subdev *subdev, int enable)mutex_lock (&sensor->mutex); ret =ov5648_sw_standby (sensor, !enable); +if (!ret) + state->streaming = !!enable;mutex_unlock (&sensor->mutex);if (ret)return ret; - state->streaming = !!enable; -if (!enable)pm_runtime_put (sensor->dev);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2328/3318 serial: sifive: fix off-by-one in console port bounds check
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zongmin Zhou <[email protected]>
[ Upstream commit bf961847813d9edcb5a9c089714069428d141fa9 ]
sifive_serial_console_ports[] is sized SIFIVE_SERIAL_MAX_PORTS (8), so valid indices are 0..7. The bounds check in sifive_serial_probe() uses "id > SIFIVE_SERIAL_MAX_PORTS", which lets id == 8 pass and causes an out-of-bounds write in __ssp_add_console_port() through sifive_serial_console_ports[ssp->port.line].
Fix the check to use >= instead, matching the check already used in sifive_serial_console_setup().
--- drivers/tty/serial/sifive.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/sifive.c +1 -1
@@ -940,7 +940,7 @@ static int sifive_serial_probe(struct platform_device *pdev) }#ifdef CONFIG_SERIAL_SIFIVE_CONSOLE -if (id >SIFIVE_SERIAL_MAX_PORTS ) { +if (id >=SIFIVE_SERIAL_MAX_PORTS ) {dev_err (&pdev->dev,"too many UARTs (%d)\n" , id);return -EINVAL ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2329/3318 dt-bindings: Add vendor prefixes
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <[email protected]>
[ Upstream commit 714ff69c331c005c9cd05d69d3c6fe9da20ef687 ]
These vendor prefixes are used by some routers supported by e.g. OpenWrt.
- ADI Engineering is a US telecom equipment company.
- Arcom Controllers is a US manufacturer of repeaters.
- Freecom Gmbh is a german telecom equipment company.
- Gemtek Technology is a Taiwan telecom company.
- Gateway Communications was a telecommunication company, now acquired by HKT Limited/PCCW.
- Goramo Gorecki is a privately owned Polish telecom company.
- U.S. Robotics Corporation, known through their brand name USRobotics is generally referred to as "USR" so use this prefix for the company's device tree bindings.
Stable-dep-of: aa906abf611c ("dt-bindings: vendor-prefixes: add Free Mobile")
--- Documentation/devicetree/bindings/vendor-prefixes.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +14 -0
@@ -59,6 +59,8 @@ patternProperties: description: AD Holdings Plc. "^adi,.*": description: Analog Devices, Inc. + "^adieng,.*": + description: ADI Engineering, Inc. "^advantech,.*": description: Advantech Corporation "^aeroflexgaisler,.*":
@@ -127,6 +129,8 @@ patternProperties: description: Arasan Chip Systems "^archermind,.*": description: ArcherMind Technology (Nanjing) Co., Ltd. + "^arcom,.*": + description: Arcom Controllers "^arctic,.*": description: Arctic Sand "^arcx,.*":
@@ -486,6 +490,8 @@ patternProperties: description: FocalTech Systems Co.,Ltd "^forlinx,.*": description: Baoding Forlinx Embedded Technology Co., Ltd. + "^freecom,.*": + description: Freecom Gmbh "^frida,.*": description: Shenzhen Frida LCD Co., Ltd. "^friendlyarm,.*":
@@ -498,6 +504,8 @@ patternProperties: description: FX Technology Ltd. "^gardena,.*": description: GARDENA GmbH + "^gateway,.*": + description: Gateway Communications "^gateworks,.*": description: Gateworks Corporation "^gcw,.*":
@@ -512,6 +520,8 @@ patternProperties: description: GE Fanuc Intelligent Platforms Embedded Systems, Inc. "^gemei,.*": description: Gemei Digital Technology Co., Ltd. + "^gemtek,.*": + description: Gemtek Technology Co., Ltd. "^genesys,.*": description: Genesys Logic, Inc. "^geniatech,.*":
@@ -534,6 +544,8 @@ patternProperties: description: Shenzhen Huiding Technology Co., Ltd. "^google,.*": description: Google, Inc. + "^goramo,.*": + description: Goramo Gorecki "^gplus,.*": description: GPLUS "^grinn,.*":
@@ -1454,6 +1466,8 @@ patternProperties: description: United Radiant Technology Corporation "^usi,.*": description: Universal Scientific Industrial Co., Ltd. + "^usr,.*": + description: U.S. Robotics Corporation "^utoo,.*": description: Aigo Digital Technology Co., Ltd. "^v3,.*":
Greg Kroah-Hartman
maintainerPATCH 2330/3318 dt-bindings: vendor-prefixes: add Free Mobile
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vincent Jardin <[email protected]>
[ Upstream commit aa906abf611c7f37c0fe9171c1d33c40270aa5fe ]
Free Mobile is a French mobile network operator. Add its vendor prefix, used by the Nodebox v3 CPU Module (freemobile,nbxv3).
--- Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
@@ -492,6 +492,8 @@ patternProperties: description: Baoding Forlinx Embedded Technology Co., Ltd. "^freecom,.*": description: Freecom Gmbh + "^freemobile,.*": + description: Free Mobile "^frida,.*": description: Shenzhen Frida LCD Co., Ltd. "^friendlyarm,.*":
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2331/3318 clk: qcom: dispcc-sm8450: Fix disp_cc_mdss_mdp_clk_src ops
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Esteban Urrutia <[email protected]>
[ Upstream commit 8464e2284fec42d9fd05f3109d8b209d65864ece ]
If the clock frequency is changed at registration time, a flicker will be visible at boot.
Switching to clk_rcg2_shared_no_init_park_ops fixes this.
--- drivers/clk/qcom/dispcc-sm8450.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/dispcc-sm8450.c +1 -1
@@ -569,7 +569,7 @@ static struct clk_rcg2 disp_cc_mdss_mdp_clk_src = { .parent_data = disp_cc_parent_data_5, .num_parents = ARRAY_SIZE(disp_cc_parent_data_5), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_shared_ops, + .ops = &clk_rcg2_shared_no_init_park_ops, }, };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2332/3318 tools/nolibc: fix WIFSIGNALED() for status 0
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Danish Khateeb <[email protected]>
[ Upstream commit 368fae47c6cae28a312c5dc86e5bdb8f9369fd26 ]
WIFSIGNALED() needs the subtraction to wrap around for status 0, so that only 1 to 0xff, a terminating signal with or without the core dump flag, pass the check. But status is an int, and 0 - 1 is -1, which is less than 0xff. A child that exits with 0 is therefore reported as both exited and killed, and a caller that tests WIFSIGNALED() first sees "killed by signal 0".
Make the subtraction unsigned, as musl does in the same macro.
--- tools/include/nolibc/types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/include/nolibc/types.h +1 -1
@@ -106,7 +106,7 @@#define WEXITSTATUS (status) (((status) & 0xff00) >> 8)#define WIFEXITED (status) (((status) & 0x7f) == 0)#define WTERMSIG (status) ((status) & 0x7f) -#define WIFSIGNALED (status) ((status) - 1 < 0xff) +#define WIFSIGNALED (status) ((status) - 1U < 0xff)/* waitpid() flags */ #define WNOHANG 1
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2333/3318 bpftool: Add support to display uprobe_multi links
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Olsa <[email protected]>
[ Upstream commit a7795698f8b6c48283fa4334eb313bc1350b2864 ]
Adding support to display details for uprobe_multi links, both plain:
# bpftool link -p
...
24: uprobe_multi prog 126
uprobe.multi path /home/jolsa/bpf/test_progs func_cnt 3 pid 4143
offset ref_ctr_offset cookies
0xd1f88 0xf5d5a8 0xdead
0xd1f8f 0xf5d5aa 0xbeef
0xd1f96 0xf5d5ac 0xcafeand json:
# bpftool link -p
[{
...
},{
"id": 24,
"type": "uprobe_multi",
"prog_id": 126,
"retprobe": false,
"path": "/home/jolsa/bpf/test_progs",
"func_cnt": 3,
"pid": 4143,
"funcs": [{
"offset": 860040,
"ref_ctr_offset": 16111016,
"cookie": 57005
},{
"offset": 860047,
"ref_ctr_offset": 16111018,
"cookie": 48879
},{
"offset": 860054,
"ref_ctr_offset": 16111020,
"cookie": 51966
}
]
}
]Stable-dep-of: dbf8cef936c7 ("bpftool: Fix CPU IDs in per-CPU map output")
--- tools/bpf/bpftool/link.c | 105 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 103 insertions(+), 2 deletions(-)
tools/bpf/bpftool/link.c +103 -2
@@ -293,6 +293,37 @@ show_kprobe_multi_json(struct bpf_link_info *info, json_writer_t *wtr)jsonw_end_array (json_wtr); } +static __u64 *u64_to_arr (__u64 val) +{ +return (__u64 *)u64_to_ptr (val); +} + +static void +show_uprobe_multi_json (struct bpf_link_info *info,json_writer_t *wtr) +{ +__u32 i; + +jsonw_bool_field (json_wtr,"retprobe" , + info->uprobe_multi.flags &BPF_F_UPROBE_MULTI_RETURN ); +jsonw_string_field (json_wtr,"path" , (char *)u64_to_ptr (info->uprobe_multi.path)); +jsonw_uint_field (json_wtr,"func_cnt" , info->uprobe_multi.count); +jsonw_int_field (json_wtr,"pid" , (int ) info->uprobe_multi.pid); +jsonw_name (json_wtr,"funcs" ); +jsonw_start_array (json_wtr); + +for (i =0 ; i < info->uprobe_multi.count; i++) { +jsonw_start_object (json_wtr); +jsonw_uint_field (json_wtr,"offset" , +u64_to_arr (info->uprobe_multi.offsets)[i]); +jsonw_uint_field (json_wtr,"ref_ctr_offset" , +u64_to_arr (info->uprobe_multi.ref_ctr_offsets)[i]); +jsonw_uint_field (json_wtr,"cookie" , +u64_to_arr (info->uprobe_multi.cookies)[i]); +jsonw_end_object (json_wtr); + } +jsonw_end_array (json_wtr); +} +static void show_perf_event_kprobe_json (struct bpf_link_info *info,json_writer_t *wtr) {
@@ -459,6 +490,9 @@ static int show_link_close_json(int fd, struct bpf_link_info *info)case BPF_LINK_TYPE_KPROBE_MULTI :show_kprobe_multi_json (info, json_wtr);break ; +case BPF_LINK_TYPE_UPROBE_MULTI : +show_uprobe_multi_json (info, json_wtr); +break ;case BPF_LINK_TYPE_PERF_EVENT :switch (info->perf_event.type) {case BPF_PERF_EVENT_EVENT :
@@ -666,6 +700,33 @@ static void show_kprobe_multi_plain(struct bpf_link_info *info) } } +static void show_uprobe_multi_plain (struct bpf_link_info *info) +{ +__u32 i; + +if (!info->uprobe_multi.count) +return ; + +if (info->uprobe_multi.flags &BPF_F_UPROBE_MULTI_RETURN ) +printf ("\n\turetprobe.multi " ); +else +printf ("\n\tuprobe.multi " ); + +printf ("path %s " , (char *)u64_to_ptr (info->uprobe_multi.path)); +printf ("func_cnt %u " , info->uprobe_multi.count); + +if (info->uprobe_multi.pid) +printf ("pid %d " , info->uprobe_multi.pid); + +printf ("\n\t%-16s %-16s %-16s" ,"offset" ,"ref_ctr_offset" ,"cookies" ); +for (i =0 ; i < info->uprobe_multi.count; i++) { +printf ("\n\t0x%-16llx 0x%-16llx 0x%-16llx" , +u64_to_arr (info->uprobe_multi.offsets)[i], +u64_to_arr (info->uprobe_multi.ref_ctr_offsets)[i], +u64_to_arr (info->uprobe_multi.cookies)[i]); + } +} +static void show_perf_event_kprobe_plain (struct bpf_link_info *info) {const char *buf;
@@ -792,6 +853,9 @@ static int show_link_close_plain(int fd, struct bpf_link_info *info)case BPF_LINK_TYPE_KPROBE_MULTI :show_kprobe_multi_plain (info);break ; +case BPF_LINK_TYPE_UPROBE_MULTI : +show_uprobe_multi_plain (info); +break ;case BPF_LINK_TYPE_PERF_EVENT :switch (info->perf_event.type) {case BPF_PERF_EVENT_EVENT :
@@ -831,8 +895,10 @@ static int show_link_close_plain(int fd, struct bpf_link_info *info)static int do_show_link (int fd) { +__u64 *ref_ctr_offsets =NULL , *offsets =NULL , *cookies =NULL ;struct bpf_link_info info;__u32 len =sizeof (info); +char path_buf[PATH_MAX ];__u64 *addrs =NULL ;char buf[PATH_MAX ];int count;
@@ -874,6 +940,39 @@ static int do_show_link(int fd) goto again; } } +if (info.type ==BPF_LINK_TYPE_UPROBE_MULTI && + !info.uprobe_multi.offsets) { + count = info.uprobe_multi.count; +if (count) { + offsets =calloc (count,sizeof (__u64)); +if (!offsets) { +p_err ("mem alloc failed" ); +close (fd); +return -ENOMEM ; + } + info.uprobe_multi.offsets =ptr_to_u64 (offsets); + ref_ctr_offsets =calloc (count,sizeof (__u64)); +if (!ref_ctr_offsets) { +p_err ("mem alloc failed" ); +free (offsets); +close (fd); +return -ENOMEM ; + } + info.uprobe_multi.ref_ctr_offsets =ptr_to_u64 (ref_ctr_offsets); + cookies =calloc (count,sizeof (__u64)); +if (!cookies) { +p_err ("mem alloc failed" ); +free (cookies); +free (offsets); +close (fd); +return -ENOMEM ; + } + info.uprobe_multi.cookies =ptr_to_u64 (cookies); + info.uprobe_multi.path =ptr_to_u64 (path_buf); + info.uprobe_multi.path_size =sizeof (path_buf); + goto again; + } + }if (info.type ==BPF_LINK_TYPE_PERF_EVENT ) {switch (info.perf_event.type) {case BPF_PERF_EVENT_TRACEPOINT :
@@ -909,8 +1008,10 @@ static int do_show_link(int fd)else show_link_close_plain (fd, &info); -if (addrs) -free (addrs); +free (ref_ctr_offsets); +free (cookies); +free (offsets); +free (addrs);close (fd);return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2334/3318 bpftool: Generated shadow variables for struct_ops maps.
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kui-Feng Lee <[email protected]>
[ Upstream commit a7b0fa352eafef95bd0d736ca94965d3f884ad18 ]
Declares and defines a pointer of the shadow type for each struct_ops map.
The code generator will create an anonymous struct type as the shadow type for each struct_ops map. The shadow type is translated from the original struct type of the map. The user of the skeleton use pointers of them to access the values of struct_ops maps.
However, shadow types only supports certain types of fields, including scalar types and function pointers. Any fields of unsupported types are translated into an array of characters to occupy the space of the original field. Function pointers are translated into pointers of the struct bpf_program. Additionally, padding fields are generated to occupy the space between two consecutive fields.
The pointers of shadow types of struct_osp maps are initialized when *__open_opts() in skeletons are called. For a map called FOO, the user can access it through the pointer at skel->struct_ops.FOO.
Stable-dep-of: dbf8cef936c7 ("bpftool: Fix CPU IDs in per-CPU map output")
--- tools/bpf/bpftool/gen.c | 237 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 236 insertions(+), 1 deletion(-)
tools/bpf/bpftool/gen.c +236 -1
@@ -54,6 +54,20 @@ static bool str_has_suffix(const char *str, const char *suffix)return true; } +static const struct btf_type * +resolve_func_ptr (const struct btf *btf,__u32 id,__u32 *res_id) +{ +const struct btf_type *t; + + t =skip_mods_and_typedefs (btf, id,NULL ); +if (!btf_is_ptr (t)) +return NULL ; + + t =skip_mods_and_typedefs (btf, t->type, res_id); + +return btf_is_func_proto (t) ? t :NULL ; +} +static void get_obj_name (char *name,const char *file) {/* Using basename() GNU version which doesn't modify arg. */
@@ -903,6 +917,207 @@ codegen_progs_skeleton(struct bpf_object *obj, size_t prog_cnt, bool populate_li } } +static int walk_st_ops_shadow_vars (struct btf *btf,const char *ident, +const struct btf_type *map_type,__u32 map_type_id) +{ + LIBBPF_OPTS(btf_dump_emit_type_decl_opts, opts, .indent_level = 3); +const struct btf_type *member_type; +__u32 offset, next_offset =0 ; +const struct btf_member *m; +struct btf_dump *d =NULL ; +const char *member_name; +__u32 member_type_id; +int i, err =0 , n; +int size; + + d =btf_dump__new (btf, codegen_btf_dump_printf,NULL ,NULL ); +if (!d) +return -errno; + + n =btf_vlen (map_type); +for (i =0 , m =btf_members (map_type); i < n; i++, m++) { + member_type =skip_mods_and_typedefs (btf, m->type, &member_type_id); + member_name =btf__name_by_offset (btf, m->name_off); + + offset = m->offset /8 ; +if (next_offset < offset) +printf ("\t\t\tchar __padding_%d[%d];\n" , i, offset - next_offset); + +switch (btf_kind (member_type)) { +case BTF_KIND_INT : +case BTF_KIND_FLOAT : +case BTF_KIND_ENUM : +case BTF_KIND_ENUM64 : +/* scalar type */ +printf ("\t\t\t" ); + opts.field_name = member_name; + err =btf_dump__emit_type_decl (d, member_type_id, &opts); +if (err) { +p_err ("Failed to emit type declaration for %s: %d" , member_name, err); + goto out; + } +printf (";\n" ); + + size =btf__resolve_size (btf, member_type_id); +if (size <0 ) { +p_err ("Failed to resolve size of %s: %d\n" , member_name, size); + err = size; + goto out; + } + + next_offset = offset + size; +break ; + +case BTF_KIND_PTR : +if (resolve_func_ptr (btf, m->type,NULL )) { +/* Function pointer */ +printf ("\t\t\tstruct bpf_program *%s;\n" , member_name); + + next_offset = offset +sizeof (void *); +break ; + } +/* All pointer types are unsupported except for +* function pointers. +*/ + fallthrough; + +default : +/* Unsupported types +* +* Types other than scalar types and function +* pointers are currently not supported in order to +* prevent conflicts in the generated code caused +* by multiple definitions. For instance, if the +* struct type FOO is used in a struct_ops map, +* bpftool has to generate definitions for FOO, +* which may result in conflicts if FOO is defined +* in different skeleton files. +*/ + size =btf__resolve_size (btf, member_type_id); +if (size <0 ) { +p_err ("Failed to resolve size of %s: %d\n" , member_name, size); + err = size; + goto out; + } +printf ("\t\t\tchar __unsupported_%d[%d];\n" , i, size); + + next_offset = offset + size; +break ; + } + } + +/* Cannot fail since it must be a struct type */ + size =btf__resolve_size (btf, map_type_id); +if (next_offset < (__u32 )size) +printf ("\t\t\tchar __padding_end[%d];\n" , size - next_offset); + +out: +btf_dump__free (d); + +return err; +} + +/* Generate the pointer of the shadow type for a struct_ops map. +* +* This function adds a pointer of the shadow type for a struct_ops map. +* The members of a struct_ops map can be exported through a pointer to a +* shadow type. The user can access these members through the pointer. +* +* A shadow type includes not all members, only members of some types. +* They are scalar types and function pointers. The function pointers are +* translated to the pointer of the struct bpf_program. The scalar types +* are translated to the original type without any modifiers. +* +* Unsupported types will be translated to a char array to occupy the same +* space as the original field, being renamed as __unsupported_*. The user +* should treat these fields as opaque data. +*/ +static int gen_st_ops_shadow_type (const char *obj_name,struct btf *btf,const char *ident, +const struct bpf_map *map) +{ +const struct btf_type *map_type; +const char *type_name; +__u32 map_type_id; +int err; + + map_type_id =bpf_map__btf_value_type_id (map); +if (map_type_id ==0 ) +return -EINVAL ; + map_type =btf__type_by_id (btf, map_type_id); +if (!map_type) +return -EINVAL ; + + type_name =btf__name_by_offset (btf, map_type->name_off); + +printf ("\t\tstruct %s__%s__%s {\n" , obj_name, ident, type_name); + + err =walk_st_ops_shadow_vars (btf, ident, map_type, map_type_id); +if (err) +return err; + +printf ("\t\t} *%s;\n" , ident); + +return 0 ; +} + +static int gen_st_ops_shadow (const char *obj_name,struct btf *btf,struct bpf_object *obj) +{ +int err, st_ops_cnt =0 ; +struct bpf_map *map; +char ident[256 ]; + +if (!btf) +return 0 ; + +/* Generate the pointers to shadow types of +* struct_ops maps. +*/ +bpf_object__for_each_map (map, obj) { +if (bpf_map__type (map) !=BPF_MAP_TYPE_STRUCT_OPS ) +continue ; +if (!get_map_ident (map, ident,sizeof (ident))) +continue ; + +if (st_ops_cnt ==0 )/* first struct_ops map */ +printf ("\tstruct {\n" ); + st_ops_cnt++; + + err =gen_st_ops_shadow_type (obj_name, btf, ident, map); +if (err) +return err; + } + +if (st_ops_cnt) +printf ("\t} struct_ops;\n" ); + +return 0 ; +} + +/* Generate the code to initialize the pointers of shadow types. */ +static void gen_st_ops_shadow_init (struct btf *btf,struct bpf_object *obj) +{ +struct bpf_map *map; +char ident[256 ]; + +if (!btf) +return ; + +/* Initialize the pointers to_ops shadow types of +* struct_ops maps. +*/ +bpf_object__for_each_map (map, obj) { +if (bpf_map__type (map) !=BPF_MAP_TYPE_STRUCT_OPS ) +continue ; +if (!get_map_ident (map, ident,sizeof (ident))) +continue ; +codegen ("\ +\n\ +obj->struct_ops.%1$s = bpf_map__initial_value(obj->maps.%1$s, NULL);\n\ +\n\ +" , ident); + } +} +static int do_skeleton (int argc,char **argv) {char header_guard[MAX_OBJ_NAME_LEN +sizeof ("__SKEL_H__" )];
@@ -1046,6 +1261,11 @@ static int do_skeleton(int argc, char **argv)printf ("\t} maps;\n" ); } + btf =bpf_object__btf (obj); + err =gen_st_ops_shadow (obj_name, btf, obj); +if (err) + goto out; +if (prog_cnt) {printf ("\tstruct {\n" );bpf_object__for_each_program (prog, obj) {
@@ -1069,7 +1289,6 @@ static int do_skeleton(int argc, char **argv)printf ("\t} links;\n" ); } - btf =bpf_object__btf (obj);if (btf) { err =codegen_datasecs (obj, obj_name);if (err)
@@ -1127,6 +1346,12 @@ static int do_skeleton(int argc, char **argv) if (err) \n\ goto err_out; \n\ \n\ + ", obj_name); + + gen_st_ops_shadow_init(btf, obj); + + codegen("\ + \n\ return obj; \n\ err_out: \n\ %1$s__destroy(obj); \n\
@@ -1436,6 +1661,10 @@ static int do_subskeleton(int argc, char **argv)printf ("\t} maps;\n" ); } + err =gen_st_ops_shadow (obj_name, btf, obj); +if (err) + goto out; +if (prog_cnt) {printf ("\tstruct {\n" );bpf_object__for_each_program (prog, obj) {
@@ -1547,6 +1776,12 @@ static int do_subskeleton(int argc, char **argv) if (err) \n\ goto err; \n\ \n\ + "); + + gen_st_ops_shadow_init(btf, obj); + + codegen("\ + \n\ return obj; \n\ err: \n\ %1$s__destroy(obj); \n\
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2335/3318 bpftool: Using the right format specifiers
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiayuan Chen <[email protected]>
[ Upstream commit 17c3dc50294ba445ddc7d50020df6452e93d38b2 ]
Fixed some formatting specifiers errors, such as using %d for int and %u for unsigned int, as well as other byte-length types.
Stable-dep-of: dbf8cef936c7 ("bpftool: Fix CPU IDs in per-CPU map output")
--- tools/bpf/bpftool/gen.c | 12 ++++++------ tools/bpf/bpftool/link.c | 14 +++++++------- tools/bpf/bpftool/main.c | 8 ++++---- tools/bpf/bpftool/map.c | 10 +++++----- 4 files changed, 22 insertions(+), 22 deletions(-)
tools/bpf/bpftool/gen.c +6 -6
@@ -654,7 +654,7 @@ static void codegen_destroy(struct bpf_object *obj, const char *obj_name)continue ;if (bpf_map__is_internal (map) && (bpf_map__map_flags (map) &BPF_F_MMAPABLE )) -printf ("\tskel_free_map_data(skel->%1$s, skel->maps.%1$s.initial_value, %2$zd);\n" , +printf ("\tskel_free_map_data(skel->%1$s, skel->maps.%1$s.initial_value, %2$zu);\n" , ident,bpf_map_mmap_sz (map)); codegen("\ \n\
@@ -941,7 +941,7 @@ static int walk_st_ops_shadow_vars(struct btf *btf, const char *ident, offset = m->offset /8 ;if (next_offset < offset) -printf ("\t\t\tchar __padding_%d[%d];\n" , i, offset - next_offset); +printf ("\t\t\tchar __padding_%d[%u];\n" , i, offset - next_offset);switch (btf_kind (member_type)) {case BTF_KIND_INT :
@@ -1009,7 +1009,7 @@ static int walk_st_ops_shadow_vars(struct btf *btf, const char *ident,/* Cannot fail since it must be a struct type */ size =btf__resolve_size (btf, map_type_id);if (next_offset < (__u32 )size) -printf ("\t\t\tchar __padding_end[%d];\n" , size - next_offset); +printf ("\t\t\tchar __padding_end[%u];\n" , size - next_offset); out:btf_dump__free (d);
@@ -2027,7 +2027,7 @@ btfgen_mark_type(struct btfgen_info *info, unsigned int type_id, bool follow_poibreak ;/* tells if some other type needs to be handled */ default : -p_err ("unsupported kind: %s (%d)" ,btf_kind_str (btf_type), type_id); +p_err ("unsupported kind: %s (%u)" ,btf_kind_str (btf_type), type_id);return -EINVAL ; }
@@ -2079,7 +2079,7 @@ static int btfgen_record_field_relo(struct btfgen_info *info, struct bpf_core_sp btf_type =btf__type_by_id (btf, type_id);break ;default : -p_err ("unsupported kind: %s (%d)" , +p_err ("unsupported kind: %s (%u)" ,btf_kind_str (btf_type), btf_type->type);return -EINVAL ; }
@@ -2178,7 +2178,7 @@ static int btfgen_mark_type_match(struct btfgen_info *info, __u32 type_id, bool }/* tells if some other type needs to be handled */ default : -p_err ("unsupported kind: %s (%d)" ,btf_kind_str (btf_type), type_id); +p_err ("unsupported kind: %s (%u)" ,btf_kind_str (btf_type), type_id);return -EINVAL ; }
tools/bpf/bpftool/link.c +7 -7
@@ -107,7 +107,7 @@ static int link_parse_fd(int *argc, char ***argv) fd =bpf_link_get_fd_by_id (id);if (fd <0 ) -p_err ("failed to get link with ID %d: %s" , id,strerror (errno)); +p_err ("failed to get link with ID %u: %s" , id,strerror (errno));return fd; }else if (is_prefix (**argv,"pinned" )) {char *path;
@@ -364,7 +364,7 @@ static char *perf_config_hw_cache_str(__u64 config)if (hw_cache)snprintf (str,PERF_HW_CACHE_LEN ,"%s-" , hw_cache);else -snprintf (str,PERF_HW_CACHE_LEN ,"%lld-" , config &0xff ); +snprintf (str,PERF_HW_CACHE_LEN ,"%llu-" , config &0xff ); op =perf_event_name (evsel__hw_cache_op, (config >>8 ) &0xff );if (op)
@@ -372,7 +372,7 @@ static char *perf_config_hw_cache_str(__u64 config) "%s-", op); else snprintf(str + strlen(str), PERF_HW_CACHE_LEN - strlen(str), - "%lld-", (config >> 8) & 0xff); + "%llu-", (config >> 8) & 0xff); result =perf_event_name (evsel__hw_cache_result, config >>16 );if (result)
@@ -380,7 +380,7 @@ static char *perf_config_hw_cache_str(__u64 config) "%s", result); else snprintf(str + strlen(str), PERF_HW_CACHE_LEN - strlen(str), - "%lld", config >> 16); + "%llu", config >> 16);return str; }
@@ -573,7 +573,7 @@ static void show_link_ifindex_plain(__u32 ifindex)else snprintf (devname,sizeof (devname),"(detached)" );if (ret) -snprintf (devname,sizeof (devname),"%s(%d)" , +snprintf (devname,sizeof (devname),"%s(%u)" , tmpname, ifindex);printf ("ifindex %s " , devname); }
@@ -649,7 +649,7 @@ void netfilter_dump_plain(const struct bpf_link_info *info)if (pfname)printf ("\n\t%s" , pfname);else -printf ("\n\tpf: %d" , pf); +printf ("\n\tpf: %u" , pf);if (hookname)printf (" %s" , hookname);
@@ -716,7 +716,7 @@ static void show_uprobe_multi_plain(struct bpf_link_info *info)printf ("func_cnt %u " , info->uprobe_multi.count);if (info->uprobe_multi.pid) -printf ("pid %d " , info->uprobe_multi.pid); +printf ("pid %u " , info->uprobe_multi.pid);printf ("\n\t%-16s %-16s %-16s" ,"offset" ,"ref_ctr_offset" ,"cookies" );for (i =0 ; i < info->uprobe_multi.count; i++) {
tools/bpf/bpftool/main.c +4 -4
@@ -152,7 +152,7 @@ static int do_version(int argc, char **argv) BPFTOOL_MINOR_VERSION, BPFTOOL_PATCH_VERSION);#endif jsonw_name (json_wtr,"libbpf_version" ); -jsonw_printf (json_wtr,"\"%d.%d\"" , +jsonw_printf (json_wtr,"\"%u.%u\"" ,libbpf_major_version (),libbpf_minor_version ());jsonw_name (json_wtr,"features" );
@@ -374,7 +374,7 @@ static int do_batch(int argc, char **argv)while ((cp =strstr (buf,"\\\n" )) !=NULL ) {if (!fgets (contline,sizeof (contline), fp) ||strlen (contline) ==0 ) { -p_err ("missing continuation line on command %d" , +p_err ("missing continuation line on command %u" , lines); err =-1 ; goto err_close;
@@ -385,7 +385,7 @@ static int do_batch(int argc, char **argv) *cp ='\0' ;if (strlen (buf) +strlen (contline) +1 >sizeof (buf)) { -p_err ("command %d is too long" , lines); +p_err ("command %u is too long" , lines); err =-1 ; goto err_close; }
@@ -427,7 +427,7 @@ static int do_batch(int argc, char **argv) err =-1 ; }else {if (!json_output) -printf ("processed %d commands\n" , lines); +printf ("processed %u commands\n" , lines); } err_close:if (fp != stdin)
tools/bpf/bpftool/map.c +5 -5
@@ -285,7 +285,7 @@ static void print_entry_plain(struct bpf_map_info *info, unsigned char *key, }if (info->value_size) {for (i =0 ; i < n; i++) { -printf ("value (CPU %02d):%c" , +printf ("value (CPU %02u):%c" , i, info->value_size >16 ?'\n' :' ' );fprint_hex (stdout, value + i * step, info->value_size," " );
@@ -316,7 +316,7 @@ static char **parse_bytes(char **argv, const char *name, unsigned char *val, }if (i != n) { -p_err ("%s expected %d bytes got %d" , name, n, i); +p_err ("%s expected %u bytes got %u" , name, n, i);return NULL ; }
@@ -462,7 +462,7 @@ static void show_map_header_json(struct bpf_map_info *info, json_writer_t *wtr)jsonw_string_field (wtr,"name" , info->name);jsonw_name (wtr,"flags" ); -jsonw_printf (wtr,"%d" , info->map_flags); +jsonw_printf (wtr,"%u" , info->map_flags); }static int show_map_close_json (int fd,struct bpf_map_info *info)
@@ -588,7 +588,7 @@ static int show_map_close_plain(int fd, struct bpf_map_info *info)if (prog_type_str)printf ("owner_prog_type %s " , prog_type_str);else -printf ("owner_prog_type %d " , prog_type); +printf ("owner_prog_type %u " , prog_type); }if (owner_jited) printf("owner%s jited",
@@ -615,7 +615,7 @@ static int show_map_close_plain(int fd, struct bpf_map_info *info)printf ("\n\t" );if (info->btf_id) -printf ("btf_id %d" , info->btf_id); +printf ("btf_id %u" , info->btf_id);if (frozen)printf ("%sfrozen" , info->btf_id ?" " :"" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2336/3318 bpftool: Fix CPU IDs in per-CPU map output
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hui Su <[email protected]>
[ Upstream commit dbf8cef936c7783ca909c38097a69f73173a19a7 ]
bpftool uses dense per-CPU value-buffer slots when printing per-CPU map values. It also uses the slot index as the CPU ID, which produces incorrect labels when the possible CPU mask is sparse, such as 0,2-3.
Parse the possible CPU mask and use the corresponding logical CPU ID in plain, JSON, and BTF-formatted output. Keep the dense slot index for accessing the per-CPU value buffer.
Pass the parsed CPU count together with the CPU ID array so that the printed CPU IDs and loop bounds come from the same possible-CPU mask. Propagate CPU-ID lookup and map output errors through the shared output path to its callers.
--- tools/bpf/bpftool/common.c | 40 ++++++++++++++++ tools/bpf/bpftool/main.h | 1 + tools/bpf/bpftool/map.c | 95 +++++++++++++++++++++++++------------- 3 files changed, 103 insertions(+), 33 deletions(-)
tools/bpf/bpftool/common.c +40 -0
@@ -29,6 +29,7 @@#include <bpf/bpf.h> #include <bpf/hashmap.h> #include <bpf/libbpf.h> /* libbpf_num_possible_cpus */ +#include <bpf/libbpf_internal.h> #include <bpf/btf.h> #include "main.h"
@@ -650,6 +651,45 @@ unsigned int get_possible_cpus(void)return cpus; } +int get_possible_cpu_ids (int **cpu_ids) +{ +const char *possible_cpus_file ="/sys/devices/system/cpu/possible" ; +bool *mask =NULL ; +int mask_sz, nr_cpus =0 ; +int *ids =NULL ; +int i, res; + + *cpu_ids =NULL ; + + res =parse_cpu_mask_file (possible_cpus_file, &mask, &mask_sz); +if (res) { +p_err ("failed to parse possible CPU mask: %s" ,strerror (-res)); +return res; + } + +for (i =0 ; i < mask_sz; i++) + nr_cpus += mask[i]; + + ids =calloc (nr_cpus,sizeof (*ids)); +if (!ids) { +p_err ("mem alloc failed" ); + res = -ENOMEM ; + goto out; + } + +for (i =0 , nr_cpus =0 ; i < mask_sz; i++) { +if (mask[i]) + ids[nr_cpus++] = i; + } + *cpu_ids = ids; + ids =NULL ; + res = nr_cpus; +out: +free (ids); +free (mask); +return res; +} +static char *ifindex_to_name_ns (__u32 ifindex,__u32 ns_dev,__u32 ns_ino,char *buf) {
tools/bpf/bpftool/main.h +1 -0
@@ -203,6 +203,7 @@ void print_hex_data_json(uint8_t *data, size_t len);unsigned int get_page_size (void );unsigned int get_possible_cpus (void ); +int get_possible_cpu_ids (int **cpu_ids);const char *ifindex_to_arch (__u32 ifindex,__u64 ns_dev,__u64 ns_ino,const char **opt);
tools/bpf/bpftool/map.c +62 -33
244 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2337/3318 ext2: drain in-flight DIO before buffered write fallback
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiale Yao <[email protected]>
[ Upstream commit 1e2ef9f221e142ed19d874a71b2cae7fabbaf138 ]
An asynchronous direct write can remain in flight after the inode lock is released. If another direct write falls back to buffered I/O while the first write is still pending, generic_perform_write() can dirty pages before the first write completes its post-I/O page cache invalidation. The invalidation then finds dirty pages, reports a page cache invalidation failure, and records -EIO in the mapping error sequence. A later fsync() therefore returns -EIO.
Commit 15cdefd0c0522f9d5e12d947fa04f4c11649b699 ("ext4: drain in-flight DIO before buffered write fallback") fixed the same race in ext4. Ext2 has an equivalent fallback after iomap_dio_rw() returns -ENOTBLK or a short write, but does not drain other in-flight DIO before dirtying the page cache.
Wait for in-flight DIO before calling generic_perform_write() in the fallback path.
A reproducer using concurrent AIO direct writes and buffered fallback triggered the following warning and made a subsequent fsync() return -EIO:
Page cache invalidation failure on direct I/O. Possible data corruption due to collision with buffered I/O!
--- fs/ext2/file.c | 7 +++++++ 1 file changed, 7 insertions(+)
fs/ext2/file.c +7 -0
@@ -251,6 +251,13 @@ static ssize_t ext2_dio_write_iter(struct kiocb *iocb, struct iov_iter *from)int ret2; iocb->ki_flags &= ~IOCB_DIRECT ; + +/* +* Prevent concurrent direct I/O and buffered I/O to the same file +* range. Wait for in-flight DIO to finish before dirtying pages. +*/ +inode_dio_wait (inode); + pos = iocb->ki_pos; status =generic_perform_write (iocb, from);if (unlikely (status <0 )) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2338/3318 mfd: rk8xx: Register poweroff handler in atomic phase
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Anderson <[email protected]>
[ Upstream commit 128115b520c6b61afbffd01809cfc3e8cbb78516 ]
This fixes a regression from v6.1 to v6.6 where Google Veyron devices (rk3288) would not power off after being shut down.
Prior to commit 4fec8a5a85c4 ("mfd: rk808: Convert to device managed resources"), pm_power_off was called by legacy_pm_power_off() which itself was registered using SYS_OFF_MODE_POWER_OFF. But in that commit the registration of rk808_power_off() moved to SYS_OFF_MODE_POWER_OFF_PREPARE. At the very least, the code should be consistent between SYS_OFF_MODE_POWER_OFF and SYS_OFF_MODE_RESTART; both should be *_PREPARE or both not.
It appears interrupt delivery is already shut down (but not disabled) when SYS_OFF_MODE_POWER_OFF_PREPARE is triggered, so regmap_update_bits() in rk808_power_off() does not complete successfully. Registering rk808_power_off() as SYS_OFF_MODE_POWER_OFF runs with interrupts disabled which causes polling I/O to be used instead, and the device to power down.
--- drivers/mfd/rk8xx-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/rk8xx-core.c +1 -1
@@ -679,7 +679,7 @@ int rk8xx_probe(struct device *dev, int variant, unsigned int irq, struct regmapif (device_property_read_bool (dev,"rockchip,system-power-controller" )) { ret =devm_register_sys_off_handler (dev, -SYS_OFF_MODE_POWER_OFF_PREPARE ,SYS_OFF_PRIO_HIGH , +SYS_OFF_MODE_POWER_OFF ,SYS_OFF_PRIO_HIGH , &rk808_power_off, rk808);if (ret) return dev_err_probe(dev, ret,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2339/3318 mfd: intel_quark_i2c_gpio: Manage the fixed-rate clock
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Myeonghun Pak <[email protected]>
[ Upstream commit 14a7cf1a3730c7c2393ef5a226e90baf61aa8a9f ]
The I2C clock is allocated by clk_register_fixed_rate(), but cleanup uses clk_unregister(), leaving the fixed-rate provider allocation behind.
Manage the provider with devm_clk_hw_register_fixed_rate() and its lookup with devm_clk_hw_register_clkdev(). Managed resources release the lookup before the provider, after the MFD children have been removed.
Remove the manual clock cleanup and the private structure that only stored the clock and lookup pointers.
This issue was identified during our ongoing static-analysis research while reviewing kernel code.
--- drivers/mfd/intel_quark_i2c_gpio.c | 52 ++++-------------------------- 1 file changed, 6 insertions(+), 46 deletions(-)
drivers/mfd/intel_quark_i2c_gpio.c +6 -46
@@ -35,11 +35,6 @@/* The Quark I2C controller source clock */ #define INTEL_QUARK_I2C_CLK_HZ 33000000 -struct intel_quark_mfd { -struct clk *i2c_clk; -struct clk_lookup *i2c_clk_lookup; -}; -static const struct property_entry intel_quark_i2c_controller_standard_properties[] = {PROPERTY_ENTRY_U32 ("clock-frequency" ,I2C_MAX_STANDARD_MODE_FREQ ), { }
@@ -160,37 +155,12 @@ MODULE_DEVICE_TABLE(pci, intel_quark_mfd_ids);static int intel_quark_register_i2c_clk (struct device *dev) { -struct intel_quark_mfd *quark_mfd =dev_get_drvdata (dev); -struct clk *i2c_clk; - - i2c_clk =clk_register_fixed_rate (dev, -INTEL_QUARK_I2C_CONTROLLER_CLK ,NULL , -0 ,INTEL_QUARK_I2C_CLK_HZ ); -if (IS_ERR (i2c_clk)) -return PTR_ERR (i2c_clk); - - quark_mfd->i2c_clk = i2c_clk; - quark_mfd->i2c_clk_lookup =clkdev_create (i2c_clk,NULL , -INTEL_QUARK_I2C_CONTROLLER_CLK ); - -if (!quark_mfd->i2c_clk_lookup) { -clk_unregister (quark_mfd->i2c_clk); -dev_err (dev,"Fixed clk register failed\n" ); -return -ENOMEM ; - } - -return 0 ; -} - -static void intel_quark_unregister_i2c_clk (struct device *dev) -{ -struct intel_quark_mfd *quark_mfd =dev_get_drvdata (dev); - -if (!quark_mfd->i2c_clk_lookup) -return ; +struct clk_hw *hw; -clkdev_drop (quark_mfd->i2c_clk_lookup); -clk_unregister (quark_mfd->i2c_clk); + hw =devm_clk_hw_register_fixed_rate (dev,INTEL_QUARK_I2C_CONTROLLER_CLK , +NULL ,0 ,INTEL_QUARK_I2C_CLK_HZ ); +return devm_clk_hw_register_clkdev (dev, hw,NULL , +INTEL_QUARK_I2C_CONTROLLER_CLK ); }static int intel_quark_i2c_setup (struct pci_dev *pdev)
@@ -238,19 +208,12 @@ static int intel_quark_gpio_setup(struct pci_dev *pdev)static int intel_quark_mfd_probe (struct pci_dev *pdev,const struct pci_device_id *id) { -struct intel_quark_mfd *quark_mfd;int ret; ret =pcim_enable_device (pdev);if (ret)return ret; - quark_mfd =devm_kzalloc (&pdev->dev,sizeof (*quark_mfd),GFP_KERNEL ); -if (!quark_mfd) -return -ENOMEM ; - -dev_set_drvdata (&pdev->dev, quark_mfd); - ret =intel_quark_register_i2c_clk (&pdev->dev);if (ret)return ret;
@@ -260,7 +223,7 @@ static int intel_quark_mfd_probe(struct pci_dev *pdev,/* This driver only requires 1 IRQ vector */ ret =pci_alloc_irq_vectors (pdev,1 ,1 ,PCI_IRQ_ALL_TYPES );if (ret <0 ) - goto err_unregister_i2c_clk; +return ret; ret =intel_quark_i2c_setup (pdev);if (ret)
@@ -282,8 +245,6 @@ static int intel_quark_mfd_probe(struct pci_dev *pdev,software_node_unregister_node_group (intel_quark_gpio_node_group); err_free_irq_vectors:pci_free_irq_vectors (pdev); -err_unregister_i2c_clk: -intel_quark_unregister_i2c_clk (&pdev->dev);return ret; }
@@ -292,7 +253,6 @@ static void intel_quark_mfd_remove(struct pci_dev *pdev)mfd_remove_devices (&pdev->dev);software_node_unregister_node_group (intel_quark_gpio_node_group);pci_free_irq_vectors (pdev); -intel_quark_unregister_i2c_clk (&pdev->dev); }static struct pci_driver intel_quark_mfd_driver = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2340/3318 mfd: da9150: Balance IRQ wake on teardown
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Myeonghun Pak <[email protected]>
[ Upstream commit ef464f82f3aecad4071af71074b2ceb77ffbb609 ]
DA9150 enables IRQ wake after registering its regmap IRQ chip, but does not disable it on a later probe failure or driver removal. This leaves the wake depth elevated after the handler is removed, and repeated bind attempts can accumulate the imbalance.
Remember whether enabling IRQ wake succeeded and balance only a successful call. Remove MFD children first so their nested IRQ users are gone, then disable wake before removing the regmap IRQ chip. Preserve the existing non-fatal behavior when IRQ wake cannot be enabled.
This issue was identified during our ongoing static-analysis research while reviewing kernel code.
--- drivers/mfd/da9150-core.c | 8 ++++++-- include/linux/mfd/da9150/core.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-)
drivers/mfd/da9150-core.c +6 -2
@@ -450,7 +450,7 @@ static int da9150_probe(struct i2c_client *client) da9150->irq_base =regmap_irq_chip_get_base (da9150->regmap_irq_data); -enable_irq_wake (da9150->irq); + da9150->irq_wake_enabled = !enable_irq_wake (da9150->irq); ret = mfd_add_devices(da9150->dev, -1, da9150_devs, ARRAY_SIZE(da9150_devs), NULL,
@@ -463,6 +463,8 @@ static int da9150_probe(struct i2c_client *client)return 0 ; mfd_fail: +if (da9150->irq_wake_enabled) +disable_irq_wake (da9150->irq);regmap_del_irq_chip (da9150->irq, da9150->regmap_irq_data); regmap_irq_fail:i2c_unregister_device (da9150->core_qif);
@@ -474,8 +476,10 @@ static void da9150_remove(struct i2c_client *client) {struct da9150 *da9150 =i2c_get_clientdata (client); -regmap_del_irq_chip (da9150->irq, da9150->regmap_irq_data);mfd_remove_devices (da9150->dev); +if (da9150->irq_wake_enabled) +disable_irq_wake (da9150->irq); +regmap_del_irq_chip (da9150->irq, da9150->regmap_irq_data);i2c_unregister_device (da9150->core_qif); }
include/linux/mfd/da9150/core.h +1 -0
@@ -65,6 +65,7 @@ struct da9150 {struct regmap_irq_chip_data *regmap_irq_data;int irq;int irq_base; +bool irq_wake_enabled; };/* Device I/O - Query Interface for FG and standard register access */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2341/3318 kconfig: warn about malformed KCONFIG_PROBABILITY values
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitrii Tulnov <[email protected]>
[ Upstream commit 9f01cd3a324390b235c67ae4ca3d35085369ebdd ]
randconfig checks the numeric range of each probability but does not validate where strtol() stops. For example, KCONFIG_PROBABILITY=50% is accepted as 50:0:0: the '%' is parsed repeatedly as zero. For the documented value 50, tristate y/m/n probabilities are 25%/25%/50%. With 50%, both y/m probabilities silently become zero, reducing the coverage of random configuration builds. Empty fields and extra fields are also accepted.
Warn when the value does not follow the documented decimal format. For malformed inputs whose parsed probabilities are in range, preserve the existing interpretation unless KCONFIG_WERROR is set. In that case, exit with an error before writing the configuration. Leading whitespace and signs are accepted by strtol(), but also trigger the warning because they are outside the documented format.
Keep the strtol() result as long until the range check. This rejects out-of-range values that narrowing to int previously made valid, such as 4294967296 becoming zero on a 64-bit host, regardless of KCONFIG_WERROR.
Add regression tests for one warning per malformed input, preserved configurations, KCONFIG_WERROR, out-of-range values, the supported probability formats, and the documented empty-value default.
--- scripts/kconfig/conf.c | 16 ++- scripts/kconfig/tests/conftest.py | 6 + .../tests/randconfig_probability/Kconfig | 12 ++ .../tests/randconfig_probability/__init__.py | 130 ++++++++++++++++++ 4 files changed, 163 insertions(+), 1 deletion(-) create mode 100644 scripts/kconfig/tests/randconfig_probability/Kconfig create mode 100644 scripts/kconfig/tests/randconfig_probability/__init__.py
scripts/kconfig/conf.c +15 -1
@@ -183,12 +183,23 @@ static bool conf_set_all_new_symbols(enum conf_def_mode mode)if (mode == def_random) {int n, p[3 ]; +bool warned = false;char *env =getenv ("KCONFIG_PROBABILITY" ); n =0 ;while (env && *env) {char *endp; -int tmp =strtol (env, &endp,10 ); +long tmp =strtol (env, &endp,10 ); + +if (!isdigit ((unsigned char )*env) || + (*endp && *endp !=':' ) || + (*endp ==':' && (!endp[1 ] || n ==2 ))) { +if (!warned) { +fprintf (stderr, +"warning: KCONFIG_PROBABILITY has malformed format\n" ); + warned = true; + } + }if (tmp >=0 && tmp <=100 ) { p[n++] = tmp;
@@ -224,6 +235,9 @@ static bool conf_set_all_new_symbols(enum conf_def_mode mode)perror ("KCONFIG_PROBABILITY" );exit (1 ); } + +if (warned &&getenv ("KCONFIG_WERROR" )) +exit (1 ); } for_all_symbols(i, sym) {
scripts/kconfig/tests/conftest.py +6 -0
@@ -289,6 +289,12 @@ class Conf: return self._matches('stderr', expected) [email protected](autouse=True) +def clear_werror(monkeypatch): + # extra_env can set strict mode, but cannot remove an inherited flag. + monkeypatch.delenv('KCONFIG_WERROR', raising=False) + + @pytest.fixture(scope="module") def conf(request): """Create a Conf instance and provide it to test functions."""
scripts/kconfig/tests/randconfig_probability/Kconfig new file +12 -0
@@ -0,0 +1,12 @@ +# SPDX-License-Identifier: GPL-2.0-only + +config MODULES + bool + default y + modules + +config BOOL + bool "Bool" + +config TRI + tristate "Tristate"
scripts/kconfig/tests/randconfig_probability/__init__.py new file +130 -0
130 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2342/3318 ASoC: fsl_asrc: use regmap_write_bits to update clock source registers
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shengjiu Wang <[email protected]>
[ Upstream commit 92871abc1302b852b88d86114115f8fd6b50b9b9 ]
After a warm reboot the REG_ASRCSR register may not be in its hardware reset state. regmap caches the register value as 0 (the assumed default), so when the desired clock source index is also 0, regmap_update_bits() skips the actual hardware write because it believes the register already holds the correct value. This leaves a stale clock source in the hardware.
Replace regmap_update_bits() with regmap_write_bits() so that the masked fields are always written to hardware regardless of the cached value.
--- sound/soc/fsl/fsl_asrc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
sound/soc/fsl/fsl_asrc.c +4 -4
@@ -521,10 +521,10 @@ static int fsl_asrc_config_pair(struct fsl_asrc_pair *pair, bool use_ideal_rate) ASRCTR_USR(index));/* Set the input and output clock sources */ -regmap_update_bits (asrc->regmap,REG_ASRCSR , -ASRCSR_AICSi_MASK (index) |ASRCSR_AOCSi_MASK (index), -ASRCSR_AICS (index, clk_index[IN ]) | -ASRCSR_AOCS (index, clk_index[OUT ])); +regmap_write_bits (asrc->regmap,REG_ASRCSR , +ASRCSR_AICSi_MASK (index) |ASRCSR_AOCSi_MASK (index), +ASRCSR_AICS (index, clk_index[IN ]) | +ASRCSR_AOCS (index, clk_index[OUT ]));/* Calculate the input clock divisors */ indiv =fsl_asrc_cal_asrck_divisor (pair, div[IN ]);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2343/3318 perf mem: Fix size tracking for mem_lvls in perf_script__meminfo_scnprintf()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Falcon <[email protected]>
[ Upstream commit 06d5ce78e4fea2cf0738da903aa248a81101c155 ]
When printing memory info in perf script, the entire size of the buffer is passed to perf_mem__lvl_scnprintf() instead of the remaining size. Pass the remaining buffer size instead.
This issue was detected by sashiko during an internal code review.
--- tools/perf/util/mem-events.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/mem-events.c +1 -1
@@ -516,7 +516,7 @@ int perf_script__meminfo_scnprintf(char *out, size_t sz, struct mem_info *mem_in i +=scnprintf (out, sz,"|OP " ); i +=perf_mem__op_scnprintf (out + i, sz - i, mem_info); i +=scnprintf (out + i, sz - i,"|LVL " ); - i +=perf_mem__lvl_scnprintf (out + i, sz, mem_info); + i +=perf_mem__lvl_scnprintf (out + i, sz - i, mem_info); i +=scnprintf (out + i, sz - i,"|SNP " ); i +=perf_mem__snp_scnprintf (out + i, sz - i, mem_info); i +=scnprintf (out + i, sz - i,"|TLB " );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2344/3318 NFS: use TCP for MOUNT when xprtsec= selects TLS
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
[ Upstream commit 72233aabc78cd0415c850641bc2a6e4fea23173f ]
An NFSv2 or NFSv3 text mount that specifies xprtsec= but no mountproto= crashes in nfs_init_timeout_values():
RIP: 0010:nfs_init_timeout_values+0x10a/0x110 [nfs] Call Trace: nfs_mount+0x1c3/0x330 [nfs] nfs_try_get_tree+0x1e5/0x460 [nfs] nfs_get_tree+0x64d/0x6d0 [nfs] vfs_get_tree+0x2b/0xe0 vfs_cmd_create+0x5f/0xd0 vfs_fsconfig_locked+0x50/0x130 __se_sys_fsconfig+0x2f9/0x3a0
nfs_validate_transport_protocol() sets nfs_server.protocol to XPRT_TRANSPORT_TCP_TLS when xprtsec= is present, but the switch in nfs_set_mount_transport_protocol() has no case for that value. mount_server.protocol stays zero, and nfs_init_timeout_values() calls BUG() on a transport it does not recognize.
mount.nfs always appends mountproto= after probing the server's rpcbind, so only a caller that bypasses it, such as "mount -i" or a program that drives fsconfig() directly, reaches the crash.
Select TCP for MOUNT when the NFS transport is XPRT_TRANSPORT_TCP_TLS. nfs_mount() requests no transport security, so MOUNT already runs over plain TCP whenever mount.nfs supplies mountproto=tcp.
--- fs/nfs/fs_context.c | 1 + 1 file changed, 1 insertion(+)
fs/nfs/fs_context.c +1 -0
@@ -370,6 +370,7 @@ static void nfs_set_mount_transport_protocol(struct nfs_fs_context *ctx) ctx->mount_server.protocol =XPRT_TRANSPORT_UDP ;break ;case XPRT_TRANSPORT_TCP : +case XPRT_TRANSPORT_TCP_TLS :case XPRT_TRANSPORT_RDMA : ctx->mount_server.protocol =XPRT_TRANSPORT_TCP ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2345/3318 ASoC: fsl_asrc: check the second front-end DMA channel
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Slavin Liu <[email protected]>
[ Upstream commit b4136c0d69ead737197af741e20edd1c3574f6b4 ]
The temporary Front-End DMA request can fail independently of the persistent channel acquired earlier in fsl_asrc_dma_hw_params(). The returned NULL pointer is immediately used to read its private data.
Check the temporary channel and release the previously acquired persistent Front-End channel on failure. Clear its slot so a later hw_free cannot release it twice. ASoC marks a component's hw_params only after success and skips unmarked components during rollback, so returning an error alone would leak the earlier channel.
Detected by static analysis and reviewed with AI-assisted source auditing.
--- sound/soc/fsl/fsl_asrc_dma.c | 5 +++++ 1 file changed, 5 insertions(+)
sound/soc/fsl/fsl_asrc_dma.c +5 -0
@@ -233,6 +233,11 @@ static int fsl_asrc_dma_hw_params(struct snd_soc_component *component,/* Get DMA request of Front-End */ tmp_chan = asrc->get_dma_channel (pair, dir); +if (!tmp_chan) { +dma_release_channel (pair->dma_chan[!dir]); + pair->dma_chan[!dir] =NULL ; +return -EINVAL ; + } tmp_data = tmp_chan->private; pair->dma_data.dma_request2 = tmp_data->dma_request; pair->dma_data.peripheral_type = tmp_data->peripheral_type;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2346/3318 ASoC: adau17x1: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 8ca84987c11d11e0ba60f202e3199b3b80c87721 ]
adau17x1_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.
Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.
The optional switch-mode callback remains ordered before the cache replay.
The issue was found by a tool we developed.
--- sound/soc/codecs/adau17x1.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/codecs/adau17x1.c +1 -3
@@ -989,9 +989,7 @@ int adau17x1_resume(struct snd_soc_component *component)if (adau->switch_mode) adau->switch_mode (component->dev); -regcache_sync (adau->regmap); - -return 0 ; +return regcache_sync (adau->regmap); }EXPORT_SYMBOL_GPL (adau17x1_resume);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2347/3318 ASoC: ak4642: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 7142c34ed92fddca7038787b8695d22c661dc6ec ]
ak4642_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.
Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.
The successful resume path is unchanged.
The issue was found by a tool we developed.
--- sound/soc/codecs/ak4642.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/codecs/ak4642.c +1 -2
@@ -533,8 +533,7 @@ static int ak4642_resume(struct snd_soc_component *component)struct regmap *regmap =dev_get_regmap (component->dev,NULL );regcache_cache_only (regmap, false); -regcache_sync (regmap); -return 0 ; +return regcache_sync (regmap); }static int ak4642_probe (struct snd_soc_component *component) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2348/3318 ASoC: es8316: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 243d0c47e57a6af89d95aa451ef5fbf453983b1c ]
es8316_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.
Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.
The successful resume path is unchanged.
The issue was found by a tool we developed.
--- sound/soc/codecs/es8316.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/codecs/es8316.c +1 -3
@@ -778,9 +778,7 @@ static int es8316_resume(struct snd_soc_component *component)struct es8316_priv *es8316 =snd_soc_component_get_drvdata (component);regcache_cache_only (es8316->regmap, false); -regcache_sync (es8316->regmap); - -return 0 ; +return regcache_sync (es8316->regmap); }static int es8316_suspend (struct snd_soc_component *component)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2349/3318 ASoC: nau8540: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 0bf2b3411537e8e4d9c03702646a9fc87198d4b1 ]
nau8540_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.
Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.
The successful resume path is unchanged.
The issue was found by a tool we developed.
--- sound/soc/codecs/nau8540.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/codecs/nau8540.c +1 -3
@@ -804,9 +804,7 @@ static int __maybe_unused nau8540_resume(struct snd_soc_component *component)struct nau8540 *nau8540 =snd_soc_component_get_drvdata (component);regcache_cache_only (nau8540->regmap, false); -regcache_sync (nau8540->regmap); - -return 0 ; +return regcache_sync (nau8540->regmap); }static const struct snd_soc_component_driver nau8540_component_driver = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2350/3318 ASoC: rt1011: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 432734a00bfae17baeff1a83b61bfc9c2ab20c12 ]
rt1011_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.
Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.
The successful resume path is unchanged.
The issue was found by a tool we developed.
--- sound/soc/codecs/rt1011.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/codecs/rt1011.c +1 -3
@@ -2099,9 +2099,7 @@ static int rt1011_resume(struct snd_soc_component *component)struct rt1011_priv *rt1011 =snd_soc_component_get_drvdata (component);regcache_cache_only (rt1011->regmap, false); -regcache_sync (rt1011->regmap); - - return 0; + return regcache_sync(rt1011->regmap); }#else #define rt1011_suspend NULL
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2351/3318 ASoC: rt1016: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 98ace05793c7b80a9f49d92b78fcc88e0970f8e4 ]
rt1016_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.
Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.
The successful resume path is unchanged.
The issue was found by a tool we developed.
--- sound/soc/codecs/rt1016.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/codecs/rt1016.c +1 -3
@@ -570,9 +570,7 @@ static int rt1016_resume(struct snd_soc_component *component)struct rt1016_priv *rt1016 =snd_soc_component_get_drvdata (component);regcache_cache_only (rt1016->regmap, false); -regcache_sync (rt1016->regmap); - - return 0; + return regcache_sync(rt1016->regmap); }#else #define rt1016_suspend NULL
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2352/3318 ASoC: rt1305: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 30858325aa90380c6bcdde605214f1ebdbec568c ]
rt1305_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.
Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.
The successful resume path is unchanged.
The issue was found by a tool we developed.
--- sound/soc/codecs/rt1305.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/codecs/rt1305.c +1 -3
@@ -896,9 +896,7 @@ static int rt1305_resume(struct snd_soc_component *component)struct rt1305_priv *rt1305 =snd_soc_component_get_drvdata (component);regcache_cache_only (rt1305->regmap, false); -regcache_sync (rt1305->regmap); - - return 0; + return regcache_sync(rt1305->regmap); }#else #define rt1305_suspend NULL
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2353/3318 ASoC: rt1308: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 3db3289178b94056753f7a8c6ee4ab4b232ee6a5 ]
rt1308_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.
Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.
The successful resume path is unchanged.
The issue was found by a tool we developed.
--- sound/soc/codecs/rt1308.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/codecs/rt1308.c +1 -3
@@ -715,9 +715,7 @@ static int rt1308_resume(struct snd_soc_component *component)struct rt1308_priv *rt1308 =snd_soc_component_get_drvdata (component);regcache_cache_only (rt1308->regmap, false); -regcache_sync (rt1308->regmap); - - return 0; + return regcache_sync(rt1308->regmap); }#else #define rt1308_suspend NULL
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2354/3318 ASoC: rt5616: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 8fc9d353d5371a946d9a9952278b96c09070374c ]
rt5616_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.
Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.
The successful resume path is unchanged.
The issue was found by a tool we developed.
--- sound/soc/codecs/rt5616.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/codecs/rt5616.c +1 -2
@@ -1250,8 +1250,7 @@ static int rt5616_resume(struct snd_soc_component *component)struct rt5616_priv *rt5616 =snd_soc_component_get_drvdata (component);regcache_cache_only (rt5616->regmap, false); -regcache_sync (rt5616->regmap); - return 0; + return regcache_sync(rt5616->regmap); }#else #define rt5616_suspend NULL
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2355/3318 ASoC: rt5659: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 3a9b5bce85a1baff95463a2bb021efac64bcf83f ]
rt5659_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.
Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.
The successful resume path is unchanged.
The issue was found by a tool we developed.
--- sound/soc/codecs/rt5659.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/codecs/rt5659.c +1 -3
@@ -3704,9 +3704,7 @@ static int rt5659_resume(struct snd_soc_component *component)struct rt5659_priv *rt5659 =snd_soc_component_get_drvdata (component);regcache_cache_only (rt5659->regmap, false); -regcache_sync (rt5659->regmap); - - return 0; + return regcache_sync(rt5659->regmap); }#else #define rt5659_suspend NULL
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2356/3318 ASoC: rt5660: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 70fe8997b03078ff8253d985a161fef310f7c346 ]
rt5660_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.
Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.
The power-off resume delay remains ordered before the cache replay.
The issue was found by a tool we developed.
--- sound/soc/codecs/rt5660.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/codecs/rt5660.c +1 -3
@@ -1150,9 +1150,7 @@ static int rt5660_resume(struct snd_soc_component *component)msleep (350 );regcache_cache_only (rt5660->regmap, false); -regcache_sync (rt5660->regmap); - - return 0; + return regcache_sync(rt5660->regmap); }#else #define rt5660_suspend NULL
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2357/3318 ASoC: rt5665: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 9f2933d9a437302d5ae32eb9022efef049d8ab22 ]
rt5665_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.
Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.
The successful resume path is unchanged.
The issue was found by a tool we developed.
--- sound/soc/codecs/rt5665.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/codecs/rt5665.c +1 -3
@@ -4485,9 +4485,7 @@ static int rt5665_resume(struct snd_soc_component *component)struct rt5665_priv *rt5665 =snd_soc_component_get_drvdata (component);regcache_cache_only (rt5665->regmap, false); -regcache_sync (rt5665->regmap); - - return 0; + return regcache_sync(rt5665->regmap); }#else #define rt5665_suspend NULL
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2358/3318 ASoC: mediatek: mt8188: mt8188-afe-clk: Handle tuner clock enable errors
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit a2c3ee3349a7da91e563b9a21a355a28fa754bc7 ]
Clock enable errors are currently ignored when enabling the APLL and tuner clocks.
Check the return values and roll back the APLL clock if the tuner clock fails to enable.
--- sound/soc/mediatek/mt8188/mt8188-afe-clk.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
sound/soc/mediatek/mt8188/mt8188-afe-clk.c +17 -4
@@ -260,15 +260,28 @@ static int mt8188_afe_enable_tuner_clk(struct mtk_base_afe *afe, unsigned int id) {struct mt8188_afe_private *afe_priv = afe->platform_priv; +int ret;switch (id) {case MT8188_AUD_PLL1 : -mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_APLL ]); -mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_APLL1_TUNER ]); + ret =mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_APLL ]); +if (ret) +return ret; + ret =mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_APLL1_TUNER ]); +if (ret) { +mt8188_afe_disable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_APLL ]); +return ret; + }break ;case MT8188_AUD_PLL2 : -mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_APLL2 ]); -mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_APLL2_TUNER ]); + ret =mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_APLL2 ]); +if (ret) +return ret; + ret =mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_APLL2_TUNER ]); +if (ret) { +mt8188_afe_disable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_APLL2 ]); +return ret; + }break ;default :return -EINVAL ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2359/3318 ASoC: mediatek: mt8188: mt8188-afe-clk: Propagate regmap update errors
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 60a8112a088aee38d728457a14fa8bfb50f4c87e ]
The return values from regmap_update_bits() are currently ignored by the clock and AFE control functions.
Propagate the errors to allow callers to handle regmap update failures.
--- sound/soc/mediatek/mt8188/mt8188-afe-clk.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
sound/soc/mediatek/mt8188/mt8188-afe-clk.c +4 -10
@@ -574,9 +574,7 @@ static int mt8188_afe_enable_top_cg(struct mtk_base_afe *afe, unsigned int cg_tyunsigned int mask =get_top_cg_mask (cg_type);unsigned int val =get_top_cg_on_val (cg_type); -regmap_update_bits (afe->regmap, reg, mask, val); - -return 0 ; +return regmap_update_bits (afe->regmap, reg, mask, val); }static int mt8188_afe_disable_top_cg (struct mtk_base_afe *afe,unsigned int cg_type)
@@ -585,9 +583,7 @@ static int mt8188_afe_disable_top_cg(struct mtk_base_afe *afe, unsigned int cg_tunsigned int mask =get_top_cg_mask (cg_type);unsigned int val =get_top_cg_off_val (cg_type); -regmap_update_bits (afe->regmap, reg, mask, val); - -return 0 ; +return regmap_update_bits (afe->regmap, reg, mask, val); }int mt8188_afe_enable_reg_rw_clk (struct mtk_base_afe *afe)
@@ -627,14 +623,12 @@ int mt8188_afe_disable_reg_rw_clk(struct mtk_base_afe *afe)static int mt8188_afe_enable_afe_on (struct mtk_base_afe *afe) { -regmap_update_bits (afe->regmap,AFE_DAC_CON0 ,0x1 ,0x1 ); -return 0 ; +return regmap_update_bits (afe->regmap,AFE_DAC_CON0 ,0x1 ,0x1 ); }static int mt8188_afe_disable_afe_on (struct mtk_base_afe *afe) { -regmap_update_bits (afe->regmap,AFE_DAC_CON0 ,0x1 ,0x0 ); -return 0 ; +return regmap_update_bits (afe->regmap,AFE_DAC_CON0 ,0x1 ,0x0 ); }static int mt8188_afe_enable_a1sys (struct mtk_base_afe *afe)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2360/3318 ASoC: mediatek: mt8188: mt8188-afe-clk: Handle clock enable errors
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 1b65c13d1af99170e2a855ca9212a03daa3e7f04 ]
Clock enable errors are currently ignored by several AFE clock control functions.
Check the return values and roll back previously enabled clocks when a subsequent clock enable fails.
--- sound/soc/mediatek/mt8188/mt8188-afe-clk.c | 69 ++++++++++++++++++---- 1 file changed, 58 insertions(+), 11 deletions(-)
sound/soc/mediatek/mt8188/mt8188-afe-clk.c +58 -11
@@ -589,22 +589,47 @@ static int mt8188_afe_disable_top_cg(struct mtk_base_afe *afe, unsigned int cg_tint mt8188_afe_enable_reg_rw_clk (struct mtk_base_afe *afe) {struct mt8188_afe_private *afe_priv = afe->platform_priv; - +int ret;/* bus clock for AFE external access, like DRAM */ -mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_TOP_AUDIO_LOCAL_BUS_SEL ]); + ret =mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_TOP_AUDIO_LOCAL_BUS_SEL ]); +if (ret) + goto err_local_bus;/* bus clock for AFE internal access, like AFE SRAM */ -mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_TOP_AUD_INTBUS_SEL ]); + ret =mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_TOP_AUD_INTBUS_SEL ]); +if (ret) + goto err_intbus;/* audio 26m clock source */ -mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_ADSP_AUDIO_26M ]); + ret =mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_ADSP_AUDIO_26M ]); +if (ret) + goto err_26m;/* AFE hw clock */ -mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_AFE ]); -mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_A1SYS_HP ]); -mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_A1SYS ]); + ret =mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_AFE ]); +if (ret) + goto err_afe; + ret =mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_A1SYS_HP ]); +if (ret) + goto err_a1sys_hp; + ret =mt8188_afe_enable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_A1SYS ]); +if (ret) + goto err_a1sys;return 0 ; + +err_a1sys: +mt8188_afe_disable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_A1SYS_HP ]); +err_a1sys_hp: +mt8188_afe_disable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_AFE ]); +err_afe: +mt8188_afe_disable_clk (afe, afe_priv->clk[MT8188_CLK_ADSP_AUDIO_26M ]); +err_26m: +mt8188_afe_disable_clk (afe, afe_priv->clk[MT8188_CLK_TOP_AUD_INTBUS_SEL ]); +err_intbus: +mt8188_afe_disable_clk (afe, afe_priv->clk[MT8188_CLK_TOP_AUDIO_LOCAL_BUS_SEL ]); +err_local_bus: +return ret; }int mt8188_afe_disable_reg_rw_clk (struct mtk_base_afe *afe)
@@ -640,7 +665,13 @@ static int mt8188_afe_enable_a1sys(struct mtk_base_afe *afe)if (ret)return ret; -return mt8188_afe_enable_top_cg (afe,MT8188_TOP_CG_A1SYS_TIMING ); + ret =mt8188_afe_enable_top_cg (afe,MT8188_TOP_CG_A1SYS_TIMING ); +if (ret) { +mt8188_afe_disable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_A1SYS ]); +return ret; + } + +return 0 ; }static int mt8188_afe_disable_a1sys (struct mtk_base_afe *afe)
@@ -661,7 +692,13 @@ static int mt8188_afe_enable_a2sys(struct mtk_base_afe *afe)if (ret)return ret; -return mt8188_afe_enable_top_cg (afe,MT8188_TOP_CG_A2SYS_TIMING ); + ret =mt8188_afe_enable_top_cg (afe,MT8188_TOP_CG_A2SYS_TIMING ); +if (ret) { +mt8188_afe_disable_clk (afe, afe_priv->clk[MT8188_CLK_AUD_A2SYS ]); +return ret; + } + +return 0 ; }static int mt8188_afe_disable_a2sys (struct mtk_base_afe *afe)
@@ -749,8 +786,18 @@ int mt8188_apll2_disable(struct mtk_base_afe *afe)int mt8188_afe_enable_main_clock (struct mtk_base_afe *afe) { -mt8188_afe_enable_top_cg (afe,MT8188_TOP_CG_26M_TIMING ); -mt8188_afe_enable_afe_on (afe); +int ret; + + ret =mt8188_afe_enable_top_cg (afe,MT8188_TOP_CG_26M_TIMING ); +if (ret) +return ret; + + ret =mt8188_afe_enable_afe_on (afe); +if (ret) { +mt8188_afe_disable_top_cg (afe,MT8188_TOP_CG_26M_TIMING ); +return ret; + } +return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2361/3318 ASoC: mediatek: mt8188: mt8188-afe-pcm: Handle runtime resume errors
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit f5f6941d92972ba66829a99999fa825e63da5162 ]
Errors from clock enable and regcache synchronization are currently ignored during runtime resume.
Check the return values from mt8188_afe_enable_reg_rw_clk(), regcache_sync(), and mt8188_afe_enable_main_clock(), and abort the runtime resume if any of them fails.
On failure, disable the previously enabled reg_rw clocks and restore the regmap to cache-only mode.
--- sound/soc/mediatek/mt8188/mt8188-afe-pcm.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)
sound/soc/mediatek/mt8188/mt8188-afe-pcm.c +16 -5
@@ -3009,22 +3009,33 @@ static int mt8188_afe_runtime_resume(struct device *dev)struct mtk_base_afe *afe =dev_get_drvdata (dev);struct mt8188_afe_private *afe_priv = afe->platform_priv;struct arm_smccc_res res; +int ret;arm_smccc_smc (MTK_SIP_AUDIO_CONTROL ,MTK_AUDIO_SMC_OP_DOMAIN_SIDEBANDS ,0 ,0 ,0 ,0 ,0 ,0 , &res); -mt8188_afe_enable_reg_rw_clk (afe); + ret =mt8188_afe_enable_reg_rw_clk (afe); +if (ret) +return ret;if (!afe->regmap || afe_priv->pm_runtime_bypass_reg_ctl) - goto skip_regmap; +return 0 ;regcache_cache_only (afe->regmap, false); -regcache_sync (afe->regmap); + ret =regcache_sync (afe->regmap); +if (ret) + goto err; + + ret =mt8188_afe_enable_main_clock (afe); +if (ret) + goto err; -mt8188_afe_enable_main_clock (afe); -skip_regmap:return 0 ; +err: +mt8188_afe_disable_reg_rw_clk (afe); +regcache_cache_only (afe->regmap, true); +return ret; }static int init_memif_priv_data (struct mtk_base_afe *afe)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2362/3318 iio: accel: bma220: publish the SPI driver ACPI alias
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit cdc7d3dd101251a6373332726b8d6fad35e83b8a ]
The SPI driver advertises an ACPI match for BMA0220 but does not export that table. A modular build therefore lacks the ACPI alias used to load the driver when the device is enumerated through ACPI.
Export the ACPI table. Move the existing SPI export next to its SPI ID table so each export is adjacent to the table it describes.
The issue was found by our static-analysis tool.
--- drivers/iio/accel/bma220_spi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/accel/bma220_spi.c +2 -1
@@ -308,12 +308,13 @@ static const struct spi_device_id bma220_spi_id[] = { {"bma220", 0}, {} }; +MODULE_DEVICE_TABLE(spi, bma220_spi_id); static const struct acpi_device_id bma220_acpi_id[] = { {"BMA0220", 0}, {} }; -MODULE_DEVICE_TABLE(spi, bma220_spi_id); +MODULE_DEVICE_TABLE(acpi, bma220_acpi_id); static struct spi_driver bma220_driver = { .driver = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2363/3318 powerpc/ftrace: Dont restore r13 during ftrace_regs_caller
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shrikanth Hegde <[email protected]>
[ Upstream commit af5f0870883ae4aea7f668d06cbb7ad0e12824c8 ]
Michal reported a stack-protector failure and subsequent panic when running kernel builds. This was observed with full/lazy preemption. Initially it was suspected as KVM, but later turned out to be due to a bcc tool running in parallel.
Issue was recreated using a bcc tool.
For example, running below in parallel leads to crash. ./funccount sched* -d 100 and make -j 64
The same crash was observed when running kprobe for schedule() function, while simpler function tracer for schedule() didn't cause the crash. This helped to narrow it down to ftrace backed kprobes area.
The crash occurs as follows:
ftrace_regs_caller entry on CPU A
|
+-> save r13 = CPU A PACA into pt_regs
|
+-> call kprobe_ftrace_handler()
|
+-> ftrace_test_recursion_unlock()
|
+-> preempt_enable
+-> task can schedule and migrate to CPU B
+-> task resumes with live r13 = CPU B PACA
|
+-> REST_GPRS(2, 31)
|
+-> restore saved r13 = CPU A PACA
|
|-> The task then continues running on CPU B with r13 pointing
| to CPU A's PACA.The stack-protector canary is accessed through the PACA. After the task migrates, CPU A may run a different task and update its PACA with that task's canary. Restoring the saved r13 then causes the migrated task's saved stack canary to be compared against the canary in CPU A's PACA, resulting in a stack-protector failure.
Similarly, current is resolved through the PACA. With a stale r13, preempt_count() can access the state of the task referenced by CPU A's PACA instead of the task running on CPU B. This results in corrupted preempt-count warnings and scheduling-while-atomic failures.
This path for example is called when using kprobes and parallel kernel builds can cause preemptions during ftrace_test_recursion_unlock.
Do not restore r13 from the saved register frame. If the task did not migrate, the live r13 already has the saved value. If it migrated, the live r13 contains the correct PACA pointer for the CPU on which the task resumed.
On PPC32, r13 is regular register. So do this fix only for PPC64
--- arch/powerpc/kernel/trace/ftrace_entry.S | 6 ++++++ 1 file changed, 6 insertions(+)
arch/powerpc/kernel/trace/ftrace_entry.S +6 -0
@@ -129,7 +129,13 @@ /* Restore gprs */ .if \allregs == 1 +#ifdef CONFIG_PPC64 + REST_GPRS(2, 12, r1) + /* Do not restore a stale PACA pointer if the task migrated */ + REST_GPRS(14, 31, r1) +#else REST_GPRS(2, 31, r1) +#endif .else REST_GPRS(3, 10, r1) #ifdef CONFIG_LIVEPATCH_64
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2364/3318 dt-bindings: vendor-prefixes: Add General Mobile
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Muzaffer Kadir <[email protected]>
[ Upstream commit 7034bec693b752bcd7ebb4fa00dc3b429b4dc4f7 ]
Add vendor prefix for General Mobile.
--- Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
@@ -524,6 +524,8 @@ patternProperties: description: Gemei Digital Technology Co., Ltd. "^gemtek,.*": description: Gemtek Technology Co., Ltd. + "^generalmobile,.*": + description: General Mobile Fzc. "^genesys,.*": description: Genesys Logic, Inc. "^geniatech,.*":
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2365/3318 perf c2c: Fix documented default coalesce fields
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiebin Sun <[email protected]>
[ Upstream commit b36a6f180baad35a962677ae181681ca60dda35b ]
The default coalesce fields dropped pid in favor of iaddr, but the man page still documents the old pid,iaddr default. Update it to match the command.
--- tools/perf/Documentation/perf-c2c.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/Documentation/perf-c2c.txt +1 -1
@@ -304,7 +304,7 @@ output fields set for cacheline offsets output: Code address, Code symbol, Shared Object, Source line dso - coalesced by shared object -By default the coalescing is setup with 'pid,iaddr'. +By default, coalescing uses `iaddr`. STDIO OUTPUT ------------
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2366/3318 mtd: block: prevent reclaim I/O during request processing
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qingfang Deng <[email protected]>
[ Upstream commit d498b2ddda99eed28cde177b1620dbcea246a1c4 ]
The blktrans request callbacks run under dev->lock and may allocate memory with GFP_KERNEL. For example, mtdblock_writesect() uses vmalloc() to allocate its eraseblock cache. Direct reclaim can then recurse into block I/O and deadlock on resources held by the request being processed. syzbot reports a circular locking dependency involving the device mutex and fs_reclaim.
Commit d5ba1c8ffd0b ("mtd: don't use PF_MEMALLOC") removed PF_MEMALLOC from the MTD request thread. That flag had prevented direct reclaim, so its removal made allocations during request processing eligible for reclaim without excluding I/O.
Wrap request processing in mtd_queue_rq() in a NOIO scope. This covers both the request and background callbacks, including allocations made by lower MTD drivers, and prevents reclaim from initiating filesystem or block I/O.
--- drivers/mtd/mtd_blkdevs.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/mtd/mtd_blkdevs.c +5 -0
@@ -18,6 +18,7 @@#include <linux/spinlock.h> #include <linux/hdreg.h> #include <linux/mutex.h> +#include <linux/sched/mm.h> #include <linux/uaccess.h> #include "mtdcore.h"
@@ -167,6 +168,7 @@ static blk_status_t mtd_queue_rq(struct blk_mq_hw_ctx *hctx, const struct blk_mq_queue_data *bd) {struct mtd_blktrans_dev *dev; +unsigned int noio_flags; dev = hctx->queue->queuedata;if (!dev) {
@@ -174,10 +176,13 @@ static blk_status_t mtd_queue_rq(struct blk_mq_hw_ctx *hctx,return BLK_STS_IOERR ; } +/* Reclaim must not recurse into I/O while processing requests. */ + noio_flags =memalloc_noio_save ();spin_lock_irq (&dev->queue_lock);list_add_tail (&bd->rq->queuelist, &dev->rq_list);mtd_blktrans_work (dev);spin_unlock_irq (&dev->queue_lock); +memalloc_noio_restore (noio_flags);return BLK_STS_OK ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2367/3318 writeback: size foreign flushes by target wb dirty pages
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xin Yin <[email protected]>
[ Upstream commit 168a8c13159c6e3f0f08da6f8fa2f633a91ba9fd ]
Foreign dirty tracking records the bdi and wb memcg IDs of recently dirtied foreign inodes. When the source memcg needs foreign writeback, mem_cgroup_flush_foreign() queues WB_REASON_FOREIGN_FLUSH to the recorded target bdi_writeback.
cgroup_writeback_by_id() currently sizes this best-effort work from the target memcg's NR_FILE_DIRTY counter. The work is scoped to one target wb, so a memcg-wide dirty count can over-size a single-bdi flush when the target memcg has dirty pages on other devices. It can also under-size the flush when the target wb has dirty pages charged to other memcgs.
Over-sizing keeps the target wb busy longer and can delay later writeback work. Under-sizing can finish before enough pages are written back for the source memcg.
Use the target wb's WB_RECLAIMABLE counter and keep the existing 25% headroom. This keeps the budget aligned with the writeback object being queued.
--- fs/fs-writeback.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)
fs/fs-writeback.c +7 -10
@@ -1124,7 +1124,7 @@ int cgroup_writeback_by_id(u64 bdi_id, int memcg_id,struct cgroup_subsys_state *memcg_css;struct bdi_writeback *wb;struct wb_writeback_work *work; -unsigned long dirty; +long dirty;int ret;/* lookup bdi and memcg */
@@ -1153,16 +1153,13 @@ int cgroup_writeback_by_id(u64 bdi_id, int memcg_id, }/* -* The caller is attempting to write out most of -* the currently dirty pages. Let's take the current dirty page -* count and inflate it by 25% which should be large enough to -* flush out most dirty pages while avoiding getting livelocked by -* concurrent dirtiers. -* -* BTW the memcg stats are flushed periodically and this is best-effort -* estimation, so some potential error is ok. +* The caller is attempting to write out most of the target wb's +* currently dirty pages. Size the work from the wb's reclaimable pages +* and inflate the count by 25%, which should be large enough to flush +* out most dirty pages while avoiding getting livelocked by concurrent +* dirtiers. */ - dirty =memcg_page_state (mem_cgroup_from_css (memcg_css),NR_FILE_DIRTY ); + dirty =wb_stat_sum (wb,WB_RECLAIMABLE ); dirty = dirty *10 /8 ;/* issue the writeback work */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2368/3318 ACPICA: Fix memory leak in acpi_ds_create_field()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <[email protected]>
[ Upstream commit dbb3d99ee95c32711950850ddd33eb22a6042eb2 ]
acpi_ds_create_field() allocates internal_pcc_buffer for operation regions in the PCC address space.
The function runs once per field, so a second field on the same region overwrites the pointer and orphans the previous buffer.
The matching ACPI_FREE() in acpi_ut_delete_internal_obj() only ever sees the last one.
An arm64 platform whose SSDT declares regions with multiple fields each leaks two buffers at boot, as detected by kmemleak:
unreferenced object 0xffff000051e65400 (size 192):
comm "swapper/0", pid 1, jiffies 4294668436 backtrace (crc 0):
__kmalloc_noprof
acpi_ds_create_field acpi_ds_load2_end_op acpi_ds_exec_end_op
acpi_ps_parse_loop
acpi_ps_parse_aml
acpi_ns_load_table
acpi_load_tables
acpi_init
Do not allocate a region if it was previously allocated before, preserving the current design, but, not leaking memory.
--- drivers/acpi/acpica/dsfield.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/acpi/acpica/dsfield.c +2 -1
@@ -522,7 +522,8 @@ acpi_ds_create_field(union acpi_parse_object *op, }if (info.region_node->object->region.space_id == -ACPI_ADR_SPACE_PLATFORM_COMM ) { +ACPI_ADR_SPACE_PLATFORM_COMM && + !region_node->object->field.internal_pcc_buffer) { region_node->object->field.internal_pcc_buffer =ACPI_ALLOCATE_ZEROED (info.region_node->object->region. length);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2369/3318 ACPICA: Fix PCC OperationRegion command offsets
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sudeep Holla <[email protected]>
[ Upstream commit 888dab4b04ea8725168c6d50d0bfb8057fccca18 ]
ACPI 6.3, section 5.5.2.4.7.3, states that the PCC Operation Region is associated with the region of shared memory that follows the PCC signature.
The generic and extended PCC shared memory layouts include the 4-byte signature at offset 0, so their raw shared memory COMMAND fields are at offsets 4 and 12 respectively. Since AML field offsets for the PCC OperationRegion are relative to the region after that signature, ACPICA must look for those COMMAND fields at OperationRegion offsets 0 and 8.
Adjust the generic and master subspace command checks to use those OperationRegion-relative offsets. Otherwise writes to the COMMAND field can fail to invoke the PCC address space handler at the offset described by the PCC OperationRegion definition.
--- drivers/acpi/acpica/exfield.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/acpi/acpica/exfield.c +6 -5
@@ -45,12 +45,13 @@ static const u8 acpi_protocol_lengths[] = {/* * The following macros determine a given offset is a COMD field. -* According to the specification, generic subspaces (types 0-2) contains a -* 2-byte COMD field at offset 4 and master subspaces (type 3) contains a 4-byte -* COMD field starting at offset 12. +* According to the specification, the PCC OperationRegion begins after +* the PCC signature. The raw shared memory COMD offsets of 4 for generic +* subspaces (types 0-2) and 12 for master subspaces (type 3) therefore +* appear at OperationRegion offsets 0 and 8. */ -#define GENERIC_SUBSPACE_COMMAND (a) (4 == a || a == 5) -#define MASTER_SUBSPACE_COMMAND (a) (12 <= a && a <= 15) +#define GENERIC_SUBSPACE_COMMAND (a) (0 == a || a == 1) +#define MASTER_SUBSPACE_COMMAND (a) (8 <= a && a <= 11)/******************************************************************************* *
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2370/3318 ACPI: PCC: Simplify PCC shared memory region handling
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sudeep Holla <[email protected]>
[ Upstream commit 8960c45a0f41399770d408921180231395604e2f ]
The PCC driver now handles mapping and unmapping of shared memory areas as part of pcc_mbox_{request,free}_channel(). Without these before, this ACPI PCC opregion driver did handling of those mappings like several other PCC mailbox client drivers.
There were redundant operations, leading to unnecessary code. Maintaining the consistency across these driver was harder due to scattered handling of shmem.
Just use the mapped shmem and remove all redundant operations from this driver.
Stable-dep-of: 46c263c21387 ("ACPI: PCC: Preserve shared memory signature in OpRegion handler")
--- drivers/acpi/acpi_pcc.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
drivers/acpi/acpi_pcc.c +2 -11
@@ -31,7 +31,6 @@struct pcc_data {struct pcc_mbox_chan *pcc_chan; -void __iomem *pcc_comm_addr;struct completion done;struct mbox_client cl;struct acpi_pcc_info ctx;
@@ -81,14 +80,6 @@ acpi_pcc_address_space_setup(acpi_handle region_handle, u32 function, ret =AE_SUPPORT ; goto err_free_channel; } - data->pcc_comm_addr =acpi_os_ioremap (pcc_chan->shmem_base_addr, - pcc_chan->shmem_size); -if (!data->pcc_comm_addr) { -pr_err ("Failed to ioremap PCC comm region mem for %d\n" , - ctx->subspace_id); - ret =AE_NO_MEMORY ; - goto err_free_channel; - } *region_context = data;return AE_OK ;
@@ -113,7 +104,7 @@ acpi_pcc_address_space_handler(u32 function, acpi_physical_address addr,reinit_completion (&data->done);/* Write to Shared Memory */ -memcpy_toio (data->pcc_comm_addr, (void *)value, data->ctx.length); +memcpy_toio (data->pcc_chan->shmem, (void *)value, data->ctx.length); ret =mbox_send_message (data->pcc_chan->mchan,NULL );if (ret <0 )
@@ -134,7 +125,7 @@ acpi_pcc_address_space_handler(u32 function, acpi_physical_address addr,mbox_chan_txdone (data->pcc_chan->mchan, ret); -memcpy_fromio (value, data->pcc_comm_addr, data->ctx.length); +memcpy_fromio (value, data->pcc_chan->shmem, data->ctx.length);return AE_OK ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2371/3318 ACPI: PCC: Preserve shared memory signature in OpRegion handler
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sudeep Holla <[email protected]>
[ Upstream commit 46c263c213876bdc2297ef61aa90f0b210ebac73 ]
ACPI 6.3 introduced PCC OperationRegions. Section 5.5.2.4.7.3, "Declaring message fields within a PCC OperationRegion", states that, for all PCC subspace types, the PCC Operation Region pertains to the region of PCC subspace that succeeds the PCC signature. Its length therefore excludes the 4-byte signature.
The PCC address space handler currently copies the OperationRegion buffer to and from the start of the shared memory. This overwrites or exposes the platform-populated signature and omits the final four bytes of the OperationRegion.
Offset the copies by the size of the signature and reject an OperationRegion that does not fit in the remaining shared memory.
The example added by commit 77e2a04745ff ("ACPI: PCC: Implement OperationRegion handler for the PCC Type 3 subtype") incorrectly included the signature as an OperationRegion field. A Type 3 OperationRegion containing a 100-byte communication area is declared as follows:
OperationRegion (PFRM, PCC, 2, 0x70)
Field (PFRM, ByteAcc, NoLock, Preserve)
{
FLGS, 32,
LEN, 32,
CMD, 32,
DATA, 800
}This contains three 32-bit fields followed by a 100-byte DATA field. The fields correspond to the Type 3 shared memory layout in ACPI 6.3, Table 14-372, after excluding its 4-byte signature.
--- drivers/acpi/acpi_pcc.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
drivers/acpi/acpi_pcc.c +16 -4
@@ -28,6 +28,7 @@* to PCC commands */ #define PCC_CMD_WAIT_RETRIES_NUM 500ULL +#define PCC_SIGNATURE_SIZE sizeof(u32)struct pcc_data {struct pcc_mbox_chan *pcc_chan;
@@ -74,6 +75,14 @@ acpi_pcc_address_space_setup(acpi_handle region_handle, u32 function, } pcc_chan = data->pcc_chan; +if (pcc_chan->shmem_size <PCC_SIGNATURE_SIZE || + ctx->length > pcc_chan->shmem_size -PCC_SIGNATURE_SIZE ) { +pr_err ("PCC channel-%d shared memory is too small.\n" , + ctx->subspace_id); + ret =AE_AML_REGION_LIMIT ; + goto err_free_channel; + } +if (!pcc_chan->mchan->mbox->txdone_irq) {pr_err ("This channel-%d does not support interrupt.\n" , ctx->subspace_id);
@@ -97,14 +106,17 @@ acpi_pcc_address_space_handler(u32 function, acpi_physical_address addr, u32 bits, acpi_integer *value, void *handler_context, void *region_context) { - int ret; struct pcc_data *data = region_context; +void __iomem *pcc_opregion;u64 usecs_lat; +int ret; + + pcc_opregion = data->pcc_chan->shmem +PCC_SIGNATURE_SIZE ;reinit_completion (&data->done); -/* Write to Shared Memory */ -memcpy_toio (data->pcc_chan->shmem, (void *)value, data->ctx.length); +/* Write to the PCC OperationRegion after the shared memory signature. */ +memcpy_toio (pcc_opregion, (void *)value, data->ctx.length); ret =mbox_send_message (data->pcc_chan->mchan,NULL );if (ret <0 )
@@ -125,7 +137,7 @@ acpi_pcc_address_space_handler(u32 function, acpi_physical_address addr,mbox_chan_txdone (data->pcc_chan->mchan, ret); -memcpy_fromio (value, data->pcc_chan->shmem, data->ctx.length); +memcpy_fromio (value, pcc_opregion, data->ctx.length);return AE_OK ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2372/3318 ASoC: mediatek: mt8183: Fix wrong clock cleanup on clk_set_parent() failure
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 7f05596bd4047e4623eeb1f3c6921d6f71481c3b ]
In mt8183_afe_enable_clock(), when clk_set_parent() fails, the current error path incorrectly cleans up the previously enabled clock instead of the clock used by clk_set_parent().
Fix the error path to clean up the correct clock when clk_set_parent() fails.
--- sound/soc/mediatek/mt8183/mt8183-afe-clk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/mediatek/mt8183/mt8183-afe-clk.c +2 -2
@@ -137,7 +137,7 @@ int mt8183_afe_enable_clock(struct mtk_base_afe *afe)dev_err (afe->dev,"%s(), clk_set_parent %s-%s fail %d\n" , __func__, aud_clks[CLK_MUX_AUDIO ], aud_clks[CLK_CLK26M ], ret); - goto CLK_MUX_AUDIO_ERR; + goto CLK_MUX_AUDIO_INTBUS_ERR; } ret =clk_prepare_enable (afe_priv->clk[CLK_MUX_AUDIOINTBUS ]);
@@ -153,7 +153,7 @@ int mt8183_afe_enable_clock(struct mtk_base_afe *afe)dev_err (afe->dev,"%s(), clk_set_parent %s-%s fail %d\n" , __func__, aud_clks[CLK_MUX_AUDIOINTBUS ], aud_clks[CLK_TOP_SYSPLL_D2_D4 ], ret); - goto CLK_MUX_AUDIO_INTBUS_ERR; + goto CLK_AFE_ERR; } ret =clk_prepare_enable (afe_priv->clk[CLK_AFE ]);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2373/3318 ASoC: mediatek: mt8183: Fix clock handling in mux disable path
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 4a0f9566ae0c3ad32620254342b266f37f4757de ]
In the disable path of the appl*_mux_setting() functions, clk_disable_unprepare() is called after clk_set_parent(). If clk_set_parent() fails, clk_disable_unprepare() is skipped, potentially leaving one of the clocks enabled.
Remove the goto exit paths so that all teardown steps are attempted and any errors are only reported.
--- sound/soc/mediatek/mt8183/mt8183-afe-clk.c | 6 ------ 1 file changed, 6 deletions(-)
sound/soc/mediatek/mt8183/mt8183-afe-clk.c +0 -6
@@ -271,7 +271,6 @@ static int apll1_mux_setting(struct mtk_base_afe *afe, bool enable)dev_err (afe->dev,"%s clk_set_parent %s-%s fail %d\n" , __func__, aud_clks[CLK_TOP_MUX_AUD_ENG1 ], aud_clks[CLK_CLK26M ], ret); - goto EXIT; }clk_disable_unprepare (afe_priv->clk[CLK_TOP_MUX_AUD_ENG1 ]);
@@ -281,7 +280,6 @@ static int apll1_mux_setting(struct mtk_base_afe *afe, bool enable)dev_err (afe->dev,"%s clk_set_parent %s-%s fail %d\n" , __func__, aud_clks[CLK_TOP_MUX_AUD_1 ], aud_clks[CLK_CLK26M ], ret); - goto EXIT; }clk_disable_unprepare (afe_priv->clk[CLK_TOP_MUX_AUD_1 ]); }
@@ -298,7 +296,6 @@ static int apll1_mux_setting(struct mtk_base_afe *afe, bool enable) afe_priv->clk[CLK_CLK26M]);clk_disable_unprepare (afe_priv->clk[CLK_TOP_MUX_AUD_1 ]); ERR_ENABLE_CLK_TOP_MUX_AUD_1: -EXIT:return ret; }
@@ -345,7 +342,6 @@ static int apll2_mux_setting(struct mtk_base_afe *afe, bool enable)dev_err (afe->dev,"%s clk_set_parent %s-%s fail %d\n" , __func__, aud_clks[CLK_TOP_MUX_AUD_ENG2 ], aud_clks[CLK_CLK26M ], ret); - goto EXIT; }clk_disable_unprepare (afe_priv->clk[CLK_TOP_MUX_AUD_ENG2 ]);
@@ -355,7 +351,6 @@ static int apll2_mux_setting(struct mtk_base_afe *afe, bool enable)dev_err (afe->dev,"%s clk_set_parent %s-%s fail %d\n" , __func__, aud_clks[CLK_TOP_MUX_AUD_2 ], aud_clks[CLK_CLK26M ], ret); - goto EXIT; }clk_disable_unprepare (afe_priv->clk[CLK_TOP_MUX_AUD_2 ]); }
@@ -372,7 +367,6 @@ static int apll2_mux_setting(struct mtk_base_afe *afe, bool enable) afe_priv->clk[CLK_CLK26M]);clk_disable_unprepare (afe_priv->clk[CLK_TOP_MUX_AUD_2 ]); ERR_ENABLE_CLK_TOP_MUX_AUD_2: -EXIT:return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2374/3318 ASoC: mediatek: mt8183: Fix APLL enable error handling
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 30cf48383006579d7cd35380cc6e766260b72bff ]
Currently, the mt8183_apll*_enable() functions call mux_setting(afe, true) but do not check its return value to handle failures.
In addition, the cleanup paths of mt8183_apll*_enable() do not call mux_setting(afe, false) when the enable operation fails, while the mt8183_apll*_disable() functions do.
Add error handling for apll*_mux_setting() and call mux_setting(afe, false) in the cleanup paths when mt8183_apll*_enable() fails.
--- sound/soc/mediatek/mt8183/mt8183-afe-clk.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
sound/soc/mediatek/mt8183/mt8183-afe-clk.c +10 -2
@@ -376,7 +376,9 @@ int mt8183_apll1_enable(struct mtk_base_afe *afe)int ret;/* setting for APLL */ -apll1_mux_setting (afe, true); + ret =apll1_mux_setting (afe, true); +if (ret) +return ret; ret =clk_prepare_enable (afe_priv->clk[CLK_APLL22M ]);if (ret) {
@@ -405,6 +407,8 @@ int mt8183_apll1_enable(struct mtk_base_afe *afe) ERR_CLK_APLL1_TUNER:clk_disable_unprepare (afe_priv->clk[CLK_APLL22M ]); ERR_CLK_APLL22M: +apll1_mux_setting (afe, false); +return ret; }
@@ -430,7 +434,9 @@ int mt8183_apll2_enable(struct mtk_base_afe *afe)int ret;/* setting for APLL */ -apll2_mux_setting (afe, true); + ret =apll2_mux_setting (afe, true); +if (ret) +return ret; ret =clk_prepare_enable (afe_priv->clk[CLK_APLL24M ]);if (ret) {
@@ -459,6 +465,8 @@ int mt8183_apll2_enable(struct mtk_base_afe *afe) ERR_CLK_APLL2_TUNER:clk_disable_unprepare (afe_priv->clk[CLK_APLL24M ]); ERR_CLK_APLL24M: +apll2_mux_setting (afe, false); +return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2375/3318 dt-bindings: vendor-prefixes: Add Chip Wealth Technology
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaron Kling <[email protected]>
[ Upstream commit 058ee00216a1356e710446b59a800065d2abbd80 ]
Add an entry for Chip Wealth Technology (https://www.chipwealth.com/)
--- Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
@@ -260,6 +260,8 @@ patternProperties: description: ChipOne "^chipspark,.*": description: ChipSPARK + "^chipwealth,.*": + description: Chip Wealth Technology "^chongzhou,.*": description: Shenzhen Chongzhou Electronic Technology Co., Ltd "^chrontel,.*":
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2376/3318 arm64: dts: qcom: sdm845-lg: fix sdcard pinctrl nodes
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Sajna <[email protected]>
[ Upstream commit e57d572ed779eb53e7eb5b8f9546731eff21bc93 ]
sdcard was previously rather unreliable during boot on sdm845-lg-judyln
Identified and applied correct settings from downstream lineageos kernel.
Verified card was properly detected over 5 reboots with rootfs on sdcard.
Refer to downstream: https://github.com/LineageOS/android_kernel_lge_sdm845/blob/efa8458f79dffeb380d43b38b9403407f87d9f05/arch/arm64/boot/dts/qcom/sdm845-pinctrl.dtsi#L148-L303
--- arch/arm64/boot/dts/qcom/sdm845-lg-common.dtsi | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)
arch/arm64/boot/dts/qcom/sdm845-lg-common.dtsi +3 -10
@@ -556,33 +556,26 @@ &tlmm { sdc2_clk: sdc2-clk-state { pins = "sdc2_clk"; bias-disable; - - /* - * It seems that mmc_test reports errors if drive - * strength is not 16 on clk, cmd, and data pins. - * - * TODO: copy-pasted from mtp, try other values - * on these devices. - */ drive-strength = <16>; }; sdc2_cmd: sdc2-cmd-state { pins = "sdc2_cmd"; bias-pull-up; - drive-strength = <16>; + drive-strength = <10>; }; sdc2_data: sdc2-data-state { pins = "sdc2_data"; bias-pull-up; - drive-strength = <16>; + drive-strength = <10>; }; sd_card_det_n: sd-card-det-n-state { pins = "gpio126"; function = "gpio"; bias-pull-up; + drive-strength = <2>; }; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2377/3318 hfs/hfsplus: serialize B-tree close against folio release
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bruno Produit <[email protected]>
[ Upstream commit dce0e0248205bb3dc5b4c6793cd2ecb453152259 ]
B-tree nodes with a zero reference count remain in the node hash until folio reclaim or tree teardown frees them. The folio release callbacks remove nodes while holding hash_lock, but hfs_btree_close() walks and frees the same hash without that lock. Reclaim can therefore unhash and free a node after close has loaded its pointer, causing a use-after-free or double-free.
The following syzkaller crashes seem to be the same UAF in {hfs,hfsplus}_btree_close() (or {hfs,hfsplus}_bnode_unhash()) and follow the same pattern, but do not contain a reproducer to confirm.
Detach each node with hfs_bnode_unhash() while holding hash_lock before inspecting and freeing it. Drop the lock before hfs_bnode_free() so a large tree is not freed while holding a spinlock. Apply the same fix to the matching HFS+ implementation.
--- fs/hfs/btree.c | 7 +++++-- fs/hfsplus/btree.c | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-)
fs/hfs/btree.c +5 -2
@@ -180,15 +180,18 @@ void hfs_btree_close(struct hfs_btree *tree)return ;for (i =0 ; i <NODE_HASH_SIZE ; i++) { +spin_lock (&tree->hash_lock);while ((node = tree->node_hash[i])) { - tree->node_hash[i] = node->next_hash; +hfs_bnode_unhash (node); +spin_unlock (&tree->hash_lock);if (atomic_read (&node->refcnt))pr_err ("node %d:%d still has %d user(s)!\n" , node->tree->cnid, node->this,atomic_read (&node->refcnt));hfs_bnode_free (node); - tree->node_hash_cnt--; +spin_lock (&tree->hash_lock); } +spin_unlock (&tree->hash_lock); }iput (tree->inode);kfree (tree);
fs/hfsplus/btree.c +5 -2
@@ -265,16 +265,19 @@ void hfs_btree_close(struct hfs_btree *tree)return ;for (i =0 ; i <NODE_HASH_SIZE ; i++) { +spin_lock (&tree->hash_lock);while ((node = tree->node_hash[i])) { - tree->node_hash[i] = node->next_hash; +hfs_bnode_unhash (node); +spin_unlock (&tree->hash_lock);if (atomic_read (&node->refcnt))pr_crit ("node %d:%d " "still has %d user(s)!\n" , node->tree->cnid, node->this,atomic_read (&node->refcnt));hfs_bnode_free (node); - tree->node_hash_cnt--; +spin_lock (&tree->hash_lock); } +spin_unlock (&tree->hash_lock); }iput (tree->inode);kfree (tree);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2378/3318 arm64: dts: qcom: lemans-ride-common: fix SerDes PHY regulator supplies
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mohd Ayaan Anwar <[email protected]>
[ Upstream commit 0d567fb7def9564d15c334ec0fa5f5f6a0114ffa ]
Both SerDes PHY nodes were configured with 'phy-supply = <&vreg_l5a>', which was incorrect on two counts: vreg_l5a is not a supply the PHY requires, and only one rail was described where the hardware needs two.
The PHY requires vdda-0p9 (vreg_l4a) and vdda-1p2 (vreg_l1c). Replace the incorrect phy-supply with these two named properties on both nodes.
--- arch/arm64/boot/dts/qcom/sa8775p-ride.dtsi | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/sa8775p-ride.dtsi +6 -2
@@ -507,12 +507,16 @@ &qupv3_id_2 { }; &serdes0 { - phy-supply = <&vreg_l5a>; + vdda-0p9-supply = <&vreg_l4a>; + vdda-1p2-supply = <&vreg_l1c>; + status = "okay"; }; &serdes1 { - phy-supply = <&vreg_l5a>; + vdda-0p9-supply = <&vreg_l4a>; + vdda-1p2-supply = <&vreg_l1c>; + status = "okay"; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2379/3318 ARM: dts: qcom: msm8974: Use the header with DSI phy clock IDs
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 1afdd80d1e021f758c975d857c6beb6da5c891bd ]
Use the header with DSI phy clock IDs to make code more readable.
Stable-dep-of: 542991a1d77e ("ARM: dts: qcom: msm8974: add MDSS reset")
--- arch/arm/boot/dts/qcom/qcom-msm8974.dtsi | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)
arch/arm/boot/dts/qcom/qcom-msm8974.dtsi +13 -8
@@ -3,6 +3,7 @@ #include <dt-bindings/interconnect/qcom,msm8974.h> #include <dt-bindings/interrupt-controller/arm-gic.h> +#include <dt-bindings/clock/qcom,dsi-phy-28nm.h> #include <dt-bindings/clock/qcom,gcc-msm8974.h> #include <dt-bindings/clock/qcom,mmcc-msm8974.h> #include <dt-bindings/clock/qcom,rpmcc.h>
@@ -1837,10 +1838,10 @@ mmcc: clock-controller@fd8c0000 { <&gcc GPLL0_VOTE>, <&gcc GPLL1_VOTE>, <&rpmcc RPM_SMD_GFX3D_CLK_SRC>, - <&mdss_dsi0_phy 1>, - <&mdss_dsi0_phy 0>, - <&mdss_dsi1_phy 1>, - <&mdss_dsi1_phy 0>, + <&mdss_dsi0_phy DSI_PIXEL_PLL_CLK>, + <&mdss_dsi0_phy DSI_BYTE_PLL_CLK>, + <&mdss_dsi1_phy DSI_PIXEL_PLL_CLK>, + <&mdss_dsi1_phy DSI_BYTE_PLL_CLK>, <0>, <0>, <0>;
@@ -1927,8 +1928,10 @@ mdss_dsi0: dsi@fd922800 { interrupt-parent = <&mdss>; interrupts = <4>; - assigned-clocks = <&mmcc BYTE0_CLK_SRC>, <&mmcc PCLK0_CLK_SRC>; - assigned-clock-parents = <&mdss_dsi0_phy 0>, <&mdss_dsi0_phy 1>; + assigned-clocks = <&mmcc BYTE0_CLK_SRC>, + <&mmcc PCLK0_CLK_SRC>; + assigned-clock-parents = <&mdss_dsi0_phy DSI_BYTE_PLL_CLK>, + <&mdss_dsi0_phy DSI_PIXEL_PLL_CLK>; clocks = <&mmcc MDSS_MDP_CLK>, <&mmcc MDSS_AHB_CLK>,
@@ -1998,8 +2001,10 @@ mdss_dsi1: dsi@fd922e00 { interrupt-parent = <&mdss>; interrupts = <4>; - assigned-clocks = <&mmcc BYTE1_CLK_SRC>, <&mmcc PCLK1_CLK_SRC>; - assigned-clock-parents = <&mdss_dsi1_phy 0>, <&mdss_dsi1_phy 1>; + assigned-clocks = <&mmcc BYTE1_CLK_SRC>, + <&mmcc PCLK1_CLK_SRC>; + assigned-clock-parents = <&mdss_dsi1_phy DSI_BYTE_PLL_CLK>, + <&mdss_dsi1_phy DSI_PIXEL_PLL_CLK>; clocks = <&mmcc MDSS_MDP_CLK>, <&mmcc MDSS_AHB_CLK>,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2380/3318 ARM: dts: qcom: msm8974: Sort header includes alphabetically
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luca Weiss <[email protected]>
[ Upstream commit 4cf8d541f4716444b61a919e3fe6f04814165782 ]
Before adding more headers in a random order, let's sort the includes once so that's done.
Stable-dep-of: 542991a1d77e ("ARM: dts: qcom: msm8974: add MDSS reset")
--- arch/arm/boot/dts/qcom/qcom-msm8974.dtsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/qcom/qcom-msm8974.dtsi +3 -3
@@ -1,14 +1,14 @@ // SPDX-License-Identifier: GPL-2.0 /dts-v1/; -#include <dt-bindings/interconnect/qcom,msm8974.h> -#include <dt-bindings/interrupt-controller/arm-gic.h> #include <dt-bindings/clock/qcom,dsi-phy-28nm.h> #include <dt-bindings/clock/qcom,gcc-msm8974.h> #include <dt-bindings/clock/qcom,mmcc-msm8974.h> #include <dt-bindings/clock/qcom,rpmcc.h> -#include <dt-bindings/reset/qcom,gcc-msm8974.h> #include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/interconnect/qcom,msm8974.h> +#include <dt-bindings/interrupt-controller/arm-gic.h> +#include <dt-bindings/reset/qcom,gcc-msm8974.h> / { #address-cells = <1>;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2381/3318 ARM: dts: qcom: msm8974: add MDSS reset
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit 542991a1d77e5fea5263c2406773a0cd09a8ec48 ]
Commit 13a4b7fb6260 ("pmdomain: core: Leave powered-on genpds on until late_initcall_sync") kept power-domains on longer during boot which is causing DSI clock to get stuck and fail to acquire its configuration on DSI bringup. Follow the example of other platforms and add MDSS reset to the display subsystem node, fixing DSI issues.
--- arch/arm/boot/dts/qcom/qcom-msm8974.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/boot/dts/qcom/qcom-msm8974.dtsi +3 -0
@@ -9,6 +9,7 @@ #include <dt-bindings/interconnect/qcom,msm8974.h> #include <dt-bindings/interrupt-controller/arm-gic.h> #include <dt-bindings/reset/qcom,gcc-msm8974.h> +#include <dt-bindings/reset/qcom,mmcc-msm8974.h> / { #address-cells = <1>;
@@ -1876,6 +1877,8 @@ mdss: display-subsystem@fd900000 { interrupt-controller; #interrupt-cells = <1>; + resets = <&mmcc MDSS_RESET>; + status = "disabled"; #address-cells = <1>;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2382/3318 dt-bindings: vendor-prefixes: Add LeEco
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adam Skladowski <[email protected]>
[ Upstream commit 1658af4d25bd3133d1b3403ccdda6214d40c0ebb ]
Add vendor prefix for now dead ecosystem company LeEco
--- Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
@@ -763,6 +763,8 @@ patternProperties: description: Shenzen LC Technology Co., Ltd. "^leadtek,.*": description: Shenzhen Leadtek Technology Co., Ltd. + "^leeco,.*": + description: Leshi Holding Beijing. "^leez,.*": description: Leez "^lego,.*":
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2383/3318 dt-bindings: vendor-prefixes: Add Retronix Technology Inc.
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
[ Upstream commit da076d5562d2fc99138ff8ab04ff82eee7a4a3d8 ]
Add vendor prefix for Retronix Technology Inc.
https://www.retronix.com.tw/en/about.html
Stable-dep-of: ea55bba4c68a ("dt-bindings: vendor-prefixes: Add Retroid Pocket")
--- Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
@@ -1161,6 +1161,8 @@ patternProperties: description: Renesas Electronics Corporation "^rervision,.*": description: Shenzhen Rervision Technology Co., Ltd. + "^retronix,.*": + description: Retronix Technology Inc. "^revotics,.*": description: Revolution Robotics, Inc. (Revotics) "^rex,.*":
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2384/3318 dt-bindings: vendor-prefixes: Add Retroid Pocket
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaron Kling <[email protected]>
[ Upstream commit ea55bba4c68a49fcb527da6c71dd48879b705fd1 ]
Add an entry for Retroid Pocket (https://www.goretroid.com/)
--- Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
@@ -1161,6 +1161,8 @@ patternProperties: description: Renesas Electronics Corporation "^rervision,.*": description: Shenzhen Rervision Technology Co., Ltd. + "^retroidpocket,.*": + description: Retroid Pocket "^retronix,.*": description: Retronix Technology Inc. "^revotics,.*":
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2385/3318 MIPS: Octeon: size the swiotlb for a modular OHCI platform driver
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Orgad Shaneh <[email protected]>
[ Upstream commit f1dd1f0c8d595a019be503d40060d25721313b4a ]
plat_swiotlb_setup() raises the swiotlb to 64 MB on OCTEON II with memory above 4 GB, because that OHCI can only DMA to 32 bits. The test is "#ifdef CONFIG_USB_OHCI_HCD_PLATFORM", which is false when the driver is a module - the usual way to build it - so the bump is silently skipped.
What is left depends on the rest of the function: with PCI enabled the "memory past the BAR1 hole" branch happens to ask for the same 64 MB, but with CONFIG_PCI off - which is normal on these SoCs when no PCI devices are wired - swiotlbsize stays at the PAGE_SIZE it was initialised to. A full- or low-speed device on an OCTEON II board with more than 4 GB of RAM then has no bounce buffer to speak of.
Use IS_ENABLED() so a modular OHCI gets the same sizing as a built-in one. Seen on a CN6635 board with 8 GB of RAM and CONFIG_USB_OHCI_HCD_PLATFORM=m.
--- arch/mips/cavium-octeon/dma-octeon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/cavium-octeon/dma-octeon.c +1 -1
@@ -228,7 +228,7 @@ void __init plat_swiotlb_setup(void) swiotlbsize = 64 * (1<<20); }#endif -#ifdef CONFIG_USB_OHCI_HCD_PLATFORM +#if IS_ENABLED (CONFIG_USB_OHCI_HCD_PLATFORM )/* OCTEON II ohci is only 32-bit. */ if (OCTEON_IS_OCTEON2 () && max_addr >=0x100000000ul ) swiotlbsize =64 * (1 <<20 );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2386/3318 MIPS: Only check -msym32 when need-compiler
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: WangYuli <[email protected]>
[ Upstream commit 7a8f286c235f5d308208cfdcb025b2a0e0c84742 ]
During 'make modules_install', the need-compiler variable is null, so Makefile.compiler isn't included. This results in call cc-option-yn returning nothing and consequently an error is issued:
*** CONFIG_CPU_DADDI_WORKAROUNDS unsupported without -msym32. Stop.
and the invocation terminated for configurations that set the Kconfig option named.
Previously commit a79a404e6c22 ("MIPS: Fix CONFIG_CPU_DADDI_WORKAROUNDS `modules_install' regression") addressed the same issue for GCC versions now supported for Linux compilation, but caused a build error with Clang because it doesn't support '-msym32'. Then commit 18ca63a2e23c ("MIPS:
Probe toolchain support of -msym32") fixed the issue with Clang, but reintroduced the 'make modules_install' error listed above.
Wrap the handling of the '-msym32' option then with ifdef need-compiler, fixing said error for 'make modules_install'.
For more technical details on why need-compiler is null during 'make modules_install' and why no compiler invocation is actually needed at this point, please refer to commit 4fe4a6374c4d ("MIPS: Only fiddle with CHECKFLAGS if need-compiler") and commit 805b2e1d427a ("kbuild: include Makefile.compiler only when compiler is needed").
NB leading 8 spaces rather than tabs required due to `make' syntax.
--- arch/mips/Makefile | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
arch/mips/Makefile +12 -10
@@ -296,18 +296,20 @@ drivers-$(CONFIG_PCI) += arch/mips/pci/ # We can always force a build with a 64-bits symbol format by # passing 'KBUILD_SYM32=no' option to the make's command line. # -ifdef CONFIG_64BIT - ifndef KBUILD_SYM32 - ifeq ($(shell expr $(load-y) \< 0xffffffff80000000), 0) - KBUILD_SYM32 = $(call cc-option-yn, -msym32) +ifdef need-compiler + ifdef CONFIG_64BIT + ifndef KBUILD_SYM32 + ifeq ($(shell expr $(load-y) \< 0xffffffff80000000), 0) + KBUILD_SYM32 = $(call cc-option-yn, -msym32) + endif endif - endif - ifeq ($(KBUILD_SYM32), y) - cflags-$(KBUILD_SYM32) += -msym32 -DKBUILD_64BIT_SYM32 - else - ifeq ($(CONFIG_CPU_DADDI_WORKAROUNDS), y) - $(error CONFIG_CPU_DADDI_WORKAROUNDS unsupported without -msym32) + ifeq ($(KBUILD_SYM32), y) + cflags-$(KBUILD_SYM32) += -msym32 -DKBUILD_64BIT_SYM32 + else + ifeq ($(CONFIG_CPU_DADDI_WORKAROUNDS), y) + $(error CONFIG_CPU_DADDI_WORKAROUNDS unsupported without -msym32) + endif endif endif endif
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2387/3318 bitmap: Remove dead code, i.e. bitmap_copy_le()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit 7733aa893847f021c674d0d30b723d892109369d ]
Besides the fact it's not used anywhere it should be implemented differently, i.e. via helpers from linux/byteorder/generic.h. Yet the helpers themselves need to be introduced first.
Also note, the function lacks of the test cases, they must be provided.
Hence, drop the current dead code for good.
Stable-dep-of: 7cee2fb210a1 ("bitmap: bitmap_parse(): reject non-hex character before 8 digits")
--- include/linux/bitmap.h | 5 ----- lib/bitmap.c | 23 ----------------------- 2 files changed, 28 deletions(-)
include/linux/bitmap.h +0 -5
@@ -224,11 +224,6 @@ int bitmap_find_free_region(unsigned long *bitmap, unsigned int bits, int order)void bitmap_release_region (unsigned long *bitmap,unsigned int pos,int order);int bitmap_allocate_region (unsigned long *bitmap,unsigned int pos,int order); -#ifdef __BIG_ENDIAN -void bitmap_copy_le (unsigned long *dst,const unsigned long *src,unsigned int nbits); -#else -#define bitmap_copy_le bitmap_copy -#endif int bitmap_print_to_pagebuf (bool list,char *buf,const unsigned long *maskp,int nmaskbits);
lib/bitmap.c +0 -23
@@ -1360,29 +1360,6 @@ int bitmap_allocate_region(unsigned long *bitmap, unsigned int pos, int order) }EXPORT_SYMBOL (bitmap_allocate_region); -/** -* bitmap_copy_le - copy a bitmap, putting the bits into little-endian order. -* @dst: destination buffer -* @src: bitmap to copy -* @nbits: number of bits in the bitmap -* -* Require nbits % BITS_PER_LONG == 0. -*/ -#ifdef __BIG_ENDIAN -void bitmap_copy_le (unsigned long *dst,const unsigned long *src,unsigned int nbits) -{ -unsigned int i; - -for (i =0 ; i < nbits/BITS_PER_LONG ; i++) { -if (BITS_PER_LONG ==64 ) - dst[i] =cpu_to_le64 (src[i]); -else - dst[i] =cpu_to_le32 (src[i]); - } -} -EXPORT_SYMBOL (bitmap_copy_le); -#endif -unsigned long *bitmap_alloc (unsigned int nbits,gfp_t flags) { return kmalloc_array(BITS_TO_LONGS(nbits), sizeof(unsigned long),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2388/3318 lib/bitmap: split-out string-related operations to a separate files
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yury Norov <[email protected]>
[ Upstream commit aae06fc1b5a2e4b52f8504a1f12f9b8b98e80641 ]
lib/bitmap.c and corresponding include/linux/bitmap.h are intended to hold functions related to operations on bitmaps, like bitmap_shift or bitmap_set. Historically, some string-related operations like bitmap_parse are also reside in lib/bitmap.c.
Now that the subsystem evolves, string-related bitmap operations became a significant part of the file. Because they are quite different from the other bitmap functions by nature, it's worth to split them to a separate source/header files.
Stable-dep-of: 7cee2fb210a1 ("bitmap: bitmap_parse(): reject non-hex character before 8 digits")
--- MAINTAINERS | 2 + include/linux/bitmap-str.h | 16 ++ include/linux/bitmap.h | 18 +- lib/Makefile | 2 +- lib/bitmap-str.c | 510 ++++++++++++++++++++++++++++++++++++ lib/bitmap.c | 512 ------------------------------------- 6 files changed, 530 insertions(+), 530 deletions(-) create mode 100644 include/linux/bitmap-str.h create mode 100644 lib/bitmap-str.c
MAINTAINERS +2 -0
@@ -3533,12 +3533,14 @@ R: Andy Shevchenko <[email protected]> R: Rasmus Villemoes <[email protected]> S: Maintained F: include/linux/bitfield.h +F: include/linux/bitmap-str.h F: include/linux/bitmap.h F: include/linux/bits.h F: include/linux/cpumask.h F: include/linux/find.h F: include/linux/nodemask.h F: include/vdso/bits.h +F: lib/bitmap-str.c F: lib/bitmap.c F: lib/cpumask.c F: lib/cpumask_kunit.c
include/linux/bitmap-str.h new file +16 -0
@@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __LINUX_BITMAP_STR_H +#define __LINUX_BITMAP_STR_H + +int bitmap_parse_user (const char __user *ubuf,unsigned int ulen,unsigned long *dst,int nbits); +int bitmap_print_to_pagebuf (bool list,char *buf,const unsigned long *maskp,int nmaskbits); +extern int bitmap_print_bitmask_to_buf (char *buf,const unsigned long *maskp, +int nmaskbits,loff_t off,size_t count); +extern int bitmap_print_list_to_buf (char *buf,const unsigned long *maskp, +int nmaskbits,loff_t off,size_t count); +int bitmap_parse (const char *buf,unsigned int buflen,unsigned long *dst,int nbits); +int bitmap_parselist (const char *buf,unsigned long *maskp,int nmaskbits); +int bitmap_parselist_user (const char __user *ubuf,unsigned int ulen, +unsigned long *dst,int nbits); + +#endif /* __LINUX_BITMAP_STR_H */
include/linux/bitmap.h +1 -17
@@ -10,6 +10,7 @@#include <linux/limits.h> #include <linux/string.h> #include <linux/types.h> +#include <linux/bitmap-str.h> struct device ;
@@ -204,14 +205,6 @@ bitmap_find_next_zero_area(unsigned long *map, align_mask, 0); } -int bitmap_parse (const char *buf,unsigned int buflen, -unsigned long *dst,int nbits); -int bitmap_parse_user (const char __user *ubuf,unsigned int ulen, -unsigned long *dst,int nbits); -int bitmap_parselist (const char *buf,unsigned long *maskp, -int nmaskbits); -int bitmap_parselist_user (const char __user *ubuf,unsigned int ulen, -unsigned long *dst,int nbits);void bitmap_remap (unsigned long *dst,const unsigned long *src,const unsigned long *old,const unsigned long *new,unsigned int nbits); int bitmap_bitremap(int oldbit,
@@ -224,15 +217,6 @@ int bitmap_find_free_region(unsigned long *bitmap, unsigned int bits, int order)void bitmap_release_region (unsigned long *bitmap,unsigned int pos,int order);int bitmap_allocate_region (unsigned long *bitmap,unsigned int pos,int order); -int bitmap_print_to_pagebuf (bool list,char *buf, -const unsigned long *maskp,int nmaskbits); - -extern int bitmap_print_bitmask_to_buf (char *buf,const unsigned long *maskp, -int nmaskbits,loff_t off,size_t count); - -extern int bitmap_print_list_to_buf (char *buf,const unsigned long *maskp, -int nmaskbits,loff_t off,size_t count); -#define BITMAP_FIRST_WORD_MASK (start) (~0UL << ((start) & (BITS_PER_LONG - 1)))#define BITMAP_LAST_WORD_MASK (nbits) (~0UL >> (-(nbits) & (BITS_PER_LONG - 1)))
lib/Makefile +1 -1
@@ -48,7 +48,7 @@ obj-y += bcd.o sort.o parser.o debug_locks.o random32.o \ bsearch.o find_bit.o llist.o memweight.o kfifo.o \ percpu-refcount.o rhashtable.o base64.o \ once.o refcount.o rcuref.o usercopy.o errseq.o bucket_locks.o \ - generic-radix-tree.o + generic-radix-tree.o bitmap-str.o obj-$(CONFIG_STRING_SELFTEST) += test_string.o obj-y += string_helpers.o obj-$(CONFIG_TEST_STRING_HELPERS) += test-string_helpers.o
lib/bitmap-str.c new file +510 -0
510 lines not on this page · raw message
lib/bitmap.c +0 -512
529 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2389/3318 bitmap: bitmap_parse(): reject non-hex character before 8 digits
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shashank Mohan Jain <[email protected]>
[ Upstream commit 7cee2fb210a198667d3d4200705215e6f315cab0 ]
bitmap_parse() is documented to return -EINVAL for illegal characters, and it does so everywhere except when the illegal character directly precedes a chunk of exactly eight hex digits.
bitmap_get_x32_reverse() parses a chunk from right to left. After it has consumed eight digits it looks at one more character: a hex digit means the chunk is wider than 32 bits and -EOVERFLOW is returned. Any other character is silently consumed as if it were a separator, and the remaining input is parsed as the next chunk. As a result:
"x12345678" -> 0x12345678, returns 0 (expected -EINVAL) "1g12345678" -> 0x1_12345678, returns 0 (expected -EINVAL) "0x0000000f" -> 0xf, returns 0, while "0xf" returns -EINVAL
bitmap_parse() backs cpumask_parse() and cpumask_parse_user(), so the same inconsistency is visible when writing masks such as /proc/irq/*/smp_affinity or the network queue rps_cpus/xps_cpus files.
__bitmap_parse(), which this function replaced in commit 2d6261583be0 ("lib: rework bitmap_parse()"), rejected all three strings with -EINVAL, and a "0x" prefix is accepted today only when exactly eight digits follow it, so no reliably working input is lost.
When the loop falls through, *end is known to be a non-separator character inside the buffer, so return -EOVERFLOW if it is a hex digit and -EINVAL otherwise.
--- lib/bitmap-str.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
lib/bitmap-str.c +6 -2
@@ -447,8 +447,12 @@ static const char *bitmap_get_x32_reverse(const char *start, goto out; } -if (hex_to_bin (*end--) >=0 ) -return ERR_PTR (-EOVERFLOW ); +/* +* Eight digits have been consumed and the next character is not a +* separator: another hex digit means the chunk does not fit in 32 +* bits, anything else is an illegal character. +*/ +return ERR_PTR (hex_to_bin (*end) >=0 ? -EOVERFLOW : -EINVAL ); out: *num = ret;return end;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2390/3318 bitmap: bitmap_parselist(): reject trailing characters after group size
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shashank Mohan Jain <[email protected]>
[ Upstream commit c55d102257fa31271c6f11fea595b78c48fd7aa2 ]
bitmap_parse_region() checks that every region ends at a separator (',', whitespace, '\n' or '\0'), except in the "range:used/group" form:
after parsing the group size it returns the pointer to the following character without looking at it. The caller then starts a new region at that character.
Before 'N' and 'all' were accepted as region starts this happened to be harmless, because any other character would fail to parse as a new region. Now text directly following the group size is silently parsed as another region:
"0-7:1/2N" -> bits 0,2,4,6,7 (nbits = 8), returns 0
"0-7:1/2all" -> all bits set, returns 0
while "0-7N", "5N" or "0-7:1/2x" are correctly rejected with -EINVAL. bitmap_parselist() is documented to return -EINVAL for an invalid character. It parses cpu lists from sysfs, cgroup cpuset files and boot parameters such as isolcpus= and nohz_full=, so a typo there is accepted and yields a different mask than intended.
Check for the end of the region after the group size as well, like the other forms do.
--- lib/bitmap-str.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
lib/bitmap-str.c +8 -1
@@ -332,7 +332,14 @@ static const char *bitmap_parse_region(const char *str, struct region *r)if (*str !='/' )return ERR_PTR (-EINVAL ); -return bitmap_getnum (str +1 , &r->group_len, lastbit); + str =bitmap_getnum (str +1 , &r->group_len, lastbit); +if (IS_ERR (str)) +return str; + +if (!end_of_region (*str)) +return ERR_PTR (-EINVAL ); + +return end_of_str (*str) ?NULL : str; no_end: r->end = r->start;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2391/3318 bitmap: bitmap_parselist(): dont wrap around on a huge group size
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shashank Mohan Jain <[email protected]>
[ Upstream commit d075c4dc0b3c8ed91a4f67ebdf3384aa59fd4fbb ]
In the "range:used/group" form bitmap_set_region() walks the range with
for (start = r->start; start <= r->end; start += r->group_len)
where all values are unsigned int. bitmap_getnum() accepts any group size up to UINT_MAX, and bitmap_check_region() only requires it to be non-zero and at least the used size. If start + group_len exceeds UINT_MAX, start wraps around to a small value that is still <= end, and bits below the start of the range get set:
"1-1:1/4294967295" -> bits 0,1 (expected bit 1)
"15-15:1/4294967281" -> bits 0,15 (expected bit 15)
The loop still terminates, because start keeps decreasing until it wraps past zero again, but the resulting mask contains bits outside the requested range.
This needs a group size within 'start' of UINT_MAX, so it is unlikely to be hit by accident; all bits set stay below the end of the range, so there is no out-of-bounds write.
A group larger than the range simply means that the range contains a single group, so stop the walk when the next group would start beyond UINT_MAX.
--- lib/bitmap-str.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
lib/bitmap-str.c +5 -2
@@ -8,6 +8,7 @@#include <linux/hex.h> #include <linux/kernel.h> #include <linux/mm.h> +#include <linux/overflow.h> #include <linux/string.h> #include "kstrtox.h"
@@ -219,10 +220,12 @@ struct region {static void bitmap_set_region (const struct region *r,unsigned long *bitmap) { -unsigned int start; +unsigned int start = r->start; -for (start = r->start; start <= r->end; start += r->group_len) +do {bitmap_set (bitmap, start,min (r->end - start +1 , r->off)); + }while (!check_add_overflow (start, r->group_len, &start) && + start <= r->end); }static int bitmap_check_region (const struct region *r)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2392/3318 m68k: apollo: Fix interrupt setup
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Palmer <[email protected]>
[ Upstream commit 6cdbe63badcb524c88f2c8b3cee08f2ffc099a1b ]
The user interrupt vector needs to be installed before the interrupts are unmasked otherwise the timer tick isn't handled and boot up gets stuck in calibrate_delay().
--- arch/m68k/apollo/dn_ints.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/m68k/apollo/dn_ints.c +6 -0
@@ -2,6 +2,7 @@#include <linux/interrupt.h> #include <linux/irq.h> +#include <asm/irq.h> #include <asm/traps.h> #include <asm/apollohw.h>
@@ -9,10 +10,13 @@ unsigned int apollo_irq_startup(struct irq_data *data) {unsigned int irq = data->irq; +m68k_irq_startup (data); +if (irq <8 ) *(volatile unsigned char *)(pica+1 ) &= ~(1 << irq);else *(volatile unsigned char *)(picb+1 ) &= ~(1 << (irq -8 )); +return 0 ; }
@@ -24,6 +28,8 @@ void apollo_irq_shutdown(struct irq_data *data) *(volatile unsigned char *)(pica+1 ) |= (1 << irq); else *(volatile unsigned char *)(picb+1 ) |= (1 << (irq -8 )); + +m68k_irq_shutdown (data); }void apollo_irq_eoi (struct irq_data *data)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2393/3318 drm/msm/a6xx: Fix secondary rail vote in ARC votes
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Akhil P Oommen <[email protected]>
[ Upstream commit 128a0edde50780ed9eb93ab5d2e18ca24c1f1c43 ]
Using the requested level can pick a secondary corner lower than the one required to support the chosen primary corner, under-voting the dependent rail. To fix this, match against the selected primary voltage instead.
Patchwork: https://patchwork.freedesktop.org/patch/755592/
Message-ID: <[email protected]>
--- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/adreno/a6xx_gmu.c +5 -1
@@ -1293,10 +1293,14 @@ static int a6xx_gmu_rpmh_arc_votes_init(struct device *dev, u32 *votes,/* * Look for a level in in the secondary list that matches. If * nothing fits, use the maximum non zero vote +* +* The secondary rail depends on the primary rail, so match it +* against the quantized primary voltage (which is >= the +* requested level), not the requested level itself. */ for (j =0 ; j < sec_count; j++) { -if (sec[j] >= level) { +if (sec[j] >= pri[pindex]) { sindex = j;break ; }else if (sec[j]) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2394/3318 netfilter: synproxy: fix reset of ct seqadj when reopening a connection
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fernando Fernandez Mancera <[email protected]>
[ Upstream commit a8708aa9fe1095ca7859cb3f102b6a3fa0fb98bd ]
SYNPROXY is resetting conntrack seqadj when a closed connection is re-opened, but it was using nf_ct_seqadj_init() which is a no-op for a zero offset.
This patch introduces nf_ct_seqadj_reset() which sets the offset values directly to zero and avoid setting IPS_SEQ_ADJUST_BIT flag, it changes SYNPROXY code to use it when needed.
--- include/net/netfilter/nf_conntrack_seqadj.h | 1 + net/netfilter/nf_conntrack_seqadj.c | 17 +++++++++++++++++ net/netfilter/nf_synproxy_core.c | 4 ++-- 3 files changed, 20 insertions(+), 2 deletions(-)
include/net/netfilter/nf_conntrack_seqadj.h +1 -0
@@ -33,6 +33,7 @@ static inline struct nf_conn_seqadj *nfct_seqadj_ext_add(struct nf_conn *ct)int nf_ct_seqadj_init (struct nf_conn *ct,enum ip_conntrack_info ctinfo,s32 off); +void nf_ct_seqadj_reset (struct nf_conn *ct,enum ip_conntrack_info ctinfo);int nf_ct_seqadj_set (struct nf_conn *ct,enum ip_conntrack_info ctinfo,__be32 seq,s32 off); void nf_ct_tcp_seqadj_set(struct sk_buff *skb, struct nf_conn *ct,
net/netfilter/nf_conntrack_seqadj.c +17 -0
@@ -29,6 +29,23 @@ int nf_ct_seqadj_init(struct nf_conn *ct, enum ip_conntrack_info ctinfo, }EXPORT_SYMBOL_GPL (nf_ct_seqadj_init); +void nf_ct_seqadj_reset (struct nf_conn *ct,enum ip_conntrack_info ctinfo) +{ +struct nf_conn_seqadj *seqadj =nfct_seqadj (ct); +enum ip_conntrack_dir dir =CTINFO2DIR (ctinfo); +struct nf_ct_seqadj *this_way; + +if (unlikely (!seqadj)) +return ; + +spin_lock_bh (&ct->lock); + this_way = &seqadj->seq[dir]; + this_way->offset_before =0 ; + this_way->offset_after =0 ; +spin_unlock_bh (&ct->lock); +} +EXPORT_SYMBOL_GPL (nf_ct_seqadj_reset); +int nf_ct_seqadj_set (struct nf_conn *ct,enum ip_conntrack_info ctinfo,__be32 seq,s32 off) {
net/netfilter/nf_synproxy_core.c +2 -2
@@ -685,7 +685,7 @@ ipv4_synproxy_hook(void *priv, struct sk_buff *skb,* adjustments, they will get initialized once the connection is * reestablished. */ -nf_ct_seqadj_init (ct, ctinfo,0 ); +nf_ct_seqadj_reset (ct, ctinfo); synproxy->tsoff =0 ;this_cpu_inc (snet->stats->conn_reopened); fallthrough;
@@ -1115,7 +1115,7 @@ ipv6_synproxy_hook(void *priv, struct sk_buff *skb,* adjustments, they will get initialized once the connection is * reestablished. */ -nf_ct_seqadj_init (ct, ctinfo,0 ); +nf_ct_seqadj_reset (ct, ctinfo); synproxy->tsoff =0 ;this_cpu_inc (snet->stats->conn_reopened); fallthrough;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2395/3318 ARM: dts: gemini: Use a level-high interrupt for TVE200
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <[email protected]>
[ Upstream commit 5bf1bb010712bba28eda926ed453db3cab91381a ]
TVE200's interrupt is configured as rising-edge. On the D-Link DIR-685, this can stop interrupt delivery after the first vertical interrupt, causing vblank and page-flip timeouts and delaying framebuffer console startup.
The vertical interrupt can remain pending after acknowledgment. Use level-high triggering so the pending condition is delivered again without requiring another edge.
Message-ID: <[email protected]>
--- arch/arm/boot/dts/gemini/gemini.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/gemini/gemini.dtsi +1 -1
@@ -428,7 +428,7 @@ dma-controller@67000000 { display-controller@6a000000 { compatible = "cortina,gemini-tvc", "faraday,tve200"; reg = <0x6a000000 0x1000>; - interrupts = <13 IRQ_TYPE_EDGE_RISING>; + interrupts = <13 IRQ_TYPE_LEVEL_HIGH>; resets = <&syscon GEMINI_RESET_TVC>; clocks = <&syscon GEMINI_CLK_GATE_TVC>, <&syscon GEMINI_CLK_TVC>;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2396/3318 PCI: aardvark: Disable PHY on probe failures
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Myeonghun Pak <[email protected]>
[ Upstream commit 28cc5bc5a6c6cffbe7ba27c0acbfbe06747fa173 ]
advk_pcie_setup_phy() initializes and powers on the PHY before the emulated bridge and IRQ domains are created. If any of those later initialization steps or pci_host_probe() fails, probe returns without powering off or exiting the PHY.
Replace the direct returns with staged cleanup labels. Remove IRQ domains in reverse order, release the emulated bridge allocation only after successful initialization, and disable the PHY on every failure after advk_pcie_setup_phy() succeeds. A setup_phy() failure still returns directly, so its partial internal cleanup is not repeated.
--- drivers/pci/controller/pci-aardvark.c | 31 ++++++++++++++++----------- 1 file changed, 18 insertions(+), 13 deletions(-)
drivers/pci/controller/pci-aardvark.c +18 -13
@@ -1888,28 +1888,25 @@ static int advk_pcie_probe(struct platform_device *pdev) ret =advk_sw_pci_bridge_init (pcie);if (ret) {dev_err (dev,"Failed to register emulated root PCI bridge\n" ); -return ret; + goto err_disable_phy; } ret =advk_pcie_init_irq_domain (pcie);if (ret) {dev_err (dev,"Failed to initialize irq\n" ); -return ret; + goto err_cleanup_bridge; } ret =advk_pcie_init_msi_irq_domain (pcie);if (ret) {dev_err (dev,"Failed to initialize irq\n" ); -advk_pcie_remove_irq_domain (pcie); -return ret; + goto err_remove_irq_domain; } ret =advk_pcie_init_rp_irq_domain (pcie);if (ret) {dev_err (dev,"Failed to initialize irq\n" ); -advk_pcie_remove_msi_irq_domain (pcie); -advk_pcie_remove_irq_domain (pcie); -return ret; + goto err_remove_msi_irq_domain; } bridge->sysdata = pcie;
@@ -1917,14 +1914,22 @@ static int advk_pcie_probe(struct platform_device *pdev) bridge->map_irq = advk_pcie_map_irq; ret =pci_host_probe (bridge); -if (ret <0 ) { -advk_pcie_remove_rp_irq_domain (pcie); -advk_pcie_remove_msi_irq_domain (pcie); -advk_pcie_remove_irq_domain (pcie); -return ret; - } +if (ret <0 ) + goto err_remove_rp_irq_domain;return 0 ; + +err_remove_rp_irq_domain: +advk_pcie_remove_rp_irq_domain (pcie); +err_remove_msi_irq_domain: +advk_pcie_remove_msi_irq_domain (pcie); +err_remove_irq_domain: +advk_pcie_remove_irq_domain (pcie); +err_cleanup_bridge: +pci_bridge_emul_cleanup (&pcie->bridge); +err_disable_phy: +advk_pcie_disable_phy (pcie); +return ret; }static void advk_pcie_remove (struct platform_device *pdev)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2397/3318 arm64: dts: qcom: sm8150: Use SM8150_CX for the SDHC power domain
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abel Vesa <[email protected]>
[ Upstream commit 475aab59d9870d250f521e202d191899c50a3ded ]
Replace the raw power-domain index of SDHC2 with the SM8150_CX binding constant, which is the correct power domain in this case.
--- arch/arm64/boot/dts/qcom/sm8150.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sm8150.dtsi +1 -1
@@ -3519,7 +3519,7 @@ sdhc_2: mmc@8804000 { iommus = <&apps_smmu 0x6a0 0x0>; qcom,dll-config = <0x0007642c>; qcom,ddr-config = <0x80040868>; - power-domains = <&rpmhpd 0>; + power-domains = <&rpmhpd SM8150_CX>; operating-points-v2 = <&sdhc2_opp_table>; status = "disabled";
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2398/3318 iommu/vt-d: Fix IQE handling to cover all descriptors in submission range
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guanghui Feng <[email protected]>
[ Upstream commit 754d07b940c4ce025fab022b548fb5c3d11bf766 ]
When an Invalidation Queue Error (IQE) occurs, hardware halts fetching and IQH points at the faulting descriptor. The previous code only checked whether IQH matched the first descriptor index of the current submission, missing faults on any other descriptor within the batch.
Expand the check to cover the entire submission range [index, wait_index], accounting for circular wrap-around.
Furthermore, after detecting IQE, the old recovery only replaced the single faulting slot with a copy of the wait descriptor and immediately returned -EINVAL. This left two problems:
a) Hardware resumed fetching and could hit another invalid descriptor in the same abandoned batch, raising a second IQE that no submitter would claim — permanently deadlocking the queue.
b) The caller reclaimed all batch slots (QI_FREE) while hardware might still be asynchronously processing descriptors from that batch, allowing concurrent overwrite and descriptor corruption.
Fix both by introducing qi_drain_remaining_descs(): upon IQE detection, overwrite the stranded slots in [IQH, wait_index) with fenced no-op wait descriptors, resubmit the wait descriptor at wait_index, clear IQE, and spin until hardware signals QI_DONE (with DMAR_OPERATION_TIMEOUT). This guarantees hardware has fully drained the batch before the caller reclaims slots.
--- drivers/iommu/intel/dmar.c | 72 ++++++++++++++++++++++++++++++++------ 1 file changed, 61 insertions(+), 11 deletions(-)
drivers/iommu/intel/dmar.c +61 -11
@@ -1276,6 +1276,49 @@ static void qi_dump_fault(struct intel_iommu *iommu, u32 fault) (unsigned long long)desc->qw1); } +static int qi_drain_remaining_descs (struct intel_iommu *iommu,int head, +int wait_index) +{ +struct q_inval *qi = iommu->qi; +int shift =qi_shift (iommu); +struct qi_desc wait_desc = {}; +struct qi_desc nop_desc = {}; +cycles_t start; + + nop_desc.qw0 =QI_IWD_FENCE |QI_IWD_TYPE ; + + wait_desc.qw0 =QI_IWD_STATUS_DATA (QI_DONE ) |QI_IWD_PRQ_DRAIN | +QI_IWD_STATUS_WRITE |QI_IWD_FENCE |QI_IWD_TYPE ; + wait_desc.qw1 =virt_to_phys (&qi->desc_status[wait_index]); + +while (head != wait_index) { +memcpy (qi->desc + (head << shift), &nop_desc,1 << shift); + head = (head +1 ) %QI_LENGTH ; + } + +WRITE_ONCE (qi->desc_status[wait_index],QI_IN_USE ); +memcpy (qi->desc + (wait_index << shift), &wait_desc,1 << shift); + +/* +* Order the descriptor rewrites before the writel() that restarts +* the fetch engine. +*/ +wmb (); + +writel (DMA_FSTS_IQE , iommu->reg +DMAR_FSTS_REG ); + + start =get_cycles (); +while (READ_ONCE (qi->desc_status[wait_index]) !=QI_DONE ) { +if (DMAR_OPERATION_TIMEOUT < (get_cycles () - start)) { +pr_err ("Timeout draining invalidation queue after IQE\n" ); +return -ETIMEDOUT ; + } +cpu_relax (); + } + +return 0 ; +} +static int qi_check_fault (struct intel_iommu *iommu,int index,int wait_index) {u32 fault;
@@ -1296,18 +1339,25 @@ static int qi_check_fault(struct intel_iommu *iommu, int index, int wait_index)* is cleared. */ if (fault &DMA_FSTS_IQE ) { +int head_idx, ret; + head =readl (iommu->reg +DMAR_IQH_REG ); -if ((head >> shift) == index) { -struct qi_desc *desc = qi->desc + head; - -/* -* desc->qw2 and desc->qw3 are either reserved or -* used by software as private data. We won't print -* out these two qw's for security consideration. -*/ -memcpy (desc, qi->desc + (wait_index << shift), -1 << shift); -writel (DMA_FSTS_IQE , iommu->reg +DMAR_FSTS_REG ); + head_idx = (head >> shift) %QI_LENGTH ; + +/* +* The faulting descriptor can be anywhere within the current +* submission's range [index, wait_index]. Since the queue is +* circular, this submission may wrap around QI_LENGTH +* (index > wait_index in that case), so check both the +* non-wrapped and wrapped cases of the range. +*/ +if (index <= wait_index ? + (head_idx >= index && head_idx <= wait_index) : + (head_idx >= index || head_idx <= wait_index)) { + ret =qi_drain_remaining_descs (iommu, head_idx, wait_index); +if (ret) +return ret; +pr_info ("Invalidation Queue Error (IQE) cleared\n" );return -EINVAL ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2399/3318 wifi: mac80211: Fix a race when expiring a mesh path
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ginger Li <[email protected]>
[ Upstream commit 6571b6a24cc37c650a1815b1c320e30db5de466f ]
My static analyzer identified a potential issue in 'net/mac80211/mesh_pathtbl.c':mpath_expired() reads mpath->flags and mpath->exp_time without holding mpath->state_lock, while mesh_path_fix_nexthop() and the other writers update both fields under that lock. In mpath_lookup() and __mesh_path_lookup_by_idx() the unlocked check is followed by taking the lock and clearing MESH_PATH_ACTIVE, so the check and the update are not atomic:
CPU0 (mpath_lookup) CPU1 (mesh_path_fix_nexthop)
mpath_expired() reads the stale
flags/exp_time and returns true
spin_lock_bh(&mpath->state_lock)
mpath->exp_time = 0;
mpath->flags = FIXED|SN_VALID;
mesh_path_activate(mpath);
spin_unlock_bh(&mpath->state_lock) spin_lock_bh(&mpath->state_lock)
mpath->flags &= ~MESH_PATH_ACTIVE;
spin_unlock_bh(&mpath->state_lock)
A path which mesh_path_fix_nexthop() has just set up as MESH_PATH_FIXED and MESH_PATH_ACTIVE then has MESH_PATH_ACTIVE cleared again, and forwarding to that destination silently stops.
Take mpath->state_lock before evaluating mpath_expired() so that the check and the clearing of MESH_PATH_ACTIVE are atomic with respect to the writers.
--- net/mac80211/mesh_pathtbl.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
net/mac80211/mesh_pathtbl.c +7 -6
@@ -246,9 +246,10 @@ static struct mesh_path *mpath_lookup(struct mesh_table *tbl, const u8 *dst, mpath =rhashtable_lookup (&tbl->rhead, dst, mesh_rht_params); -if (mpath &&mpath_expired (mpath)) { +if (mpath) {spin_lock_bh (&mpath->state_lock); - mpath->flags &= ~MESH_PATH_ACTIVE ; +if (mpath_expired (mpath)) + mpath->flags &= ~MESH_PATH_ACTIVE ;spin_unlock_bh (&mpath->state_lock); }return mpath;
@@ -289,11 +290,11 @@ __mesh_path_lookup_by_idx(struct mesh_table *tbl, int idx)if (!mpath)return NULL ; -if (mpath_expired (mpath)) { -spin_lock_bh (&mpath->state_lock); +spin_lock_bh (&mpath->state_lock); +if (mpath_expired (mpath)) mpath->flags &= ~MESH_PATH_ACTIVE ; -spin_unlock_bh (&mpath->state_lock); - } +spin_unlock_bh (&mpath->state_lock); +return mpath; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2400/3318 RDMA/hns: Pin CQ buffer writable to match device DMA write access
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yishai Hadas <[email protected]>
[ Upstream commit ce29f6e741844a78ad1977f2a550ede27ecf95f8 ]
alloc_cq_buf() leaves user_access zero-initialized, but the device writes CQEs into the CQ buffer. Set IB_ACCESS_LOCAL_WRITE so the buffer is pinned writable, matching the device's write access.
--- drivers/infiniband/hw/hns/hns_roce_cq.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/hns/hns_roce_cq.c +1 -0
@@ -206,6 +206,7 @@ static int alloc_cq_buf(struct hns_roce_dev *hr_dev, struct hns_roce_cq *hr_cq, buf_attr.region[0 ].size = hr_cq->cq_depth * hr_cq->cqe_size; buf_attr.region[0 ].hopnum = hr_dev->caps.cqe_hop_num; buf_attr.region_count =1 ; + buf_attr.user_access =IB_ACCESS_LOCAL_WRITE ; ret = hns_roce_mtr_create(hr_dev, &hr_cq->mtr, &buf_attr, hr_dev->caps.cqe_ba_pg_sz + PAGE_SHIFT,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2401/3318 RDMA/mlx5: Set WQ event handler before firmware RQ insertion
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yishai Hadas <[email protected]>
[ Upstream commit 28c559d1e25de46bb6dd39e6fa1e93ea6abdf1f6 ]
create_rq() inserts the RQ into dev->qp_table.tree, making it visible to rsc_event_notifier() before rwq->core_qp.event was assigned. A firmware WQ_CATAS_ERROR event in that window finds a NULL event pointer.
Move the assignment before create_rq().
--- drivers/infiniband/hw/mlx5/qp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/qp.c +1 -1
@@ -5472,6 +5472,7 @@ struct ib_wq *mlx5_ib_create_wq(struct ib_pd *pd, rwq =kzalloc (sizeof (*rwq),GFP_KERNEL );if (!rwq)return ERR_PTR (-ENOMEM ); + rwq->core_qp.event = mlx5_ib_wq_event; err =prepare_user_rq (pd, init_attr, udata, rwq);if (err) goto err;
@@ -5495,7 +5496,6 @@ struct ib_wq *mlx5_ib_create_wq(struct ib_pd *pd, goto err_copy; } - rwq->core_qp.event = mlx5_ib_wq_event; rwq->ibwq.event_handler = init_attr->event_handler;return &rwq->ibwq;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2402/3318 RDMA/mlx5: Set SRQ event handler before xarray insertion
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yishai Hadas <[email protected]>
[ Upstream commit d2aa15620e98dc4c6516944397ebea03b7a62b90 ]
mlx5_cmd_create_srq() stores the SRQ into the xarray before srq->msrq.event was assigned. A firmware SRQ event arriving in that window calls through a NULL pointer.
Move the assignment before mlx5_cmd_create_srq().
--- drivers/infiniband/hw/mlx5/srq.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/infiniband/hw/mlx5/srq.c +1 -2
@@ -284,6 +284,7 @@ int mlx5_ib_create_srq(struct ib_srq *ib_srq, in.pd =to_mpd (ib_srq->pd)->pdn; in.db_record = srq->db.dma; + srq->msrq.event = mlx5_ib_srq_event; err =mlx5_cmd_create_srq (dev, &srq->msrq, &in);kvfree (in.pas);if (err) {
@@ -292,8 +293,6 @@ int mlx5_ib_create_srq(struct ib_srq *ib_srq, }mlx5_ib_dbg (dev,"create SRQ with srqn 0x%x\n" , srq->msrq.srqn); - - srq->msrq.event = mlx5_ib_srq_event; srq->ibsrq.ext.xrc.srq_num = srq->msrq.srqn;if (udata) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2403/3318 RDMA/mlx5: Set RQ event handler for raw-packet QP
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yishai Hadas <[email protected]>
[ Upstream commit a4fa6497002c80b55ebe597242a1bba2ff268886 ]
create_raw_packet_qp() creates a separate firmware RQ object but never assigned rq->base.mqp.event. Any firmware event on this resource (e.g. WQ_CATAS_ERROR, WQ_ACCESS_ERROR) calls through a NULL pointer.
Set the event pointer before the RQ is inserted into the resource table.
--- drivers/infiniband/hw/mlx5/qp.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/mlx5/qp.c +1 -0
@@ -1619,6 +1619,7 @@ static int create_raw_packet_qp(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,if (qp->rq.wqe_cnt) { rq->base.container_mibqp = qp; + rq->base.mqp.event = mlx5_ib_qp_event;if (qp->flags &IB_QP_CREATE_CVLAN_STRIPPING ) rq->flags |=MLX5_IB_RQ_CVLAN_STRIPPING ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2404/3318 RDMA/mlx5: Initialize QP/RQ/SQ resource refcount before publishing it
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yishai Hadas <[email protected]>
[ Upstream commit 829a0e65deff3f826a7870a52404aeaf1a3fec3f ]
create_resource_common() inserted the resource into the radix tree before its initialization was complete. A firmware EQE in that window finds a zero refcount_t and calls refcount_inc() on it; the refcount API treats this as a use-after-free, saturates the counter, and permanently breaks the resource's lifecycle tracking.
Move the initialization before the radix_tree_insert().
--- drivers/infiniband/hw/mlx5/qpc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/infiniband/hw/mlx5/qpc.c +4 -4
@@ -165,6 +165,10 @@ static int create_resource_common(struct mlx5_ib_dev *dev,int err; qp->common.res = rsc_type; +refcount_set (&qp->common.refcount,1 ); +init_completion (&qp->common.free); + qp->pid = current->pid; +spin_lock_irq (&table->lock); err = radix_tree_insert(&table->tree, qp->qpn | (rsc_type << MLX5_USER_INDEX_LEN),
@@ -173,10 +177,6 @@ static int create_resource_common(struct mlx5_ib_dev *dev,if (err)return err; -refcount_set (&qp->common.refcount,1 ); -init_completion (&qp->common.free); - qp->pid = current->pid; -return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2405/3318 ASoC: amd: acp-es8336: Use an owned codec device reference
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yibo Tan <[email protected]>
[ Upstream commit c257e3bcb36f4597d6dbb6fbc546e466ef53e385 ]
acpi_get_first_physical_node() returns a borrowed device pointer. If the pa-enable GPIO lookup fails, st_es8336_late_probe() puts that pointer despite not owning a reference. A later physical-node teardown can then release the device while device_del() is still using it.
This was reproduced on current mainline with the real static late-probe callback and normal platform-device unregister. The GPIO lookup returned -EPROBE_DEFER and KASAN reported a slab-use-after-free in device_del(), with the object freed by acpi_unbind_one().
Use acpi_bus_get_primary_device(), which obtains a stable device reference under the physical-node lock, and release it at callback exit with scoped cleanup. Keep the reference callback-local because late probe can be retried; registering one devres action per attempt would accumulate references.
The same KASAN guest with this change reached the same -EPROBE_DEFER and unregister path without KASAN, WARNING, Oops or panic. The test directly invoked the production callback and did not emulate a complete ASoC card or physical AMD hardware.
--- sound/soc/amd/acp-es8336.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/amd/acp-es8336.c +1 -2
@@ -31,7 +31,6 @@static unsigned long acp2x_machine_id;static struct snd_soc_jack st_jack; -static struct device *codec_dev;static struct gpio_desc *gpio_pa; static int sof_es8316_speaker_power_event(struct snd_soc_dapm_widget *w,
@@ -194,6 +193,7 @@ static const struct acpi_gpio_mapping acpi_es8336_gpios[] = {static int st_es8336_late_probe (struct snd_soc_card *card) { + struct device *codec_dev __free(put_device) = NULL;struct acpi_device *adev;int ret;
@@ -216,7 +216,6 @@ static int st_es8336_late_probe(struct snd_soc_card *card)if (IS_ERR (gpio_pa)) { ret =dev_err_probe (card->dev,PTR_ERR (gpio_pa),"could not get pa-enable GPIO\n" ); -put_device (codec_dev);return ret; }return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2406/3318 ALSA: oxygen: Use guard() for mutex locks
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit 8ecafe5dacc2d98312315b83902ce7b7dbcdfa86 ]
Replace the manual mutex lock/unlock pairs with guard() for code simplification.
Only code refactoring, and no behavior change.
Stable-dep-of: 5bdc232c3094 ("ALSA: oxygen: use helper to activate the SPDIF PCM control")
--- sound/pci/oxygen/oxygen.c | 12 +++---- sound/pci/oxygen/oxygen_mixer.c | 60 +++++++++++-------------------- sound/pci/oxygen/oxygen_pcm.c | 21 ++++------- sound/pci/oxygen/xonar_cs43xx.c | 3 +- sound/pci/oxygen/xonar_dg_mixer.c | 33 ++++++----------- sound/pci/oxygen/xonar_pcm179x.c | 18 ++++------ sound/pci/oxygen/xonar_wm87x6.c | 31 ++++++---------- 7 files changed, 59 insertions(+), 119 deletions(-)
sound/pci/oxygen/oxygen.c +4 -8
@@ -450,7 +450,7 @@ static int rolloff_put(struct snd_kcontrol *ctl,int changed;u8 reg; -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex); reg = data->ak4396_regs[0 ][AK4396_CONTROL_2 ];if (value->value.enumerated.item[0 ]) reg |=AK4396_SLOW ;
@@ -461,7 +461,6 @@ static int rolloff_put(struct snd_kcontrol *ctl,for (i =0 ; i < data->dacs; ++i)ak4396_write (chip, i,AK4396_CONTROL_2 , reg); } -mutex_unlock (&chip->mutex);return changed; }
@@ -499,14 +498,13 @@ static int hpf_put(struct snd_kcontrol *ctl, struct snd_ctl_elem_value *value)unsigned int reg;int changed; -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex); reg = data->wm8785_regs[WM8785_R2 ] & ~(WM8785_HPFR |WM8785_HPFL );if (value->value.enumerated.item[0 ]) reg |=WM8785_HPFR |WM8785_HPFL ; changed = reg != data->wm8785_regs[WM8785_R2 ];if (changed)wm8785_write (chip,WM8785_R2 , reg); -mutex_unlock (&chip->mutex);return changed; }
@@ -563,7 +561,7 @@ static int meridian_dig_source_put(struct snd_kcontrol *ctl,u16 old_reg, new_reg;int changed; -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex); old_reg =oxygen_read16 (chip,OXYGEN_GPIO_DATA ); new_reg = old_reg & ~GPIO_MERIDIAN_DIG_MASK ;if (value->value.enumerated.item[0 ] ==0 )
@@ -573,7 +571,6 @@ static int meridian_dig_source_put(struct snd_kcontrol *ctl, changed = new_reg != old_reg;if (changed)oxygen_write16 (chip,OXYGEN_GPIO_DATA , new_reg); -mutex_unlock (&chip->mutex);return changed; }
@@ -584,7 +581,7 @@ static int claro_dig_source_put(struct snd_kcontrol *ctl,u16 old_reg, new_reg;int changed; -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex); old_reg =oxygen_read16 (chip,OXYGEN_GPIO_DATA ); new_reg = old_reg & ~GPIO_CLARO_DIG_COAX ;if (value->value.enumerated.item[0 ])
@@ -592,7 +589,6 @@ static int claro_dig_source_put(struct snd_kcontrol *ctl, changed = new_reg != old_reg;if (changed)oxygen_write16 (chip,OXYGEN_GPIO_DATA , new_reg); -mutex_unlock (&chip->mutex);return changed; }
sound/pci/oxygen/oxygen_mixer.c +20 -40
250 lines not on this page · raw message
sound/pci/oxygen/oxygen_pcm.c +7 -14
@@ -171,7 +171,7 @@ static int oxygen_open(struct snd_pcm_substream *substream,snd_pcm_set_sync (substream); chip->streams[channel] = substream; -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex); chip->pcm_active |=1 << channel;if (channel ==PCM_SPDIF ) { chip->spdif_pcm_bits = chip->spdif_bits;
@@ -181,7 +181,6 @@ static int oxygen_open(struct snd_pcm_substream *substream,SNDRV_CTL_EVENT_MASK_INFO , &chip->controls[CONTROL_SPDIF_PCM]->id); } -mutex_unlock (&chip->mutex);return 0 ; }
@@ -221,7 +220,7 @@ static int oxygen_close(struct snd_pcm_substream *substream)struct oxygen *chip =snd_pcm_substream_chip (substream);unsigned int channel =oxygen_substream_channel (substream); -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex); chip->pcm_active &= ~(1 << channel);if (channel ==PCM_SPDIF ) { chip->controls[CONTROL_SPDIF_PCM]->vd[0].access |=
@@ -232,7 +231,6 @@ static int oxygen_close(struct snd_pcm_substream *substream) }if (channel ==PCM_SPDIF || channel ==PCM_MULTICH )oxygen_update_spdif_source (chip); -mutex_unlock (&chip->mutex); chip->streams[channel] =NULL ;return 0 ;
@@ -366,9 +364,8 @@ static int oxygen_rec_a_hw_params(struct snd_pcm_substream *substream, OXYGEN_I2S_BITS_MASK);spin_unlock_irq (&chip->reg_lock); -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex); chip->model.set_adc_params (chip, hw_params); -mutex_unlock (&chip->mutex);return 0 ; }
@@ -403,9 +400,8 @@ static int oxygen_rec_b_hw_params(struct snd_pcm_substream *substream,spin_unlock_irq (&chip->reg_lock);if (!is_ac97) { -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex); chip->model.set_adc_params (chip, hw_params); -mutex_unlock (&chip->mutex); }return 0 ; }
@@ -440,9 +436,8 @@ static int oxygen_rec_c_hw_params(struct snd_pcm_substream *substream,spin_unlock_irq (&chip->reg_lock);if (!is_spdif) { -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex); chip->model.set_adc_params (chip, hw_params); -mutex_unlock (&chip->mutex); }return 0 ; }
@@ -457,7 +452,7 @@ static int oxygen_spdif_hw_params(struct snd_pcm_substream *substream,if (err <0 )return err; -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex);spin_lock_irq (&chip->reg_lock);oxygen_clear_bits32 (chip,OXYGEN_SPDIF_CONTROL ,OXYGEN_SPDIF_OUT_ENABLE );
@@ -469,7 +464,6 @@ static int oxygen_spdif_hw_params(struct snd_pcm_substream *substream, OXYGEN_SPDIF_OUT_RATE_MASK);oxygen_update_spdif_source (chip);spin_unlock_irq (&chip->reg_lock); -mutex_unlock (&chip->mutex);return 0 ; }
@@ -483,7 +477,7 @@ static int oxygen_multich_hw_params(struct snd_pcm_substream *substream,if (err <0 )return err; -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex);spin_lock_irq (&chip->reg_lock); oxygen_write8_masked(chip, OXYGEN_PLAY_CHANNELS, oxygen_play_channels(hw_params),
@@ -505,7 +499,6 @@ static int oxygen_multich_hw_params(struct snd_pcm_substream *substream, chip->model.set_dac_params (chip, hw_params);oxygen_update_dac_routing (chip); -mutex_unlock (&chip->mutex);return 0 ; }
sound/pci/oxygen/xonar_cs43xx.c +1 -2
@@ -309,7 +309,7 @@ static int rolloff_put(struct snd_kcontrol *ctl,int changed;u8 reg; -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex); reg = data->cs4398_regs[7 ];if (value->value.enumerated.item[0 ]) reg |=CS4398_FILT_SEL ;
@@ -324,7 +324,6 @@ static int rolloff_put(struct snd_kcontrol *ctl, reg = data->cs4362a_regs[0x04 ] & ~CS4362A_FILT_SEL ;cs4362a_write (chip,0x04 , reg); } -mutex_unlock (&chip->mutex);return changed; }
sound/pci/oxygen/xonar_dg_mixer.c +11 -22
@@ -62,9 +62,8 @@ static int output_select_get(struct snd_kcontrol *ctl,struct oxygen *chip = ctl->private_data;struct dg *data = chip->model_data; -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex); value->value.enumerated.item[0 ] = data->output_sel; -mutex_unlock (&chip->mutex);return 0 ; }
@@ -77,14 +76,13 @@ static int output_select_put(struct snd_kcontrol *ctl,int changed =0 ;int ret; -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex);if (data->output_sel != new) { data->output_sel = new; ret =output_select_apply (chip); changed = ret >=0 ?1 : ret;oxygen_update_dac_routing (chip); } -mutex_unlock (&chip->mutex);return changed; }
@@ -108,12 +106,11 @@ static int hp_stereo_volume_get(struct snd_kcontrol *ctl,struct dg *data = chip->model_data;unsigned int tmp; -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex); tmp = (~data->cs4245_shadow[CS4245_DAC_A_CTRL ]) &255 ; val->value.integer.value[0 ] = tmp; tmp = (~data->cs4245_shadow[CS4245_DAC_B_CTRL ]) &255 ; val->value.integer.value[1 ] = tmp; -mutex_unlock (&chip->mutex);return 0 ; }
@@ -130,7 +127,7 @@ static int hp_stereo_volume_put(struct snd_kcontrol *ctl,if ((new1 >255 ) || (new1 <0 ) || (new2 >255 ) || (new2 <0 ))return -EINVAL ; -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex);if ((data->cs4245_shadow[CS4245_DAC_A_CTRL ] != ~new1) || (data->cs4245_shadow[CS4245_DAC_B_CTRL ] != ~new2)) { data->cs4245_shadow[CS4245_DAC_A_CTRL ] = ~new1;
@@ -140,7 +137,6 @@ static int hp_stereo_volume_put(struct snd_kcontrol *ctl, ret =cs4245_write_spi (chip,CS4245_DAC_B_CTRL ); changed = ret >=0 ?1 : ret; } -mutex_unlock (&chip->mutex);return changed; }
@@ -153,10 +149,9 @@ static int hp_mute_get(struct snd_kcontrol *ctl,struct oxygen *chip = ctl->private_data;struct dg *data = chip->model_data; -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex); val->value.integer.value[0 ] = !(data->cs4245_shadow[CS4245_DAC_CTRL_1 ] &CS4245_MUTE_DAC ); -mutex_unlock (&chip->mutex);return 0 ; }
@@ -170,13 +165,12 @@ static int hp_mute_put(struct snd_kcontrol *ctl,if (val->value.integer.value[0 ] >1 )return -EINVAL ; -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex); data->cs4245_shadow[CS4245_DAC_CTRL_1 ] &= ~CS4245_MUTE_DAC ; data->cs4245_shadow[CS4245_DAC_CTRL_1 ] |= (~val->value.integer.value[0 ] <<2 ) &CS4245_MUTE_DAC ; ret =cs4245_write_spi (chip,CS4245_DAC_CTRL_1 ); changed = ret >=0 ?1 : ret; -mutex_unlock (&chip->mutex);return changed; }
@@ -212,10 +206,9 @@ static int input_vol_get(struct snd_kcontrol *ctl,struct dg *data = chip->model_data;unsigned int idx = ctl->private_value; -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex); value->value.integer.value[0 ] = data->input_vol[idx][0 ]; value->value.integer.value[1 ] = data->input_vol[idx][1 ]; -mutex_unlock (&chip->mutex);return 0 ; }
@@ -233,7 +226,7 @@ static int input_vol_put(struct snd_kcontrol *ctl, value->value.integer.value[1 ] <2 *-12 || value->value.integer.value[1] > 2 * 12) return -EINVAL; -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex); changed = data->input_vol[idx][0 ] != value->value.integer.value[0 ] || data->input_vol[idx][1 ] != value->value.integer.value[1 ];if (changed) {
@@ -246,7 +239,6 @@ static int input_vol_put(struct snd_kcontrol *ctl, } changed = ret >=0 ?1 : ret; } -mutex_unlock (&chip->mutex);return changed; }
@@ -282,9 +274,8 @@ static int input_sel_get(struct snd_kcontrol *ctl,struct oxygen *chip = ctl->private_data;struct dg *data = chip->model_data; -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex); value->value.enumerated.item[0 ] = data->input_sel; -mutex_unlock (&chip->mutex);return 0 ; }
@@ -299,7 +290,7 @@ static int input_sel_put(struct snd_kcontrol *ctl,if (value->value.enumerated.item[0 ] >3 )return -EINVAL ; -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex); changed = value->value.enumerated.item[0 ] != data->input_sel;if (changed) { data->input_sel = value->value.enumerated.item[0 ];
@@ -311,7 +302,6 @@ static int input_sel_put(struct snd_kcontrol *ctl, data->input_vol[data->input_sel][1]); changed = ret >=0 ?1 : ret; } -mutex_unlock (&chip->mutex);return changed; }
@@ -341,7 +331,7 @@ static int hpf_put(struct snd_kcontrol *ctl, struct snd_ctl_elem_value *value)u8 reg;int changed; -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex); reg = data->cs4245_shadow[CS4245_ADC_CTRL ] & ~CS4245_HPF_FREEZE ;if (value->value.enumerated.item[0 ]) reg |=CS4245_HPF_FREEZE ;
@@ -350,7 +340,6 @@ static int hpf_put(struct snd_kcontrol *ctl, struct snd_ctl_elem_value *value) data->cs4245_shadow[CS4245_ADC_CTRL ] = reg;cs4245_write_spi (chip,CS4245_ADC_CTRL ); } -mutex_unlock (&chip->mutex);return changed; }
sound/pci/oxygen/xonar_pcm179x.c +6 -12
@@ -762,7 +762,7 @@ static int rolloff_put(struct snd_kcontrol *ctl,int changed;u8 reg; -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex); reg = data->pcm1796_regs[0 ][19 -PCM1796_REG_BASE ]; reg &= ~PCM1796_FLT_MASK ;if (!value->value.enumerated.item[0 ])
@@ -774,7 +774,6 @@ static int rolloff_put(struct snd_kcontrol *ctl,for (i =0 ; i < data->dacs; ++i)pcm1796_write (chip, i,19 , reg); } -mutex_unlock (&chip->mutex);return changed; }
@@ -806,7 +805,7 @@ static int deemph_put(struct snd_kcontrol *ctl,int changed;u8 reg; -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex); reg = data->pcm1796_regs[0 ][18 -PCM1796_REG_BASE ];if (!value->value.integer.value[0 ]) reg &= ~PCM1796_DME ;
@@ -817,7 +816,6 @@ static int deemph_put(struct snd_kcontrol *ctl,for (i =0 ; i < data->dacs; ++i)pcm1796_write (chip, i,18 , reg); } -mutex_unlock (&chip->mutex);return changed; }
@@ -872,7 +870,7 @@ static int st_output_switch_put(struct snd_kcontrol *ctl,struct xonar_pcm179x *data = chip->model_data;u16 gpio_old, gpio; -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex); gpio_old =oxygen_read16 (chip,OXYGEN_GPIO_DATA ); gpio = gpio_old;switch (value->value.enumerated.item[0 ]) {
@@ -889,7 +887,6 @@ static int st_output_switch_put(struct snd_kcontrol *ctl,oxygen_write16 (chip,OXYGEN_GPIO_DATA , gpio); data->hp_active = gpio &GPIO_ST_HP ;update_pcm1796_volume (chip); -mutex_unlock (&chip->mutex);return gpio != gpio_old; }
@@ -909,7 +906,7 @@ static int st_hp_volume_offset_get(struct snd_kcontrol *ctl,struct oxygen *chip = ctl->private_data;struct xonar_pcm179x *data = chip->model_data; -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex);if (data->hp_gain_offset <2 *-12 ) value->value.enumerated.item[0 ] =0 ;else if (data->hp_gain_offset <2 *-6 )
@@ -918,7 +915,6 @@ static int st_hp_volume_offset_get(struct snd_kcontrol *ctl, value->value.enumerated.item[0 ] =2 ; else value->value.enumerated.item[0] = 3; -mutex_unlock (&chip->mutex);return 0 ; }
@@ -935,13 +931,12 @@ static int st_hp_volume_offset_put(struct snd_kcontrol *ctl,if (value->value.enumerated.item[0 ] >3 )return -EINVAL ; offset = offsets[value->value.enumerated.item[0 ]]; -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex); changed = offset != data->hp_gain_offset;if (changed) { data->hp_gain_offset = offset;update_pcm1796_volume (chip); } -mutex_unlock (&chip->mutex);return changed; }
@@ -985,7 +980,7 @@ static int xense_output_switch_put(struct snd_kcontrol *ctl,struct xonar_pcm179x *data = chip->model_data;u16 gpio_old, gpio; -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex); gpio_old =oxygen_read16 (chip,OXYGEN_GPIO_DATA ); gpio = gpio_old;switch (value->value.enumerated.item[0 ]) {
@@ -1002,7 +997,6 @@ static int xense_output_switch_put(struct snd_kcontrol *ctl,oxygen_write16 (chip,OXYGEN_GPIO_DATA , gpio); data->hp_active = !(gpio &GPIO_XENSE_SPEAKERS );update_pcm1796_volume (chip); -mutex_unlock (&chip->mutex);return gpio != gpio_old; }
sound/pci/oxygen/xonar_wm87x6.c +10 -21
@@ -237,7 +237,7 @@ static void xonar_ds_handle_hp_jack(struct oxygen *chip)bool hp_plugged;unsigned int reg; -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex); hp_plugged = !(oxygen_read16 (chip,OXYGEN_GPIO_DATA ) &GPIO_DS_HP_DETECT );
@@ -252,8 +252,6 @@ static void xonar_ds_handle_hp_jack(struct oxygen *chip)wm8766_write_cached (chip,WM8766_DAC_CTRL , reg);snd_jack_report (data->hp_jack, hp_plugged ?SND_JACK_HEADPHONE :0 ); - -mutex_unlock (&chip->mutex); }static void xonar_ds_init (struct oxygen *chip)
@@ -521,14 +519,13 @@ static int wm8776_bit_switch_put(struct snd_kcontrol *ctl,bool invert = (ctl->private_value >>24 ) &1 ;int changed; -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex); reg_value = data->wm8776_regs[reg_index] & ~bit;if (value->value.integer.value[0 ] ^ invert) reg_value |= bit; changed = reg_value != data->wm8776_regs[reg_index];if (changed)wm8776_write (chip, reg_index, reg_value); -mutex_unlock (&chip->mutex);return changed; }
@@ -648,13 +645,12 @@ static int wm8776_field_set(struct snd_kcontrol *ctl, unsigned int value) max = (ctl->private_value >>12 ) &0xf ;if (value < min || value > max)return -EINVAL ; -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex); changed = value != (ctl->private_value &0xf );if (changed) { ctl->private_value = (ctl->private_value & ~0xf ) | value;wm8776_field_set_from_ctl (ctl); } -mutex_unlock (&chip->mutex);return changed; }
@@ -700,12 +696,11 @@ static int wm8776_hp_vol_get(struct snd_kcontrol *ctl,struct oxygen *chip = ctl->private_data;struct xonar_wm87x6 *data = chip->model_data; -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex); value->value.integer.value[0 ] = data->wm8776_regs[WM8776_HPLVOL ] &WM8776_HPATT_MASK ; value->value.integer.value[1 ] = data->wm8776_regs[WM8776_HPRVOL ] &WM8776_HPATT_MASK ; -mutex_unlock (&chip->mutex);return 0 ; }
@@ -716,7 +711,7 @@ static int wm8776_hp_vol_put(struct snd_kcontrol *ctl,struct xonar_wm87x6 *data = chip->model_data;u8 to_update; -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex); to_update = (value->value.integer.value[0 ] != (data->wm8776_regs[WM8776_HPLVOL ] &WM8776_HPATT_MASK )) <<0 ;
@@ -744,7 +739,6 @@ static int wm8776_hp_vol_put(struct snd_kcontrol *ctl, value->value.integer.value[1 ] | WM8776_HPZCEN | WM8776_UPDATE); } -mutex_unlock (&chip->mutex);return to_update !=0 ; }
@@ -770,7 +764,7 @@ static int wm8776_input_mux_put(struct snd_kcontrol *ctl,u16 reg;int changed; -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex); reg = data->wm8776_regs[WM8776_ADCMUX ];if (value->value.integer.value[0 ]) { reg |= mux_bit;
@@ -794,7 +788,6 @@ static int wm8776_input_mux_put(struct snd_kcontrol *ctl, GPIO_DS_INPUT_ROUTE);wm8776_write (chip,WM8776_ADCMUX , reg); } -mutex_unlock (&chip->mutex);return changed; }
@@ -814,12 +807,11 @@ static int wm8776_input_vol_get(struct snd_kcontrol *ctl,struct oxygen *chip = ctl->private_data;struct xonar_wm87x6 *data = chip->model_data; -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex); value->value.integer.value[0 ] = data->wm8776_regs[WM8776_ADCLVOL ] &WM8776_AGMASK ; value->value.integer.value[1 ] = data->wm8776_regs[WM8776_ADCRVOL ] &WM8776_AGMASK ; -mutex_unlock (&chip->mutex);return 0 ; }
@@ -830,7 +822,7 @@ static int wm8776_input_vol_put(struct snd_kcontrol *ctl,struct xonar_wm87x6 *data = chip->model_data;int changed =0 ; -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex); changed = (value->value.integer.value[0 ] != (data->wm8776_regs[WM8776_ADCLVOL] & WM8776_AGMASK)) || (value->value.integer.value[1] !=
@@ -839,7 +831,6 @@ static int wm8776_input_vol_put(struct snd_kcontrol *ctl, value->value.integer.value[0] | WM8776_ZCA);wm8776_write_cached (chip,WM8776_ADCRVOL , value->value.integer.value[1 ] |WM8776_ZCA ); -mutex_unlock (&chip->mutex);return changed; }
@@ -895,7 +886,7 @@ static int wm8776_level_control_put(struct snd_kcontrol *ctl,if (value->value.enumerated.item[0 ] >=3 )return -EINVAL ; -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex); changed = value->value.enumerated.item[0 ] != ctl->private_value;if (changed) { ctl->private_value = value->value.enumerated.item[0 ];
@@ -926,7 +917,6 @@ static int wm8776_level_control_put(struct snd_kcontrol *ctl,for (i =0 ; i <ARRAY_SIZE (data->lc_controls); ++i)activate_control (chip, data->lc_controls[i], mode); } -mutex_unlock (&chip->mutex);return changed; }
@@ -956,14 +946,13 @@ static int hpf_put(struct snd_kcontrol *ctl, struct snd_ctl_elem_value *value)unsigned int reg;int changed; -mutex_lock (&chip->mutex); +guard (mutex)(&chip->mutex); reg = data->wm8776_regs[WM8776_ADCIFCTRL ] & ~WM8776_ADCHPD ;if (!value->value.enumerated.item[0 ]) reg |=WM8776_ADCHPD ; changed = reg != data->wm8776_regs[WM8776_ADCIFCTRL ];if (changed)wm8776_write (chip,WM8776_ADCIFCTRL , reg); -mutex_unlock (&chip->mutex);return changed; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2407/3318 ALSA: oxygen: use helper to activate the SPDIF PCM control
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Runyu Xiao <[email protected]>
[ Upstream commit 5bdc232c3094304a7e17df5ddb66dcdacbead6bf ]
oxygen_open() and oxygen_close() modify the SPDIF PCM control access flags while holding chip->mutex. Direct access changes bypass the control core locking and notification path.
Move the access transition outside the driver mutex and use snd_ctl_activate_id(), which serializes the control update with the control core.
--- sound/pci/oxygen/oxygen_pcm.c | 37 +++++++++++++++-------------------- 1 file changed, 16 insertions(+), 21 deletions(-)
sound/pci/oxygen/oxygen_pcm.c +16 -21
@@ -171,16 +171,14 @@ static int oxygen_open(struct snd_pcm_substream *substream,snd_pcm_set_sync (substream); chip->streams[channel] = substream; -guard (mutex)(&chip->mutex); - chip->pcm_active |=1 << channel; -if (channel ==PCM_SPDIF ) { - chip->spdif_pcm_bits = chip->spdif_bits; - chip->controls[CONTROL_SPDIF_PCM ]->vd[0 ].access &= - ~SNDRV_CTL_ELEM_ACCESS_INACTIVE ; -snd_ctl_notify (chip->card,SNDRV_CTL_EVENT_MASK_VALUE | -SNDRV_CTL_EVENT_MASK_INFO , - &chip->controls[CONTROL_SPDIF_PCM ]->id); + scoped_guard(mutex, &chip->mutex) { + chip->pcm_active |=1 << channel; +if (channel ==PCM_SPDIF ) + chip->spdif_pcm_bits = chip->spdif_bits; } +if (channel ==PCM_SPDIF ) +snd_ctl_activate_id (chip->card, + &chip->controls[CONTROL_SPDIF_PCM ]->id,1 );return 0 ; }
@@ -220,19 +218,16 @@ static int oxygen_close(struct snd_pcm_substream *substream)struct oxygen *chip =snd_pcm_substream_chip (substream);unsigned int channel =oxygen_substream_channel (substream); -guard (mutex)(&chip->mutex); - chip->pcm_active &= ~(1 << channel); -if (channel ==PCM_SPDIF ) { - chip->controls[CONTROL_SPDIF_PCM ]->vd[0 ].access |= -SNDRV_CTL_ELEM_ACCESS_INACTIVE ; -snd_ctl_notify (chip->card,SNDRV_CTL_EVENT_MASK_VALUE | -SNDRV_CTL_EVENT_MASK_INFO , - &chip->controls[CONTROL_SPDIF_PCM ]->id); - } -if (channel ==PCM_SPDIF || channel ==PCM_MULTICH ) -oxygen_update_spdif_source (chip); + scoped_guard(mutex, &chip->mutex) { + chip->pcm_active &= ~(1 << channel); +if (channel ==PCM_SPDIF || channel ==PCM_MULTICH ) +oxygen_update_spdif_source (chip); - chip->streams[channel] =NULL ; + chip->streams[channel] =NULL ; + } +if (channel ==PCM_SPDIF ) +snd_ctl_activate_id (chip->card, + &chip->controls[CONTROL_SPDIF_PCM ]->id,0 );return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2408/3318 ALSA: via82xx: use helper to activate DXS controls
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Runyu Xiao <[email protected]>
[ Upstream commit aee7c43126e3184d7eefde6545b3b88628e5591a ]
The VIA DXS playback callbacks modify control access flags directly when a stream opens or closes. This bypasses the control core locking and notification path.
Use snd_ctl_activate_id() for both transitions so access changes are serialized by the control core and reported with the expected info event.
--- sound/pci/via82xx.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
sound/pci/via82xx.c +2 -9
@@ -1251,11 +1251,7 @@ static int snd_via8233_playback_open(struct snd_pcm_substream *substream)VIA_DXS_MAX_VOLUME - (dxs_init_volume &31 ); chip->playback_volume[stream][1 ] =VIA_DXS_MAX_VOLUME - (dxs_init_volume &31 ); - chip->dxs_controls[stream]->vd[0 ].access &= - ~SNDRV_CTL_ELEM_ACCESS_INACTIVE ; -snd_ctl_notify (chip->card,SNDRV_CTL_EVENT_MASK_VALUE | -SNDRV_CTL_EVENT_MASK_INFO , - &chip->dxs_controls[stream]->id); +snd_ctl_activate_id (chip->card, &chip->dxs_controls[stream]->id,1 ); }return 0 ; }
@@ -1342,10 +1338,7 @@ static int snd_via8233_playback_close(struct snd_pcm_substream *substream) stream = viadev->reg_offset /0x10 ;if (chip->dxs_controls[stream]) { - chip->dxs_controls[stream]->vd[0 ].access |= -SNDRV_CTL_ELEM_ACCESS_INACTIVE ; -snd_ctl_notify (chip->card,SNDRV_CTL_EVENT_MASK_INFO , - &chip->dxs_controls[stream]->id); +snd_ctl_activate_id (chip->card, &chip->dxs_controls[stream]->id,0 ); }return snd_via82xx_pcm_close (substream); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2409/3318 drm/exynos/fimd: fix register offset type in fimd_trigger()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen-Yu Tsai <[email protected]>
[ Upstream commit f901c9b986b6355716822d5c6ad34ae5edd71085 ]
Sparse reports:
exynos_drm_fimd.c:992:39: warning: incorrect type in initializer (different address spaces)
exynos_drm_fimd.c:992:39: expected void *timing_base
exynos_drm_fimd.c:992:39: got void [noderef] __iomem *
exynos_drm_fimd.c:1005:33: warning: incorrect type in argument 1 (different address spaces)
exynos_drm_fimd.c:1005:33: expected void const volatile [noderef] __iomem *addr
exynos_drm_fimd.c:1005:33: got void *
exynos_drm_fimd.c:1007:33: warning: incorrect type in argument 2 (different address spaces)
exynos_drm_fimd.c:1007:33: expected void volatile [noderef] __iomem *addr
exynos_drm_fimd.c:1007:33: got void *
Add "__iomem" to *timing_base to fix its type.
--- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +1 -1
@@ -988,7 +988,7 @@ static void fimd_trigger(struct device *dev) {struct fimd_context *ctx =dev_get_drvdata (dev);const struct fimd_driver_data *driver_data = ctx->driver_data; -void *timing_base = ctx->regs + driver_data->timing_base; +void __iomem *timing_base = ctx->regs + driver_data->timing_base;u32 reg;/*
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2410/3318 staging: iio: adc: ad7816: Sort headers alphabetically
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abdelnasser Hussein <[email protected]>
[ Upstream commit 8c7b99ff159d64679c9b3b4d5878e44459f7272a ]
Sort the include directives alphabetically to improve readability and maintainability. This is a precursor cleanup patch to prepare for the addition of new headers in subsequent changes.
Stable-dep-of: b96187644664 ("staging: iio: adc: ad7816: Protect sysfs attributes with mutex")
--- drivers/staging/iio/adc/ad7816.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/iio/adc/ad7816.c +6 -6
@@ -5,19 +5,19 @@* Copyright 2010 Analog Devices Inc. */ -#include <linux/interrupt.h> -#include <linux/gpio/consumer.h> #include <linux/device.h> +#include <linux/gpio/consumer.h> +#include <linux/interrupt.h> #include <linux/kernel.h> -#include <linux/slab.h> -#include <linux/sysfs.h> #include <linux/list.h> -#include <linux/spi/spi.h> #include <linux/module.h> +#include <linux/slab.h> +#include <linux/spi/spi.h> +#include <linux/sysfs.h> +#include <linux/iio/events.h> #include <linux/iio/iio.h> #include <linux/iio/sysfs.h> -#include <linux/iio/events.h> /* * AD7816 config masks
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2411/3318 staging: iio: adc: ad7816: Serialize SPI operations
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abdelnasser Hussein <[email protected]>
[ Upstream commit 8f99c766605a484663764b52da56a0b160f9d9c3 ]
The ad7816_spi_read() and ad7816_spi_write() functions perform a sequence of GPIO state changes followed by an SPI transfer. If multiple operations occur simultaneously, the GPIO state could be changed by one thread while another is in the middle of a transfer, leading to a race condition.
Introduce a mutex to serialize the operations, ensuring that the GPIO toggling and the SPI transfer are treated as a single atomic operation. The mutex is placed right after the pointers in the device state structure to avoid padding holes.
Stable-dep-of: b96187644664 ("staging: iio: adc: ad7816: Protect sysfs attributes with mutex")
--- drivers/staging/iio/adc/ad7816.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/staging/iio/adc/ad7816.c +11 -0
@@ -5,12 +5,14 @@* Copyright 2010 Analog Devices Inc. */ +#include <linux/cleanup.h> #include <linux/device.h> #include <linux/gpio/consumer.h> #include <linux/interrupt.h> #include <linux/kernel.h> #include <linux/list.h> #include <linux/module.h> +#include <linux/mutex.h> #include <linux/slab.h> #include <linux/spi/spi.h> #include <linux/sysfs.h>
@@ -47,6 +49,7 @@ struct ad7816_chip_info {struct gpio_desc *rdwr_pin;struct gpio_desc *convert_pin;struct gpio_desc *busy_pin; +struct mutex lock;/* protect device state during SPI transfers */ u8 oti_data[AD7816_CS_MAX +1 ];u8 channel_id;/* 0 always be temperature */ u8 mode;
@@ -67,6 +70,8 @@ static int ad7816_spi_read(struct ad7816_chip_info *chip, u16 *data)int ret;__be16 buf; +guard (mutex)(&chip->lock); +gpiod_set_value (chip->rdwr_pin,1 );gpiod_set_value (chip->rdwr_pin,0 ); ret =spi_write_then_read (spi_dev, &chip->channel_id,sizeof (chip->channel_id),NULL ,0 );
@@ -107,6 +112,8 @@ static int ad7816_spi_write(struct ad7816_chip_info *chip, u8 data)struct spi_device *spi_dev = chip->spi_dev;int ret; +guard (mutex)(&chip->lock); +gpiod_set_value (chip->rdwr_pin,1 );gpiod_set_value (chip->rdwr_pin,0 ); ret =spi_write_then_read (spi_dev, &data,sizeof (data),NULL ,0 );
@@ -362,6 +369,10 @@ static int ad7816_probe(struct spi_device *spi_dev)/* this is only used for device removal purposes */ dev_set_drvdata (&spi_dev->dev, indio_dev); + ret =devm_mutex_init (&spi_dev->dev, &chip->lock); +if (ret) +return ret; + chip->spi_dev = spi_dev;for (i =0 ; i <=AD7816_CS_MAX ; i++) chip->oti_data[i] =203 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2412/3318 staging: iio: adc: ad7816: Protect sysfs attributes with mutex
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abdelnasser Hussein <[email protected]>
[ Upstream commit b96187644664d10b641dddeb7ca2eeef97a77c41 ]
The sysfs store functions modify driver state that is critical during SPI transactions. ad7816_store_mode toggles hardware GPIO pins, while ad7816_store_channel updates the internal software state (chip->channel_id).
If these are modified concurrently by userspace while an SPI transfer is in progress, it could corrupt the hardware transaction or cause the driver to communicate with the wrong channel.
Add the existing chip->lock guard to these functions to serialize access and prevent these race conditions.
--- drivers/staging/iio/adc/ad7816.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/staging/iio/adc/ad7816.c +4 -0
@@ -143,6 +143,8 @@ static ssize_t ad7816_store_mode(struct device *dev,struct iio_dev *indio_dev =dev_to_iio_dev (dev);struct ad7816_chip_info *chip =iio_priv (indio_dev); +guard (mutex)(&chip->lock); +if (strcmp (buf,"full" ) ==0 ) {gpiod_set_value (chip->rdwr_pin,1 ); chip->mode =AD7816_FULL ;
@@ -207,6 +209,8 @@ static ssize_t ad7816_store_channel(struct device *dev,return -EINVAL ; } +guard (mutex)(&chip->lock); + chip->channel_id = data;return len;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2413/3318 iio: dac: ad5758: Fix alignment for DMA safety
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arka Mondal <[email protected]>
[ Upstream commit 465bdce79a9fe140a4b46b95f6bdfd880d197148 ]
ad5758_spi_reg_read() reads into st->d32[2] with spi_sync_transfer(), but d32 is not marked __aligned(IIO_DMA_MINALIGN), so it can share a cacheline with the fields before it. When DMA is not cache coherent, the cache invalidation after the read can discard CPU writes to those fields.
Mark d32 __aligned(IIO_DMA_MINALIGN). It is the last member of the struct, so nothing comes after it.
--- drivers/iio/dac/ad5758.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/dac/ad5758.c +1 -1
@@ -118,7 +118,7 @@ struct ad5758_state {unsigned int dc_dc_ilim;unsigned int slew_time;bool pwr_down; -__be32 d32[3 ]; +__be32 d32[3 ]__aligned(IIO_DMA_MINALIGN) ; };/*
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2414/3318 iio: dac: ad5758: Reject out-of-range raw values
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arka Mondal <[email protected]>
[ Upstream commit ebc026be1b719e47bd7f2f1e72fabc875b590f87 ]
ad5758_write_raw() passes the value from userspace straight to ad5758_spi_reg_write(), which keeps only the low 16 bits. Writing -1 to the raw attribute gives full-scale output, and 65536 gives code 0.
Return -EINVAL for values outside 0 to U16_MAX, as ad5755 does.
--- drivers/iio/dac/ad5758.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/iio/dac/ad5758.c +3 -0
@@ -557,6 +557,9 @@ static int ad5758_write_raw(struct iio_dev *indio_dev,switch (info) {case IIO_CHAN_INFO_RAW : +if (val <0 || val >U16_MAX ) +return -EINVAL ; +mutex_lock (&st->lock); ret =ad5758_spi_reg_write (st,AD5758_DAC_INPUT , val);mutex_unlock (&st->lock);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2415/3318 iio: dac: ad5758: Fix the offset calculation
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arka Mondal <[email protected]>
[ Upstream commit a3b3580713f3ac5a32dc2874ee546828977a1d68 ]
The offset is a count of DAC codes, so the microamp or microvolt units of min and max cancel out and the final division by 1000 is wrong. For the +-20 mA range the driver reports -32 instead of -32768. For the +-5 V and +-10 V ranges min * (1 << 16) also overflows int, and the reported offset is 0.
Drop the division and do the multiplication in 64 bits.
--- drivers/iio/dac/ad5758.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/dac/ad5758.c +2 -1
@@ -9,6 +9,7 @@#include <linux/bsearch.h> #include <linux/delay.h> #include <linux/kernel.h> +#include <linux/math64.h> #include <linux/module.h> #include <linux/mod_devicetable.h> #include <linux/property.h>
@@ -541,7 +542,7 @@ static int ad5758_read_raw(struct iio_dev *indio_dev,case IIO_CHAN_INFO_OFFSET : min = st->out_range.min; max = st->out_range.max; - *val = ((min * (1 <<16 )) / (max - min)) /1000 ; + *val =div_s64 ((s64 )min * (1 <<16 ), max - min);return IIO_VAL_INT ;default :return -EINVAL ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2416/3318 ALSA: caiaq: Serialize access to the EP1 command buffer
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niko Huuskonen <[email protected]>
[ Upstream commit a718fd03e1e00211cf4662f5ab82d33f4c18e2a7 ]
snd_usb_caiaq_send_command() and snd_usb_caiaq_send_command_bank() copy the command into cdev->ep1_out_buf and send it with a synchronous bulk transfer. Nothing serializes their callers. An ALSA control write, which sets the LEDs on the Kore controllers and several other devices, can run at the same time as a PCM prepare, which sends the audio parameters through the same buffer. One caller can then overwrite the buffer while the transfer of the other is still in flight, and the device receives a mix of both commands.
Protect the buffer with a mutex. All callers run in process context and already sleep in usb_bulk_msg().
The problem was found by code review while adding another user of the buffer, the Kore LCD support later in this series. It has not been observed or reproduced.
--- sound/usb/caiaq/device.c | 5 +++++ sound/usb/caiaq/device.h | 3 +++ 2 files changed, 8 insertions(+)
sound/usb/caiaq/device.c +5 -0
@@ -212,6 +212,8 @@ int snd_usb_caiaq_send_command(struct snd_usb_caiaqdev *cdev,if (len >EP1_BUFSIZE -1 ) len =EP1_BUFSIZE -1 ; +guard (mutex)(&cdev->ep1_out_mutex); +if (buffer && len >0 )memcpy (cdev->ep1_out_buf+1 , buffer, len);
@@ -235,6 +237,8 @@ int snd_usb_caiaq_send_command_bank(struct snd_usb_caiaqdev *cdev,if (len >EP1_BUFSIZE -2 ) len =EP1_BUFSIZE -2 ; +guard (mutex)(&cdev->ep1_out_mutex); +if (buffer && len >0 )memcpy (cdev->ep1_out_buf+2 , buffer, len);
@@ -443,6 +447,7 @@ static int create_card(struct usb_device *usb_dev, cdev->chip.usb_id =USB_ID (le16_to_cpu (usb_dev->descriptor.idVendor),le16_to_cpu (usb_dev->descriptor.idProduct));spin_lock_init (&cdev->spinlock); +mutex_init (&cdev->ep1_out_mutex); *cardp = card;return 0 ;
sound/usb/caiaq/device.h +3 -0
@@ -2,6 +2,8 @@#ifndef CAIAQ_DEVICE_H #define CAIAQ_DEVICE_H +#include <linux/mutex.h> +#include "../usbaudio.h" #define USB_VID_NATIVEINSTRUMENTS 0x17cc
@@ -68,6 +70,7 @@ struct snd_usb_caiaqdev {unsigned char ep1_in_buf[EP1_BUFSIZE ];unsigned char ep1_out_buf[EP1_BUFSIZE ]; +struct mutex ep1_out_mutex;/* protects ep1_out_buf */ unsigned char midi_out_buf[EP1_BUFSIZE ];struct caiaq_device_spec spec;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2417/3318 ALSA: caiaq: Fix the Kore controller key map
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niko Huuskonen <[email protected]>
[ Upstream commit c0508fc6895137f9e2dd43c1a09cc834254cc149 ]
keycode_kore does not match the hardware in two places:
- Softkeys 5 to 8 are listed in reverse order, so pressing the fifth softkey reports BTN_8, the sixth BTN_7 and so on. Softkeys 1 to 4 are correct. The OpenKoreBridge project, which drives a Kore 2 through this driver, works around the same reversal in userspace.
- On the first Kore controller the touch sensors of the eight knobs are
scrambled: touching knob 1 reports KEY_BRL_DOT6, knob 2 KEY_BRL_DOT8, knob 3 KEY_BRL_DOT2, knob 6 KEY_BRL_DOT7, knob 7 KEY_BRL_DOT1 and knob 8 KEY_BRL_DOT3. Only knobs 4 and 5 are right.
Put the softkeys in order for both controllers, and give the first Kore controller its own touch sensor order, so that BTN_n and KEY_BRL_DOTn belong to the n-th knob. The touch sensor order of the Kore 2 is left alone, as it could not be checked.
Userspace that compensates for the old order needs to follow. It can read the key map with EVIOCGKEYCODE, which also makes it possible to support kernels with and without this change.
Tested on a Kore controller (USB ID 17cc:4711).
--- sound/usb/caiaq/input.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-)
sound/usb/caiaq/input.c +25 -4
@@ -41,11 +41,11 @@ static const unsigned short keycode_kore[] = {BTN_3 ,BTN_2 ,BTN_1 , -BTN_8 , -BTN_7 , -BTN_6 ,BTN_5 , -KEY_BRL_DOT4 ,/* touch sensitive knobs */ +BTN_6 , +BTN_7 , +BTN_8 , +KEY_BRL_DOT4 ,/* touch sensitive knobs (Kore 2 order) */ KEY_BRL_DOT3 ,KEY_BRL_DOT2 , KEY_BRL_DOT1,
@@ -55,6 +55,21 @@ static const unsigned short keycode_kore[] = { KEY_BRL_DOT5 }; +/* index of the first touch sensor in keycode_kore */ +#define KORE_TOUCH_KEYS 24 + +/* the first Kore controller reports its touch sensors in this order */ +static const unsigned short keycode_kore1_touch[] = { +KEY_BRL_DOT4 , +KEY_BRL_DOT8 , +KEY_BRL_DOT3 , +KEY_BRL_DOT7 , +KEY_BRL_DOT2 , +KEY_BRL_DOT6 , +KEY_BRL_DOT1 , +KEY_BRL_DOT5 +}; +#define MASCHINE_BUTTONS (42)#define MASCHINE_BUTTON (X ) ((X) + BTN_MISC)#define MASCHINE_PADS (16)
@@ -656,6 +671,12 @@ int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *cdev) input->absbit[BIT_WORD (ABS_MISC )] |=BIT_MASK (ABS_MISC );BUILD_BUG_ON (sizeof (cdev->keycode) <sizeof (keycode_kore));memcpy (cdev->keycode, keycode_kore,sizeof (keycode_kore)); +BUILD_BUG_ON (KORE_TOUCH_KEYS +ARRAY_SIZE (keycode_kore1_touch) > +ARRAY_SIZE (keycode_kore)); +if (cdev->chip.usb_id == +USB_ID (USB_VID_NATIVEINSTRUMENTS ,USB_PID_KORECONTROLLER )) +memcpy (cdev->keycode +KORE_TOUCH_KEYS , keycode_kore1_touch, +sizeof (keycode_kore1_touch)); input->keycodemax =ARRAY_SIZE (keycode_kore);input_set_abs_params (input,ABS_HAT0X ,0 ,999 ,0 ,10 );input_set_abs_params (input,ABS_HAT0Y ,0 ,999 ,0 ,10 );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2418/3318 spi: rspi: Get rid of unused struct rspi_plat_data
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit bdeef5dcea6b164f4bd614655821b1ef12ebec9a ]
No in-kernel users of struct rspi_plat_data. If required, the software nodes should be used for such users. For now just get rid of it.
Stable-dep-of: 7b85114d47f6 ("spi: rspi: Fix DMA mode when the DMA controller is built as a module")
--- drivers/spi/spi-rspi.c | 12 +----------- include/linux/spi/rspi.h | 18 ------------------ 2 files changed, 1 insertion(+), 29 deletions(-) delete mode 100644 include/linux/spi/rspi.h
drivers/spi/spi-rspi.c +1 -11
@@ -24,7 +24,6 @@#include <linux/reset.h> #include <linux/sh_dma.h> #include <linux/spi/spi.h> -#include <linux/spi/rspi.h> #include <linux/spinlock.h> #define RSPI_SPCR 0x00/* Control Register */
@@ -1131,16 +1130,12 @@ static struct dma_chan *rspi_request_dma_chan(struct device *dev,static int rspi_request_dma (struct device *dev,struct spi_controller *ctlr,const struct resource *res) { -const struct rspi_plat_data *rspi_pd =dev_get_platdata (dev);unsigned int dma_tx_id, dma_rx_id;if (dev->of_node) {/* In the OF case we will get the slave IDs from the DT */ dma_tx_id =0 ; dma_rx_id =0 ; - }else if (rspi_pd && rspi_pd->dma_tx_id && rspi_pd->dma_rx_id) { - dma_tx_id = rspi_pd->dma_tx_id; - dma_rx_id = rspi_pd->dma_rx_id; }else {/* The driver assumes no error. */ return 0 ;
@@ -1296,7 +1291,6 @@ static int rspi_probe(struct platform_device *pdev)struct spi_controller *ctlr;struct rspi_data *rspi;int ret; -const struct rspi_plat_data *rspi_pd;const struct spi_ops *ops;unsigned long clksrc;
@@ -1311,11 +1305,7 @@ static int rspi_probe(struct platform_device *pdev) goto error1; }else { ops = (struct spi_ops *)pdev->id_entry->driver_data; - rspi_pd =dev_get_platdata (&pdev->dev); -if (rspi_pd && rspi_pd->num_chipselect) - ctlr->num_chipselect = rspi_pd->num_chipselect; -else - ctlr->num_chipselect =2 ;/* default */ + ctlr->num_chipselect =2 ;/* default */ } rspi =spi_controller_get_devdata (ctlr);
include/linux/spi/rspi.h deleted +0 -18
@@ -1,18 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* -* Renesas SPI driver -* -* Copyright (C) 2012 Renesas Solutions Corp. -*/ - -#ifndef __LINUX_SPI_RENESAS_SPI_H__ -#define __LINUX_SPI_RENESAS_SPI_H__ - -struct rspi_plat_data { -unsigned int dma_tx_id; -unsigned int dma_rx_id; - -u16 num_chipselect; -}; - -#endif
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2419/3318 spi: rspi: Fix DMA mode when the DMA controller is built as a module
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ovidiu Panait <[email protected]>
[ Upstream commit 7b85114d47f693b709b2e8e22e44cdf58c04b111 ]
On the Renesas RZ/G2L platform, the RSPI driver falls back to PIO mode instead of using DMA when the DMA controller driver is built as a module (CONFIG_RZ_DMAC=m):
renesas_spi 1004b000.spi: dma_request_slave_channel_compat failed renesas_spi 1004b000.spi: DMA not available, using PIO
The driver requests DMA channels through dma_request_slave_channel_compat() which returns either a valid pointer or NULL and cannot handle -EPROBE_DEFER. If the DMA controller has not probed yet, the driver falls back to PIO directly.
Fix this by replacing the dma_request_slave_channel_compat() call with a regular dma_request_chan() call. dma_request_slave_channel_compat() is always passed a NULL fn_param in all code paths, so it actually behaves like a plain dma_request_chan() call.
--- drivers/spi/spi-rspi.c | 49 ++++++++++++++++-------------------------- 1 file changed, 19 insertions(+), 30 deletions(-)
drivers/spi/spi-rspi.c +19 -30
@@ -22,7 +22,6 @@#include <linux/of.h> #include <linux/pm_runtime.h> #include <linux/reset.h> -#include <linux/sh_dma.h> #include <linux/spi/spi.h> #include <linux/spinlock.h>
@@ -1091,24 +1090,15 @@ static irqreturn_t rspi_irq_tx(int irq, void *_sr)static struct dma_chan *rspi_request_dma_chan (struct device *dev,enum dma_transfer_direction dir, -unsigned int id,dma_addr_t port_addr) { -dma_cap_mask_t mask;struct dma_chan *chan;struct dma_slave_config cfg;int ret; -dma_cap_zero (mask); -dma_cap_set (DMA_SLAVE , mask); - - chan =dma_request_slave_channel_compat (mask, shdma_chan_filter, - (void *)(unsigned long )id, dev, - dir ==DMA_MEM_TO_DEV ?"tx" :"rx" ); -if (!chan) { -dev_warn (dev,"dma_request_slave_channel_compat failed\n" ); -return NULL ; - } + chan =dma_request_chan (dev, dir ==DMA_MEM_TO_DEV ?"tx" :"rx" ); +if (IS_ERR (chan)) +return chan;memset (&cfg,0 ,sizeof (cfg)); cfg.dst_addr = port_addr +RSPI_SPDR ;
@@ -1121,7 +1111,7 @@ static struct dma_chan *rspi_request_dma_chan(struct device *dev,if (ret) {dev_warn (dev,"dmaengine_slave_config failed %d\n" , ret);dma_release_channel (chan); -return NULL ; +return ERR_PTR (ret); }return chan;
@@ -1130,29 +1120,23 @@ static struct dma_chan *rspi_request_dma_chan(struct device *dev,static int rspi_request_dma (struct device *dev,struct spi_controller *ctlr,const struct resource *res) { -unsigned int dma_tx_id, dma_rx_id; +struct dma_chan *chan; -if (dev->of_node) { -/* In the OF case we will get the slave IDs from the DT */ - dma_tx_id =0 ; - dma_rx_id =0 ; - }else { -/* The driver assumes no error. */ +if (!dev->of_node)return 0 ; - } - ctlr->dma_tx =rspi_request_dma_chan (dev,DMA_MEM_TO_DEV , dma_tx_id, - res->start); -if (!ctlr->dma_tx) -return -ENODEV ; + chan =rspi_request_dma_chan (dev,DMA_MEM_TO_DEV , res->start); +if (IS_ERR (chan)) +return PTR_ERR (chan); + ctlr->dma_tx = chan; - ctlr->dma_rx =rspi_request_dma_chan (dev,DMA_DEV_TO_MEM , dma_rx_id, - res->start); -if (!ctlr->dma_rx) { + chan =rspi_request_dma_chan (dev,DMA_DEV_TO_MEM , res->start); +if (IS_ERR (chan)) {dma_release_channel (ctlr->dma_tx); ctlr->dma_tx =NULL ; -return -ENODEV ; +return PTR_ERR (chan); } + ctlr->dma_rx = chan; ctlr->can_dma = rspi_can_dma;dev_info (dev,"DMA available" );
@@ -1380,6 +1364,11 @@ static int rspi_probe(struct platform_device *pdev) } ret =rspi_request_dma (&pdev->dev, ctlr, res); +if (ret == -EPROBE_DEFER ) { +dev_err_probe (&pdev->dev, ret, +"failed to request DMA channels\n" ); + goto error2; + }if (ret <0 )dev_warn (&pdev->dev,"DMA not available, using PIO\n" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2420/3318 ASoC: mediatek: mt8192: fix APLL mux error handling
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit e8c263e0ef957fd8286e299b2be9266b902cec16 ]
Propagate errors from clock operations in the enable path and clean up previously enabled clocks when a later operation fails.
For the disable path, continue disabling all clocks even if a clock operation fails. Log the error without returning it, so the disable path can perform as much cleanup as possible.
--- sound/soc/mediatek/mt8192/mt8192-afe-clk.c | 54 +++++++++++++--------- 1 file changed, 32 insertions(+), 22 deletions(-)
sound/soc/mediatek/mt8192/mt8192-afe-clk.c +32 -22
@@ -87,7 +87,7 @@ static int apll1_mux_setting(struct mtk_base_afe *afe, bool enable)if (ret) {dev_err (afe->dev,"%s clk_prepare_enable %s fail %d\n" , __func__, aud_clks[CLK_TOP_MUX_AUD_1 ], ret); - goto EXIT; +return ret; } ret =clk_set_parent (afe_priv->clk[CLK_TOP_MUX_AUD_1 ], afe_priv->clk[CLK_TOP_APLL1_CK ]);
@@ -95,7 +95,7 @@ static int apll1_mux_setting(struct mtk_base_afe *afe, bool enable)dev_err (afe->dev,"%s clk_set_parent %s-%s fail %d\n" , __func__, aud_clks[CLK_TOP_MUX_AUD_1 ], aud_clks[CLK_TOP_APLL1_CK ], ret); - goto EXIT; + goto err_disable_mux_aud_1; }/* 180.6336 / 4 = 45.1584MHz */
@@ -103,7 +103,7 @@ static int apll1_mux_setting(struct mtk_base_afe *afe, bool enable)if (ret) {dev_err (afe->dev,"%s clk_prepare_enable %s fail %d\n" , __func__, aud_clks[CLK_TOP_MUX_AUD_ENG1 ], ret); - goto EXIT; + goto err_set_parent_mux_aud_1; } ret =clk_set_parent (afe_priv->clk[CLK_TOP_MUX_AUD_ENG1 ], afe_priv->clk[CLK_TOP_APLL1_D4 ]);
@@ -111,31 +111,36 @@ static int apll1_mux_setting(struct mtk_base_afe *afe, bool enable)dev_err (afe->dev,"%s clk_set_parent %s-%s fail %d\n" , __func__, aud_clks[CLK_TOP_MUX_AUD_ENG1 ], aud_clks[CLK_TOP_APLL1_D4 ], ret); - goto EXIT; + goto err_disable_mux_aud_eng1; } }else { ret =clk_set_parent (afe_priv->clk[CLK_TOP_MUX_AUD_ENG1 ], afe_priv->clk[CLK_CLK26M ]); -if (ret) { +if (ret)dev_err (afe->dev,"%s clk_set_parent %s-%s fail %d\n" , __func__, aud_clks[CLK_TOP_MUX_AUD_ENG1 ], aud_clks[CLK_CLK26M ], ret); - goto EXIT; - }clk_disable_unprepare (afe_priv->clk[CLK_TOP_MUX_AUD_ENG1 ]); ret =clk_set_parent (afe_priv->clk[CLK_TOP_MUX_AUD_1 ], afe_priv->clk[CLK_CLK26M ]); -if (ret) { +if (ret)dev_err (afe->dev,"%s clk_set_parent %s-%s fail %d\n" , __func__, aud_clks[CLK_TOP_MUX_AUD_1 ], aud_clks[CLK_CLK26M ], ret); - goto EXIT; - }clk_disable_unprepare (afe_priv->clk[CLK_TOP_MUX_AUD_1 ]); } -EXIT: +return 0 ; + +err_disable_mux_aud_eng1: +clk_disable_unprepare (afe_priv->clk[CLK_TOP_MUX_AUD_ENG1 ]); +err_set_parent_mux_aud_1: +clk_set_parent (afe_priv->clk[CLK_TOP_MUX_AUD_1 ], + afe_priv->clk[CLK_CLK26M ]); +err_disable_mux_aud_1: +clk_disable_unprepare (afe_priv->clk[CLK_TOP_MUX_AUD_1 ]); +return ret; }
@@ -149,7 +154,7 @@ static int apll2_mux_setting(struct mtk_base_afe *afe, bool enable)if (ret) {dev_err (afe->dev,"%s clk_prepare_enable %s fail %d\n" , __func__, aud_clks[CLK_TOP_MUX_AUD_2 ], ret); - goto EXIT; +return ret; } ret =clk_set_parent (afe_priv->clk[CLK_TOP_MUX_AUD_2 ], afe_priv->clk[CLK_TOP_APLL2_CK ]);
@@ -157,7 +162,7 @@ static int apll2_mux_setting(struct mtk_base_afe *afe, bool enable)dev_err (afe->dev,"%s clk_set_parent %s-%s fail %d\n" , __func__, aud_clks[CLK_TOP_MUX_AUD_2 ], aud_clks[CLK_TOP_APLL2_CK ], ret); - goto EXIT; + goto err_disable_mux_aud_2; }/* 196.608 / 4 = 49.152MHz */
@@ -165,7 +170,7 @@ static int apll2_mux_setting(struct mtk_base_afe *afe, bool enable)if (ret) {dev_err (afe->dev,"%s clk_prepare_enable %s fail %d\n" , __func__, aud_clks[CLK_TOP_MUX_AUD_ENG2 ], ret); - goto EXIT; + goto err_set_parent_mux_aud_2; } ret =clk_set_parent (afe_priv->clk[CLK_TOP_MUX_AUD_ENG2 ], afe_priv->clk[CLK_TOP_APLL2_D4 ]);
@@ -173,31 +178,36 @@ static int apll2_mux_setting(struct mtk_base_afe *afe, bool enable)dev_err (afe->dev,"%s clk_set_parent %s-%s fail %d\n" , __func__, aud_clks[CLK_TOP_MUX_AUD_ENG2 ], aud_clks[CLK_TOP_APLL2_D4 ], ret); - goto EXIT; + goto err_disable_mux_aud_eng2; } }else { ret =clk_set_parent (afe_priv->clk[CLK_TOP_MUX_AUD_ENG2 ], afe_priv->clk[CLK_CLK26M ]); -if (ret) { +if (ret)dev_err (afe->dev,"%s clk_set_parent %s-%s fail %d\n" , __func__, aud_clks[CLK_TOP_MUX_AUD_ENG2 ], aud_clks[CLK_CLK26M ], ret); - goto EXIT; - }clk_disable_unprepare (afe_priv->clk[CLK_TOP_MUX_AUD_ENG2 ]); ret =clk_set_parent (afe_priv->clk[CLK_TOP_MUX_AUD_2 ], afe_priv->clk[CLK_CLK26M ]); -if (ret) { +if (ret)dev_err (afe->dev,"%s clk_set_parent %s-%s fail %d\n" , __func__, aud_clks[CLK_TOP_MUX_AUD_2 ], aud_clks[CLK_CLK26M ], ret); - goto EXIT; - }clk_disable_unprepare (afe_priv->clk[CLK_TOP_MUX_AUD_2 ]); } -EXIT: +return 0 ; + +err_disable_mux_aud_eng2: +clk_disable_unprepare (afe_priv->clk[CLK_TOP_MUX_AUD_ENG2 ]); +err_set_parent_mux_aud_2: +clk_set_parent (afe_priv->clk[CLK_TOP_MUX_AUD_2 ], + afe_priv->clk[CLK_CLK26M ]); +err_disable_mux_aud_2: +clk_disable_unprepare (afe_priv->clk[CLK_TOP_MUX_AUD_2 ]); +return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2421/3318 ASoC: mediatek: mt8192: fix AFE clock error handling
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 7c54781e6e60681af8d0858148d613becb582328 ]
If a clock operation fails in mt8192_afe_enable_clock(), the function returns immediately via the EXIT label without disabling the clocks that were successfully enabled earlier in the sequence. This leaves unneeded clocks running and causes a resource leak.
Properly unwind clocks enabled before an error by jumping to appropriate cleanup labels on failure.
--- sound/soc/mediatek/mt8192/mt8192-afe-clk.c | 28 +++++++++++++++------- 1 file changed, 19 insertions(+), 9 deletions(-)
sound/soc/mediatek/mt8192/mt8192-afe-clk.c +19 -9
@@ -220,21 +220,21 @@ int mt8192_afe_enable_clock(struct mtk_base_afe *afe)if (ret) {dev_err (afe->dev,"%s clk_prepare_enable %s fail %d\n" , __func__, aud_clks[CLK_INFRA_SYS_AUDIO ], ret); - goto EXIT; +return ret; } ret =clk_prepare_enable (afe_priv->clk[CLK_INFRA_AUDIO_26M ]);if (ret) {dev_err (afe->dev,"%s clk_prepare_enable %s fail %d\n" , __func__, aud_clks[CLK_INFRA_AUDIO_26M ], ret); - goto EXIT; + goto err_disable_infra_sys_audio; } ret =clk_prepare_enable (afe_priv->clk[CLK_MUX_AUDIO ]);if (ret) {dev_err (afe->dev,"%s clk_prepare_enable %s fail %d\n" , __func__, aud_clks[CLK_MUX_AUDIO ], ret); - goto EXIT; + goto err_disable_infra_audio_26m; } ret =clk_set_parent (afe_priv->clk[CLK_MUX_AUDIO ], afe_priv->clk[CLK_CLK26M ]);
@@ -242,14 +242,14 @@ int mt8192_afe_enable_clock(struct mtk_base_afe *afe)dev_err (afe->dev,"%s clk_set_parent %s-%s fail %d\n" , __func__, aud_clks[CLK_MUX_AUDIO ], aud_clks[CLK_CLK26M ], ret); - goto EXIT; + goto err_disable_mux_audio; } ret =clk_prepare_enable (afe_priv->clk[CLK_MUX_AUDIOINTBUS ]);if (ret) {dev_err (afe->dev,"%s clk_prepare_enable %s fail %d\n" , __func__, aud_clks[CLK_MUX_AUDIOINTBUS ], ret); - goto EXIT; + goto err_disable_mux_audio; } ret =mt8192_set_audio_int_bus_parent (afe,CLK_CLK26M );
@@ -257,7 +257,7 @@ int mt8192_afe_enable_clock(struct mtk_base_afe *afe)dev_err (afe->dev,"%s clk_set_parent %s-%s fail %d\n" , __func__, aud_clks[CLK_MUX_AUDIOINTBUS ], aud_clks[CLK_CLK26M ], ret); - goto EXIT; + goto err_disable_mux_audiointbus; } ret = clk_set_parent(afe_priv->clk[CLK_TOP_MUX_AUDIO_H],
@@ -266,17 +266,27 @@ int mt8192_afe_enable_clock(struct mtk_base_afe *afe)dev_err (afe->dev,"%s clk_set_parent %s-%s fail %d\n" , __func__, aud_clks[CLK_TOP_MUX_AUDIO_H ], aud_clks[CLK_TOP_APLL2_CK ], ret); - goto EXIT; + goto err_disable_mux_audiointbus; } ret =clk_prepare_enable (afe_priv->clk[CLK_AFE ]);if (ret) {dev_err (afe->dev,"%s clk_prepare_enable %s fail %d\n" , __func__, aud_clks[CLK_AFE ], ret); - goto EXIT; + goto err_disable_mux_audiointbus; } -EXIT: +return 0 ; + +err_disable_mux_audiointbus: +clk_disable_unprepare (afe_priv->clk[CLK_MUX_AUDIOINTBUS ]); +err_disable_mux_audio: +clk_disable_unprepare (afe_priv->clk[CLK_MUX_AUDIO ]); +err_disable_infra_audio_26m: +clk_disable_unprepare (afe_priv->clk[CLK_INFRA_AUDIO_26M ]); +err_disable_infra_sys_audio: +clk_disable_unprepare (afe_priv->clk[CLK_INFRA_SYS_AUDIO ]); +return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2422/3318 ASoC: mediatek: mt8192: fix error handling in APLL enable functions
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 88760524ca995acd229c30ec69ced7d883a90a72 ]
If a clock operation fails in mt8192_apll1_enable() or apll2_enable(), the functions return without checking the return value of mux settings or unwinding previously enabled clocks and MUX configurations.
Fix this by checking the return value of apll1_mux_setting() and apll2_mux_setting(), and adding proper unwind handling on failure.
--- sound/soc/mediatek/mt8192/mt8192-afe-clk.c | 32 ++++++++++++++++------ 1 file changed, 24 insertions(+), 8 deletions(-)
sound/soc/mediatek/mt8192/mt8192-afe-clk.c +24 -8
@@ -308,20 +308,22 @@ int mt8192_apll1_enable(struct mtk_base_afe *afe)int ret;/* setting for APLL */ -apll1_mux_setting (afe, true); + ret =apll1_mux_setting (afe, true); +if (ret) +return ret; ret =clk_prepare_enable (afe_priv->clk[CLK_APLL22M ]);if (ret) {dev_err (afe->dev,"%s clk_prepare_enable %s fail %d\n" , __func__, aud_clks[CLK_APLL22M ], ret); - goto EXIT; + goto err_disable_mux_setting; } ret =clk_prepare_enable (afe_priv->clk[CLK_APLL1_TUNER ]);if (ret) {dev_err (afe->dev,"%s clk_prepare_enable %s fail %d\n" , __func__, aud_clks[CLK_APLL1_TUNER ], ret); - goto EXIT; + goto err_disable_apll22m; } regmap_update_bits(afe->regmap, AFE_APLL1_TUNER_CFG,
@@ -332,7 +334,13 @@ int mt8192_apll1_enable(struct mtk_base_afe *afe)AFE_22M_ON_MASK_SFT , 0x1 << AFE_22M_ON_SFT); -EXIT: +return 0 ; + +err_disable_apll22m: +clk_disable_unprepare (afe_priv->clk[CLK_APLL22M ]); +err_disable_mux_setting: +apll1_mux_setting (afe, false); +return ret; }
@@ -358,20 +366,22 @@ int mt8192_apll2_enable(struct mtk_base_afe *afe)int ret;/* setting for APLL */ -apll2_mux_setting (afe, true); + ret =apll2_mux_setting (afe, true); +if (ret) +return ret; ret =clk_prepare_enable (afe_priv->clk[CLK_APLL24M ]);if (ret) {dev_err (afe->dev,"%s clk_prepare_enable %s fail %d\n" , __func__, aud_clks[CLK_APLL24M ], ret); - goto EXIT; + goto err_disable_mux_setting; } ret =clk_prepare_enable (afe_priv->clk[CLK_APLL2_TUNER ]);if (ret) {dev_err (afe->dev,"%s clk_prepare_enable %s fail %d\n" , __func__, aud_clks[CLK_APLL2_TUNER ], ret); - goto EXIT; + goto err_disable_apll24m; } regmap_update_bits(afe->regmap, AFE_APLL2_TUNER_CFG,
@@ -382,7 +392,13 @@ int mt8192_apll2_enable(struct mtk_base_afe *afe)AFE_24M_ON_MASK_SFT , 0x1 << AFE_24M_ON_SFT); -EXIT: +return 0 ; + +err_disable_apll24m: +clk_disable_unprepare (afe_priv->clk[CLK_APLL24M ]); +err_disable_mux_setting: +apll2_mux_setting (afe, false); +return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2423/3318 ASoC: mediatek: mt8192: fix MCK clock error handling
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 4a0ab266cb1594f8c6aef3c79726476ad99618c5 ]
If an error occurs after enabling 'm_sel_id' or 'div_clk_id' in mt8192_mck_enable(), the function returns directly without disabling the previously enabled clocks, leading to a resource leak.
Fix this by jumping to proper cleanup labels to unwind enabled clocks on failure paths.
--- sound/soc/mediatek/mt8192/mt8192-afe-clk.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
sound/soc/mediatek/mt8192/mt8192-afe-clk.c +11 -3
@@ -619,7 +619,7 @@ int mt8192_mck_enable(struct mtk_base_afe *afe, int mck_id, int rate)dev_err (afe->dev,"%s(), clk_set_parent %s-%s fail %d\n" , __func__, aud_clks[m_sel_id], aud_clks[apll_clk_id], ret); -return ret; + goto err_disable_m_sel; } }
@@ -628,17 +628,25 @@ int mt8192_mck_enable(struct mtk_base_afe *afe, int mck_id, int rate)if (ret) {dev_err (afe->dev,"%s(), clk_prepare_enable %s fail %d\n" , __func__, aud_clks[div_clk_id], ret); -return ret; + goto err_disable_m_sel; } ret =clk_set_rate (afe_priv->clk[div_clk_id], rate);if (ret) {dev_err (afe->dev,"%s(), clk_set_rate %s, rate %d, fail %d\n" , __func__, aud_clks[div_clk_id], rate, ret); -return ret; + goto err_disable_div_clk; }return 0 ; + +err_disable_div_clk: +clk_disable_unprepare (afe_priv->clk[div_clk_id]); +err_disable_m_sel: +if (m_sel_id >=0 ) +clk_disable_unprepare (afe_priv->clk[m_sel_id]); + +return ret; }void mt8192_mck_disable (struct mtk_base_afe *afe,int mck_id)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2424/3318 ASoC: mediatek: mt8192: switch to devm_clk_get_optional()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 6f4edfdce0099dc0c346c78c85f58a23d4ee646e ]
Switch from devm_clk_get() to devm_clk_get_optional() when requesting clocks, as optional clocks automatically return NULL when not present instead of requiring manual check and NULL assignment.
Additionally, handle clock errors properly using dev_err_probe() to propagate error codes (such as -EPROBE_DEFER) on failure instead of just printing a warning and continuing with NULL pointers.
--- sound/soc/mediatek/mt8192/mt8192-afe-clk.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
sound/soc/mediatek/mt8192/mt8192-afe-clk.c +4 -7
@@ -672,13 +672,10 @@ int mt8192_init_clock(struct mtk_base_afe *afe)return -ENOMEM ;for (i =0 ; i <CLK_NUM ; i++) { - afe_priv->clk[i] =devm_clk_get (afe->dev, aud_clks[i]); -if (IS_ERR (afe_priv->clk[i])) { -dev_warn (afe->dev,"%s devm_clk_get %s fail, ret %ld\n" , - __func__, - aud_clks[i],PTR_ERR (afe_priv->clk[i])); - afe_priv->clk[i] =NULL ; - } + afe_priv->clk[i] =devm_clk_get_optional (afe->dev, aud_clks[i]); +if (IS_ERR (afe_priv->clk[i])) +return dev_err_probe (afe->dev,PTR_ERR (afe_priv->clk[i]), +"failed to get clock %s\n" , aud_clks[i]); } afe_priv->apmixedsys = syscon_regmap_lookup_by_phandle(of_node,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2425/3318 ASoC: mediatek: mt8192: mt8192-afe-gpio: Use guard() for mutex locks
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 14edf39daefbf7aa689ea2bb8811a85c498e0ff6 ]
Convert the explicit mutex_lock()/mutex_unlock() pair to guard(mutex) to simplify the locking logic and automatically release the mutex on all exit paths.
This changes the mutex release point from immediately before dev_warn() to automatic cleanup at scope exit. However, the affected path only emits a warning and immediately returns -EINVAL, without any further processing.
Stable-dep-of: 411be3902fa8 ("ASoC: mediatek: mt8192: Propagate errors in mt8192_afe_gpio_request()")
--- sound/soc/mediatek/mt8192/mt8192-afe-gpio.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/mediatek/mt8192/mt8192-afe-gpio.c +1 -3
@@ -209,7 +209,7 @@ static int mt8192_afe_gpio_adda_ch34_ul(struct device *dev, bool enable)int mt8192_afe_gpio_request (struct device *dev,bool enable,int dai,int uplink) { -mutex_lock (&gpio_request_mutex); +guard (mutex)(&gpio_request_mutex);switch (dai) {case MT8192_DAI_ADDA :if (uplink)
@@ -297,11 +297,9 @@ int mt8192_afe_gpio_request(struct device *dev, bool enable, }break ;default : -mutex_unlock (&gpio_request_mutex);dev_warn (dev,"%s(), invalid dai %d\n" , __func__, dai);return -EINVAL ; } -mutex_unlock (&gpio_request_mutex);return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2426/3318 ASoC: mediatek: mt8192: Propagate errors in mt8192_afe_gpio_request()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 411be3902fa8f879db6f2f55d0c15507efe09c92 ]
Currently, mt8192_afe_gpio_request() ignores the return values from mt8192_afe_gpio_select() and other helper functions. If configuring a GPIO state fails, the function still returns 0, hiding the failure from callers.
Fix this by capturing and returning the error codes properly.
--- sound/soc/mediatek/mt8192/mt8192-afe-gpio.c | 74 +++++++++++---------- 1 file changed, 40 insertions(+), 34 deletions(-)
sound/soc/mediatek/mt8192/mt8192-afe-gpio.c +40 -34
@@ -209,98 +209,104 @@ static int mt8192_afe_gpio_adda_ch34_ul(struct device *dev, bool enable)int mt8192_afe_gpio_request (struct device *dev,bool enable,int dai,int uplink) { +int ret; +guard (mutex)(&gpio_request_mutex);switch (dai) {case MT8192_DAI_ADDA :if (uplink) -mt8192_afe_gpio_adda_ul (dev, enable); + ret =mt8192_afe_gpio_adda_ul (dev, enable);else -mt8192_afe_gpio_adda_dl (dev, enable); + ret =mt8192_afe_gpio_adda_dl (dev, enable);break ;case MT8192_DAI_ADDA_CH34 :if (uplink) -mt8192_afe_gpio_adda_ch34_ul (dev, enable); + ret =mt8192_afe_gpio_adda_ch34_ul (dev, enable);else -mt8192_afe_gpio_adda_ch34_dl (dev, enable); + ret =mt8192_afe_gpio_adda_ch34_dl (dev, enable);break ;case MT8192_DAI_I2S_0 :if (enable) -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S0_ON ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S0_ON );else -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S0_OFF ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S0_OFF );break ;case MT8192_DAI_I2S_1 :if (enable) -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S1_ON ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S1_ON );else -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S1_OFF ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S1_OFF );break ;case MT8192_DAI_I2S_2 :if (enable) -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S2_ON ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S2_ON );else -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S2_OFF ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S2_OFF );break ;case MT8192_DAI_I2S_3 :if (enable) -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S3_ON ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S3_ON );else -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S3_OFF ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S3_OFF );break ;case MT8192_DAI_I2S_5 :if (enable) -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S5_ON ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S5_ON );else -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S5_OFF ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S5_OFF );break ;case MT8192_DAI_I2S_6 :if (enable) -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S6_ON ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S6_ON );else -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S6_OFF ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S6_OFF );break ;case MT8192_DAI_I2S_7 :if (enable) -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S7_ON ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S7_ON );else -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S7_OFF ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S7_OFF );break ;case MT8192_DAI_I2S_8 :if (enable) -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S8_ON ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S8_ON );else -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S8_OFF ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S8_OFF );break ;case MT8192_DAI_I2S_9 :if (enable) -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S9_ON ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S9_ON );else -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S9_OFF ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_I2S9_OFF );break ;case MT8192_DAI_TDM :if (enable) -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_TDM_ON ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_TDM_ON );else -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_TDM_OFF ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_TDM_OFF );break ;case MT8192_DAI_VOW :if (enable) { -mt8192_afe_gpio_select (dev, -MT8192_AFE_GPIO_VOW_CLK_ON ); -mt8192_afe_gpio_select (dev, -MT8192_AFE_GPIO_VOW_DAT_ON ); + ret =mt8192_afe_gpio_select (dev, +MT8192_AFE_GPIO_VOW_CLK_ON ); +if (ret) +break ; + ret =mt8192_afe_gpio_select (dev, +MT8192_AFE_GPIO_VOW_DAT_ON ); }else { -mt8192_afe_gpio_select (dev, -MT8192_AFE_GPIO_VOW_CLK_OFF ); -mt8192_afe_gpio_select (dev, -MT8192_AFE_GPIO_VOW_DAT_OFF ); + ret =mt8192_afe_gpio_select (dev, +MT8192_AFE_GPIO_VOW_CLK_OFF ); +if (ret) +break ; + ret =mt8192_afe_gpio_select (dev, +MT8192_AFE_GPIO_VOW_DAT_OFF ); }break ;default :dev_warn (dev,"%s(), invalid dai %d\n" , __func__, dai); -return -EINVAL ; + ret = -EINVAL ; } -return 0 ; +return ret; }EXPORT_SYMBOL (mt8192_afe_gpio_request);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2427/3318 ASoC: mediatek: mt8192: check return values in mt8192_afe_gpio_init()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 7cca184ad434436e8f4648f71756bab0c3593ed9 ]
Currently, mt8192_afe_gpio_init() ignores the return values of mt8192_afe_gpio_select() and mt8192_afe_gpio_request(). If configuring GPIO states or requesting GPIOs fails during initialization, the function still proceeds and returns 0, masking the initialization failure.
Fix this by checking and propagating the return values properly.
--- sound/soc/mediatek/mt8192/mt8192-afe-gpio.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
sound/soc/mediatek/mt8192/mt8192-afe-gpio.c +8 -4
@@ -152,13 +152,17 @@ int mt8192_afe_gpio_init(struct device *dev) } } -mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_CLK_MOSI_ON ); + ret =mt8192_afe_gpio_select (dev,MT8192_AFE_GPIO_CLK_MOSI_ON ); +if (ret) +return ret;/* gpio status init */ -mt8192_afe_gpio_request (dev, false,MT8192_DAI_ADDA ,0 ); -mt8192_afe_gpio_request (dev, false,MT8192_DAI_ADDA ,1 ); + ret =mt8192_afe_gpio_request (dev, false,MT8192_DAI_ADDA ,0 ); +if (ret) +return ret; + ret =mt8192_afe_gpio_request (dev, false,MT8192_DAI_ADDA ,1 ); -return 0 ; +return ret; }EXPORT_SYMBOL (mt8192_afe_gpio_init);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2428/3318 ASoC: mediatek: mt8192: Handle regcache_sync() failure in runtime resume
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit d9e264741b041fc9dffc555bc1ab68708658cefd ]
Currently, the return value of regcache_sync() in mt8192_afe_runtime_resume() is ignored. If regcache_sync() fails, the function continues execution with clocks enabled and regcache out of sync.
Fix this by checking the return value of regcache_sync(). On failure, restore regcache to cache-only mode and disable the clocks enabled earlier in the function.
--- sound/soc/mediatek/mt8192/mt8192-afe-pcm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
sound/soc/mediatek/mt8192/mt8192-afe-pcm.c +5 -1
@@ -2104,7 +2104,11 @@ static int mt8192_afe_runtime_resume(struct device *dev) goto skip_regmap;regcache_cache_only (afe->regmap, false); -regcache_sync (afe->regmap); + ret =regcache_sync (afe->regmap); +if (ret) { +regcache_cache_only (afe->regmap, true); +mt8192_afe_disable_clock (afe); + }/* enable audio sys DCM for power saving */ regmap_update_bits(afe_priv->infracfg,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2429/3318 ASoC: mediatek: mt8192: Propagate mt8192_afe_gpio_request() errors in ADDA DAI
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit eed9414a1b075e2df308e7222e3786981bd42b32 ]
Currently, DAPM event handlers in mt8192-dai-adda.c ignore the return value of mt8192_afe_gpio_request(). If GPIO configuration fails during PRE_PMU or POST_PMD events, the error is silently ignored.
Fix this by checking and propagating error codes from mt8192_afe_gpio_request() in all ADDA DAPM event handlers.
--- sound/soc/mediatek/mt8192/mt8192-dai-adda.c | 44 +++++++++++++++------ 1 file changed, 32 insertions(+), 12 deletions(-)
sound/soc/mediatek/mt8192/mt8192-dai-adda.c +32 -12
@@ -302,10 +302,13 @@ static int mtk_adda_ul_event(struct snd_soc_dapm_widget *w,struct mtk_base_afe *afe =snd_soc_component_get_drvdata (cmpnt);struct mt8192_afe_private *afe_priv = afe->platform_priv;int mtkaif_dmic = afe_priv->mtkaif_dmic; +int ret;switch (event) {case SND_SOC_DAPM_PRE_PMU : -mt8192_afe_gpio_request (afe->dev, true,MT8192_DAI_ADDA ,1 ); + ret =mt8192_afe_gpio_request (afe->dev, true,MT8192_DAI_ADDA ,1 ); +if (ret) +return ret;/* update setting to dmic */ if (mtkaif_dmic) {
@@ -323,7 +326,9 @@ static int mtk_adda_ul_event(struct snd_soc_dapm_widget *w,case SND_SOC_DAPM_POST_PMD :/* should delayed 1/fs(smallest is 8k) = 125us before afe off */ usleep_range (125 ,135 ); -mt8192_afe_gpio_request (afe->dev, false,MT8192_DAI_ADDA ,1 ); + ret =mt8192_afe_gpio_request (afe->dev, false,MT8192_DAI_ADDA ,1 ); +if (ret) +return ret;break ;default :break ;
@@ -341,11 +346,14 @@ static int mtk_adda_ch34_ul_event(struct snd_soc_dapm_widget *w,struct mt8192_afe_private *afe_priv = afe->platform_priv;int mtkaif_dmic = afe_priv->mtkaif_dmic_ch34;int mtkaif_adda6_only = afe_priv->mtkaif_adda6_only; +int ret;switch (event) {case SND_SOC_DAPM_PRE_PMU : -mt8192_afe_gpio_request (afe->dev, true,MT8192_DAI_ADDA_CH34 , -1 ); + ret =mt8192_afe_gpio_request (afe->dev, true,MT8192_DAI_ADDA_CH34 , +1 ); +if (ret) +return ret;/* update setting to dmic */ if (mtkaif_dmic) {
@@ -375,8 +383,10 @@ static int mtk_adda_ch34_ul_event(struct snd_soc_dapm_widget *w,case SND_SOC_DAPM_POST_PMD :/* should delayed 1/fs(smallest is 8k) = 125us before afe off */ usleep_range (125 ,135 ); -mt8192_afe_gpio_request (afe->dev, false,MT8192_DAI_ADDA_CH34 , -1 ); + ret =mt8192_afe_gpio_request (afe->dev, false,MT8192_DAI_ADDA_CH34 , +1 ); +if (ret) +return ret;/* reset dmic */ afe_priv->mtkaif_dmic_ch34 =0 ;
@@ -530,15 +540,20 @@ static int mtk_adda_dl_event(struct snd_soc_dapm_widget *w, {struct snd_soc_component *cmpnt =snd_soc_dapm_to_component (w->dapm);struct mtk_base_afe *afe =snd_soc_component_get_drvdata (cmpnt); +int ret;switch (event) {case SND_SOC_DAPM_PRE_PMU : -mt8192_afe_gpio_request (afe->dev, true,MT8192_DAI_ADDA ,0 ); + ret =mt8192_afe_gpio_request (afe->dev, true,MT8192_DAI_ADDA ,0 ); +if (ret) +return ret;break ;case SND_SOC_DAPM_POST_PMD :/* should delayed 1/fs(smallest is 8k) = 125us before afe off */ usleep_range (125 ,135 ); -mt8192_afe_gpio_request (afe->dev, false,MT8192_DAI_ADDA ,0 ); + ret =mt8192_afe_gpio_request (afe->dev, false,MT8192_DAI_ADDA ,0 ); +if (ret) +return ret;break ;default :break ;
@@ -553,17 +568,22 @@ static int mtk_adda_ch34_dl_event(struct snd_soc_dapm_widget *w, {struct snd_soc_component *cmpnt =snd_soc_dapm_to_component (w->dapm);struct mtk_base_afe *afe =snd_soc_component_get_drvdata (cmpnt); +int ret;switch (event) {case SND_SOC_DAPM_PRE_PMU : -mt8192_afe_gpio_request (afe->dev, true,MT8192_DAI_ADDA_CH34 , -0 ); + ret =mt8192_afe_gpio_request (afe->dev, true,MT8192_DAI_ADDA_CH34 , +0 ); +if (ret) +return ret;break ;case SND_SOC_DAPM_POST_PMD :/* should delayed 1/fs(smallest is 8k) = 125us before afe off */ usleep_range (125 ,135 ); -mt8192_afe_gpio_request (afe->dev, false,MT8192_DAI_ADDA_CH34 , -0 ); + ret =mt8192_afe_gpio_request (afe->dev, false,MT8192_DAI_ADDA_CH34 , +0 ); +if (ret) +return ret;break ;default :break ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2430/3318 ASoC: mediatek: mt8192: Propagate errors in TDM DAI DAPM event handlers
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit d0bc9613bc2d9e20a7e4f3e447cd9427c95d194a ]
Currently, DAPM event handlers in mt8192-dai-tdm.c ignore return values from mt8192_afe_gpio_request() and mt8192_mck_enable().
If GPIO configuration or master clock setup fails during DAPM events, the error is silently ignored.
Fix this by checking and propagating error codes properly in all TDM DAI DAPM event handlers.
--- sound/soc/mediatek/mt8192/mt8192-dai-tdm.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
sound/soc/mediatek/mt8192/mt8192-dai-tdm.c +13 -5
@@ -250,6 +250,7 @@ static int mtk_tdm_en_event(struct snd_soc_dapm_widget *w,struct mt8192_afe_private *afe_priv = afe->platform_priv;int dai_id =get_tdm_id_by_name (w->name);struct mtk_afe_tdm_priv *tdm_priv = afe_priv->dai_priv[dai_id]; +int ret;if (!tdm_priv) {dev_warn (afe->dev,"%s(), tdm_priv == NULL" , __func__);
@@ -261,16 +262,17 @@ static int mtk_tdm_en_event(struct snd_soc_dapm_widget *w,switch (event) {case SND_SOC_DAPM_PRE_PMU : -mt8192_afe_gpio_request (afe->dev, true, tdm_priv->id,0 ); + ret =mt8192_afe_gpio_request (afe->dev, true, tdm_priv->id,0 );break ;case SND_SOC_DAPM_POST_PMD : -mt8192_afe_gpio_request (afe->dev, false, tdm_priv->id,0 ); + ret =mt8192_afe_gpio_request (afe->dev, false, tdm_priv->id,0 );break ;default : + ret =0 ;break ; } -return 0 ; +return ret; } static int mtk_tdm_bck_en_event(struct snd_soc_dapm_widget *w,
@@ -282,6 +284,7 @@ static int mtk_tdm_bck_en_event(struct snd_soc_dapm_widget *w,struct mt8192_afe_private *afe_priv = afe->platform_priv;int dai_id =get_tdm_id_by_name (w->name);struct mtk_afe_tdm_priv *tdm_priv = afe_priv->dai_priv[dai_id]; +int ret;if (!tdm_priv) {dev_warn (afe->dev,"%s(), tdm_priv == NULL" , __func__);
@@ -293,7 +296,9 @@ static int mtk_tdm_bck_en_event(struct snd_soc_dapm_widget *w,switch (event) {case SND_SOC_DAPM_PRE_PMU : -mt8192_mck_enable (afe, tdm_priv->bck_id, tdm_priv->bck_rate); + ret =mt8192_mck_enable (afe, tdm_priv->bck_id, tdm_priv->bck_rate); +if (ret) +return ret;break ;case SND_SOC_DAPM_POST_PMD :mt8192_mck_disable (afe, tdm_priv->bck_id);
@@ -314,6 +319,7 @@ static int mtk_tdm_mck_en_event(struct snd_soc_dapm_widget *w,struct mt8192_afe_private *afe_priv = afe->platform_priv;int dai_id =get_tdm_id_by_name (w->name);struct mtk_afe_tdm_priv *tdm_priv = afe_priv->dai_priv[dai_id]; +int ret;if (!tdm_priv) {dev_warn (afe->dev,"%s(), tdm_priv == NULL" , __func__);
@@ -325,7 +331,9 @@ static int mtk_tdm_mck_en_event(struct snd_soc_dapm_widget *w,switch (event) {case SND_SOC_DAPM_PRE_PMU : -mt8192_mck_enable (afe, tdm_priv->mclk_id, tdm_priv->mclk_rate); + ret =mt8192_mck_enable (afe, tdm_priv->mclk_id, tdm_priv->mclk_rate); +if (ret) +return ret;break ;case SND_SOC_DAPM_POST_PMD : tdm_priv->mclk_rate =0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2431/3318 ASoC: mediatek: mt8192: Handle component name prefix
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 86cfaf99e4d3c7b4707fb8cc9eb06d8db10c1414 ]
Use snd_soc_dapm_widget_name_cmp() helper when comparing widget names, to include also the component's name prefix.
Stable-dep-of: 49aeb628d10e ("ASoC: mediatek: mt8192: Propagate errors in I2S DAI DAPM event handlers")
--- sound/soc/mediatek/mt8192/mt8192-dai-adda.c | 4 ++-- sound/soc/mediatek/mt8192/mt8192-dai-i2s.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
sound/soc/mediatek/mt8192/mt8192-dai-adda.c +2 -2
@@ -445,7 +445,7 @@ static int mtk_adda_mtkaif_cfg_event(struct snd_soc_dapm_widget *w,regmap_write (afe->regmap,AFE_ADDA6_MTKAIF_CFG0 ,0x00010000 ); -if (strcmp (w->name,"ADDA_MTKAIF_CFG" ) ==0 && +if (snd_soc_dapm_widget_name_cmp (w,"ADDA_MTKAIF_CFG" ) ==0 && (afe_priv->mtkaif_chosen_phase[0 ] <0 || afe_priv->mtkaif_chosen_phase[1 ] <0 )) { dev_warn(afe->dev,
@@ -454,7 +454,7 @@ static int mtk_adda_mtkaif_cfg_event(struct snd_soc_dapm_widget *w, afe_priv->mtkaif_chosen_phase[0 ], afe_priv->mtkaif_chosen_phase[1]);break ; - }else if (strcmp (w->name,"ADDA6_MTKAIF_CFG" ) ==0 && + }else if (snd_soc_dapm_widget_name_cmp (w,"ADDA6_MTKAIF_CFG" ) ==0 && afe_priv->mtkaif_chosen_phase[2 ] <0 ) { dev_warn(afe->dev, "%s(), mtkaif_chosen_phase[2]:%d\n",
sound/soc/mediatek/mt8192/mt8192-dai-i2s.c +2 -2
@@ -623,13 +623,13 @@ static int mtk_apll_event(struct snd_soc_dapm_widget *w,switch (event) {case SND_SOC_DAPM_PRE_PMU : -if (strcmp (w->name,APLL1_W_NAME ) ==0 ) +if (snd_soc_dapm_widget_name_cmp (w,APLL1_W_NAME ) ==0 )mt8192_apll1_enable (afe);else mt8192_apll2_enable (afe);break ;case SND_SOC_DAPM_POST_PMD : -if (strcmp (w->name,APLL1_W_NAME ) ==0 ) +if (snd_soc_dapm_widget_name_cmp (w,APLL1_W_NAME ) ==0 )mt8192_apll1_disable (afe);else mt8192_apll2_disable (afe);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2432/3318 ASoC: mediatek: mt8192: Propagate errors in I2S DAI DAPM event handlers
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 49aeb628d10ef3d5694c39b7a3427d34bde06bb2 ]
Currently, DAPM event handlers in mt8192-dai-i2s.c ignore return values from mt8192_afe_gpio_request(), mt8192_apll1_enable(), mt8192_apll2_enable(), and mt8192_mck_enable(). If GPIO configuration or clock setup fails during DAPM events, the error is silently ignored.
Fix this by checking and propagating error codes properly in all I2S DAI DAPM event handlers.
--- sound/soc/mediatek/mt8192/mt8192-dai-i2s.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
sound/soc/mediatek/mt8192/mt8192-dai-i2s.c +14 -6
@@ -586,6 +586,7 @@ static int mtk_i2s_en_event(struct snd_soc_dapm_widget *w,struct snd_soc_component *cmpnt =snd_soc_dapm_to_component (w->dapm);struct mtk_base_afe *afe =snd_soc_component_get_drvdata (cmpnt);struct mtk_afe_i2s_priv *i2s_priv; +int ret; i2s_priv =get_i2s_priv_by_name (afe, w->name);
@@ -599,16 +600,17 @@ static int mtk_i2s_en_event(struct snd_soc_dapm_widget *w,switch (event) {case SND_SOC_DAPM_PRE_PMU : -mt8192_afe_gpio_request (afe->dev, true, i2s_priv->id,0 ); + ret =mt8192_afe_gpio_request (afe->dev, true, i2s_priv->id,0 );break ;case SND_SOC_DAPM_POST_PMD : -mt8192_afe_gpio_request (afe->dev, false, i2s_priv->id,0 ); + ret =mt8192_afe_gpio_request (afe->dev, false, i2s_priv->id,0 );break ;default : + ret =0 ;break ; } -return 0 ; +return ret; } static int mtk_apll_event(struct snd_soc_dapm_widget *w,
@@ -617,6 +619,7 @@ static int mtk_apll_event(struct snd_soc_dapm_widget *w, {struct snd_soc_component *cmpnt =snd_soc_dapm_to_component (w->dapm);struct mtk_base_afe *afe =snd_soc_component_get_drvdata (cmpnt); +int ret;dev_dbg (cmpnt->dev,"%s(), name %s, event 0x%x\n" , __func__, w->name, event);
@@ -624,9 +627,11 @@ static int mtk_apll_event(struct snd_soc_dapm_widget *w,switch (event) {case SND_SOC_DAPM_PRE_PMU :if (snd_soc_dapm_widget_name_cmp (w,APLL1_W_NAME ) ==0 ) -mt8192_apll1_enable (afe); + ret =mt8192_apll1_enable (afe);else -mt8192_apll2_enable (afe); + ret =mt8192_apll2_enable (afe); +if (ret) +return ret;break ;case SND_SOC_DAPM_POST_PMD :if (snd_soc_dapm_widget_name_cmp (w,APLL1_W_NAME ) ==0 )
@@ -704,6 +709,7 @@ static int mtk_mclk_en_event(struct snd_soc_dapm_widget *w,struct snd_soc_component *cmpnt =snd_soc_dapm_to_component (w->dapm);struct mtk_base_afe *afe =snd_soc_component_get_drvdata (cmpnt);struct mtk_afe_i2s_priv *i2s_priv; +int ret;dev_dbg (cmpnt->dev,"%s(), name %s, event 0x%x\n" , __func__, w->name, event);
@@ -716,7 +722,9 @@ static int mtk_mclk_en_event(struct snd_soc_dapm_widget *w,switch (event) {case SND_SOC_DAPM_PRE_PMU : -mt8192_mck_enable (afe, i2s_priv->mclk_id, i2s_priv->mclk_rate); + ret =mt8192_mck_enable (afe, i2s_priv->mclk_id, i2s_priv->mclk_rate); +if (ret) +return ret;break ;case SND_SOC_DAPM_POST_PMD : i2s_priv->mclk_rate =0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2433/3318 ASoC: mediatek: mt8192-mt6359: Fix error handling in MTKAIF calibration
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit d6c8a0b5bf696d89350e43bf554362de8929f801 ]
mt8192_mt6359_mtkaif_calibration() ignored the return values of pm_runtime_get_sync() and mt8192_afe_gpio_request(), which could leave PM runtime references or GPIO state unbalanced on failure.
Switch to pm_runtime_resume_and_get(), check each GPIO request, and unwind on error.
--- .../mt8192/mt8192-mt6359-rt1015-rt5682.c | 37 +++++++++++++------ 1 file changed, 25 insertions(+), 12 deletions(-)
sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c +25 -12
@@ -160,12 +160,23 @@ static int mt8192_mt6359_mtkaif_calibration(struct snd_soc_pcm_runtime *rtd)int chosen_phase_1, chosen_phase_2, chosen_phase_3;int counter;int mtkaif_calib_ok; +int ret =0 ; -pm_runtime_get_sync (afe->dev); -mt8192_afe_gpio_request (afe->dev, true,MT8192_DAI_ADDA ,1 ); -mt8192_afe_gpio_request (afe->dev, true,MT8192_DAI_ADDA ,0 ); -mt8192_afe_gpio_request (afe->dev, true,MT8192_DAI_ADDA_CH34 ,1 ); -mt8192_afe_gpio_request (afe->dev, true,MT8192_DAI_ADDA_CH34 ,0 ); + ret =pm_runtime_resume_and_get (afe->dev); +if (ret <0 ) +return ret; + ret =mt8192_afe_gpio_request (afe->dev, true,MT8192_DAI_ADDA ,1 ); +if (ret) + goto err_pm_put; + ret =mt8192_afe_gpio_request (afe->dev, true,MT8192_DAI_ADDA ,0 ); +if (ret) + goto err_disable_adda_1; + ret =mt8192_afe_gpio_request (afe->dev, true,MT8192_DAI_ADDA_CH34 ,1 ); +if (ret) + goto err_disable_adda_0; + ret =mt8192_afe_gpio_request (afe->dev, true,MT8192_DAI_ADDA_CH34 ,0 ); +if (ret) + goto err_disable_adda_ch34_1;mt6359_mtkaif_calibration_enable (cmpnt_codec);
@@ -286,10 +297,14 @@ static int mt8192_mt6359_mtkaif_calibration(struct snd_soc_pcm_runtime *rtd)mt6359_mtkaif_calibration_disable (cmpnt_codec); -mt8192_afe_gpio_request (afe->dev, false,MT8192_DAI_ADDA ,1 ); -mt8192_afe_gpio_request (afe->dev, false,MT8192_DAI_ADDA ,0 ); -mt8192_afe_gpio_request (afe->dev, false,MT8192_DAI_ADDA_CH34 ,1 );mt8192_afe_gpio_request (afe->dev, false,MT8192_DAI_ADDA_CH34 ,0 ); +err_disable_adda_ch34_1: +mt8192_afe_gpio_request (afe->dev, false,MT8192_DAI_ADDA_CH34 ,1 ); +err_disable_adda_0: +mt8192_afe_gpio_request (afe->dev, false,MT8192_DAI_ADDA ,0 ); +err_disable_adda_1: +mt8192_afe_gpio_request (afe->dev, false,MT8192_DAI_ADDA ,1 ); +err_pm_put:pm_runtime_put (afe->dev); dev_dbg(afe->dev, "%s(), mtkaif_chosen_phase[0/1/2]:%d/%d/%d\n",
@@ -298,7 +313,7 @@ static int mt8192_mt6359_mtkaif_calibration(struct snd_soc_pcm_runtime *rtd) afe_priv->mtkaif_chosen_phase[1 ], afe_priv->mtkaif_chosen_phase[2]); -return 0 ; +return ret; }static int mt8192_mt6359_init (struct snd_soc_pcm_runtime *rtd)
@@ -316,9 +331,7 @@ static int mt8192_mt6359_init(struct snd_soc_pcm_runtime *rtd) afe_priv->mtkaif_protocol =MTKAIF_PROTOCOL_2_CLK_P2 ;/* mtkaif calibration */ -mt8192_mt6359_mtkaif_calibration (rtd); - -return 0 ; +return mt8192_mt6359_mtkaif_calibration (rtd); }static int mt8192_rt5682_init (struct snd_soc_pcm_runtime *rtd)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2434/3318 perf vendor events intel: Fix skylakex umask encoding.
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit f37e7dfbd34c4e48d2bea4c5e0e64c398671e87b ]
Fix UMaskExt that was wrongly encoded when the UMask was 0.
--- .../pmu-events/arch/x86/skylakex/uncore-interconnect.json | 6 ++++++ 1 file changed, 6 insertions(+)
tools/perf/pmu-events/arch/x86/skylakex/uncore-interconnect.json +6 -0
@@ -10998,6 +10998,7 @@ "EventCode": "0x4", "EventName": "UNC_UPI_TxL_HDR_MATCH.DATA_HDR", "PerPkg": "1", + "UMask": "0x800", "Unit": "UPI" }, {
@@ -11006,6 +11007,7 @@ "EventCode": "0x4", "EventName": "UNC_UPI_TxL_HDR_MATCH.DUAL_SLOT_HDR", "PerPkg": "1", + "UMask": "0x2000", "Unit": "UPI" }, {
@@ -11014,6 +11016,7 @@ "EventCode": "0x4", "EventName": "UNC_UPI_TxL_HDR_MATCH.LOC", "PerPkg": "1", + "UMask": "0x200", "Unit": "UPI" }, {
@@ -11040,6 +11043,7 @@ "EventCode": "0x4", "EventName": "UNC_UPI_TxL_HDR_MATCH.NON_DATA_HDR", "PerPkg": "1", + "UMask": "0x1000", "Unit": "UPI" }, {
@@ -11048,6 +11052,7 @@ "EventCode": "0x4", "EventName": "UNC_UPI_TxL_HDR_MATCH.REM", "PerPkg": "1", + "UMask": "0x400", "Unit": "UPI" }, {
@@ -11083,6 +11088,7 @@ "EventCode": "0x4", "EventName": "UNC_UPI_TxL_HDR_MATCH.SGL_SLOT_HDR", "PerPkg": "1", + "UMask": "0x4000", "Unit": "UPI" }, {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2435/3318 perf vendor events intel: Fix snowridgex umask encoding.
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit 8a0b9c9ff582258aafc6d6c8fe3fb104d9686a7b ]
Fix UMaskExt that was wrongly encoded when the UMask was 0.
--- .../arch/x86/snowridgex/uncore-cache.json | 68 +++++++++++++++++++ .../x86/snowridgex/uncore-interconnect.json | 10 +++ 2 files changed, 78 insertions(+)
tools/perf/pmu-events/arch/x86/snowridgex/uncore-cache.json +68 -0
@@ -1354,6 +1354,7 @@ "EventName": "UNC_CHA_LLC_LOOKUP.ANY_F", "PerPkg": "1", "PublicDescription": "Cache Lookups : All Request Filter : Counts the number of times the LLC was accessed - this includes code, data, prefetches and hints coming from L2. This has numerous filters available. Note the non-standard filtering equation. This event will count requests that lookup the cache multiple times with multiple increments. One must ALWAYS select a state or states (in the umask field) to match. Otherwise, the event will count nothing. : Any local or remote transaction to the LLC, including prefetch.", + "UMask": "0x2000", "Unit": "CHA" }, {
@@ -1380,6 +1381,7 @@ "EventName": "UNC_CHA_LLC_LOOKUP.CODE_READ_F", "PerPkg": "1", "PublicDescription": "Cache Lookups : CRd Request Filter : Counts the number of times the LLC was accessed - this includes code, data, prefetches and hints coming from L2. This has numerous filters available. Note the non-standard filtering equation. This event will count requests that lookup the cache multiple times with multiple increments. One must ALWAYS select a state or states (in the umask field) to match. Otherwise, the event will count nothing. : Local or remote CRd transactions to the LLC. This includes CRd prefetch.", + "UMask": "0x1000", "Unit": "CHA" }, {
@@ -1397,6 +1399,7 @@ "EventName": "UNC_CHA_LLC_LOOKUP.COREPREF_OR_DMND_LOCAL_F", "PerPkg": "1", "PublicDescription": "Cache Lookups : Local request Filter : Counts the number of times the LLC was accessed - this includes code, data, prefetches and hints coming from L2. This has numerous filters available. Note the non-standard filtering equation. This event will count requests that lookup the cache multiple times with multiple increments. One must ALWAYS select a state or states (in the umask field) to match. Otherwise, the event will count nothing. : Any local transaction to the LLC, including prefetches from the Core", + "UMask": "0x4000", "Unit": "CHA" }, {
@@ -1432,6 +1435,7 @@ "EventName": "UNC_CHA_LLC_LOOKUP.DATA_READ_F", "PerPkg": "1", "PublicDescription": "Cache Lookups : Data Read Request Filter : Counts the number of times the LLC was accessed - this includes code, data, prefetches and hints coming from L2. This has numerous filters available. Note the non-standard filtering equation. This event will count requests that lookup the cache multiple times with multiple increments. One must ALWAYS select a state or states (in the umask field) to match. Otherwise, the event will count nothing. : Read transactions.", + "UMask": "0x100", "Unit": "CHA" }, {
@@ -1485,6 +1489,7 @@ "EventName": "UNC_CHA_LLC_LOOKUP.FLUSH_OR_INV_F", "PerPkg": "1", "PublicDescription": "Cache Lookups : Flush or Invalidate Filter : Counts the number of times the LLC was accessed - this includes code, data, prefetches and hints coming from L2. This has numerous filters available. Note the non-standard filtering equation. This event will count requests that lookup the cache multiple times with multiple increments. One must ALWAYS select a state or states (in the umask field) to match. Otherwise, the event will count nothing.", + "UMask": "0x400", "Unit": "CHA" }, {
@@ -1502,6 +1507,7 @@ "EventName": "UNC_CHA_LLC_LOOKUP.LOCAL_F", "PerPkg": "1", "PublicDescription": "Cache Lookups : Transactions homed locally Filter : Counts the number of times the LLC was accessed - this includes code, data, prefetches and hints coming from L2. This has numerous filters available. Note the non-standard filtering equation. This event will count requests that lookup the cache multiple times with multiple increments. One must ALWAYS select a state or states (in the umask field) to match. Otherwise, the event will count nothing. : Transaction whose address resides in the local MC.", + "UMask": "0x80000", "Unit": "CHA" }, {
@@ -1528,6 +1534,7 @@ "EventName": "UNC_CHA_LLC_LOOKUP.OTHER_REQ_F", "PerPkg": "1", "PublicDescription": "Cache Lookups : Write Request Filter : Counts the number of times the LLC was accessed - this includes code, data, prefetches and hints coming from L2. This has numerous filters available. Note the non-standard filtering equation. This event will count requests that lookup the cache multiple times with multiple increments. One must ALWAYS select a state or states (in the umask field) to match. Otherwise, the event will count nothing. : Writeback transactions to the LLC This includes all write transactions -- both Cacheable and UC.", + "UMask": "0x200", "Unit": "CHA" }, {
@@ -1626,6 +1633,7 @@ "EventName": "UNC_CHA_LLC_LOOKUP.RFO_F", "PerPkg": "1", "PublicDescription": "Cache Lookups : RFO Request Filter : Counts the number of times the LLC was accessed - this includes code, data, prefetches and hints coming from L2. This has numerous filters available. Note the non-standard filtering equation. This event will count requests that lookup the cache multiple times with multiple increments. One must ALWAYS select a state or states (in the umask field) to match. Otherwise, the event will count nothing. : Local or remote RFO transactions to the LLC. This includes RFO prefetch.", + "UMask": "0x800", "Unit": "CHA" }, {
@@ -1751,6 +1759,7 @@ "EventName": "UNC_CHA_LLC_VICTIMS.LOCAL_ONLY", "PerPkg": "1", "PublicDescription": "Lines Victimized : Local Only : Counts the number of lines that were victimized on a fill. This can be filtered by the state that the line was in.", + "UMask": "0x2000", "Unit": "CHA" }, {
@@ -1847,6 +1856,7 @@ "EventName": "UNC_CHA_PIPE_REJECT.ADEGRCREDIT", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x10000000", "Unit": "CHA" }, {
@@ -1855,6 +1865,7 @@ "EventName": "UNC_CHA_PIPE_REJECT.AKEGRCREDIT", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x20000000", "Unit": "CHA" }, {
@@ -1863,6 +1874,7 @@ "EventName": "UNC_CHA_PIPE_REJECT.ALLRSFWAYS_RES", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x80000", "Unit": "CHA" }, {
@@ -1871,6 +1883,7 @@ "EventName": "UNC_CHA_PIPE_REJECT.BLEGRCREDIT", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x8000000", "Unit": "CHA" }, {
@@ -1879,6 +1892,7 @@ "EventName": "UNC_CHA_PIPE_REJECT.FSF_VICP", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x200", "Unit": "CHA" }, {
@@ -1923,6 +1937,7 @@ "EventName": "UNC_CHA_PIPE_REJECT.HACREDIT", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x40000000", "Unit": "CHA" }, {
@@ -1931,6 +1946,7 @@ "EventName": "UNC_CHA_PIPE_REJECT.IDX_INPIPE", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x10000", "Unit": "CHA" }, {
@@ -1939,6 +1955,7 @@ "EventName": "UNC_CHA_PIPE_REJECT.IPQ_SETMATCH_VICP", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x2000", "Unit": "CHA" }, {
@@ -1947,6 +1964,7 @@ "EventName": "UNC_CHA_PIPE_REJECT.IRQ_SETMATCH_VICP", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x100", "Unit": "CHA" }, {
@@ -1955,6 +1973,7 @@ "EventName": "UNC_CHA_PIPE_REJECT.ISMQ_SETMATCH_VICP", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x200000", "Unit": "CHA" }, {
@@ -1963,6 +1982,7 @@ "EventName": "UNC_CHA_PIPE_REJECT.IVEGRCREDIT", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x4000000", "Unit": "CHA" }, {
@@ -1971,6 +1991,7 @@ "EventName": "UNC_CHA_PIPE_REJECT.LLC_WAYS_RES", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x800000", "Unit": "CHA" }, {
@@ -1979,6 +2000,7 @@ "EventName": "UNC_CHA_PIPE_REJECT.NOTALLOWSNOOP", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x1000000", "Unit": "CHA" }, {
@@ -1987,6 +2009,7 @@ "EventName": "UNC_CHA_PIPE_REJECT.ONE_FSF_VIC", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x400", "Unit": "CHA" }, {
@@ -1995,6 +2018,7 @@ "EventName": "UNC_CHA_PIPE_REJECT.ONE_RSP_CON", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x8000", "Unit": "CHA" }, {
@@ -2021,6 +2045,7 @@ "EventName": "UNC_CHA_PIPE_REJECT.RRQ_SETMATCH_VICP", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x100000", "Unit": "CHA" }, {
@@ -2029,6 +2054,7 @@ "EventName": "UNC_CHA_PIPE_REJECT.SETMATCHENTRYWSCT", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x20000", "Unit": "CHA" }, {
@@ -2037,6 +2063,7 @@ "EventName": "UNC_CHA_PIPE_REJECT.SF_WAYS_RES", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x400000", "Unit": "CHA" }, {
@@ -2045,6 +2072,7 @@ "EventName": "UNC_CHA_PIPE_REJECT.TOPA_MATCH", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x2000000", "Unit": "CHA" }, {
@@ -2053,6 +2081,7 @@ "EventName": "UNC_CHA_PIPE_REJECT.TORID_MATCH_GO_P", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x1000", "Unit": "CHA" }, {
@@ -2061,6 +2090,7 @@ "EventName": "UNC_CHA_PIPE_REJECT.VN_AD_REQ", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x80000000", "Unit": "CHA" }, {
@@ -2069,6 +2099,7 @@ "EventName": "UNC_CHA_PIPE_REJECT.VN_AD_RSP", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x100000000", "Unit": "CHA" }, {
@@ -2093,6 +2124,7 @@ "EventName": "UNC_CHA_PIPE_REJECT.VN_BL_RSP", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x200000000", "Unit": "CHA" }, {
@@ -2109,6 +2141,7 @@ "EventName": "UNC_CHA_PIPE_REJECT.WAY_MATCH", "PerPkg": "1", "PublicDescription": "Pipe Rejects : More Miscellaneous events in the Cbo.", + "UMask": "0x4000", "Unit": "CHA" }, {
@@ -2135,6 +2168,7 @@ "EventName": "UNC_CHA_READ_NO_CREDITS.MC10", "PerPkg": "1", "PublicDescription": "CHA iMC CHNx READ Credits Empty : MC10 : Counts the number of times when there are no credits available for sending reads from the CHA into the iMC. In order to send reads into the memory controller, the HA must first acquire a credit for the iMC's AD Ingress queue. : Filter for memory controller 10 only.", + "UMask": "0x400", "Unit": "CHA" }, {
@@ -2143,6 +2177,7 @@ "EventName": "UNC_CHA_READ_NO_CREDITS.MC11", "PerPkg": "1", "PublicDescription": "CHA iMC CHNx READ Credits Empty : MC11 : Counts the number of times when there are no credits available for sending reads from the CHA into the iMC. In order to send reads into the memory controller, the HA must first acquire a credit for the iMC's AD Ingress queue. : Filter for memory controller 11 only.", + "UMask": "0x800", "Unit": "CHA" }, {
@@ -2151,6 +2186,7 @@ "EventName": "UNC_CHA_READ_NO_CREDITS.MC12", "PerPkg": "1", "PublicDescription": "CHA iMC CHNx READ Credits Empty : MC12 : Counts the number of times when there are no credits available for sending reads from the CHA into the iMC. In order to send reads into the memory controller, the HA must first acquire a credit for the iMC's AD Ingress queue. : Filter for memory controller 12 only.", + "UMask": "0x1000", "Unit": "CHA" }, {
@@ -2159,6 +2195,7 @@ "EventName": "UNC_CHA_READ_NO_CREDITS.MC13", "PerPkg": "1", "PublicDescription": "CHA iMC CHNx READ Credits Empty : MC13 : Counts the number of times when there are no credits available for sending reads from the CHA into the iMC. In order to send reads into the memory controller, the HA must first acquire a credit for the iMC's AD Ingress queue. : Filter for memory controller 13 only.", + "UMask": "0x2000", "Unit": "CHA" }, {
@@ -2221,6 +2258,7 @@ "EventName": "UNC_CHA_READ_NO_CREDITS.MC8", "PerPkg": "1", "PublicDescription": "CHA iMC CHNx READ Credits Empty : MC8 : Counts the number of times when there are no credits available for sending reads from the CHA into the iMC. In order to send reads into the memory controller, the HA must first acquire a credit for the iMC's AD Ingress queue. : Filter for memory controller 8 only.", + "UMask": "0x100", "Unit": "CHA" }, {
@@ -2229,6 +2267,7 @@ "EventName": "UNC_CHA_READ_NO_CREDITS.MC9", "PerPkg": "1", "PublicDescription": "CHA iMC CHNx READ Credits Empty : MC9 : Counts the number of times when there are no credits available for sending reads from the CHA into the iMC. In order to send reads into the memory controller, the HA must first acquire a credit for the iMC's AD Ingress queue. : Filter for memory controller 9 only.", + "UMask": "0x200", "Unit": "CHA" }, {
@@ -4198,6 +4237,7 @@ "EventName": "UNC_CHA_TOR_INSERTS.DDR", "PerPkg": "1", "PublicDescription": "TOR Inserts : DDR4 Access : Counts the number of entries successfully inserted into the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x400", "Unit": "CHA" }, {
@@ -4206,6 +4246,7 @@ "EventCode": "0x35", "EventName": "UNC_CHA_TOR_INSERTS.DDR4", "PerPkg": "1", + "UMask": "0x400", "Unit": "CHA" }, {
@@ -4223,6 +4264,7 @@ "EventName": "UNC_CHA_TOR_INSERTS.HIT", "PerPkg": "1", "PublicDescription": "TOR Inserts : Just Hits : Counts the number of entries successfully inserted into the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x100", "Unit": "CHA" }, {
@@ -4753,6 +4795,7 @@ "EventName": "UNC_CHA_TOR_INSERTS.ISOC", "PerPkg": "1", "PublicDescription": "TOR Inserts : Just ISOC : Counts the number of entries successfully inserted into the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x200000000", "Unit": "CHA" }, {
@@ -4761,6 +4804,7 @@ "EventName": "UNC_CHA_TOR_INSERTS.LOCAL_TGT", "PerPkg": "1", "PublicDescription": "TOR Inserts : Just Local Targets : Counts the number of entries successfully inserted into the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x8000", "Unit": "CHA" }, {
@@ -4796,6 +4840,7 @@ "EventName": "UNC_CHA_TOR_INSERTS.MATCH_OPC", "PerPkg": "1", "PublicDescription": "TOR Inserts : Match the Opcode in b[29:19] of the extended umask field : Counts the number of entries successfully inserted into the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x20000", "Unit": "CHA" }, {
@@ -4804,6 +4849,7 @@ "EventName": "UNC_CHA_TOR_INSERTS.MISS", "PerPkg": "1", "PublicDescription": "TOR Inserts : Just Misses : Counts the number of entries successfully inserted into the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x200", "Unit": "CHA" }, {
@@ -4812,6 +4858,7 @@ "EventName": "UNC_CHA_TOR_INSERTS.MMCFG", "PerPkg": "1", "PublicDescription": "TOR Inserts : MMCFG Access : Counts the number of entries successfully inserted into the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x2000", "Unit": "CHA" }, {
@@ -4820,6 +4867,7 @@ "EventName": "UNC_CHA_TOR_INSERTS.NEARMEM", "PerPkg": "1", "PublicDescription": "TOR Inserts : Just NearMem : Counts the number of entries successfully inserted into the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x40000000", "Unit": "CHA" }, {
@@ -4828,6 +4876,7 @@ "EventName": "UNC_CHA_TOR_INSERTS.NONCOH", "PerPkg": "1", "PublicDescription": "TOR Inserts : Just NonCoherent : Counts the number of entries successfully inserted into the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x100000000", "Unit": "CHA" }, {
@@ -4836,6 +4885,7 @@ "EventName": "UNC_CHA_TOR_INSERTS.NOT_NEARMEM", "PerPkg": "1", "PublicDescription": "TOR Inserts : Just NotNearMem : Counts the number of entries successfully inserted into the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x80000000", "Unit": "CHA" }, {
@@ -4844,6 +4894,7 @@ "EventName": "UNC_CHA_TOR_INSERTS.PREMORPH_OPC", "PerPkg": "1", "PublicDescription": "TOR Inserts : Match the PreMorphed Opcode in b[29:19] of the extended umask field : Counts the number of entries successfully inserted into the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x40000", "Unit": "CHA" }, {
@@ -4870,6 +4921,7 @@ "EventName": "UNC_CHA_TOR_OCCUPANCY.DDR", "PerPkg": "1", "PublicDescription": "TOR Occupancy : DDR4 Access : For each cycle, this event accumulates the number of valid entries in the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x400", "Unit": "CHA" }, {
@@ -4887,6 +4939,7 @@ "EventName": "UNC_CHA_TOR_OCCUPANCY.HIT", "PerPkg": "1", "PublicDescription": "TOR Occupancy : Just Hits : For each cycle, this event accumulates the number of valid entries in the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x100", "Unit": "CHA" }, {
@@ -5381,6 +5434,7 @@ "EventName": "UNC_CHA_TOR_OCCUPANCY.ISOC", "PerPkg": "1", "PublicDescription": "TOR Occupancy : Just ISOC : For each cycle, this event accumulates the number of valid entries in the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x200000000", "Unit": "CHA" }, {
@@ -5389,6 +5443,7 @@ "EventName": "UNC_CHA_TOR_OCCUPANCY.LOCAL_TGT", "PerPkg": "1", "PublicDescription": "TOR Occupancy : Just Local Targets : For each cycle, this event accumulates the number of valid entries in the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x8000", "Unit": "CHA" }, {
@@ -5424,6 +5479,7 @@ "EventName": "UNC_CHA_TOR_OCCUPANCY.MATCH_OPC", "PerPkg": "1", "PublicDescription": "TOR Occupancy : Match the Opcode in b[29:19] of the extended umask field : For each cycle, this event accumulates the number of valid entries in the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x20000", "Unit": "CHA" }, {
@@ -5432,6 +5488,7 @@ "EventName": "UNC_CHA_TOR_OCCUPANCY.MISS", "PerPkg": "1", "PublicDescription": "TOR Occupancy : Just Misses : For each cycle, this event accumulates the number of valid entries in the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x200", "Unit": "CHA" }, {
@@ -5440,6 +5497,7 @@ "EventName": "UNC_CHA_TOR_OCCUPANCY.MMCFG", "PerPkg": "1", "PublicDescription": "TOR Occupancy : MMCFG Access : For each cycle, this event accumulates the number of valid entries in the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x2000", "Unit": "CHA" }, {
@@ -5448,6 +5506,7 @@ "EventName": "UNC_CHA_TOR_OCCUPANCY.NEARMEM", "PerPkg": "1", "PublicDescription": "TOR Occupancy : Just NearMem : For each cycle, this event accumulates the number of valid entries in the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x40000000", "Unit": "CHA" }, {
@@ -5456,6 +5515,7 @@ "EventName": "UNC_CHA_TOR_OCCUPANCY.NONCOH", "PerPkg": "1", "PublicDescription": "TOR Occupancy : Just NonCoherent : For each cycle, this event accumulates the number of valid entries in the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x100000000", "Unit": "CHA" }, {
@@ -5464,6 +5524,7 @@ "EventName": "UNC_CHA_TOR_OCCUPANCY.NOT_NEARMEM", "PerPkg": "1", "PublicDescription": "TOR Occupancy : Just NotNearMem : For each cycle, this event accumulates the number of valid entries in the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x80000000", "Unit": "CHA" }, {
@@ -5472,6 +5533,7 @@ "EventName": "UNC_CHA_TOR_OCCUPANCY.PREMORPH_OPC", "PerPkg": "1", "PublicDescription": "TOR Occupancy : Match the PreMorphed Opcode in b[29:19] of the extended umask field : For each cycle, this event accumulates the number of valid entries in the TOR that match qualifications specified by the subevent. Does not include addressless requests such as locks and interrupts.", + "UMask": "0x40000", "Unit": "CHA" }, {
@@ -6947,6 +7009,7 @@ "EventName": "UNC_CHA_WRITE_NO_CREDITS.MC10", "PerPkg": "1", "PublicDescription": "CHA iMC CHNx WRITE Credits Empty : MC10 : Counts the number of times when there are no credits available for sending WRITEs from the CHA into the iMC. In order to send WRITEs into the memory controller, the HA must first acquire a credit for the iMC's BL Ingress queue. : Filter for memory controller 10 only.", + "UMask": "0x400", "Unit": "CHA" }, {
@@ -6955,6 +7018,7 @@ "EventName": "UNC_CHA_WRITE_NO_CREDITS.MC11", "PerPkg": "1", "PublicDescription": "CHA iMC CHNx WRITE Credits Empty : MC11 : Counts the number of times when there are no credits available for sending WRITEs from the CHA into the iMC. In order to send WRITEs into the memory controller, the HA must first acquire a credit for the iMC's BL Ingress queue. : Filter for memory controller 11 only.", + "UMask": "0x800", "Unit": "CHA" }, {
@@ -6963,6 +7027,7 @@ "EventName": "UNC_CHA_WRITE_NO_CREDITS.MC12", "PerPkg": "1", "PublicDescription": "CHA iMC CHNx WRITE Credits Empty : MC12 : Counts the number of times when there are no credits available for sending WRITEs from the CHA into the iMC. In order to send WRITEs into the memory controller, the HA must first acquire a credit for the iMC's BL Ingress queue. : Filter for memory controller 12 only.", + "UMask": "0x1000", "Unit": "CHA" }, {
@@ -6971,6 +7036,7 @@ "EventName": "UNC_CHA_WRITE_NO_CREDITS.MC13", "PerPkg": "1", "PublicDescription": "CHA iMC CHNx WRITE Credits Empty : MC13 : Counts the number of times when there are no credits available for sending WRITEs from the CHA into the iMC. In order to send WRITEs into the memory controller, the HA must first acquire a credit for the iMC's BL Ingress queue. : Filter for memory controller 13 only.", + "UMask": "0x2000", "Unit": "CHA" }, {
@@ -7033,6 +7099,7 @@ "EventName": "UNC_CHA_WRITE_NO_CREDITS.MC8", "PerPkg": "1", "PublicDescription": "CHA iMC CHNx WRITE Credits Empty : MC8 : Counts the number of times when there are no credits available for sending WRITEs from the CHA into the iMC. In order to send WRITEs into the memory controller, the HA must first acquire a credit for the iMC's BL Ingress queue. : Filter for memory controller 8 only.", + "UMask": "0x100", "Unit": "CHA" }, {
@@ -7041,6 +7108,7 @@ "EventName": "UNC_CHA_WRITE_NO_CREDITS.MC9", "PerPkg": "1", "PublicDescription": "CHA iMC CHNx WRITE Credits Empty : MC9 : Counts the number of times when there are no credits available for sending WRITEs from the CHA into the iMC. In order to send WRITEs into the memory controller, the HA must first acquire a credit for the iMC's BL Ingress queue. : Filter for memory controller 9 only.", + "UMask": "0x200", "Unit": "CHA" }, {
tools/perf/pmu-events/arch/x86/snowridgex/uncore-interconnect.json +10 -0
@@ -1802,6 +1802,7 @@ "EventCode": "0x38", "EventName": "UNC_M2M_IMC_WRITES.CH0_FROM_TGR", "PerPkg": "1", + "UMask": "0x500", "Unit": "M2M" }, {
@@ -1825,6 +1826,7 @@ "EventCode": "0x38", "EventName": "UNC_M2M_IMC_WRITES.CH0_NI_MISS", "PerPkg": "1", + "UMask": "0x2000", "Unit": "M2M" }, {
@@ -1856,6 +1858,7 @@ "EventCode": "0x38", "EventName": "UNC_M2M_IMC_WRITES.CH1_FROM_TGR", "PerPkg": "1", + "UMask": "0x900", "Unit": "M2M" }, {
@@ -1879,6 +1882,7 @@ "EventCode": "0x38", "EventName": "UNC_M2M_IMC_WRITES.CH1_NI_MISS", "PerPkg": "1", + "UMask": "0xc00", "Unit": "M2M" }, {
@@ -1902,6 +1906,7 @@ "EventCode": "0x38", "EventName": "UNC_M2M_IMC_WRITES.FROM_TGR", "PerPkg": "1", + "UMask": "0x1d00", "Unit": "M2M" }, {
@@ -1925,6 +1930,7 @@ "EventCode": "0x38", "EventName": "UNC_M2M_IMC_WRITES.NI_MISS", "PerPkg": "1", + "UMask": "0x1c00", "Unit": "M2M" }, {
@@ -2303,6 +2309,7 @@ "EventCode": "0x70", "EventName": "UNC_M2M_PREFCAM_DROP_REASONS_CH0.RPQ_PROXY", "PerPkg": "1", + "UMask": "0x100", "Unit": "M2M" }, {
@@ -2326,6 +2333,7 @@ "EventCode": "0x70", "EventName": "UNC_M2M_PREFCAM_DROP_REASONS_CH0.XPT_THRESH", "PerPkg": "1", + "UMask": "0x200", "Unit": "M2M" }, {
@@ -2381,6 +2389,7 @@ "EventCode": "0x71", "EventName": "UNC_M2M_PREFCAM_DROP_REASONS_CH1.RPQ_PROXY", "PerPkg": "1", + "UMask": "0x100", "Unit": "M2M" }, {
@@ -2404,6 +2413,7 @@ "EventCode": "0x71", "EventName": "UNC_M2M_PREFCAM_DROP_REASONS_CH1.XPT_THRESH", "PerPkg": "1", + "UMask": "0x200", "Unit": "M2M" }, {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2436/3318 soc: ti: k3-ringacc: Correct ring API kernel-doc
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karl Mehltretter <[email protected]>
[ Upstream commit 45ea6911ad16859d4ce4f25780b0ebcf5660e43a ]
The ring accelerator header labels k3_ring_cfg as an enum, uses propname instead of property, and gives the DMA reset helper the ordinary reset helper's name. The DMA reset comment also omits occ, including the convention that zero requests a hardware occupancy read.
The proxy flag is parsed as a separate parameter, and the pop helpers describe pushing elements. Proxy access is supported in Message mode; the listed Credentials and Queue modes are not implemented. The phandle lookup returns encoded error pointers rather than integer error values.
Match the declarations and document these argument and operation roles.
--- include/linux/soc/ti/k3-ringacc.h | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-)
include/linux/soc/ti/k3-ringacc.h +12 -14
@@ -57,13 +57,13 @@ struct k3_ringacc;struct k3_ring ;/** -* enum k3_ring_cfg - RA ring configuration structure +* struct k3_ring_cfg - RA ring configuration structure * * @size: Ring size, number of elements * @elm_size: Ring element size * @mode: Ring operational mode * @flags: Ring configuration flags. Possible values: -* @K3_RINGACC_RING_SHARED: when set allows to request the same ring +* %K3_RINGACC_RING_SHARED: when set allows to request the same ring * few times. It's usable when the same ring is used as Free Host PD ring * for different flows, for example. * Note: Locking should be done by consumer if required
@@ -88,11 +88,10 @@ struct k3_ring_cfg {/** * of_k3_ringacc_get_by_phandle - find a RA by phandle property * @np: device node -* @propname: property name containing phandle on RA node +* @property: property name containing phandle on RA node * -* Returns pointer on the RA - struct k3_ringacc -* or -ENODEV if not found, -* or -EPROBE_DEFER if not yet registered +* Return: Pointer to the RA, or ERR_PTR(-ENODEV) if the phandle cannot +* be resolved, or ERR_PTR(-EPROBE_DEFER) if the RA is not yet registered. */ struct k3_ringacc *of_k3_ringacc_get_by_phandle (struct device_node *np,const char *property);
@@ -103,10 +102,8 @@ struct k3_ringacc *of_k3_ringacc_get_by_phandle(struct device_node *np,* k3_ringacc_request_ring - request ring from ringacc * @ringacc: pointer on ringacc * @id: ring id or K3_RINGACC_RING_ID_ANY for any general purpose ring -* @flags: -* @K3_RINGACC_RING_USE_PROXY: if set - proxy will be allocated and -* used to access ring memory. Sopported only for rings in -* Message/Credentials/Queue mode. +* @flags: Set %K3_RINGACC_RING_USE_PROXY to allocate a proxy for +* accessing ring memory in Message mode. * * Returns pointer on the Ring - struct k3_ring * or NULL in case of failure.
@@ -126,8 +123,9 @@ int k3_ringacc_request_rings_pair(struct k3_ringacc *ringacc,*/ void k3_ringacc_ring_reset (struct k3_ring *ring);/** -* k3_ringacc_ring_reset - ring reset for DMA rings +* k3_ringacc_ring_reset_dma - ring reset for DMA rings * @ring: pointer on Ring +* @occ: occupancy used by the DMA reset quirk, or zero to read it from hardware * * Resets ring internal state ((hw)occ, (hw)idx). Should be used for rings * which are read by K3 UDMA, like TX or Free Host PD rings.
@@ -217,8 +215,8 @@ int k3_ringacc_ring_push(struct k3_ring *ring, void *elem);* @ring: pointer on ring * @elem: pointer on ring element buffer * -* Push one ring element from the ring head. Size of the ring element is -* determined by ring configuration &struct k3_ring_cfg elm_size.. +* Pop one ring element from the ring head. Size of the ring element is +* determined by ring configuration &struct k3_ring_cfg elm_size. * * Returns 0 on success, errno otherwise. */
@@ -242,7 +240,7 @@ int k3_ringacc_ring_push_head(struct k3_ring *ring, void *elem);* @ring: pointer on ring * @elem: pointer on ring element buffer * -* Push one ring element from the ring tail. Size of the ring element is +* Pop one ring element from the ring tail. Size of the ring element is * determined by ring configuration &struct k3_ring_cfg elm_size. * * Returns 0 on success, errno otherwise.
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2437/3318 soc: ti: k3-ringacc: Fix DMA ring initialization kernel-doc
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karl Mehltretter <[email protected]>
[ Upstream commit 6c4e6e8f5cf95f7e0d4f04928a9ae70e20c73d4b ]
The heading for k3_ringacc_init_data repeats struct, so kernel-doc cannot match it to the declaration. Its three fields are also missing descriptions.
Use the structure name and describe the firmware handle, device ID, and total number of available rings used during DMA ring initialization.
--- include/linux/soc/ti/k3-ringacc.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
include/linux/soc/ti/k3-ringacc.h +4 -1
@@ -254,7 +254,10 @@ u32 k3_ringacc_get_tisci_dev_id(struct k3_ring *ring);struct ti_sci_handle ;/** -* struct struct k3_ringacc_init_data - Initialization data for DMA rings +* struct k3_ringacc_init_data - Initialization data for DMA rings +* @tisci: TI SCI firmware handle +* @tisci_dev_id: TI SCI device ID of the DMA controller +* @num_rings: Total number of available rings */ struct k3_ringacc_init_data {const struct ti_sci_handle *tisci;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2438/3318 fs/ntfs3: fix slab-out-of-bounds write in attr_insert_range()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiang Mei (Microsoft) <[email protected]>
[ Upstream commit bf9a6578e03b065335836e025356b4b9170b9449 ]
When fallocate(FALLOC_FL_INSERT_RANGE) grows a still-resident ntfs3 attribute, attr_insert_range() shifts the inline data using the insert length 'bytes' as both the destination offset and the copy size:
memmove(data + bytes, data, bytes);
Both are wrong: the shift must start at the insertion point 'vbo' and move only the data past it (data_size - vbo). When bytes > data_size the memmove runs off the end of the data_size + bytes buffer and overflows the adjacent slab object.
Since vbo < data_size is already enforced above, the reworked offsets stay within the data_size + bytes buffer and cannot under/overflow.
BUG: KASAN: slab-out-of-bounds in attr_insert_range (fs/ntfs3/attrib.c:2581) Write of size 512 at addr ffff8880135e8b10 by task exploit/142 ... __asan_memmove (mm/kasan/shadow.c:95) attr_insert_range (fs/ntfs3/attrib.c:2581) ntfs_fallocate (fs/ntfs3/file.c:618) vfs_fallocate (fs/open.c:338) __x64_sys_fallocate (fs/open.c:362) ...
--- fs/ntfs3/attrib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ntfs3/attrib.c +2 -2
@@ -2447,8 +2447,8 @@ int attr_insert_range(struct ntfs_inode *ni, u64 vbo, u64 bytes)char *data =Add2Ptr (attr_b,le16_to_cpu (attr_b->res.data_off)); -memmove (data + bytes, data, bytes); -memset (data,0 , bytes); +memmove (data + vbo + bytes, data + vbo, data_size - vbo); +memset (data + vbo,0 , bytes); goto done; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2439/3318 RDMA/mlx5: Restore mr->pi_mr after temporary stack-local assignment
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li RongQing <[email protected]>
[ Upstream commit 9728effe43d8fc4d58e12b697d0d6127355abdd5 ]
In handle_reg_mr_integrity, when mr->pi_mr is NULL (physical-address optimization path), the code points mr->pi_mr at a stack-local pa_pi_mr so set_pi_umr_wr can read it during this call. The pointer is never restored, so after the function returns mr->pi_mr dangles at a freed stack frame. A second IB_WR_REG_MR_INTEGRITY posted on the same MR without remapping reads the stale pointer and dereferences it.
Save the original pi_mr (captured at function entry) and restore it on the out path.
--- drivers/infiniband/hw/mlx5/wr.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/mlx5/wr.c +1 -0
@@ -925,6 +925,7 @@ static int handle_reg_mr_integrity(struct mlx5_ib_dev *dev, qp->next_fence =MLX5_FENCE_MODE_INITIATOR_SMALL ; out: + mr->pi_mr = pi_mr;return err; }
Signature · 1 line
2.53.0