6.18.65-rc1 review
Greg Kroah-Hartman
maintainerPATCH 616/2151 RDMA/cxgb4: Fix neigh reference leak in rx_pkt()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
[ Upstream commit 5fb3051aa4611ae18e304814fb1b74a30065fd85 ]
If ip_dev_find() fails on the loopback path the code jumps to free_dst without releasing the neighbour reference taken by dst_neigh_lookup_skb(), leaking one neigh reference.
Release the neighbour before jumping to free_dst.
--- drivers/infiniband/hw/cxgb4/cm.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/cxgb4/cm.c +1 -0
@@ -4156,6 +4156,7 @@ static int rx_pkt(struct c4iw_dev *dev, struct sk_buff *skb) pdev =ip_dev_find (&init_net, iph->daddr);if (!pdev) {pr_err ("%s - failed to find device!\n" , __func__); +neigh_release (neigh); goto free_dst; } e = cxgb4_l2t_get(dev->rdev.lldi.l2t, neigh,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 617/2151 RDMA/cxgb4: Fix skb reference leak in rx_pkt()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
[ Upstream commit 5eb6ecb612841927b5ede554a0e9d88240934282 ]
rx_pkt() takes an extra reference on the received skb so it can be handed to the firmware completion path via req->cookie. When the work request skb allocation in send_fw_pass_open_req() fails the function returns without releasing that extra reference, leaking one skb reference.
Free the packet skb before returning when the allocation fails, matching the cxgb4_ofld_send() failure path.
--- drivers/infiniband/hw/cxgb4/cm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/infiniband/hw/cxgb4/cm.c +3 -1
@@ -4006,8 +4006,10 @@ static void send_fw_pass_open_req(struct c4iw_dev *dev, struct sk_buff *skb,int ret; req_skb =alloc_skb (sizeof (struct fw_ofld_connection_wr ),GFP_KERNEL ); -if (!req_skb) +if (!req_skb) { +kfree_skb (skb);return ; + } req =__skb_put_zero (req_skb,sizeof (*req)); req->op_compl =htonl (WR_OP_V (FW_OFLD_CONNECTION_WR ) |FW_WR_COMPL_F ); req->len16_pkd =htonl (FW_WR_LEN16_V (DIV_ROUND_UP (sizeof (*req),16 )));
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 618/2151 RDMA/mlx5: Fix RQ resource reference leak in mlx5_ib_wq_event()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
[ Upstream commit 65f3eab431944415bbe5e3af1bbb2736d4bb1523 ]
Since commit 312b8f79eb05 ("RDMA/mlx: Calling qp event handler in workqueue context") rsc_event_notifier() expects the event handler to drop the resource reference taken by mlx5_get_rsc(). mlx5_ib_wq_event() was missed by that conversion, so every RQ event leaks one reference, which keeps destroy_resource_common() waiting on the completion.
Put the resource reference on all exits of the handler.
--- drivers/infiniband/hw/mlx5/qp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/qp.c +4 -1
@@ -5212,11 +5212,14 @@ static void mlx5_ib_wq_event(struct mlx5_core_qp *core_qp, int type)break ;default :mlx5_ib_warn (dev,"Unexpected event type %d on WQ %06x\n" , type, core_qp->qpn); -return ; + goto out; } rwq->ibwq.event_handler (&event, rwq->ibwq.wq_context); } + +out: +mlx5_core_res_put (&core_qp->common); }static int set_delay_drop (struct mlx5_ib_dev *dev)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 619/2151 RDMA/siw: Fix qp use-after-free in siw_get_base_qp()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
[ Upstream commit ef15197f81ffedf29560edf2221199d92fd83dc2 ]
The reference taken by siw_qp_id2obj() is dropped before the address of the embedded ib_qp is taken from the QP. If that reference was the last one the QP is freed and the pointer returned to the iwarp core is dangling; the core only pins the QP with iw_add_ref() after the call has returned.
Copy the pointer while the reference is still held.
--- drivers/infiniband/sw/siw/siw_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/infiniband/sw/siw/siw_main.c +4 -1
@@ -217,8 +217,11 @@ static struct ib_qp *siw_get_base_qp(struct ib_device *base_dev, int id)/* * siw_qp_id2obj() increments object reference count */ +struct ib_qp *base_qp = &qp->base_qp; +siw_qp_put (qp); -return &qp->base_qp; + +return base_qp; }return NULL ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 620/2151 hwrng: starfive - propagate clock and reset errors
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit ace145efdd80cd2eb95e84b1087d0f1fc55bdc0d ]
The StarFive TRNG probe and resume paths ignore failures from their clock and reset operations. That lets the driver register or resume while its hardware access prerequisites were not established.
Check each transition, unwind only the previously enabled clock on failure, and propagate the error to the probe or PM core.
--- drivers/char/hw_random/jh7110-trng.c | 39 +++++++++++++++++++++------- 1 file changed, 29 insertions(+), 10 deletions(-)
drivers/char/hw_random/jh7110-trng.c +29 -10
@@ -321,9 +321,17 @@ static int starfive_trng_probe(struct platform_device *pdev)return dev_err_probe (&pdev->dev,PTR_ERR (trng->rst),"Error getting hardware reset line\n" ); -clk_prepare_enable (trng->hclk); -clk_prepare_enable (trng->ahb); -reset_control_deassert (trng->rst); + ret =clk_prepare_enable (trng->hclk); +if (ret) +return ret; + + ret =clk_prepare_enable (trng->ahb); +if (ret) + goto disable_hclk; + + ret =reset_control_deassert (trng->rst); +if (ret) + goto disable_ahb; trng->rng.name =dev_driver_string (&pdev->dev); trng->rng.init = starfive_trng_init;
@@ -343,13 +351,18 @@ static int starfive_trng_probe(struct platform_device *pdev)pm_runtime_disable (&pdev->dev);reset_control_assert (trng->rst); -clk_disable_unprepare (trng->ahb); -clk_disable_unprepare (trng->hclk); - -return dev_err_probe (&pdev->dev, ret,"Failed to register hwrng\n" ); + ret =dev_err_probe (&pdev->dev, ret,"Failed to register hwrng\n" ); + goto disable_ahb; }return 0 ; + +disable_ahb: +clk_disable_unprepare (trng->ahb); +disable_hclk: +clk_disable_unprepare (trng->hclk); + +return ret; }static int __maybe_unused starfive_trng_suspend (struct device *dev)
@@ -365,11 +378,17 @@ static int __maybe_unused starfive_trng_suspend(struct device *dev)static int __maybe_unused starfive_trng_resume (struct device *dev) {struct starfive_trng *trng =dev_get_drvdata (dev); +int ret; -clk_prepare_enable (trng->hclk); -clk_prepare_enable (trng->ahb); + ret =clk_prepare_enable (trng->hclk); +if (ret) +return ret; -return 0 ; + ret =clk_prepare_enable (trng->ahb); +if (ret) +clk_disable_unprepare (trng->hclk); + +return ret; }static const struct dev_pm_ops starfive_trng_pm_ops = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 621/2151 crypto: starfive - handle clock enable failures
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiawen Liu <[email protected]>
[ Upstream commit 5358248961ae23f7253d010ddfde1cfd2556ce22 ]
Return error from failed clock enable.
starfive_cryp_probe ignores clk_prepare_enable return for hclk/ahb, then remove/error paths unconditionally clk_disable_unprepare both clocks.
Check consecutive clk_prepare_enable(cryp->hclk)/cryp->ahb returns in starfive_cryp_probe.
Stable-dep-of: c8acdd77a623 ("crypto: starfive - propagate clock and reset errors")
--- drivers/crypto/starfive/jh7110-cryp.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/crypto/starfive/jh7110-cryp.c +9 -2
@@ -126,8 +126,15 @@ static int starfive_cryp_probe(struct platform_device *pdev)return dev_err_probe (&pdev->dev,PTR_ERR (cryp->rst),"Error getting hardware reset line\n" ); -clk_prepare_enable (cryp->hclk); -clk_prepare_enable (cryp->ahb); + ret =clk_prepare_enable (cryp->hclk); +if (ret) +return ret; + + ret =clk_prepare_enable (cryp->ahb); +if (ret) { +clk_disable_unprepare (cryp->hclk); +return ret; + }reset_control_deassert (cryp->rst);spin_lock (&dev_list.lock);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 622/2151 crypto: starfive - propagate clock and reset errors
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit c8acdd77a62374507ed8e70d59e124269d999b75 ]
starfive_cryp_probe() publishes the crypto device after enabling its clocks and deasserting its reset without checking whether those operations succeeded.
Check each hardware activation step and unwind only the resources that were actually enabled before returning the error.
--- drivers/crypto/starfive/jh7110-cryp.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
drivers/crypto/starfive/jh7110-cryp.c +10 -7
@@ -131,11 +131,12 @@ static int starfive_cryp_probe(struct platform_device *pdev)return ret; ret =clk_prepare_enable (cryp->ahb); -if (ret) { -clk_disable_unprepare (cryp->hclk); -return ret; - } -reset_control_deassert (cryp->rst); +if (ret) + goto disable_hclk; + + ret =reset_control_deassert (cryp->rst); +if (ret) + goto disable_ahb;spin_lock (&dev_list.lock);list_add (&cryp->list, &dev_list.dev_list);
@@ -183,9 +184,11 @@ static int starfive_cryp_probe(struct platform_device *pdev)list_del (&cryp->list);spin_unlock (&dev_list.lock); -clk_disable_unprepare (cryp->hclk); -clk_disable_unprepare (cryp->ahb);reset_control_assert (cryp->rst); +disable_ahb: +clk_disable_unprepare (cryp->ahb); +disable_hclk: +clk_disable_unprepare (cryp->hclk);return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 623/2151 crypto: api - Fix DUP_FIRST crash on unregister
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herbert Xu <[email protected]>
[ Upstream commit 1dfb35de0800967c972eee35e19f3dfc8d50e512 ]
The flag CRYPTO_ALG_DUP_FIRST is buggy because upon unregistration it tries to unregister the original algorithm rather than the duplicate which was allocated during registration.
Fix this by locating the duplicated algorithm and unregistering that instead of the original.
Also remove the duplicate crypto_destroy_alg call.
--- crypto/algapi.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-)
crypto/algapi.c +22 -1
@@ -422,7 +422,6 @@ static void crypto_free_alg(struct crypto_alg *alg)unsigned int algsize = alg->cra_type->algsize;u8 *p = (u8 *)alg - algsize; -crypto_destroy_alg (alg);kfree (p); }
@@ -492,9 +491,31 @@ void crypto_unregister_alg(struct crypto_alg *alg)LIST_HEAD (list);down_write (&crypto_alg_sem); +if (alg->cra_flags &CRYPTO_ALG_DUP_FIRST ) { +struct crypto_alg *q, *r =NULL ; + +list_for_each_entry (q, &crypto_alg_list, cra_list) { +if (crypto_is_larval (q)) +continue ; +if (strcmp (q->cra_driver_name, alg->cra_driver_name)) +continue ; + r = q; +break ; + } + +if (!r) { +up_write (&crypto_alg_sem); + ret = -ENOENT ; + goto not_found; + } + + alg = r; + } + ret =crypto_remove_alg (alg, &list);up_write (&crypto_alg_sem); +not_found:if (WARN (ret,"Algorithm %s is not registered" , alg->cra_driver_name))return ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 624/2151 crypto: hisilicon/hpre - remove dma_free_coherent on NULL req->dst in ECDH
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weili Qian <[email protected]>
[ Upstream commit 5b87f619cc5c0a55dcd85ce97974e3f5b9333b7b ]
In hpre_ecdh_hw_data_clr_all(), req->dst is always NULL because hpre_ecdh_dst_data_init() sets hpre_req->dst = NULL before mapping the user buffer with dma_map_single(). The dma_free_coherent() call on req->dst is therefore dead code. Remove it.
--- drivers/crypto/hisilicon/hpre/hpre_crypto.c | 2 -- 1 file changed, 2 deletions(-)
drivers/crypto/hisilicon/hpre/hpre_crypto.c +0 -2
@@ -1419,8 +1419,6 @@ static void hpre_ecdh_hw_data_clr_all(struct hpre_ctx *ctx,if (unlikely (dma_mapping_error (dev, dma)))return ; -if (req->dst) -dma_free_coherent (dev, ctx->key_sz <<1 , req->dst, dma);if (dst)dma_unmap_single (dev, dma, ctx->key_sz <<1 ,DMA_FROM_DEVICE ); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 625/2151 crypto: ccp - fix SFS ioctl race against device teardown
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Muhammad Bilal <[email protected]>
[ Upstream commit de4929b47683ed22d8c05f68d2d0f0cfd95b90a1 ]
sfs_ioctl() reads psp_master->sfs_data and caches it in sfs_dev before taking sfs_ioctl_mutex, while sfs_dev_destroy() frees sfs_dev->page and sfs_dev->command_buf with no locking at all and only clears psp->sfs_data afterwards. A call to sfs_ioctl() that reads sfs_data just before sfs_dev_destroy() runs will still acquire the mutex and go on to use the now-freed command buffer in send_sfs_cmd().
Have both functions take sfs_ioctl_mutex before touching psp->sfs_data, so a call that is already using sfs_dev completes before teardown can free it, and a call arriving after teardown sees sfs_data cleared and returns -ENODEV instead of racing it.
--- drivers/crypto/ccp/sfs.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/crypto/ccp/sfs.c +6 -3
@@ -111,13 +111,13 @@ static long sfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)struct sfs_device *sfs_dev;int ret =0 ; +guard (mutex)(&sfs_ioctl_mutex); +if (!psp_master || !psp_master->sfs_data)return -ENODEV ; sfs_dev = psp_master->sfs_data; -guard (mutex)(&sfs_ioctl_mutex); -switch (cmd) {case SFSIOCFWVERS :dev_dbg (sfs_dev->dev,"in SFSIOCFWVERS\n" );
@@ -191,8 +191,11 @@ static void sfs_exit(struct kref *ref)void sfs_dev_destroy (struct psp_device *psp) { -struct sfs_device *sfs_dev = psp->sfs_data; +struct sfs_device *sfs_dev; + +guard (mutex)(&sfs_ioctl_mutex); + sfs_dev = psp->sfs_data;if (!sfs_dev)return ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 626/2151 crypto: ccp - kill v3 IRQ tasklet during teardown
In reply to Greg Kroah-Hartman6.18-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 627/2151 crypto: ccp - kill v5 IRQ tasklet during teardown
In reply to Greg Kroah-Hartman6.18-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 628/2151 RDMA/mlx5: Guard steering anchor resource destruction on create error
In reply to Greg Kroah-Hartman6.18-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
@@ -3041,8 +3041,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 629/2151 swim: Assert strobe with stable outputs
In reply to Greg Kroah-Hartman6.18-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 630/2151 swim: Select appropriate drive once only
In reply to Greg Kroah-Hartman6.18-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 631/2151 swim: Enable the drive when probing
In reply to Greg Kroah-Hartman6.18-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); }
@@ -804,6 +815,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 632/2151 swim: Dont disable drive after every sector
In reply to Greg Kroah-Hartman6.18-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 633/2151 swim: Perform ISM/IWM mode switching according to specs
In reply to Greg Kroah-Hartman6.18-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 634/2151 swim: Configure parameter memory
In reply to Greg Kroah-Hartman6.18-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,6 +796,17 @@ 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) {struct queue_limits lim = {
@@ -805,6 +816,8 @@ static int swim_floppy_init(struct swim_priv *swd)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 635/2151 swim: Refactor SWIM setup
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit 62977e8ea98e99dbf86609e65930e6607398e1c5 ]
The write to the setup register is really chip initialization, so do it in swim_floppy_init() rather than floppy_open(). Drop the udelay(), which was apparently copied and pasted from swim3.c where it presumably relates to interrupts, of which this chip has none. (See also mkLinux SWIM 3 driver.)
Stable-dep-of: 3c02a14c8996 ("swim: Enable clock divider only where appropriate")
--- drivers/block/swim.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/block/swim.c +3 -2
@@ -628,8 +628,7 @@ static int floppy_open(struct gendisk *disk, blk_mode_t mode) fs->ref_count =-1 ; else fs->ref_count++; -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 );
@@ -816,6 +815,8 @@ static int swim_floppy_init(struct swim_priv *swd)int drive;struct swim __iomem *base = swd->base; +swim_write (base, setup,S_IBM_DRIVE |S_FCLK_DIV2 ); +swim_set_parameters (base);/* scan floppy drives */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 636/2151 swim: Enable clock divider only where appropriate
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit 3c02a14c89962c88ed0abb3cce4101021c63149c ]
Some models have a 16 MHz FCLK oscillator and others 32 MHz. Put this information into the swim device platform_data so that the driver can correctly enable the clock divider. When this is enabled incorrectly, nothing can be read and failures from the Error Correction Machine are flagged in the error register.
--- arch/m68k/mac/config.c | 31 ++++++++++++++++++++++++++++++- drivers/block/swim.c | 9 ++++++--- 2 files changed, 36 insertions(+), 4 deletions(-)
arch/m68k/mac/config.c +30 -1
@@ -984,8 +984,37 @@ static int __init mac_platform_init(void) .start = swim_base, .end = swim_base + 0x1FFF, }; +bool fast_fclk = false; + +/* Models in this list are supposed to run FCLK at 32 MHz */ +switch (macintosh_config->ident) { +case MAC_MODEL_CCL : +case MAC_MODEL_CCLII : +case MAC_MODEL_LCIII : +case MAC_MODEL_Q605 : +case MAC_MODEL_Q605_ACC : +case MAC_MODEL_Q610 : +case MAC_MODEL_Q630 : +case MAC_MODEL_Q650 : +case MAC_MODEL_Q800 : +case MAC_MODEL_P460 : +case MAC_MODEL_P475 : +case MAC_MODEL_P475F : +case MAC_MODEL_P520 : +case MAC_MODEL_P550 : +case MAC_MODEL_P575 : +case MAC_MODEL_P588 : +case MAC_MODEL_TV : +case MAC_MODEL_C610 : +case MAC_MODEL_C650 : +case MAC_MODEL_PB190 : +case MAC_MODEL_PB520 : + fast_fclk = true; +break ; + } -platform_device_register_simple ("swim" ,-1 , &swim_rsrc,1 ); +platform_device_register_resndata (NULL ,"swim" ,-1 , &swim_rsrc,1 , + &fast_fclk,sizeof (fast_fclk)); }/*
drivers/block/swim.c +6 -3
@@ -806,8 +806,11 @@ static void swim_set_parameters(struct swim __iomem *base)swim_write (base, parameter, mem[i]); } -static int swim_floppy_init (struct swim_priv *swd) +static int swim_floppy_init (struct platform_device *pdev) { +struct swim_priv *swd =platform_get_drvdata (pdev); +bool *data = pdev->dev.platform_data; +bool fast_fclk = data && *data;struct queue_limits lim = { .features =BLK_FEAT_ROTATIONAL , };
@@ -815,7 +818,7 @@ static int swim_floppy_init(struct swim_priv *swd)int drive;struct swim __iomem *base = swd->base; -swim_write (base, setup,S_IBM_DRIVE |S_FCLK_DIV2 ); +swim_write (base, setup,S_IBM_DRIVE | (fast_fclk ?S_FCLK_DIV2 :0 ));swim_set_parameters (base);
@@ -931,7 +934,7 @@ static int swim_probe(struct platform_device *dev) swd->base = swim_base; - ret =swim_floppy_init (swd); + ret =swim_floppy_init (dev);if (ret) goto out_kfree;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 637/2151 swim: Dont start motor until medium is present
In reply to Greg Kroah-Hartman6.18-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
@@ -630,8 +630,7 @@ static int floppy_open(struct gendisk *disk, blk_mode_t mode) fs->ref_count++;swim_drive (base, fs->location); -swim_motor (base,ON ); -swim_action (base,SETMFM ); +if (fs->ejected)setup_medium (fs);if (!fs->disk_in) {
@@ -639,6 +638,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 638/2151 swim: Recalibrate when drive is probed
In reply to Greg Kroah-Hartman6.18-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 ; }
@@ -759,24 +753,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 = {
@@ -826,14 +829,8 @@ static int swim_floppy_init(struct platform_device *pdev)/* 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 639/2151 swim: Add track zero recalibration delay
In reply to Greg Kroah-Hartman6.18-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 640/2151 swim: Handle FIFO timeout error
In reply to Greg Kroah-Hartman6.18-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 641/2151 swim: Check for CRC errors
In reply to Greg Kroah-Hartman6.18-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 642/2151 swim: Simplify return value initialization
In reply to Greg Kroah-Hartman6.18-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 643/2151 swim: Check error register during sector read
In reply to Greg Kroah-Hartman6.18-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 644/2151 swim: Dont use the mark register to read data
In reply to Greg Kroah-Hartman6.18-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 645/2151 swim: Fix buffer overflow
In reply to Greg Kroah-Hartman6.18-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 646/2151 swim: Convert to blocking queue
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit 92353a04763726f70fea6be90957c50fc18215e0 ]
These drives are slow: completing a request can take hundreds of milliseconds. Delays are managed by disabling interrupts judiciously and sleeping opportunistically.
As of commit e3896d77b702 ("swim: convert to blk-mq"), a spinlock is taken in irq mode as soon as a request is issued. That lock is held for the duration of the request. Hence the driver sleeps while holding the lock which is forbidden.
Adopt BLK_MQ_F_BLOCKING and remove the spinlock. Use a mutex to serialize requests from the two request queues. (The chip cannot simultaneously process requests on both internal and external drive.)
--- drivers/block/swim.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/block/swim.c +3 -8
@@ -211,7 +211,6 @@ enum head {struct swim_priv {struct swim __iomem *base; -spinlock_t lock;int floppy_count;struct floppy_state unit[FD_MAX_UNIT ]; };
@@ -537,12 +536,10 @@ static blk_status_t swim_queue_rq(struct blk_mq_hw_ctx *hctx, const struct blk_mq_queue_data *bd) {struct floppy_state *fs = hctx->queue->queuedata; -struct swim_priv *swd = fs->swd;struct request *req = bd->rq;blk_status_t err; -if (!spin_trylock_irq (&swd->lock)) -return BLK_STS_DEV_RESOURCE ; +mutex_lock (&swim_mutex);blk_mq_start_request (req);
@@ -560,7 +557,7 @@ static blk_status_t swim_queue_rq(struct blk_mq_hw_ctx *hctx, err =BLK_STS_OK ; out: -spin_unlock_irq (&swd->lock); +mutex_unlock (&swim_mutex);return err; }
@@ -842,11 +839,9 @@ static int swim_floppy_init(struct platform_device *pdev)return -EBUSY ; } -spin_lock_init (&swd->lock); -for (drive =0 ; drive < swd->floppy_count; drive++) { err =blk_mq_alloc_sq_tag_set (&swd->unit[drive].tag_set, - &swim_mq_ops,2 ,0 ); + &swim_mq_ops,2 ,BLK_MQ_F_BLOCKING );if (err) goto exit_put_disks;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 647/2151 swim: Remove redundant RELAX actions
In reply to Greg Kroah-Hartman6.18-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
@@ -336,7 +336,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 );
@@ -344,7 +343,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 ); } }
@@ -355,13 +354,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)
@@ -385,7 +382,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 ; }
@@ -399,8 +395,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 648/2151 swim: Deduplicate polling loops
In reply to Greg Kroah-Hartman6.18-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>
@@ -296,7 +297,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;
@@ -309,6 +310,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) {
@@ -331,16 +335,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 );
@@ -349,16 +345,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)
@@ -373,19 +361,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 649/2151 swim: Check drive ready bit
In reply to Greg Kroah-Hartman6.18-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 */
@@ -313,6 +313,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) {
@@ -351,8 +359,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 )
@@ -387,20 +393,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 ; }
@@ -482,6 +493,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;
@@ -602,6 +615,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 650/2151 swim: Revisit delays
In reply to Greg Kroah-Hartman6.18-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
@@ -290,7 +290,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 );
@@ -337,6 +337,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,
@@ -355,6 +356,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)
@@ -368,6 +370,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 ); }
@@ -398,6 +401,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 651/2151 swim: Dont search beyond the first data mark
In reply to Greg Kroah-Hartman6.18-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 652/2151 media: i2c: ov5648: Fix a data race on state->streaming
In reply to Greg Kroah-Hartman6.18-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 653/2151 media: staging/ipu7: release ISYS firmware resources on remove
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guangshuo Li <[email protected]>
[ Upstream commit 628a575c99e767d6fac81215fca1190b61867148 ]
isys_remove() tears down the registered ISYS devices but does not call ipu7_fw_isys_release() after a successful probe. The probe error path already uses this helper after ipu7_fw_isys_init() succeeds.
Without the matching release, resources initialized by ipu7_fw_isys_init() remain allocated on normal device removal.
Call ipu7_fw_isys_release() after unregistering the ISYS devices to match the cleanup performed by the probe error path.
--- drivers/staging/media/ipu7/ipu7-isys.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/media/ipu7/ipu7-isys.c +1 -0
@@ -590,6 +590,7 @@ static void isys_remove(struct auxiliary_device *auxdev)isys_notifier_cleanup (isys);isys_unregister_devices (isys); +ipu7_fw_isys_release (isys);cpu_latency_qos_remove_request (&isys->pm_qos);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 654/2151 serial: msm: select PM_OPP
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Sinyavin <[email protected]>
[ Upstream commit 6a8352bb4e4bfcf67fa23c49d2e0d14684ffe2e6 ]
Commit 173ebdedcd84 ("serial: msm: Use OPP table for DVFS support") made the MSM serial driver unconditionally configure the core clock through the OPP framework during probe.
When CONFIG_PM_OPP is disabled, devm_pm_opp_set_clkname() is a stub that returns -EOPNOTSUPP, so every MSM serial port fails to probe. Select PM_OPP to keep minimal configurations functional.
--- drivers/tty/serial/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/tty/serial/Kconfig +1 -0
@@ -905,6 +905,7 @@ config SERIAL_JSM config SERIAL_MSM tristate "MSM on-chip serial port support" depends on ARCH_QCOM || COMPILE_TEST + select PM_OPP select SERIAL_CORE config SERIAL_MSM_CONSOLE
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 655/2151 serial: txx9: Drop noop probe function and dangerous remove callback
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König (The Capable Hub) <[email protected]>
[ Upstream commit 22c6a6ac74c2434735638e7ef1101597ae263aec ]
The only platform device that can be bound to the driver is allocated by the driver itself. That device doesn't have platdata, so the probe function only consists of a loop that is never run and thus can be dropped without loss of functionality.
The remove function then should better not undo things that were not done in the first place. That happens because serial_txx9_init() calls serial_txx9_register_ports() with the created platform device and so up->dev == &dev->dev evaluates to true and uart_remove_one_port() is called twice for each port.
So let serial_txx9_exit() undo exactly what serial_txx9_init() does and remove the useless respectively wrong functions.
--- drivers/tty/serial/serial_txx9.c | 55 ++------------------------------ 1 file changed, 3 insertions(+), 52 deletions(-)
drivers/tty/serial/serial_txx9.c +3 -52
@@ -1009,7 +1009,8 @@ static void serial_txx9_unregister_port(int line)struct uart_port *uart = &serial_txx9_ports[line];mutex_lock (&serial_txx9_mutex); -uart_remove_one_port (&serial_txx9_reg, uart); +if (uart->iobase || uart->mapbase) +uart_remove_one_port (&serial_txx9_reg, uart); uart->flags =0 ; uart->type =PORT_UNKNOWN ; uart->iobase =0 ;
@@ -1019,52 +1020,6 @@ static void serial_txx9_unregister_port(int line)mutex_unlock (&serial_txx9_mutex); } -/* -* Register a set of serial devices attached to a platform device. -*/ -static int serial_txx9_probe (struct platform_device *dev) -{ -struct uart_port *p =dev_get_platdata (&dev->dev); -struct uart_port port; -int ret, i; - -memset (&port,0 ,sizeof (struct uart_port )); -for (i =0 ; p && p->uartclk !=0 ; p++, i++) { - port.iobase = p->iobase; - port.membase = p->membase; - port.irq = p->irq; - port.uartclk = p->uartclk; - port.iotype = p->iotype; - port.flags = p->flags; - port.mapbase = p->mapbase; - port.dev = &dev->dev; - port.has_sysrq =IS_ENABLED (CONFIG_SERIAL_TXX9_CONSOLE ); - ret =serial_txx9_register_port (&port); -if (ret <0 ) { -dev_err (&dev->dev,"unable to register port at index %d " -"(IO%lx MEM%llx IRQ%d): %d\n" , i, - p->iobase, (unsigned long long )p->mapbase, - p->irq, ret); - } - } -return 0 ; -} - -/* -* Remove serial ports registered against a platform device. -*/ -static void serial_txx9_remove (struct platform_device *dev) -{ -int i; - -for (i =0 ; i <UART_NR ; i++) { -struct uart_port *up = &serial_txx9_ports[i]; - -if (up->dev == &dev->dev) -serial_txx9_unregister_port (i); - } -} -#ifdef CONFIG_PM static int serial_txx9_suspend (struct platform_device *dev,pm_message_t state) {
@@ -1096,8 +1051,6 @@ static int serial_txx9_resume(struct platform_device *dev)#endif static struct platform_driver serial_txx9_plat_driver = { - .probe = serial_txx9_probe, - .remove = serial_txx9_remove, #ifdef CONFIG_PM .suspend = serial_txx9_suspend, .resume = serial_txx9_resume,
@@ -1251,9 +1204,7 @@ static void __exit serial_txx9_exit(void)platform_driver_unregister (&serial_txx9_plat_driver);platform_device_unregister (serial_txx9_plat_devs);for (i =0 ; i <UART_NR ; i++) { -struct uart_port *up = &serial_txx9_ports[i]; -if (up->iobase || up->mapbase) -uart_remove_one_port (&serial_txx9_reg, up); +serial_txx9_unregister_port (i); }uart_unregister_driver (&serial_txx9_reg);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 656/2151 serial: 8250_hub6: add hub6_match_port()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hugo Villeneuve <[email protected]>
[ Upstream commit 3d406299d8829747fe2e8692f4c29fe3dc1d101f ]
Move the entire hub6 related match port check into its own function in 8250_hub6.c and add a stub for the case when hub6 code is not even built into kernel.
Stable-dep-of: a300273c458c ("serial: 8250: hub6: Add cleanup code")
--- drivers/tty/serial/8250/8250.h | 7 +++++++ drivers/tty/serial/8250/8250_hub6.c | 6 ++++++ drivers/tty/serial/serial_core.c | 4 ++-- 3 files changed, 15 insertions(+), 2 deletions(-)
drivers/tty/serial/8250/8250.h +7 -0
@@ -343,6 +343,13 @@ int fintek_8250_probe(struct uart_8250_port *uart);static inline int fintek_8250_probe (struct uart_8250_port *uart) {return 0 ; }#endif +#ifdef CONFIG_SERIAL_8250_HUB6 +bool hub6_match_port (const struct uart_port *port1,const struct uart_port *port2); +#else +static inline bool hub6_match_port (const struct uart_port *port1,const struct uart_port *port2) +{return false; } +#endif +#ifdef CONFIG_ARCH_OMAP1 #include <linux/soc/ti/omap1-soc.h> static inline int is_omap1_8250 (struct uart_8250_port *pt)
drivers/tty/serial/8250/8250_hub6.c +6 -0
@@ -41,6 +41,12 @@ static struct platform_device hub6_device = { }, }; +bool hub6_match_port (const struct uart_port *port1,const struct uart_port *port2) +{ +return port1->iobase == port2->iobase && port1->hub6 == port2->hub6; +} +EXPORT_SYMBOL_GPL (hub6_match_port); +static int __init hub6_init (void ) {return platform_device_register (&hub6_device);
drivers/tty/serial/serial_core.c +2 -2
@@ -33,6 +33,7 @@#include <linux/uaccess.h> #include "serial_base.h" +#include "8250/8250.h" /* For hub6_match_port() */ /* * This is used to lock changes in serial line configuration.
@@ -3261,8 +3262,7 @@ bool uart_match_port(const struct uart_port *port1,case UPIO_PORT :return port1->iobase == port2->iobase;case UPIO_HUB6 : -return port1->iobase == port2->iobase && - port1->hub6 == port2->hub6; +return hub6_match_port (port1, port2);case UPIO_MEM :case UPIO_MEM16 :case UPIO_MEM32 :
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 657/2151 serial: 8250: fix compile error with hub6_match_port() when compiled as a module
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hugo Villeneuve <[email protected]>
[ Upstream commit 7ab80d1e72431f5b7acbc55d83a23b76814957cf ]
With CONFIG_SERIAL_8250_HUB6=m, we have the following compile error:
../drivers/tty/serial/8250/8250_hub6.c:46:6: error: redefinition of
'hub6_match_port'
Fix hub6_match_port() prototype definition by using IS_REACHABLE() to support both built-in and module values, and substitute empty prototype otherwise.
Stable-dep-of: a300273c458c ("serial: 8250: hub6: Add cleanup code")
--- drivers/tty/serial/8250/8250.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/tty/serial/8250/8250.h +2 -1
@@ -8,6 +8,7 @@*/ #include <linux/bits.h> +#include <linux/kconfig.h> #include <linux/serial_8250.h> #include <linux/serial_core.h> #include <linux/dmaengine.h>
@@ -343,7 +344,7 @@ int fintek_8250_probe(struct uart_8250_port *uart);static inline int fintek_8250_probe (struct uart_8250_port *uart) {return 0 ; }#endif -#ifdef CONFIG_SERIAL_8250_HUB6 +#if IS_REACHABLE (CONFIG_SERIAL_8250_HUB6 )bool hub6_match_port (const struct uart_port *port1,const struct uart_port *port2);#else static inline bool hub6_match_port (const struct uart_port *port1,const struct uart_port *port2)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 658/2151 serial: 8250: Fix corner case for port matching
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König (The Capable Hub) <[email protected]>
[ Upstream commit c526404a4a92dd83b2332446d544eac7cfd3d376 ]
In the case CONFIG_SERIAL_8250=y + CONFIG_SERIAL_8250_HUB6=m hub6_match_port() evaluates statically to false in serial8250_match_port() which is a bug and a change in behavior compared to before commit 7ab80d1e7243 ("serial: 8250: fix compile error with hub6_match_port() when compiled as a module").
To make the comparison correct, the dummy implementation of hub6_match_port() must only be used if CONFIG_SERIAL_8250_HUB6 is disabled. Then as there is a bidirectional dependency between 8250_hub6.c and 8250_core.c, put both in the same module.
Stable-dep-of: a300273c458c ("serial: 8250: hub6: Add cleanup code")
--- drivers/tty/serial/8250/8250.h | 8 +++++++- drivers/tty/serial/8250/8250_hub6.c | 8 +------- drivers/tty/serial/8250/8250_platform.c | 4 ++++ drivers/tty/serial/8250/Kconfig | 4 ++-- drivers/tty/serial/8250/Makefile | 2 +- 5 files changed, 15 insertions(+), 11 deletions(-)
drivers/tty/serial/8250/8250.h +7 -1
@@ -324,6 +324,12 @@ static inline int serial8250_pnp_init(void) { return 0; }static inline void serial8250_pnp_exit (void ) { }#endif +#ifdef CONFIG_SERIAL_8250_HUB6 +int serial8250_hub6_init (void ); +#else +static inline int serial8250_hub6_init (void ) {return 0 ; } +#endif +#ifdef CONFIG_SERIAL_8250_RSA void univ8250_rsa_support (struct uart_ops *ops,const struct uart_ops *core_ops);void rsa_enable (struct uart_8250_port *up);
@@ -344,7 +350,7 @@ int fintek_8250_probe(struct uart_8250_port *uart);static inline int fintek_8250_probe (struct uart_8250_port *uart) {return 0 ; }#endif -#if IS_REACHABLE (CONFIG_SERIAL_8250_HUB6 ) +#if IS_ENABLED (CONFIG_SERIAL_8250_HUB6 )bool hub6_match_port (const struct uart_port *port1,const struct uart_port *port2);#else static inline bool hub6_match_port (const struct uart_port *port1,const struct uart_port *port2)
drivers/tty/serial/8250/8250_hub6.c +1 -7
@@ -47,13 +47,7 @@ bool hub6_match_port(const struct uart_port *port1, const struct uart_port *port }EXPORT_SYMBOL_GPL (hub6_match_port); -static int __init hub6_init (void ) +int __init serial8250_hub6_init (void ) {return platform_device_register (&hub6_device); } - -module_init (hub6_init); - -MODULE_AUTHOR ("Russell King" ); -MODULE_DESCRIPTION ("8250 serial probe module for Hub6 cards" ); -MODULE_LICENSE ("GPL" );
drivers/tty/serial/8250/8250_platform.c +4 -0
@@ -322,6 +322,10 @@ static int __init serial8250_init(void)if (ret) goto unreg_uart_drv; + ret =serial8250_hub6_init (); +if (ret) + goto unreg_pnp; + serial8250_isa_devs =platform_device_alloc ("serial8250" ,PLAT8250_DEV_LEGACY );if (!serial8250_isa_devs) { ret = -ENOMEM ;
drivers/tty/serial/8250/Kconfig +2 -2
@@ -292,8 +292,8 @@ config SERIAL_8250_EXAR_ST16C554 will be called 8250_exar_st16c554. config SERIAL_8250_HUB6 - tristate "Support Hub6 cards" - depends on SERIAL_8250 != n && ISA && SERIAL_8250_MANY_PORTS + bool "Support Hub6 cards" + depends on SERIAL_8250_MANY_PORTS && ISA help Say Y here if you have a HUB6 serial board.
drivers/tty/serial/8250/Makefile +1 -1
@@ -7,6 +7,7 @@ obj-$(CONFIG_SERIAL_8250) += 8250.o 8250-y := 8250_core.o 8250-y += 8250_platform.o 8250-$(CONFIG_SERIAL_8250_PNP) += 8250_pnp.o +8250-$(CONFIG_SERIAL_8250_HUB6) += 8250_hub6.o obj-$(CONFIG_SERIAL_8250) += 8250_base.o 8250_base-y := 8250_port.o
@@ -35,7 +36,6 @@ obj-$(CONFIG_SERIAL_8250_EXAR_ST16C554) += 8250_exar_st16c554.o obj-$(CONFIG_SERIAL_8250_FOURPORT) += 8250_fourport.o obj-$(CONFIG_SERIAL_8250_FSL) += 8250_fsl.o obj-$(CONFIG_SERIAL_8250_HP300) += 8250_hp300.o -obj-$(CONFIG_SERIAL_8250_HUB6) += 8250_hub6.o obj-$(CONFIG_SERIAL_8250_INGENIC) += 8250_ingenic.o obj-$(CONFIG_SERIAL_8250_IOC3) += 8250_ioc3.o obj-$(CONFIG_SERIAL_8250_LPC18XX) += 8250_lpc18xx.o
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 659/2151 serial: 8250: hub6: Add cleanup code
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König (The Capable Hub) <[email protected]>
[ Upstream commit a300273c458ca32666f5bc6c1b3eb3a7cca206ce ]
At module load time a platform device is registered. That should be undone when the module is unloaded.
--- drivers/tty/serial/8250/8250.h | 2 ++ drivers/tty/serial/8250/8250_hub6.c | 5 +++++ drivers/tty/serial/8250/8250_platform.c | 5 ++++- 3 files changed, 11 insertions(+), 1 deletion(-)
drivers/tty/serial/8250/8250.h +2 -0
@@ -326,8 +326,10 @@ static inline void serial8250_pnp_exit(void) { }#ifdef CONFIG_SERIAL_8250_HUB6 int serial8250_hub6_init (void ); +void serial8250_hub6_exit (void );#else static inline int serial8250_hub6_init (void ) {return 0 ; } +static inline void serial8250_hub6_exit (void ) { }#endif #ifdef CONFIG_SERIAL_8250_RSA
drivers/tty/serial/8250/8250_hub6.c +5 -0
@@ -51,3 +51,8 @@ int __init serial8250_hub6_init(void) {return platform_device_register (&hub6_device); } + +void __init_or_module serial8250_hub6_exit(void) +{ +platform_device_unregister (&hub6_device); +}
drivers/tty/serial/8250/8250_platform.c +4 -1
@@ -329,7 +329,7 @@ static int __init serial8250_init(void) serial8250_isa_devs =platform_device_alloc ("serial8250" ,PLAT8250_DEV_LEGACY );if (!serial8250_isa_devs) { ret = -ENOMEM ; - goto unreg_pnp; + goto unreg_hub6; } ret =platform_device_add (serial8250_isa_devs);
@@ -345,6 +345,8 @@ static int __init serial8250_init(void)platform_device_del (serial8250_isa_devs); put_dev:platform_device_put (serial8250_isa_devs); +unreg_hub6: +serial8250_hub6_exit (); unreg_pnp:serial8250_pnp_exit (); unreg_uart_drv:
@@ -372,6 +374,7 @@ static void __exit serial8250_exit(void)platform_driver_unregister (&serial8250_isa_driver);platform_device_unregister (isa_dev); +serial8250_hub6_exit ();serial8250_pnp_exit ();#ifdef CONFIG_SPARC
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 660/2151 RDMA/mlx5: Use DEFINE_RAW_FLEX for leftovers flow attributes
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li RongQing <[email protected]>
[ Upstream commit e43913aabd35eef837edef29e93f15e15bdeeacd ]
Commit e91fb8b9d0ed ("RDMA/mlx5: Avoid flexible array warning") split the leftovers_specs[] array into two separate structs to silence the sparse "array of flexible structures" warning, but in doing so reversed the member order: eth_flow was placed before flow_attr.
_create_flow_rule() locates the flow specs with:
ib_flow = (void *)flow_attr + sizeof(*flow_attr);
which expects the spec data to immediately follow the ib_flow_attr. With the reversed order, flow_attr is the last member, so ib_flow points past the end of the struct and the num_of_specs = 1 loop reads out-of-bounds memory (whatever static data follows in the .data section), producing incorrect flow rules or a crash.
Rebuild the leftovers attributes with DEFINE_RAW_FLEX(), which declares an on-stack struct ib_flow_attr with a properly sized trailing flows[] array. The ETH spec lives in flows[0].eth at exactly the offset _create_flow_rule() expects, so no layout-dependent composite struct is needed. This also avoids embedding a structure that contains a flexible array member as a non-last member, which would trigger -Wflex-array-member-not-at-end once the warning is enabled.
--- drivers/infiniband/hw/mlx5/fs.c | 45 +++++++++++++++------------------ 1 file changed, 21 insertions(+), 24 deletions(-)
drivers/infiniband/hw/mlx5/fs.c +21 -24
@@ -17,6 +17,7 @@#include <linux/mlx5/fs.h> #include <linux/mlx5/fs_helpers.h> #include <linux/mlx5/eswitch.h> +#include <linux/overflow.h> #include <net/inet_ecn.h> #include "mlx5_ib.h" #include "counters.h"
@@ -1645,36 +1646,32 @@ static struct mlx5_ib_flow_handler *create_leftovers_rule(struct mlx5_ib_dev *destruct ib_flow_attr *flow_attr, struct mlx5_flow_destination *dst) { + DEFINE_RAW_FLEX(struct ib_flow_attr, flow_attr_wc, flows, 1); + DEFINE_RAW_FLEX(struct ib_flow_attr, flow_attr_uc, flows, 1); +struct mlx5_ib_flow_handler *handler_ucast =NULL ;struct mlx5_ib_flow_handler *handler =NULL ; -static struct { -struct ib_flow_spec_eth eth_flow; -struct ib_flow_attr flow_attr; - } leftovers_wc = { .flow_attr = { .num_of_specs =1 , - .size =sizeof (leftovers_wc) }, - .eth_flow = { - .type =IB_FLOW_SPEC_ETH , - .size =sizeof (struct ib_flow_spec_eth ), - .mask = { .dst_mac = {0x1 } }, - .val = { .dst_mac = {0x1 } } } }; - -static struct { -struct ib_flow_spec_eth eth_flow; -struct ib_flow_attr flow_attr; - } leftovers_uc = { .flow_attr = { .num_of_specs =1 , - .size =sizeof (leftovers_uc) }, - .eth_flow = { - .type =IB_FLOW_SPEC_ETH , - .size =sizeof (struct ib_flow_spec_eth ), - .mask = { .dst_mac = {0x1 } }, - .val = { .dst_mac = {} } } }; - - handler =create_flow_rule (dev, ft_prio, &leftovers_wc.flow_attr, dst); + flow_attr_wc->num_of_specs =1 ; + flow_attr_wc->size =sizeof (struct ib_flow_attr ) + +sizeof (struct ib_flow_spec_eth ); + flow_attr_wc->flows[0 ].eth.type =IB_FLOW_SPEC_ETH ; + flow_attr_wc->flows[0 ].eth.size =sizeof (struct ib_flow_spec_eth ); + flow_attr_wc->flows[0 ].eth.mask.dst_mac[0 ] =0x1 ; + flow_attr_wc->flows[0 ].eth.val.dst_mac[0 ] =0x1 ; + + flow_attr_uc->num_of_specs =1 ; + flow_attr_uc->size =sizeof (struct ib_flow_attr ) + +sizeof (struct ib_flow_spec_eth ); + flow_attr_uc->flows[0 ].eth.type =IB_FLOW_SPEC_ETH ; + flow_attr_uc->flows[0 ].eth.size =sizeof (struct ib_flow_spec_eth ); + flow_attr_uc->flows[0 ].eth.mask.dst_mac[0 ] =0x1 ; + + handler =create_flow_rule (dev, ft_prio, flow_attr_wc, dst);if (!IS_ERR (handler) && flow_attr->type ==IB_FLOW_ATTR_ALL_DEFAULT ) { handler_ucast =create_flow_rule (dev, ft_prio, - &leftovers_uc.flow_attr, dst); + flow_attr_uc, dst);if (IS_ERR (handler_ucast)) {mlx5_del_flow_rules (handler->rule); ft_prio->refcount--;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 661/2151 serial: sh-sci: Drop checking port type for device file{create, remove}
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Biju Das <[email protected]>
[ Upstream commit 42f7303c5f668403f06d9b938d3de2bda3736530 ]
Ports that support FIFO has fifosize > 1. Replace checking the port type with fifosize for device file{create, remove}.
Stable-dep-of: c5b33c86d86d ("serial: sh-sci: Unregister UART on sysfs setup failure")
--- drivers/tty/serial/sh-sci.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)
drivers/tty/serial/sh-sci.c +4 -11
@@ -3375,16 +3375,14 @@ static struct uart_driver sci_uart_driver = {static void sci_remove (struct platform_device *dev) {struct sci_port *s =platform_get_drvdata (dev); -unsigned int type = s->type;/* uart_remove_... clears it */ sci_ports_in_use &= ~BIT (s->port.line);uart_remove_one_port (&sci_uart_driver, &s->port); -if (s->port.fifosize >1 ) +if (s->port.fifosize >1 ) {device_remove_file (&dev->dev, &dev_attr_rx_fifo_trigger); -if (type ==PORT_SCIFA || type ==PORT_SCIFB || type ==PORT_HSCIF || - type ==SCI_PORT_RSCI )device_remove_file (&dev->dev, &dev_attr_rx_fifo_timeout); + } }static const struct sci_of_data of_sci_scif_sh2 = {
@@ -3743,15 +3741,10 @@ static int sci_probe(struct platform_device *dev) ret =device_create_file (&dev->dev, &dev_attr_rx_fifo_trigger);if (ret)return ret; - } -if (sp->type ==PORT_SCIFA || sp->type ==PORT_SCIFB || - sp->type ==PORT_HSCIF || sp->type ==SCI_PORT_RSCI ) { + ret =device_create_file (&dev->dev, &dev_attr_rx_fifo_timeout);if (ret) { -if (sp->port.fifosize >1 ) { -device_remove_file (&dev->dev, - &dev_attr_rx_fifo_trigger); - } +device_remove_file (&dev->dev, &dev_attr_rx_fifo_trigger);return ret; } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 662/2151 serial: sh-sci: Unregister UART on sysfs setup failure
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Myeonghun Pak <[email protected]>
[ Upstream commit c5b33c86d86da3ccff8c05e2a28719e3ec933f70 ]
sci_probe_single() registers the UART port before sci_probe() creates the RX FIFO tuning attributes. If either device_create_file() call fails, probe returns an error without removing the port from the serial core. Device-managed resources are then released while the port remains registered.
Unregister the UART port before returning either sysfs creation error. If the second attribute fails, remove the first attribute before unregistering the port. Keep the existing probe failure policy and leave the successful initialization path unchanged.
This issue was identified during our ongoing static-analysis research while reviewing kernel code.
--- drivers/tty/serial/sh-sci.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/tty/serial/sh-sci.c +6 -2
@@ -3740,12 +3740,12 @@ static int sci_probe(struct platform_device *dev)if (sp->port.fifosize >1 ) { ret =device_create_file (&dev->dev, &dev_attr_rx_fifo_trigger);if (ret) -return ret; + goto err_remove_port; ret =device_create_file (&dev->dev, &dev_attr_rx_fifo_timeout);if (ret) {device_remove_file (&dev->dev, &dev_attr_rx_fifo_trigger); -return ret; + goto err_remove_port; } }
@@ -3755,6 +3755,10 @@ static int sci_probe(struct platform_device *dev) sci_ports_in_use |=BIT (dev_id);return 0 ; + +err_remove_port: +uart_remove_one_port (&sci_uart_driver, &sp->port); +return ret; }static int sci_suspend (struct device *dev)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 663/2151 serial: 8250_uniphier: Use devm_clk_get_enabled()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Malathi A <[email protected]>
[ Upstream commit 790aacba3fdfd3a227cdd5e4952c596ed66a0ed8 ]
uniphier_uart_probe() enables priv->clk by hand and is then responsible for disabling it again on every error path. It misses one: when uart_read_port_properties() fails the function returns directly, leaving the clock prepared and enabled. The neighbouring path, taken when serial8250_register_8250_port() fails, does call clk_disable_unprepare(), which shows the leak is an oversight rather than intent.
Rather than adding another manual unwind, switch to devm_clk_get_enabled() so the clock is released by devres. That removes the error path entirely, along with the explicit disables in the register failure path and in uniphier_uart_remove().
The clock is still disabled and re-enabled by hand across system sleep, which stays balanced: only SET_SYSTEM_SLEEP_PM_OPS is used, so the device cannot be unbound while suspended and devres always sees an enabled clock at detach.
Found by smatch:
drivers/tty/serial/8250/8250_uniphier.c:232 uniphier_uart_probe() warn: 'priv->clk' from clk_prepare_enable() not released on lines: 205.
--- drivers/tty/serial/8250/8250_uniphier.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/tty/serial/8250/8250_uniphier.c +2 -8
@@ -180,16 +180,12 @@ static int uniphier_uart_probe(struct platform_device *pdev)memset (&up,0 ,sizeof (up)); - priv->clk =devm_clk_get (dev,NULL ); + priv->clk =devm_clk_get_enabled (dev,NULL );if (IS_ERR (priv->clk)) { -dev_err (dev,"failed to get clock\n" ); +dev_err (dev,"failed to get and enable clock\n" );return PTR_ERR (priv->clk); } - ret =clk_prepare_enable (priv->clk); -if (ret) -return ret; - up.port.uartclk =clk_get_rate (priv->clk);spin_lock_init (&priv->atomic_write_lock);
@@ -222,7 +218,6 @@ static int uniphier_uart_probe(struct platform_device *pdev) ret =serial8250_register_8250_port (&up);if (ret <0 ) {dev_err (dev,"failed to register 8250 port\n" ); -clk_disable_unprepare (priv->clk);return ret; } priv->line = ret;
@@ -237,7 +232,6 @@ static void uniphier_uart_remove(struct platform_device *pdev)struct uniphier8250_priv *priv =platform_get_drvdata (pdev);serial8250_unregister_port (priv->line); -clk_disable_unprepare (priv->clk); }static int __maybe_unused uniphier_uart_suspend (struct device *dev)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 664/2151 serial: sifive: fix off-by-one in console port bounds check
In reply to Greg Kroah-Hartman6.18-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
@@ -999,7 +999,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 665/2151 HID: Intel-thc-hid: Intel-quicki2c: Use hid_safe_input_report()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Even Xu <[email protected]>
[ Upstream commit 48c72318ef1e9017b6c34cf73eed453d0dc9c2d4 ]
Replace the deprecated hid_input_report() with hid_safe_input_report(), which takes the allocated size of the input report buffer and allows hid-core to validate the reported data length against the actual buffer size.
Track the allocated size of qcdev->input_buf in the new input_len field and pass it through quicki2c_hid_send_report() to hid_safe_input_report() to prevent potential out-of-bounds reads.
--- drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c | 4 +++- drivers/hid/intel-thc-hid/intel-quicki2c/quicki2c-dev.h | 2 ++ drivers/hid/intel-thc-hid/intel-quicki2c/quicki2c-hid.c | 6 ++++-- drivers/hid/intel-thc-hid/intel-quicki2c/quicki2c-hid.h | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-)
drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c +3 -1
@@ -295,7 +295,7 @@ static int handle_input_report(struct quicki2c_device *qcdev)if (qcdev->state !=QUICKI2C_ENABLED )continue ; -quicki2c_hid_send_report (qcdev, pkt->data, +quicki2c_hid_send_report (qcdev, pkt->data, qcdev->input_len,HIDI2C_DATA_LEN (le16_to_cpu (pkt->len))); }
@@ -591,6 +591,8 @@ static int quicki2c_alloc_report_buf(struct quicki2c_device *qcdev)if (!qcdev->input_buf)return -ENOMEM ; + qcdev->input_len = max_report_len; +if (!le16_to_cpu (qcdev->dev_desc.max_output_len)) qcdev->dev_desc.max_output_len =cpu_to_le16 (SZ_4K );
drivers/hid/intel-thc-hid/intel-quicki2c/quicki2c-dev.h +2 -0
@@ -179,6 +179,7 @@ struct acpi_device;* @i2c_clock_lcnt: I2C CLK low period time (unit in cycle count) * @report_descriptor: Store a copy of device report descriptor * @input_buf: Store a copy of latest input report data +* @input_len: The data size of the input report buffer * @report_buf: Store a copy of latest input/output report packet from set/get feature * @report_len: The length of input/output report packet * @reset_ack_wq: Workqueue for waiting reset response from device
@@ -212,6 +213,7 @@ struct quicki2c_device {u8 *report_descriptor;u8 *input_buf; +size_t input_len;u8 *report_buf;u32 report_len;
drivers/hid/intel-thc-hid/intel-quicki2c/quicki2c-hid.c +4 -2
@@ -149,16 +149,18 @@ void quicki2c_hid_remove(struct quicki2c_device *qcdev)* * @qcdev: point to quicki2c device * @data: point to input report data buffer +* @buf_size: the allocated size of the input report data buffer * @data_len: the length of input report data * * Return: 0 on success, non zero on error. */ int quicki2c_hid_send_report (struct quicki2c_device *qcdev, -void *data,size_t data_len) +void *data,size_t buf_size,size_t data_len) {int ret; - ret =hid_input_report (qcdev->hid_dev,HID_INPUT_REPORT , data, data_len,1 ); + ret =hid_safe_input_report (qcdev->hid_dev,HID_INPUT_REPORT , data, + buf_size, data_len,1 );if (ret)dev_err (qcdev->dev,"Failed to send HID input report, ret = %d.\n" , ret);
drivers/hid/intel-thc-hid/intel-quicki2c/quicki2c-hid.h +1 -1
@@ -7,7 +7,7 @@struct quicki2c_device ;int quicki2c_hid_send_report (struct quicki2c_device *qcdev, -void *data,size_t data_size); +void *data,size_t buf_size,size_t data_size);int quicki2c_hid_probe (struct quicki2c_device *qcdev);void quicki2c_hid_remove (struct quicki2c_device *qcdev);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 666/2151 HID: Intel-thc-hid: Intel-quickspi: Use hid_safe_input_report()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Even Xu <[email protected]>
[ Upstream commit 291f4f310cc18ff8f5addbc3c9fbe33877283ec7 ]
Replace the deprecated hid_input_report() with hid_safe_input_report(), which takes the allocated size of the input report buffer and allows hid-core to validate the reported data length against the actual buffer size.
Track the allocated size of qsdev->input_buf in the new input_len field and pass it through quickspi_hid_send_report() to hid_safe_input_report() to prevent potential out-of-bounds reads.
--- drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c | 2 ++ drivers/hid/intel-thc-hid/intel-quickspi/quickspi-dev.h | 2 ++ drivers/hid/intel-thc-hid/intel-quickspi/quickspi-hid.c | 6 ++++-- drivers/hid/intel-thc-hid/intel-quickspi/quickspi-hid.h | 2 +- .../hid/intel-thc-hid/intel-quickspi/quickspi-protocol.c | 2 +- 5 files changed, 10 insertions(+), 4 deletions(-)
drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c +2 -0
@@ -554,6 +554,8 @@ static int quickspi_alloc_report_buf(struct quickspi_device *qsdev)if (!qsdev->input_buf)return -ENOMEM ; + qsdev->input_len = max_input_len; + max_report_len =max (le16_to_cpu (qsdev->dev_desc.max_output_len),le16_to_cpu (qsdev->dev_desc.max_input_len));
drivers/hid/intel-thc-hid/intel-quickspi/quickspi-dev.h +2 -0
@@ -112,6 +112,7 @@ struct acpi_device;* @low_power_ltr_val: THC low power LTR value * @report_descriptor: store a copy of device report descriptor * @input_buf: store a copy of latest input report data +* @input_len: the data size of the input report buffer * @report_buf: store a copy of latest input/output report packet from set/get feature * @report_len: the length of input/output report packet * @reset_ack_wq: workqueue for waiting reset response from device
@@ -156,6 +157,7 @@ struct quickspi_device {u8 *report_descriptor;u8 *input_buf; +u32 input_len;u8 *report_buf;u32 report_buf_size;u32 report_len;
drivers/hid/intel-thc-hid/intel-quickspi/quickspi-hid.c +4 -2
@@ -148,16 +148,18 @@ void quickspi_hid_remove(struct quickspi_device *qsdev)* * @qsdev: point to quickspi device * @data: point to input report data buffer +* @buf_size: the allocated size of the input report data buffer * @data_len: the length of input report data * * Return: 0 on success, non zero on error. */ int quickspi_hid_send_report (struct quickspi_device *qsdev, -void *data,size_t data_len) +void *data,size_t buf_size,size_t data_len) {int ret; - ret =hid_input_report (qsdev->hid_dev,HID_INPUT_REPORT , data, data_len,1 ); + ret =hid_safe_input_report (qsdev->hid_dev,HID_INPUT_REPORT , data, + buf_size, data_len,1 );if (ret)dev_err (qsdev->dev,"Failed to send HID input report, ret = %d.\n" , ret);
drivers/hid/intel-thc-hid/intel-quickspi/quickspi-hid.h +1 -1
@@ -7,7 +7,7 @@struct quickspi_device ;int quickspi_hid_send_report (struct quickspi_device *qsdev, -void *data,size_t data_size); +void *data,size_t buf_size,size_t data_size);int quickspi_hid_probe (struct quickspi_device *qsdev);void quickspi_hid_remove (struct quickspi_device *qsdev);
drivers/hid/intel-thc-hid/intel-quickspi/quickspi-protocol.c +1 -1
@@ -240,7 +240,7 @@ void quickspi_handle_input_data(struct quickspi_device *qsdev, u32 buf_len) input_len =sizeof (body_hdr->content_id) + input_len; input_report = input_body->content -sizeof (body_hdr->content_id); - ret =quickspi_hid_send_report (qsdev, input_report, input_len); + ret =quickspi_hid_send_report (qsdev, input_report, qsdev->input_len, input_len);if (ret)dev_err_once (qsdev->dev,"Failed to send HID input report: %d\n" , ret);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 667/2151 ARM: dts: ux500: Convert HREF audio to audio-graph-card2
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <[email protected]>
[ Upstream commit f9b2262d1edba1b6c0abc12118105f8fa200980a ]
Describe the HREF500 and HREF520 sound hardware with two-link audio graph cards in their PMIC-specific HREF DTSIs, and name the card HREF-500. Connect MSP1 to codec DAI 0 for playback and MSP3 to codec DAI 1 for capture.
Describe the DSP_A format, codec-provided bit and frame clocks, 16-by-16-bit TDM frame and active slots on the graph endpoints. Keep the clocks running continuously, matching the legacy machine driver's normal one- and two-channel mode.
Keep each complete card, including its endpoint graph, connector widgets and routes, in the existing PMIC-specific HREF DTSI. The AB8500 variant exposes six digital microphone endpoints. AB8505 has neither the digital microphone interface nor its VDMIC regulator, so leave these endpoints out of HREF520 and remove its stale regulator and pin configuration nodes.
Select ULPCLK as the fixed parent of the codec audio clock in the HREF-specific codec DTSIs. This replaces the machine driver clock control with declarative board policy.
--- arch/arm/boot/dts/st/ste-ab8500.dtsi | 6 -- arch/arm/boot/dts/st/ste-ab8505.dtsi | 6 -- arch/arm/boot/dts/st/ste-dbx5x0.dtsi | 5 - arch/arm/boot/dts/st/ste-href-ab8500.dtsi | 104 +++++++++++++++++++ arch/arm/boot/dts/st/ste-href-ab8505.dtsi | 118 +++++++++++++++++----- 5 files changed, 196 insertions(+), 43 deletions(-)
arch/arm/boot/dts/st/ste-ab8500.dtsi +0 -6
@@ -364,12 +364,6 @@ ab8500_ldo_ana_reg: ab8500_ldo_ana { }; }; - sound { - stericsson,audio-codec = <&codec>; - clocks = <&prcmu_clk PRCMU_SYSCLK>, <&ab8500_clock AB8500_SYSCLK_ULP>, <&ab8500_clock AB8500_SYSCLK_INT>; - clock-names = "sysclk", "ulpclk", "intclk"; - }; - mcde@a0350000 { vana-supply = <&ab8500_ldo_ana_reg>;
arch/arm/boot/dts/st/ste-ab8505.dtsi +0 -6
@@ -301,12 +301,6 @@ ab8500_ldo_ana_reg: ab8500_ldo_ana { }; }; - sound { - stericsson,audio-codec = <&codec>; - clocks = <&prcmu_clk PRCMU_SYSCLK>, <&ab8500_clock AB8500_SYSCLK_ULP>, <&ab8500_clock AB8500_SYSCLK_INT>; - clock-names = "sysclk", "ulpclk", "intclk"; - }; - mcde@a0350000 { vana-supply = <&ab8500_ldo_ana_reg>;
arch/arm/boot/dts/st/ste-dbx5x0.dtsi +0 -5
@@ -1071,11 +1071,6 @@ mmc@80008000 { status = "disabled"; }; - sound { - compatible = "stericsson,snd-soc-mop500"; - stericsson,cpu-dai = <&msp1 &msp3>; - }; - msp0: msp@80123000 { compatible = "stericsson,ux500-msp-i2s"; reg = <0x80123000 0x1000>;
arch/arm/boot/dts/st/ste-href-ab8500.dtsi +104 -0
113 lines not on this page · raw message
arch/arm/boot/dts/st/ste-href-ab8505.dtsi +92 -26
145 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 668/2151 rust: clk: document overflow panics in `Hertz` constructors
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Georgios Androutsopoulos <[email protected]>
[ Upstream commit 45a68afbd4b632538a0956ba783fca45b8ceb446 ]
Hertz::from_khz(), from_mhz() and from_ghz() multiply their argument by 1_000, 1_000_000 and 1_000_000_000 respectively without checking for overflow. When CONFIG_RUST_OVERFLOW_CHECKS is enabled, each panics once its argument exceeds c_ulong::MAX divided by that factor. None of the three documents this. The panic occurs only at runtime, when the argument is not a constant expression.
Add the missing # Panics sections stating the bound for each unit.
--- rust/kernel/clk.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
rust/kernel/clk.rs +15 -0
@@ -35,16 +35,31 @@ impl Hertz {const GHZ_TO_HZ :c_ulong =1_000_000_000 ;/// Create a new instance from kilohertz (kHz) +/// +/// # Panics +/// +/// Panics if `CONFIG_RUST_OVERFLOW_CHECKS` is enabled and `khz` is greater +/// than `c_ulong::MAX / 1_000`. pub const fn from_khz (khz:c_ulong ) ->Self {Self (khz *Self ::KHZ_TO_HZ ) }/// Create a new instance from megahertz (MHz) +/// +/// # Panics +/// +/// Panics if `CONFIG_RUST_OVERFLOW_CHECKS` is enabled and `mhz` is greater +/// than `c_ulong::MAX / 1_000_000`. pub const fn from_mhz (mhz:c_ulong ) ->Self {Self (mhz *Self ::MHZ_TO_HZ ) }/// Create a new instance from gigahertz (GHz) +/// +/// # Panics +/// +/// Panics if `CONFIG_RUST_OVERFLOW_CHECKS` is enabled and `ghz` is greater +/// than `c_ulong::MAX / 1_000_000_000`. pub const fn from_ghz (ghz:c_ulong ) ->Self {Self (ghz *Self ::GHZ_TO_HZ ) }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 669/2151 dt-bindings: vendor-prefixes: add Free Mobile
In reply to Greg Kroah-Hartman6.18-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
@@ -588,6 +588,8 @@ patternProperties: description: Freebox SAS "^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 670/2151 arm64: dts: imx8mp-kontron: Fix LVDS clock frequency for DL device
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oualid Derouiche <[email protected]>
[ Upstream commit a5f316e602d3f5852fe2f88226fe64c8a495f479 ]
The panel needs a pixel clock of 50 MHz, which means the LDB serializer has to run at 50 MHz * 7 = 350 MHz. The LDB rate itself is set by the fsl-ldb driver, but VIDEO_PLL1 needs to be pinned to 700 MHz, so that both the LDB clock (/2) and the pixel clock (/14) can be derived from it exactly.
--- arch/arm64/boot/dts/freescale/imx8mp-kontron-dl.dtso | 11 +++++++++++ 1 file changed, 11 insertions(+)
arch/arm64/boot/dts/freescale/imx8mp-kontron-dl.dtso +11 -0
@@ -6,6 +6,7 @@ /dts-v1/; /plugin/; +#include <dt-bindings/clock/imx8mp-clock.h> #include <dt-bindings/gpio/gpio.h> #include "imx8mp-pinfunc.h"
@@ -98,6 +99,16 @@ &ldb_lvds_ch0 { &lvds_bridge { status = "okay"; + /* + * The video PLL clock frequency needs to be configured manually. + * The panel needs a LVDS clock of 50 MHz * 7 = 350 MHz. + * IMX8MP_CLK_MEDIA_LDB = IMX8MP_CLK_MEDIA_DISP2_PIX * 7 + * IMX8MP_VIDEO_PLL1 = IMX8MP_CLK_MEDIA_LDB * 2 + */ + assigned-clocks = <&clk IMX8MP_CLK_MEDIA_LDB>, + <&clk IMX8MP_VIDEO_PLL1>; + assigned-clock-parents = <&clk IMX8MP_VIDEO_PLL1_OUT>; + assigned-clock-rates = <0>, <700000000>; }; /* redefine to remove touch controller GPIOs */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 671/2151 clk: qcom: dispcc-sm8450: Fix disp_cc_mdss_mdp_clk_src ops
In reply to Greg Kroah-Hartman6.18-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
@@ -614,7 +614,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 672/2151 clk: qcom: alpha-pll: Check Lucid Ole PLL status before configuring
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Esteban Urrutia <[email protected]>
[ Upstream commit eb34e2804ce4ea56efb741e23d598469274a2f94 ]
On some platforms such as SM8475, not doing this may result in graphical glitches when the mdss driver takes over.
This fixes the aforementioned issue.
--- drivers/clk/qcom/clk-alpha-pll.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/clk/qcom/clk-alpha-pll.c +9 -0
@@ -2356,6 +2356,15 @@ void clk_lucid_ole_pll_configure(struct clk_alpha_pll *pll, struct regmap *regma {u32 lval = config->l; +/* +* If the bootloader left the PLL enabled it's likely that there are +* RCGs that will lock up if we disable the PLL below. +*/ +if (trion_pll_is_enabled (pll, regmap)) { +pr_debug ("Lucid Ole PLL is already enabled, skipping configuration\n" ); +return ; + } + lval |=TRION_PLL_CAL_VAL <<LUCID_EVO_PLL_CAL_L_VAL_SHIFT ; lval |=TRION_PLL_CAL_VAL <<LUCID_OLE_PLL_RINGOSC_CAL_L_VAL_SHIFT ;clk_alpha_pll_write_config (regmap,PLL_L_VAL (pll), lval);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 673/2151 clk: qcom: fix SM6115 lpasscc register offset
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivas Kandagatla <[email protected]>
[ Upstream commit 689364ac19e4680e09d100c743f8797da127609a ]
For some reason we ended with incorrect register offset for soundwire tx controller reset and the regmap register max was also incorrect it was 0x1000 instead of 0x12000 which is full register range for this IP.
This was somehow compenseated in DT reg property which got it working so far.
Fix this by correcting the actual offset and max registers as per SoC documentation.
--- drivers/clk/qcom/lpasscc-sm6115.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/qcom/lpasscc-sm6115.c +2 -2
@@ -35,7 +35,7 @@ static const struct qcom_cc_desc lpass_audiocc_sm6115_reset_desc = { };static const struct qcom_reset_map lpasscc_sm6115_resets[] = { - [LPASS_SWR_TX_CONFIG_CGCR ] = { .reg =0x100 , .bit =1 , .udelay =500 }, + [LPASS_SWR_TX_CONFIG_CGCR ] = { .reg =0xc100 , .bit =1 , .udelay =500 }, };static struct regmap_config lpasscc_sm6115_regmap_config = {
@@ -43,7 +43,7 @@ static struct regmap_config lpasscc_sm6115_regmap_config = { .reg_stride = 4, .val_bits = 32, .name = "lpass-tcsr", - .max_register = 0x1000, + .max_register = 0x12000, };static const struct qcom_cc_desc lpasscc_sm6115_reset_desc = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 674/2151 tools/nolibc: fix WIFSIGNALED() for status 0
In reply to Greg Kroah-Hartman6.18-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
@@ -109,7 +109,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)/* standard exit() codes */ #define EXIT_SUCCESS 0
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 675/2151 bpftool: Fix CPU IDs in per-CPU map output
In reply to Greg Kroah-Hartman6.18-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
@@ -31,6 +31,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 <zlib.h>
@@ -655,6 +656,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
@@ -216,6 +216,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 676/2151 bpftool: Accept zero perf counter snapshots
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mykyta Yatsenko <[email protected]>
[ Upstream commit b2cf39f53478fd4b04d2f04585c21b3d91d7042f ]
A perf counter can be zero at fentry when PMU multiplexing has not scheduled the event. Do not reject that sample.
Use enabled time to distinguish a successful snapshot. Read directly into the per-CPU map value.
Stable-dep-of: edc071d7b3aa ("bpftool: Fix sparse CPU IDs in prog profile")
--- tools/bpf/bpftool/skeleton/profiler.bpf.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-)
tools/bpf/bpftool/skeleton/profiler.bpf.c +7 -14
@@ -45,28 +45,21 @@ const volatile __u32 num_metric = 1; SEC("fentry/XXX")int BPF_PROG (fentry_XXX ) { -struct bpf_perf_event_value___local *ptrs[MAX_NUM_METRICS ];u32 key =bpf_get_smp_processor_id ();u32 i; -/* look up before reading, to reduce error */ for (i =0 ; i < num_metric && i <MAX_NUM_METRICS ; i++) { +struct bpf_perf_event_value___local *reading;u32 flag = i; - - ptrs[i] =bpf_map_lookup_elem (&fentry_readings, &flag); -if (!ptrs[i]) -return 0 ; - } - -for (i =0 ; i < num_metric && i <MAX_NUM_METRICS ; i++) { -struct bpf_perf_event_value___local reading;int err; - err =bpf_perf_event_read_value (&events, key, (void *)&reading, -sizeof (reading)); + reading =bpf_map_lookup_elem (&fentry_readings, &flag); +if (!reading) +return 0 ; + err =bpf_perf_event_read_value (&events, key, (void *)reading, +sizeof (*reading));if (err)return 0 ; - *(ptrs[i]) = reading; key += num_cpu; }
@@ -80,7 +73,7 @@ fexit_update_maps(u32 id, struct bpf_perf_event_value___local *after) before =bpf_map_lookup_elem (&fentry_readings, &id);/* only account samples with a valid fentry_reading */ -if (before && before->counter) { +if (before && before->enabled) {struct bpf_perf_event_value___local *accum; diff.counter = after->counter - before->counter;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 677/2151 bpftool: Group profile events by CPU
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mykyta Yatsenko <[email protected]>
[ Upstream commit 6b5fe4b6d5ae5fac328416b061e5416d68aec762 ]
Independently scheduled perf events can cover different intervals, making derived ratios inconsistent.
Open one event group per CPU and enable it only after all selected metrics have joined.
Fail the profile setup when a selected event cannot join its group.
Stable-dep-of: edc071d7b3aa ("bpftool: Fix sparse CPU IDs in prog profile")
--- tools/bpf/bpftool/prog.c | 87 ++++++++++++++++++++++++---------------- 1 file changed, 52 insertions(+), 35 deletions(-)
tools/bpf/bpftool/prog.c +52 -35
@@ -2350,7 +2350,7 @@ static char *profile_tgt_name;static int *profile_perf_events;static int profile_perf_event_cnt; -static void profile_close_perf_events (struct profiler_bpf *obj) +static void profile_close_perf_events (void ) {int i;
@@ -2361,61 +2361,78 @@ static void profile_close_perf_events(struct profiler_bpf *obj) profile_perf_event_cnt =0 ; } -static int profile_open_perf_event (int mid,int cpu,int map_fd) +static int profile_open_perf_event (int mid,int cpu, +int map_fd,int group_fd,__u32 map_key) { +struct perf_event_attr attr = metrics[mid].attr; +bool group_leader = group_fd <0 ;int pmu_fd; +int err; - pmu_fd =syscall (__NR_perf_event_open, &metrics[mid].attr, --1 /*pid*/ , cpu,-1 /*group_fd*/ ,0 ); + attr.disabled = group_leader; + pmu_fd =syscall (__NR_perf_event_open, &attr,-1 /* pid */ , cpu, + group_fd,0 );if (pmu_fd <0 ) { -if (errno ==ENODEV ) { -p_info ("cpu %d may be offline, skip %s profiling." , - cpu, metrics[mid].name); - profile_perf_event_cnt++; -return 0 ; - } -return -1 ; + err = -errno; +if (errno ==ENODEV && group_leader) +p_info ("cpu %d may be offline, skip profiling." , cpu); +return err; } -if (bpf_map_update_elem (map_fd, - &profile_perf_event_cnt, - &pmu_fd,BPF_ANY ) || -ioctl (pmu_fd,PERF_EVENT_IOC_ENABLE ,0 )) { +if (bpf_map_update_elem (map_fd, &map_key, &pmu_fd,BPF_ANY )) { + err = -errno;close (pmu_fd); -return -1 ; +return err; } profile_perf_events[profile_perf_event_cnt++] = pmu_fd; -return 0 ; +return pmu_fd; }static int profile_open_perf_events (struct profiler_bpf *obj) { +__u32 num_cpu = obj->rodata->num_cpu; +__u32 map_key;unsigned int cpu, m; -int map_fd; +int group_fd, map_fd, pmu_fd; +int err; - profile_perf_events =calloc ( - obj->rodata->num_cpu * obj->rodata->num_metric,sizeof (int )); + profile_perf_events =calloc (num_cpu * obj->rodata->num_metric, +sizeof (*profile_perf_events));if (!profile_perf_events) {p_err ("failed to allocate memory for perf_event array: %s" ,strerror (errno)); -return -1 ; +return -ENOMEM ; } + map_fd =bpf_map__fd (obj->maps.events); -if (map_fd <0 ) { -p_err ("failed to get fd for events map" ); -return -1 ; - } +for (cpu =0 ; cpu < num_cpu; cpu++) { + group_fd =-1 ; + map_key = cpu; +for (m =0 ; m <ARRAY_SIZE (metrics); m++) { +if (!metrics[m].selected) +continue ; -for (m =0 ; m <ARRAY_SIZE (metrics); m++) { -if (!metrics[m].selected) -continue ; -for (cpu =0 ; cpu < obj->rodata->num_cpu; cpu++) { -if (profile_open_perf_event (m, cpu, map_fd)) { -p_err ("failed to create event %s on cpu %u" , - metrics[m].name, cpu); -return -1 ; + pmu_fd =profile_open_perf_event (m, cpu, map_fd, group_fd, + map_key); +if (pmu_fd == -ENODEV && group_fd <0 ) +break ; +if (pmu_fd <0 ) { +p_err ("failed to add event %s to group on CPU %u: %s" , + metrics[m].name, cpu,strerror (-pmu_fd)); +return pmu_fd; } +if (group_fd <0 ) + group_fd = pmu_fd; + map_key += num_cpu; + } +if (group_fd <0 ) +continue ; +if (ioctl (group_fd,PERF_EVENT_IOC_ENABLE ,PERF_IOC_FLAG_GROUP )) { + err = -errno; +p_err ("failed to enable perf event group on CPU %u: %s" , + cpu,strerror (-err)); +return err; } }return 0 ;
@@ -2423,7 +2440,7 @@ static int profile_open_perf_events(struct profiler_bpf *obj)static void profile_print_and_cleanup (void ) { -profile_close_perf_events (profile_obj); +profile_close_perf_events ();profile_read_values (profile_obj);profile_print_readings ();profiler_bpf__destroy (profile_obj);
@@ -2529,7 +2546,7 @@ static int do_profile(int argc, char **argv)return 0 ; out: -profile_close_perf_events (profile_obj); +profile_close_perf_events ();if (profile_obj)profiler_bpf__destroy (profile_obj);close (profile_tgt_fd);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 678/2151 bpftool: Scale counters and report cycles per run
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mykyta Yatsenko <[email protected]>
[ Upstream commit c2c8bd265627364a8257c413e697fee8f2605197 ]
Perf counters undercount when the PMU multiplexes them. Scale each per-CPU value before aggregation. Per-CPU event groups make PMU ratios use matching scheduling intervals.
Keep run_cnt as the total number of program executions, independent of counter scheduling.
Keep JSON value raw, report the scaled value in value_scaled, and document the output.
Stable-dep-of: edc071d7b3aa ("bpftool: Fix sparse CPU IDs in prog profile")
--- .../bpftool/Documentation/bpftool-prog.rst | 11 +- tools/bpf/bpftool/prog.c | 122 ++++++++++++------ 2 files changed, 89 insertions(+), 44 deletions(-)
tools/bpf/bpftool/Documentation/bpftool-prog.rst +9 -2
@@ -217,7 +217,14 @@ bpftool prog run *PROG* data_in *FILE* [data_out *FILE* [data_size_out *L*]] [ct bpftool prog profile *PROG* [duration *DURATION*] *METRICs* Profile *METRICs* for bpf program *PROG* for *DURATION* seconds or until user hits <Ctrl+C>. *DURATION* is optional. If *DURATION* is not specified, - the profiling will run up to **UINT_MAX** seconds. + the profiling will run up to **UINT_MAX** seconds. Selected metrics form a + perf event group on each CPU so that ratios use counters scheduled over the + same intervals. Plain output scales each per-CPU metric value to correct + for perf event multiplexing. When **cycles** is selected, it also reports + cycles per program run. + + In JSON output, **value** is raw, **value_scaled** is scaled, and + **run_cnt** is the total number of program runs. bpftool prog help Print short help message.
@@ -360,7 +367,7 @@ EXAMPLES :: 51397 run_cnt - 40176203 cycles (83.05%) + 40176203 cycles # 781.68 cycles per run (83.05%) 42518139 instructions # 1.06 insns per cycle (83.39%) 123 llc_misses # 2.89 LLC misses per million insns (83.15%)
tools/bpf/bpftool/prog.c +80 -42
259 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 679/2151 bpftool: Fix sparse CPU IDs in prog profile
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hui Su <[email protected]>
[ Upstream commit edc071d7b3aaae8047a12c21b02cc537557aacee ]
bpftool prog profile currently treats the number of possible CPUs as both the logical CPU ID range and the stride of the perf event array. That misses valid logical CPUs when the possible CPU mask is sparse, such as 0,2-3, and can use incorrect PERF_EVENT_ARRAY keys.
Keep the compact possible CPU count for per-CPU result buffers, while enumerating the actual logical CPU IDs when creating per-CPU perf event groups. Use the maximum logical CPU ID plus one as the metric stride in the PERF_EVENT_ARRAY.
This keeps the current per-CPU event grouping intact while separating the compact per-CPU buffer index from the logical CPU ID and event-array key. Report the logical CPU ID when a per-CPU event was not counted.
--- tools/bpf/bpftool/prog.c | 51 +++++++++++++++-------- tools/bpf/bpftool/skeleton/profiler.bpf.c | 8 ++-- 2 files changed, 37 insertions(+), 22 deletions(-)
tools/bpf/bpftool/prog.c +33 -18
@@ -2164,6 +2164,9 @@ struct profile_metric { };static __u64 profile_total_count; +static int profile_cpu_cnt; +static int *profile_cpu_ids; +static int profile_cpu_id_span;#define MAX_NUM_PROFILE_METRICS 4
@@ -2200,7 +2203,7 @@ static int profile_parse_metrics(int argc, char **argv)static int profile_read_values (struct profiler_bpf *obj) { -__u32 m, cpu, num_cpu = obj->rodata->num_cpu; +__u32 m, cpu, num_cpu = profile_cpu_cnt;int reading_map_fd, count_map_fd;__u64 counts[num_cpu];__u32 key =0 ;
@@ -2235,8 +2238,8 @@ static int profile_read_values(struct profiler_bpf *obj)for (cpu =0 ; cpu < num_cpu; cpu++) { val = &values[cpu];if (counts[cpu] && !val->running) { -p_err ("perf event %s was not counted on CPU %u" , - metrics[m].name, cpu); +p_err ("perf event %s was not counted on CPU %d" , + metrics[m].name, profile_cpu_ids[cpu]);return -EAGAIN ; } metrics[m].val.enabled += val->enabled;
@@ -2394,6 +2397,7 @@ static void profile_close_perf_events(void)close (profile_perf_events[i]);free (profile_perf_events); + profile_perf_events =NULL ; profile_perf_event_cnt =0 ; }
@@ -2427,13 +2431,12 @@ static int profile_open_perf_event(int mid, int cpu,static int profile_open_perf_events (struct profiler_bpf *obj) { -__u32 num_cpu = obj->rodata->num_cpu;__u32 map_key;unsigned int cpu, m;int group_fd, map_fd, pmu_fd;int err; - profile_perf_events =calloc (num_cpu * obj->rodata->num_metric, + profile_perf_events =calloc (profile_cpu_cnt * obj->rodata->num_metric,sizeof (*profile_perf_events));if (!profile_perf_events) { p_err("failed to allocate memory for perf_event array: %s",
@@ -2442,32 +2445,34 @@ static int profile_open_perf_events(struct profiler_bpf *obj) } map_fd =bpf_map__fd (obj->maps.events); -for (cpu =0 ; cpu < num_cpu; cpu++) { +for (cpu =0 ; cpu < (unsigned int )profile_cpu_cnt; cpu++) { +int cpu_id = profile_cpu_ids[cpu]; + group_fd =-1 ; - map_key = cpu; + map_key = cpu_id;for (m =0 ; m <ARRAY_SIZE (metrics); m++) {if (!metrics[m].selected)continue ; - pmu_fd =profile_open_perf_event (m, cpu, map_fd, group_fd, + pmu_fd =profile_open_perf_event (m, cpu_id, map_fd, group_fd, map_key);if (pmu_fd == -ENODEV && group_fd <0 )break ;if (pmu_fd <0 ) { -p_err ("failed to add event %s to group on CPU %u: %s" , - metrics[m].name, cpu,strerror (-pmu_fd)); +p_err ("failed to add event %s to group on CPU %d: %s" , + metrics[m].name, cpu_id,strerror (-pmu_fd));return pmu_fd; }if (group_fd <0 ) group_fd = pmu_fd; - map_key += num_cpu; + map_key += profile_cpu_id_span; }if (group_fd <0 )continue ;if (ioctl (group_fd,PERF_EVENT_IOC_ENABLE ,PERF_IOC_FLAG_GROUP )) { err = -errno; -p_err ("failed to enable perf event group on CPU %u: %s" , - cpu,strerror (-err)); +p_err ("failed to enable perf event group on CPU %d: %s" , + cpu_id,strerror (-err));return err; } }
@@ -2486,6 +2491,10 @@ static int profile_print_and_cleanup(void)close (profile_tgt_fd);free (profile_tgt_name); +free (profile_cpu_ids); + profile_cpu_ids =NULL ; + profile_cpu_cnt =0 ; + profile_cpu_id_span =0 ;return err; }
@@ -2496,7 +2505,7 @@ static void int_exit(int signo)static int do_profile (int argc,char **argv) { -int num_metric, num_cpu, err =-1 ; +int num_metric, err =-1 ;struct bpf_program *prog;unsigned long duration;char *endptr;
@@ -2527,11 +2536,12 @@ static int do_profile(int argc, char **argv)if (num_metric <=0 ) goto out; - num_cpu =libbpf_num_possible_cpus (); -if (num_cpu <=0 ) { + profile_cpu_cnt =get_possible_cpu_ids (&profile_cpu_ids); +if (profile_cpu_cnt <=0 ) {p_err ("failed to identify number of CPUs" ); goto out; } + profile_cpu_id_span = profile_cpu_ids[profile_cpu_cnt -1 ] +1 ; profile_obj =profiler_bpf__open ();if (!profile_obj) {
@@ -2539,11 +2549,12 @@ static int do_profile(int argc, char **argv) goto out; } - profile_obj->rodata->num_cpu = num_cpu; profile_obj->rodata->num_metric = num_metric; + profile_obj->rodata->cpu_id_span = profile_cpu_id_span;/* adjust map sizes */ -bpf_map__set_max_entries (profile_obj->maps.events, num_metric * num_cpu); +bpf_map__set_max_entries (profile_obj->maps.events, + num_metric * profile_cpu_id_span);bpf_map__set_max_entries (profile_obj->maps.fentry_readings, num_metric);bpf_map__set_max_entries (profile_obj->maps.accum_readings, num_metric);bpf_map__set_max_entries (profile_obj->maps.counts,1 );
@@ -2589,6 +2600,10 @@ static int do_profile(int argc, char **argv)profiler_bpf__destroy (profile_obj);close (profile_tgt_fd);free (profile_tgt_name); +free (profile_cpu_ids); + profile_cpu_ids =NULL ; + profile_cpu_cnt =0 ; + profile_cpu_id_span =0 ;return err; }
tools/bpf/bpftool/skeleton/profiler.bpf.c +4 -4
@@ -10,7 +10,7 @@ struct bpf_perf_event_value___local {__u64 running; } __attribute__((preserve_access_index)); -/* map of perf event fds, num_cpu * num_metric entries */ +/* map of perf event fds, cpu_id_span * num_metric entries */ struct { __uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY); __uint(key_size, sizeof(u32));
@@ -38,8 +38,8 @@ struct {__uint (value_size,sizeof (u64)); } counts SEC(".maps"); -const volatile __u32 num_cpu =1 ;const volatile __u32 num_metric =1 ; +const volatile __u32 cpu_id_span =1 ;#define MAX_NUM_METRICS 4SEC ("fentry/XXX" )
@@ -60,7 +60,7 @@ int BPF_PROG(fentry_XXX) sizeof(*reading));if (err)return 0 ; - key += num_cpu; + key += cpu_id_span; }return 0 ;
@@ -100,7 +100,7 @@ int BPF_PROG(fexit_XXX)/* read all events before updating the maps, to reduce error */ for (i =0 ; i < num_metric && i <MAX_NUM_METRICS ; i++) { - err =bpf_perf_event_read_value (&events, cpu + i * num_cpu, + err =bpf_perf_event_read_value (&events, cpu + i * cpu_id_span, (void *)(readings + i),sizeof (*readings));if (err)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 680/2151 iommufd: Fix iommufd_hw_capabilities reference in kernel-doc
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karl Mehltretter <[email protected]>
[ Upstream commit 54dadb030c7e2350957855d3995de05ae02c2e66 ]
The kernel-doc comment of struct iommu_hw_info refers to iommu_hw_capabilities, which does not exist. The name is iommufd_hw_capabilities. Say iommufd_hw_capabilities.
--- include/uapi/linux/iommufd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/iommufd.h +1 -1
@@ -680,7 +680,7 @@ enum iommufd_hw_info_flags {* @out_data_type: Output the iommu hardware info type as defined in the enum * iommu_hw_info_type. * @out_capabilities: Output the generic iommu capability info type as defined -* in the enum iommu_hw_capabilities. +* in the enum iommufd_hw_capabilities. * @out_max_pasid_log2: Output the width of PASIDs. 0 means no PASID support. * PCI devices turn to out_capabilities to check if the * specific capabilities is supported or not.
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 681/2151 ext2: drain in-flight DIO before buffered write fallback
In reply to Greg Kroah-Hartman6.18-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
@@ -253,6 +253,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 682/2151 mfd: rk8xx: Register poweroff handler in atomic phase
In reply to Greg Kroah-Hartman6.18-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
@@ -800,7 +800,7 @@ int rk8xx_probe(struct device *dev, int variant, unsigned int irq, struct regmapif (device_property_read_bool (dev,"system-power-controller" ) ||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 683/2151 mfd: intel_quark_i2c_gpio: Manage the fixed-rate clock
In reply to Greg Kroah-Hartman6.18-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 684/2151 mfd: da9150: Balance IRQ wake on teardown
In reply to Greg Kroah-Hartman6.18-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 685/2151 um: Add definition of __NR_close_range for older host OSs
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <[email protected]>
[ Upstream commit 03dcf7bd302c9bae0c75a21a3004a44b4940317e ]
__NR_close_range was introduced with 278a5fbaed89dacd04e9d052f4594ffd0e0585de ("open: add close_range()") which is present in Linux >= 5.9. Older hosts running a kernel version prior to that range currently fail to build due to that missing system call number definition.
--- arch/um/include/shared/skas/stub-data.h | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/um/include/shared/skas/stub-data.h +9 -0
@@ -9,11 +9,20 @@#define __STUB_DATA_H#include <linux/compiler_types.h> +#include <asm/unistd.h> #include <as-layout.h> #include <sysdep/tls.h> #include <sysdep/stub-data.h> #include <mm_id.h> +#ifndef __NR_close_range +# if defined(__alpha__) +# define __NR_close_range 546 +# else +# define __NR_close_range 436 +# endif +#endif +#define FUTEX_IN_CHILD 0#define FUTEX_IN_KERN 1
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 686/2151 rust: dma: allow drivers to tune max segment size
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Beata Michalska <[email protected]>
[ Upstream commit c71257394bc9c59ea727803f6e55e83fe63db74e ]
Make dma_set_max_seg_size() available to Rust so drivers can perform standard DMA setup steps.
Stable-dep-of: c15c5befd6d6 ("rust: scatterlist: honor the device's maximum segment size")
--- rust/helpers/dma.c | 6 ++++++ rust/kernel/dma.rs | 17 +++++++++++++++++ 2 files changed, 23 insertions(+)
rust/helpers/dma.c +6 -0
@@ -40,3 +40,9 @@ size_t rust_helper_dma_max_mapping_size(struct device *dev) {return dma_max_mapping_size (dev); } + +__rust_helper void rust_helper_dma_set_max_seg_size(struct device *dev, +unsigned int size) +{ +dma_set_max_seg_size (dev, size); +}
rust/kernel/dma.rs +17 -0
@@ -84,6 +84,23 @@ unsafe fn dma_set_mask_and_coherent(&self, mask: DmaMask) -> Result { bindings::dma_set_mask_and_coherent (self.as_ref ().as_raw (), mask.value ()) }) } + +/// Set the maximum size of a single DMA segment the device may request. +/// +/// This method is usually called once from `probe()` as soon as the device capabilities are +/// known. +/// +/// # Safety +/// +/// This method must not be called concurrently with any DMA allocation or mapping primitives, +/// such as [`CoherentAllocation::alloc_attrs`]. +unsafe fn dma_set_max_seg_size (&self, size:u32 ) { +// SAFETY: +// - By the type invariant of `device::Device`, `self.as_ref().as_raw()` is valid. +// - The safety requirement of this function guarantees that there are no concurrent calls +// to DMA allocation and mapping primitives using this parameter. +unsafe { bindings::dma_set_max_seg_size (self.as_ref ().as_raw (), size) } + } }/// A DMA mask that holds a bitmask with the lowest `n` bits set.
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 687/2151 rust: scatterlist: honor the devices maximum segment size
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matteo Kloiber <[email protected]>
[ Upstream commit c15c5befd6d6150e92ab7c6c7fde1088e0f543e6 ]
SGTable::new() caps segment length at dma_max_mapping_size() only, which limits the DMA mapping path (e.g. swiotlb), not the device itself. The per-device limit from dma_set_max_seg_size() is ignored, so contiguous page segments can be longer than the declared max segment size, potentially causing problems for future drivers that use this abstraction.
--- rust/helpers/dma.c | 5 +++++ rust/kernel/scatterlist.rs | 12 ++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-)
rust/helpers/dma.c +5 -0
@@ -46,3 +46,8 @@ __rust_helper void rust_helper_dma_set_max_seg_size(struct device *dev, {dma_set_max_seg_size (dev, size); } + +__rust_helper unsigned int rust_helper_dma_get_max_seg_size(struct device *dev) +{ +return dma_get_max_seg_size (dev); +}
rust/kernel/scatterlist.rs +10 -2
@@ -349,15 +349,23 @@ fn new( page_vec.push (page.as_ptr (), flags)?; } +// Cap segments at both the DMA mapping-path limit and the device's declared +// max segment size. +// // `dma_max_mapping_size` returns `size_t`, but `sg_alloc_table_from_pages_segment()` takes // an `unsigned int`. // // SAFETY: `dev.as_raw()` is a valid pointer to a `struct device`. -let max_segment =match unsafe { bindings::dma_max_mapping_size (dev.as_raw ()) } { +let max_mapping_size =match unsafe { bindings::dma_max_mapping_size (dev.as_raw ()) } {0 => u32::MAX , - max_segment => u32::try_from (max_segment).unwrap_or (u32::MAX ), + max_mapping_size => u32::try_from (max_mapping_size).unwrap_or (u32::MAX ), }; +// SAFETY: `dev.as_raw()` is a valid pointer to a `struct device`. +let max_seg_size =unsafe { bindings::dma_get_max_seg_size (dev.as_raw ()) }; + +let max_segment = max_mapping_size.min (max_seg_size); + Ok(try_pin_init!(&this in Self { // SAFETY: // - `page_vec` is a `KVec` of valid `struct page *` obtained from `pages`.
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 688/2151 kconfig: warn about malformed KCONFIG_PROBABILITY values
In reply to Greg Kroah-Hartman6.18-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
@@ -186,12 +186,23 @@ static void 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;
@@ -227,6 +238,9 @@ static void conf_set_all_new_symbols(enum conf_def_mode mode)perror ("KCONFIG_PROBABILITY" );exit (1 ); } + +if (warned &&getenv ("KCONFIG_WERROR" )) +exit (1 ); }menu_for_each_entry (menu) {
scripts/kconfig/tests/conftest.py +6 -0
@@ -308,6 +308,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 689/2151 ASoC: fsl_asrc: use regmap_write_bits to update clock source registers
In reply to Greg Kroah-Hartman6.18-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 690/2151 perf mem: Fix size tracking for mem_lvls in perf_script__meminfo_scnprintf()
In reply to Greg Kroah-Hartman6.18-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
@@ -607,7 +607,7 @@ int perf_script__meminfo_scnprintf(char *out, size_t sz, const struct mem_info * 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 691/2151 NFS: use TCP for MOUNT when xprtsec= selects TLS
In reply to Greg Kroah-Hartman6.18-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
@@ -402,6 +402,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 692/2151 PCI/TPH: Validate the firmware Steering Tag response
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Huang <[email protected]>
[ Upstream commit 5c382ef425c875bf854d411fb0a45909878a233a ]
TPH _DSM returns an eight-byte Steering Tag information buffer. Checking only the ACPI object type allows a short firmware response to be read beyond the end of its buffer.
For safety, require a non-NULL buffer containing the complete value before copying it. Use memcpy() so that reading the response does not depend on the alignment of the firmware buffer.
--- drivers/pci/tph.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/pci/tph.c +4 -2
@@ -119,12 +119,14 @@ static acpi_status tph_invoke_dsm(acpi_handle handle, u32 cpu_uid,if (!out_obj)return AE_ERROR ; -if (out_obj->type !=ACPI_TYPE_BUFFER ) { +if (out_obj->type !=ACPI_TYPE_BUFFER || + out_obj->buffer.length <sizeof (st_out->value) || + !out_obj->buffer.pointer) {ACPI_FREE (out_obj);return AE_ERROR ; } - st_out->value = *((u64 *)(out_obj->buffer.pointer)); +memcpy (&st_out->value, out_obj->buffer.pointer,sizeof (st_out->value));ACPI_FREE (out_obj);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 693/2151 bpf: Adjust bpf_func to account for CFI offset in bpf_jit_free on riscv
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pu Lehui <[email protected]>
[ Upstream commit 93df8ae3267f19bf0c1135d26a0e21145dd0ea1c ]
When CFI is enabled, the actual BPF program entry point is shifted forward by a CFI preamble. During bpf_jit_free(), this shifted pointer causes the wrong ro_header to be fetched, leading to a potential invalid memory free.
Fix this by subtracting cfi_get_offset() from prog->bpf_func to correctly restore the original JITed allocation address before freeing.
--- arch/riscv/net/bpf_jit_core.c | 1 + 1 file changed, 1 insertion(+)
arch/riscv/net/bpf_jit_core.c +1 -0
@@ -254,6 +254,7 @@ void bpf_jit_free(struct bpf_prog *prog)kfree (jit_data->ctx.offset);kfree (jit_data); } + prog->bpf_func = (void *)prog->bpf_func -cfi_get_offset (); hdr =bpf_jit_binary_pack_hdr (prog);bpf_jit_binary_pack_free (hdr,NULL );WARN_ON_ONCE (!bpf_prog_kallsyms_verify_off (prog));
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 694/2151 ASoC: fsl_asrc: check the second front-end DMA channel
In reply to Greg Kroah-Hartman6.18-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
@@ -246,6 +246,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 695/2151 ASoC: adau17x1: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.18-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 696/2151 ASoC: ak4642: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.18-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 697/2151 ASoC: es8316: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.18-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
@@ -808,9 +808,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 698/2151 ASoC: es8323: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit b7c3f95915a9e791fc8721ce1ecc037f7a55d58c ]
es8323_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/es8323.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/codecs/es8323.c +1 -3
@@ -704,9 +704,7 @@ static int es8323_resume(struct snd_soc_component *component)struct es8323_priv *es8323 =snd_soc_component_get_drvdata (component);regcache_cache_only (es8323->regmap, false); -regcache_sync (es8323->regmap); - -return 0 ; +return regcache_sync (es8323->regmap); }static const struct snd_soc_component_driver soc_component_dev_es8323 = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 699/2151 ASoC: nau8540: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.18-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
@@ -897,9 +897,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 700/2151 ASoC: rt1011: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.18-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 701/2151 ASoC: rt1016: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.18-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 702/2151 ASoC: rt1305: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.18-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 703/2151 ASoC: rt1308: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.18-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 704/2151 ASoC: rt1318: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit a5735b341c6e8cff5f5f9480295012a5ceebb665 ]
rt1318_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/rt1318.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/codecs/rt1318.c +1 -2
@@ -1076,8 +1076,7 @@ static int rt1318_resume(struct snd_soc_component *component)struct rt1318_priv *rt1318 =snd_soc_component_get_drvdata (component);regcache_cache_only (rt1318->regmap, false); -regcache_sync (rt1318->regmap); - return 0; + return regcache_sync(rt1318->regmap); }#else #define rt1318_suspend NULL
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 705/2151 ASoC: rt5616: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.18-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
@@ -1247,8 +1247,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 706/2151 ASoC: rt5659: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.18-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 707/2151 ASoC: rt5660: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.18-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
@@ -1147,9 +1147,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 708/2151 ASoC: rt5665: return cache sync errors from resume
In reply to Greg Kroah-Hartman6.18-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
@@ -4389,9 +4389,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 709/2151 ASoC: mediatek: mt8188: mt8188-afe-clk: Handle tuner clock enable errors
In reply to Greg Kroah-Hartman6.18-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 710/2151 ASoC: mediatek: mt8188: mt8188-afe-clk: Propagate regmap update errors
In reply to Greg Kroah-Hartman6.18-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 711/2151 ASoC: mediatek: mt8188: mt8188-afe-clk: Handle clock enable errors
In reply to Greg Kroah-Hartman6.18-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 712/2151 ASoC: mediatek: mt8188: mt8188-afe-pcm: Handle runtime resume errors
In reply to Greg Kroah-Hartman6.18-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
@@ -3032,22 +3032,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 713/2151 ASoC: fsl_asrc_m2m: fix pm_runtime usage counter leak on error
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 5626653a4bdf32812d66b970860677cd9d7a2190 ]
pm_runtime_get_sync() leaves the runtime PM usage counter incremented even when it fails, but the error path in fsl_asrc_m2m_comp_open() does not call pm_runtime_put_noidle() to balance it, leaking a reference each time resume fails.
Use pm_runtime_resume_and_get() instead, which automatically drops the usage counter on failure, fixing the leak.
--- sound/soc/fsl/fsl_asrc_m2m.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/fsl/fsl_asrc_m2m.c +1 -1
@@ -314,7 +314,7 @@ static int fsl_asrc_m2m_comp_open(struct snd_compr_stream *stream)if (ret) goto error_alloc_out_buf; - ret =pm_runtime_get_sync (dev); + ret =pm_runtime_resume_and_get (dev);if (ret <0 ) {dev_err (dev,"Failed to power up asrc\n" ); goto err_pm_runtime;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 714/2151 spi: rockchip-sfc: disable runtime PM in remove
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiawen Liu <[email protected]>
[ Upstream commit 34e32e9ade58e32daf933974c9b697d066fc5aaa ]
rockchip_sfc_probe enables runtime PM and leaves the device active with a usage count held by pm_runtime_get_noresume(). The remove callback only disables the clocks and does not disable runtime PM, leaving the device in an inconsistent state and leaking the runtime PM reference. Add the missing runtime PM teardown in rockchip_sfc_remove to balance the probe's enable and get_noresume calls.
Stable-dep-of: 926f9c44a76f ("spi: rockchip-sfc: skip DMA cleanup in PIO mode")
--- drivers/spi/spi-rockchip-sfc.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/spi/spi-rockchip-sfc.c +5 -0
@@ -744,6 +744,11 @@ static void rockchip_sfc_remove(struct platform_device *pdev)struct spi_controller *host = sfc->host;spi_unregister_controller (host); +pm_runtime_get_sync (&pdev->dev); +pm_runtime_put_noidle (&pdev->dev); +pm_runtime_disable (&pdev->dev); +pm_runtime_set_suspended (&pdev->dev); +pm_runtime_dont_use_autosuspend (&pdev->dev);dma_unmap_single (&pdev->dev, sfc->dma_buffer, sfc->max_iosize,DMA_BIDIRECTIONAL );free_pages ((unsigned long )sfc->buffer,get_order (sfc->max_iosize));
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 715/2151 spi: rockchip-sfc: skip DMA cleanup in PIO mode
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Myeonghun Pak <[email protected]>
[ Upstream commit 926f9c44a76fe9e722180d0804c607c6cf1ebbb4 ]
With rockchip,sfc-no-dma, probe skips allocating and mapping the transfer buffer. However, controller registration failure and driver removal still call dma_unmap_single() for that nonexistent mapping.
Guard the DMA mapping and buffer cleanup with use_dma. Keep the existing cleanup for allocation and mapping failures on the DMA path.
This issue was identified during our ongoing static-analysis research while reviewing kernel code.
--- drivers/spi/spi-rockchip-sfc.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/spi/spi-rockchip-sfc.c +10 -6
@@ -720,10 +720,12 @@ static int rockchip_sfc_probe(struct platform_device *pdev)return 0 ; err_register: -dma_unmap_single (dev, sfc->dma_buffer, sfc->max_iosize, -DMA_BIDIRECTIONAL ); +if (sfc->use_dma) +dma_unmap_single (dev, sfc->dma_buffer, sfc->max_iosize, +DMA_BIDIRECTIONAL ); err_dma_map: -free_pages ((unsigned long )sfc->buffer,get_order (sfc->max_iosize)); +if (sfc->use_dma) +free_pages ((unsigned long )sfc->buffer,get_order (sfc->max_iosize)); err_dma:pm_runtime_get_sync (dev);pm_runtime_put_noidle (dev);
@@ -749,9 +751,11 @@ static void rockchip_sfc_remove(struct platform_device *pdev)pm_runtime_disable (&pdev->dev);pm_runtime_set_suspended (&pdev->dev);pm_runtime_dont_use_autosuspend (&pdev->dev); -dma_unmap_single (&pdev->dev, sfc->dma_buffer, sfc->max_iosize, -DMA_BIDIRECTIONAL ); -free_pages ((unsigned long )sfc->buffer,get_order (sfc->max_iosize)); +if (sfc->use_dma) { +dma_unmap_single (&pdev->dev, sfc->dma_buffer, sfc->max_iosize, +DMA_BIDIRECTIONAL ); +free_pages ((unsigned long )sfc->buffer,get_order (sfc->max_iosize)); + }clk_disable_unprepare (sfc->clk);clk_disable_unprepare (sfc->hclk);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 716/2151 iio: accel: bma220: publish the SPI driver ACPI alias
In reply to Greg Kroah-Hartman6.18-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
@@ -307,12 +307,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 717/2151 dt-bindings: arm: mediatek: Fix MT6779 audsys compatible
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rob Herring (Arm) <[email protected]>
[ Upstream commit 034b3b1ce25a62222920e2bb3b6a0c7ef160b108 ]
The correct name for the MediaTek MT6779 audsys compatible is "mediatek,mt6779-audio", not "mediatek,mt6779-audsys". The original .txt binding was correct.
--- .../devicetree/bindings/arm/mediatek/mediatek,audsys.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/arm/mediatek/mediatek,audsys.yaml +1 -1
@@ -19,7 +19,7 @@ properties: - enum: - mediatek,mt2701-audsys - mediatek,mt6765-audsys - - mediatek,mt6779-audsys + - mediatek,mt6779-audio - mediatek,mt7622-audsys - mediatek,mt8167-audsys - mediatek,mt8173-audsys
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 718/2151 powerpc/ftrace: Dont restore r13 during ftrace_regs_caller
In reply to Greg Kroah-Hartman6.18-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
@@ -220,7 +220,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) #if defined(CONFIG_LIVEPATCH_64) || defined(CONFIG_PPC_FTRACE_OUT_OF_LINE)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 719/2151 perf llvm: Fix memory leak of args->fileloc in symbol__disassemble_llvm()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tengda Wu <[email protected]>
[ Upstream commit fe529886843f451ad6da7e65d53325432e0f80fb ]
In symbol__disassemble_llvm(), after calling llvm_addr2line(), if the subsequent disasm_line__new() fails, the code directly jumps to 'err' without freeing args->fileloc, leading to a memory leak.
Fix this by explicitly calling free(args->fileloc) before jumping to the error handling path when disasm_line__new() fails.
--- tools/perf/util/llvm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/perf/util/llvm.c +3 -1
@@ -248,8 +248,10 @@ int symbol__disassemble_llvm(const char *filename, struct symbol *sym, (unsigned int *)&args->line_nr, false, NULL); dl =disasm_line__new (args); -if (dl ==NULL ) +if (dl ==NULL ) { +free (args->fileloc); goto err; + }annotation_line__add (&dl->al, ¬es->src->source);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 720/2151 sysctl: unregister tables before freeing bitmap
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yibo Tan <[email protected]>
[ Upstream commit 238dfe02fb0a9f72d7fd275d74ce80f13923ef31 ]
The table registered for bitmap_0001 retains a pointer to test_data.bitmap_0001. unregister_sysctl_table() prevents new handlers from starting and waits for active handlers to finish.
test_sysctl_exit() currently frees the bitmap before unregistering the table. A concurrent read during module removal can therefore enter proc_do_large_bitmap() while the bitmap is freed. KASAN reports a slab-use-after-free in _find_next_bit().
Unregister all tables before freeing the bitmap so the unregister rundown provides the required lifetime boundary.
The unmodified module reproduced the use-after-free in three KASAN runs. With this change, three runs each completed 100 load, read and unload race rounds without a kernel diagnostic.
--- lib/test_sysctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/test_sysctl.c +1 -1
@@ -321,11 +321,11 @@ module_init(test_sysctl_init); static void __exit test_sysctl_exit(void) { -kfree (test_data.bitmap_0001);for (int i =0 ; i <TEST_H_SIZE ; i++) {if (ctl_headers[i])unregister_sysctl_table (ctl_headers[i]); } +kfree (test_data.bitmap_0001); }module_exit (test_sysctl_exit);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 721/2151 vfio: Reject a second cdev open before mutating shared device state
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Williamson <[email protected]>
[ Upstream commit 258ba46543abdd36844f04bba8b4022a5731d873 ]
The cdev single-open check lives in vfio_df_open(), which runs at the end of the bind ioctl, after vfio_df_ioctl_bind_iommufd() has already updated state shared across all opens: vfio_df_check_token() can set the PF vf_token and vfio_df_get_kvm_safe() records the caller's KVM pointer in device->kvm and takes a reference.
A second cdev bind of an already-open device runs both, only to be rejected in vfio_df_open(). The error path clears device->kvm and drops the reference, tearing down the current opener's KVM association and potentially resulting in an unbalanced reference on close or premature release, while the vf_token remains clobbered.
Move the single-open check into vfio_df_ioctl_bind_iommufd() ahead of both mutations, so a bind that cannot complete leaves the current opener's state untouched. df->group is NULL on this path, so a non-zero open_count is exactly what vfio_df_open() rejected. The test in vfio_df_open() becomes redundant and is removed.
Return -EBUSY rather than -EINVAL here. The arguments are not invalid, the device is in use, which could be a transient condition due to a delayed fput if the prior user is terminated. This provides compatibility with the group path, where a group open returns -EBUSY, and users may choose bounded polling to detect such a transient condition.
--- drivers/vfio/device_cdev.c | 12 ++++++++++++ drivers/vfio/vfio_main.c | 7 ------- 2 files changed, 12 insertions(+), 7 deletions(-)
drivers/vfio/device_cdev.c +12 -0
@@ -121,6 +121,18 @@ long vfio_df_ioctl_bind_iommufd(struct vfio_device_file *df, goto out_unlock; } +/* +* The cdev path allows only a single open. Reject a second open here, +* before the VF token and device->kvm updates below would clobber the +* current opener's state on a bind that cannot complete. Return -EBUSY +* rather than -EINVAL since a delayed release of the prior opener can +* make this transient. +*/ +if (device->open_count) { + ret = -EBUSY ; + goto out_unlock; + } + ret =vfio_df_check_token (device, &bind);if (ret) goto out_unlock;
drivers/vfio/vfio_main.c +0 -7
@@ -567,13 +567,6 @@ int vfio_df_open(struct vfio_device_file *df)lockdep_assert_held (&device->dev_set->lock); -/* -* Only the group path allows the device to be opened multiple -* times. The device cdev path doesn't have a secure way for it. -*/ -if (device->open_count !=0 && !df->group) -return -EINVAL ; - device->open_count++;if (device->open_count ==1 ) { ret =vfio_df_device_first_open (df);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 722/2151 arm64: dts: qcom: x1e80100-dell-inspiron-14-plus-7441: fix touchscreen i2c address
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charlie Garner <[email protected]>
[ Upstream commit 52c679ecfd03312c585bfbfe1c7a0d3a9c25cf0e ]
The touchscreen is at i2c address 0x09, not 0x10. Nothing responds at 0x10, so i2c_hid_of never probes and the panel does not work. tlmm pin 51, the touchscreen interrupt, is left unclaimed as a result.
Scanning the bus shows only 0x09 responding (0x28 also ACKs but returns zeros, presumably an alternate address on the same controller). Linux bus 0 here is the GENI I2C controller at 0xa80000, which is i2c8 in the DT:
# i2cdetect -y -r 0 00: -- 09 -- -- -- -- -- -- ...
and 0x09 returns a valid HID-over-I2C descriptor:
1e 00 descriptor length 30 00 01 bcdVersion 1.00 6b 03 report descriptor length 875 ... bd 29 vendor 0x29bd 03 11 product 0x1103
whose report descriptor opens as a Windows Precision touchscreen:
05 0d Usage Page (Digitizer) 09 04 Usage (Touch Screen) a1 01 Collection (Application) 85 10 Report ID (0x10) 05 0d Usage Page (Digitizer) 09 22 Usage (Finger) a1 02 Collection (Logical) 09 42 Usage (Tip Switch) ... Contact Id, 16-bit X/Y, unit exponent -3
The firmware agrees. The DSDT describes one touchscreen, \_SB.TSC1, on I2C9 (QUP_1_SE_0 at 0xa80000, i2c8 here) with its interrupt on GPIO 51. Its _HID, slave address and HID descriptor address are placeholders that UEFI fills in at boot, and on this machine they read LXST2021, 0x09 and 0x0001. Nothing at 0x28 is described. The Latitude 7455 DT already has the same LXST2021 touchscreen at 0x09.
The original touchscreen@10 node is identical to the ones in x1-crd.dtsi, x1e80100-dell-xps13-9345.dts and x1e78100-lenovo-thinkpad-t14s.dtsi, which the Inspiron DT was based on.
Rename the node to match the corrected unit address.
--- .../boot/dts/qcom/x1e80100-dell-inspiron-14-plus-7441.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/x1e80100-dell-inspiron-14-plus-7441.dts +2 -2
@@ -25,9 +25,9 @@ &gpu_zap_shader { }; &i2c8 { - touchscreen@10 { + touchscreen@9 { compatible = "hid-over-i2c"; - reg = <0x10>; + reg = <0x9>; hid-descr-addr = <0x1>; interrupts-extended = <&tlmm 51 IRQ_TYPE_LEVEL_LOW>;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 723/2151 arm64: dts: qcom: x1-crd: Mark the EC reset gpio as reserved
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abel Vesa <[email protected]>
[ Upstream commit 099cd579fa73c142fde2f7e3ea473f334792a249 ]
GPIO 65 from TLMM is connected to the embedded controller's active-high reset line. Asserting it causes the fans to run at full speed during reset and leaves the keyboard non-functional afterwards.
Reserve it to prevent Linux from requesting or reconfiguring it.
--- arch/arm64/boot/dts/qcom/x1-crd.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/qcom/x1-crd.dtsi +1 -0
@@ -1476,6 +1476,7 @@ right_tweeter: speaker@0,1 { &tlmm { gpio-reserved-ranges = <34 2>, /* Unused */ <44 4>, /* SPI (TPM) */ + <65 1>, /* EC reset */ <238 1>; /* UFS Reset */ edp_reg_en: edp-reg-en-state {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 724/2151 arm64: dts: qcom: x1e001de-devkit: Mark the EC reset gpio as reserved
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abel Vesa <[email protected]>
[ Upstream commit 0297c8e98a054fc2a0afcb96114f57603a02594e ]
GPIO 65 from TLMM is used by the embedded controller as its reset line.
On some devices, toggling the embedded controller reset line makes the device not power up at all, unless the battery is unplugged.
So reserve it in order to prevent Linux from requesting or reconfiguring it.
--- arch/arm64/boot/dts/qcom/x1e001de-devkit.dts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/x1e001de-devkit.dts +2 -1
@@ -1188,7 +1188,8 @@ wcd_tx: codec@0,3 { }; &tlmm { - gpio-reserved-ranges = <44 4>; /* SPI (TPM) */ + gpio-reserved-ranges = <44 4>, /* SPI (TPM) */ + <65 1>; /* EC reset */ eusb3_reset_n: eusb3-reset-n-state { pins = "gpio6";
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 725/2151 arm64: dts: qcom: x1e78100-t14s: Mark the EC reset gpio as reserved
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abel Vesa <[email protected]>
[ Upstream commit 07321595ce693eea5854120869a8b1560d7b14d6 ]
GPIO 65 from TLMM is used by the embedded controller as its reset line.
On some devices, toggling the embedded controller reset line makes the device not power up at all, unless the battery is unplugged.
So reserve it in order to prevent Linux from requesting or reconfiguring it.
--- arch/arm64/boot/dts/qcom/x1e78100-lenovo-thinkpad-t14s.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/qcom/x1e78100-lenovo-thinkpad-t14s.dtsi +1 -0
@@ -1284,6 +1284,7 @@ wcd_tx: codec@0,3 { &tlmm { gpio-reserved-ranges = <34 2>, /* Unused */ <44 4>, /* SPI (TPM) */ + <65 1>, /* EC reset */ <72 2>, /* Secure EC I2C connection (?) */ <238 1>; /* UFS Reset */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 726/2151 arm64: dts: qcom: x1e80100-dell-xps13-9345: Mark the EC reset gpio as reserved
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abel Vesa <[email protected]>
[ Upstream commit 5630150c90db33df906d26cc4b6ff56315471352 ]
GPIO 65 from TLMM is used by the embedded controller as its reset line.
On some devices, toggling the embedded controller reset line makes the device not power up at all, unless the battery is unplugged.
So reserve it in order to prevent Linux from requesting or reconfiguring it.
--- arch/arm64/boot/dts/qcom/x1e80100-dell-xps13-9345.dts | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/qcom/x1e80100-dell-xps13-9345.dts +1 -0
@@ -1070,6 +1070,7 @@ &smb2360_1_eusb2_repeater { &tlmm { gpio-reserved-ranges = <44 4>, /* SPI11 (TPM) */ <76 4>, /* SPI19 (TZ Protected) */ + <65 1>, /* EC reset */ <238 1>; /* UFS Reset */ cam_indicator_en: cam-indicator-en-state {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 727/2151 arm64: dts: qcom: x1e80100-yoga-slim7x: Mark the EC reset gpio as reserved
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abel Vesa <[email protected]>
[ Upstream commit a92ac66d35dfd8438b6e40bfb956ff69365798ac ]
GPIO 65 from TLMM is used by the embedded controller as its reset line.
On some devices, toggling the embedded controller reset line makes the device not power up at all, unless the battery is unplugged.
So reserve it in order to prevent Linux from requesting or reconfiguring it.
--- arch/arm64/boot/dts/qcom/x1e80100-lenovo-yoga-slim7x.dts | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/qcom/x1e80100-lenovo-yoga-slim7x.dts +1 -0
@@ -1348,6 +1348,7 @@ right_tweeter: speaker@0,1 { &tlmm { gpio-reserved-ranges = <34 2>, /* Unused */ <44 4>, /* SPI (TPM) */ + <65 1>, /* EC reset */ <238 1>; /* UFS Reset */ edp_reg_en: edp-reg-en-state {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 728/2151 arm64: dts: qcom: x1e80100-qcp: Mark the EC reset gpio as reserved
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abel Vesa <[email protected]>
[ Upstream commit fd7d7b5d307f3a475e9555dfd89ff80cfae46b3c ]
GPIO 65 from TLMM is used by the embedded controller as its reset line.
On some devices, toggling the embedded controller reset line makes the device not power up at all, unless the battery is unplugged.
So reserve it in order to prevent Linux from requesting or reconfiguring it.
--- arch/arm64/boot/dts/qcom/x1e80100-qcp.dts | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/qcom/x1e80100-qcp.dts +1 -0
@@ -1177,6 +1177,7 @@ wcd_tx: codec@0,3 { &tlmm { gpio-reserved-ranges = <33 3>, /* Unused */ <44 4>, /* SPI (TPM) */ + <65 1>, /* EC reset */ <238 1>; /* UFS Reset */ edp_reg_en: edp-reg-en-state {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 729/2151 arm64: dts: qcom: x1-asus-zenbook-a14: Mark the EC reset gpio as reserved
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abel Vesa <[email protected]>
[ Upstream commit 48213677c9173680de328785768ea56315bfdd53 ]
GPIO 65 from TLMM is used by the embedded controller as its reset line.
On some devices, toggling the embedded controller reset line makes the device not power up at all, unless the battery is unplugged.
So reserve it in order to prevent Linux from requesting or reconfiguring it.
--- arch/arm64/boot/dts/qcom/x1-asus-zenbook-a14.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/qcom/x1-asus-zenbook-a14.dtsi +1 -0
@@ -1223,6 +1223,7 @@ wcd_tx: codec@0,3 { &tlmm { gpio-reserved-ranges = <44 4>, /* SPI11, TZ Protected */ + <65 1>, /* EC reset */ <90 1>; /* Unknown, TZ Protected */ cam_indicator_en: cam-indicator-en-state {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 730/2151 arm64: dts: qcom: x1-dell-thena: Mark the EC reset gpio as reserved
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abel Vesa <[email protected]>
[ Upstream commit 2c376a1b675075018c77d040ba1595db896a75f6 ]
GPIO 65 from TLMM is used by the embedded controller as its reset line.
On some devices, toggling the embedded controller reset line makes the device not power up at all, unless the battery is unplugged.
So reserve it in order to prevent Linux from requesting or reconfiguring it.
--- arch/arm64/boot/dts/qcom/x1-dell-thena.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/qcom/x1-dell-thena.dtsi +1 -0
@@ -1301,6 +1301,7 @@ right_tweeter: speaker@0,1 { &tlmm { gpio-reserved-ranges = <44 4>, /* SPI11 (TPM) */ + <65 1>, /* EC reset */ <76 4>, /* SPI19 (TZ Protected) */ <80 2>, /* I2C20 (Battery SMBus) */ <238 1>; /* UFS Reset */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 731/2151 arm64: dts: qcom: x1-hp-omnibook-x14: Mark the EC reset gpio as reserved
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abel Vesa <[email protected]>
[ Upstream commit 4ea8c5b790dd884bb5118336dfcb2c648cb40b2d ]
GPIO 65 from TLMM is used by the embedded controller as its reset line.
On some devices, toggling the embedded controller reset line makes the device not power up at all, unless the battery is unplugged.
So reserve it in order to prevent Linux from requesting or reconfiguring it.
--- arch/arm64/boot/dts/qcom/x1-hp-omnibook-x14.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/qcom/x1-hp-omnibook-x14.dtsi +1 -0
@@ -1285,6 +1285,7 @@ wcd_tx: codec@0,3 { &tlmm { gpio-reserved-ranges = <34 2>, /* Unused */ <44 4>, /* SPI (TPM) */ + <65 1>, /* EC reset */ <72 2>, /* Secure EC I2C connection (?) */ <238 1>; /* UFS Reset */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 732/2151 arm64: dts: qcom: x1p42100-thinkbook-16: Mark the EC reset gpio as reserved
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abel Vesa <[email protected]>
[ Upstream commit d15d83967b113e43a4811164ada19909d99c93a7 ]
GPIO 65 from TLMM is used by the embedded controller as its reset line.
On some devices, toggling the embedded controller reset line makes the device not power up at all, unless the battery is unplugged.
So reserve it in order to prevent Linux from requesting or reconfiguring it.
--- arch/arm64/boot/dts/qcom/x1p42100-lenovo-thinkbook-16.dts | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/qcom/x1p42100-lenovo-thinkbook-16.dts +1 -0
@@ -1275,6 +1275,7 @@ wcd_tx: codec@0,3 { &tlmm { gpio-reserved-ranges = <34 2>, /* Unused */ + <65 1>, /* EC reset */ <72 2>; /* Secure EC I2C connection (?) */ edp_hpd_default: edp-hpd-default-state {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 733/2151 dt-bindings: vendor-prefixes: Add General Mobile
In reply to Greg Kroah-Hartman6.18-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
@@ -626,6 +626,8 @@ patternProperties: description: Gemei Digital Technology Co., Ltd. "^gemtek,.*": description: Gemtek Technology Co., Ltd. + "^generalmobile,.*": + description: General Mobile Fzc. "^genesys,.*": description: Genesys Logic, Inc. "^genexis,.*":
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 734/2151 perf c2c: Fix documented default coalesce fields
In reply to Greg Kroah-Hartman6.18-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
@@ -311,7 +311,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 735/2151 perf pmu: Add PMU kind to simplify differentiating
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit f0feb21e0a10c50e3a154e9bdf3fbb8a38480251 ]
Rather than perf_pmu__is_xxx calls, and a notion of kind so that a single call can be used.
Stable-dep-of: aa9265d5073c ("perf evlist: Don't restrict uncore events to PMU CPUs")
--- tools/perf/util/pmu.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
tools/perf/util/pmu.h +34 -0
@@ -37,6 +37,19 @@ struct perf_pmu_caps {struct list_head list; }; +enum pmu_kind { +/* A perf event syscall PMU. */ +PERF_PMU_KIND_PE , +/* A perf tool provided DRM PMU. */ +PERF_PMU_KIND_DRM , +/* A perf tool provided HWMON PMU. */ +PERF_PMU_KIND_HWMON , +/* Perf tool provided PMU for tool events like time. */ +PERF_PMU_KIND_TOOL , +/* A testing PMU kind. */ +PERF_PMU_KIND_FAKE +}; +enum {PERF_PMU_TYPE_PE_START =0 ,PERF_PMU_TYPE_PE_END =0xFFFDFFFF ,
@@ -306,4 +319,25 @@ void perf_pmu__delete(struct perf_pmu *pmu);const char *perf_pmu__name_from_config (struct perf_pmu *pmu,u64 config);bool perf_pmu__is_fake (const struct perf_pmu *pmu); +static inline enum pmu_kind perf_pmu__kind (const struct perf_pmu *pmu) +{ +__u32 type; + +if (!pmu) +return PERF_PMU_KIND_PE ; + + type = pmu->type; +if (type <=PERF_PMU_TYPE_PE_END ) +return PERF_PMU_KIND_PE ; +if (type <=PERF_PMU_TYPE_DRM_END ) +return PERF_PMU_KIND_DRM ; +if (type <=PERF_PMU_TYPE_DRM_END ) +return PERF_PMU_KIND_DRM ; +if (type <=PERF_PMU_TYPE_HWMON_END ) +return PERF_PMU_KIND_HWMON ; +if (type ==PERF_PMU_TYPE_TOOL ) +return PERF_PMU_KIND_TOOL ; +return PERF_PMU_KIND_FAKE ; +} +#endif /* __PMU_H */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 736/2151 perf evlist: Special map propagation for tool events that read on 1 CPU
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit ff8548172f63288b5c2b0fda5a4a4be294f610f1 ]
Tool events like duration_time don't need a perf_cpu_map that contains all online CPUs.
Having such a perf_cpu_map causes overheads when iterating between events for CPU affinity.
During parsing mark events that just read on a single CPU map index as such, then during map propagation set up the evsel's CPUs and thereby the evlists accordingly.
The setting cannot be done early in parsing as user CPUs are only fully known when evlist__create_maps is called.
Stable-dep-of: aa9265d5073c ("perf evlist: Don't restrict uncore events to PMU CPUs")
--- tools/lib/perf/evlist.c | 36 ++++++++++++++++++++++--- tools/lib/perf/include/internal/evsel.h | 2 ++ tools/perf/util/parse-events.c | 1 + tools/perf/util/pmu.c | 11 ++++++++ tools/perf/util/pmu.h | 2 ++ 5 files changed, 48 insertions(+), 4 deletions(-)
tools/lib/perf/evlist.c +32 -4
@@ -101,6 +101,28 @@ static void __perf_evlist__propagate_maps(struct perf_evlist *evlist, evsel->cpus =perf_cpu_map__get (evlist->user_requested_cpus); } +/* +* Tool events may only read on the first CPU index to avoid double +* counting things like duration_time. Make the evsel->cpus contain just +* that single entry otherwise we may spend time changing affinity to +* CPUs that just have tool events, etc. +*/ +if (evsel->reads_only_on_cpu_idx0 &&perf_cpu_map__nr (evsel->cpus) >0 ) { +struct perf_cpu_map *srcs[3 ] = { + evlist->all_cpus, + evlist->user_requested_cpus, + evsel->pmu_cpus, + }; +for (size_t i =0 ; i <ARRAY_SIZE (srcs); i++) { +if (!srcs[i]) +continue ; + +perf_cpu_map__put (evsel->cpus); + evsel->cpus =perf_cpu_map__new_int (perf_cpu_map__cpu (srcs[i],0 ).cpu); +break ; + } + } +/* Sanity check assert before the evsel is potentially removed. */ assert (!evsel->requires_cpu || !perf_cpu_map__has_any_cpu (evsel->cpus));
@@ -133,16 +155,22 @@ static void __perf_evlist__propagate_maps(struct perf_evlist *evlist,static void perf_evlist__propagate_maps (struct perf_evlist *evlist) { -struct perf_evsel *evsel, *n; - evlist->needs_map_propagation = true;/* Clear the all_cpus set which will be merged into during propagation. */ perf_cpu_map__put (evlist->all_cpus); evlist->all_cpus =NULL ; -list_for_each_entry_safe (evsel, n, &evlist->entries, node) -__perf_evlist__propagate_maps (evlist, evsel); +/* 2 rounds so that reads_only_on_cpu_idx0 benefit from knowing the other CPU maps. */ +for (int round =0 ; round <2 ; round++) { +struct perf_evsel *evsel, *n; + +list_for_each_entry_safe (evsel, n, &evlist->entries, node) { +if ((!evsel->reads_only_on_cpu_idx0 && round ==0 ) || + (evsel->reads_only_on_cpu_idx0 && round ==1 )) +__perf_evlist__propagate_maps (evlist, evsel); + } + } } void perf_evlist__add(struct perf_evlist *evlist,
tools/lib/perf/include/internal/evsel.h +2 -0
@@ -128,6 +128,8 @@ struct perf_evsel {bool requires_cpu;/** Is the PMU for the event a core one? Effects the handling of own_cpus. */ bool is_pmu_core; +/** Does the evsel on read on the first CPU index such as tool time events? */ +bool reads_only_on_cpu_idx0;int idx; };
tools/perf/util/parse-events.c +1 -0
@@ -309,6 +309,7 @@ __add_event(struct list_head *list, int *idx, evsel->core.pmu_cpus = pmu_cpus; evsel->core.requires_cpu = pmu ? pmu->is_uncore : false; evsel->core.is_pmu_core = is_pmu_core; + evsel->core.reads_only_on_cpu_idx0 =perf_pmu__reads_only_on_cpu_idx0 (attr); evsel->pmu = pmu; evsel->alternate_hw_config = alternate_hw_config; evsel->first_wildcard_match = first_wildcard_match;
tools/perf/util/pmu.c +11 -0
@@ -2604,3 +2604,14 @@ const char *perf_pmu__name_from_config(struct perf_pmu *pmu, u64 config) }return NULL ; } + +bool perf_pmu__reads_only_on_cpu_idx0 (const struct perf_event_attr *attr) +{ +enum tool_pmu_event event; + +if (attr->type !=PERF_PMU_TYPE_TOOL ) +return false; + + event = (enum tool_pmu_event )attr->config; +return event !=TOOL_PMU__EVENT_USER_TIME && event !=TOOL_PMU__EVENT_SYSTEM_TIME ; +}
tools/perf/util/pmu.h +2 -0
@@ -319,6 +319,8 @@ void perf_pmu__delete(struct perf_pmu *pmu);const char *perf_pmu__name_from_config (struct perf_pmu *pmu,u64 config);bool perf_pmu__is_fake (const struct perf_pmu *pmu); +bool perf_pmu__reads_only_on_cpu_idx0 (const struct perf_event_attr *attr); +static inline enum pmu_kind perf_pmu__kind (const struct perf_pmu *pmu) {__u32 type;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 737/2151 perf evlist: Dont restrict uncore events to PMU CPUs
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nia Su <[email protected]>
[ Upstream commit aa9265d5073cb01b89f31ae030442873d4a259d3 ]
The PMU CPU map has different semantics for core and uncore PMUs.
For core PMUs, pmu_cpus contains the CPUs on which the event can be opened. Intersect the user-requested CPU map with the PMU CPU map to reject CPUs unsupported by the PMU.
For uncore PMUs, pmu_cpus is read from the PMU's cpumask sysfs attribute, which lists the default CPU to open the event on per socket/die, not the set of CPUs it can only be opened on. The user-requested CPU may override these defaults, and the driver can redirect the event to the appropriate control CPU.
Currently, __perf_evlist__propagate_maps() intersects the user-requested CPU map with pmu_cpus for all PMUs. If the user-requested CPU is not in pmu_cpus, the intersection becomes empty and the evsel is removed before perf_event_open() is called.
Add evsel->is_pmu_uncore, set once from pmu->is_uncore at parse time, to skip the intersection for uncore PMUs. Core PMUs, and other non-core PMUs such as software events, breakpoints, or tracepoints, continue to be restricted to their PMU CPU map.
--- tools/lib/perf/evlist.c | 5 +++-- tools/lib/perf/include/internal/evsel.h | 2 ++ tools/perf/util/evsel.c | 1 + tools/perf/util/parse-events.c | 1 + 4 files changed, 7 insertions(+), 2 deletions(-)
tools/lib/perf/evlist.c +3 -2
@@ -79,8 +79,9 @@ static void __perf_evlist__propagate_maps(struct perf_evlist *evlist, } } -/* Ensure cpus only references valid PMU CPUs. */ -if (!perf_cpu_map__has_any_cpu (evsel->cpus) && +/* Ensure cpus only references valid PMU CPUs, except for uncore PMUs. */ +if (!evsel->is_pmu_uncore && + !perf_cpu_map__has_any_cpu (evsel->cpus) && !perf_cpu_map__is_subset (evsel->pmu_cpus, evsel->cpus)) {struct perf_cpu_map *tmp =perf_cpu_map__intersect (evsel->pmu_cpus, evsel->cpus);
tools/lib/perf/include/internal/evsel.h +2 -0
@@ -128,6 +128,8 @@ struct perf_evsel {bool requires_cpu;/** Is the PMU for the event a core one? Effects the handling of own_cpus. */ bool is_pmu_core; +/** Is the PMU for the event an uncore one? */ +bool is_pmu_uncore;/** Does the evsel on read on the first CPU index such as tool time events? */ bool reads_only_on_cpu_idx0;int idx;
tools/perf/util/evsel.c +1 -0
@@ -497,6 +497,7 @@ struct evsel *evsel__clone(struct evsel *dest, struct evsel *orig) evsel->core.system_wide = orig->core.system_wide; evsel->core.requires_cpu = orig->core.requires_cpu; evsel->core.is_pmu_core = orig->core.is_pmu_core; + evsel->core.is_pmu_uncore = orig->core.is_pmu_uncore;if (orig->name) { evsel->name =strdup (orig->name);
tools/perf/util/parse-events.c +1 -0
@@ -309,6 +309,7 @@ __add_event(struct list_head *list, int *idx, evsel->core.pmu_cpus = pmu_cpus; evsel->core.requires_cpu = pmu ? pmu->is_uncore : false; evsel->core.is_pmu_core = is_pmu_core; + evsel->core.is_pmu_uncore = pmu ? pmu->is_uncore : false; evsel->core.reads_only_on_cpu_idx0 =perf_pmu__reads_only_on_cpu_idx0 (attr); evsel->pmu = pmu; evsel->alternate_hw_config = alternate_hw_config;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 738/2151 mtd: block: prevent reclaim I/O during request processing
In reply to Greg Kroah-Hartman6.18-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 739/2151 clk: qcom: gcc-qcs615: Fix GCC_CPUSS_GNOC_CBCR offset
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abel Vesa <[email protected]>
[ Upstream commit 51ff9ffa18758c465a1a67ca36a78c2a8a5f3b2e ]
According to the documentation, the offset GCC_CPUSS_GNOC_CBCR is 0x48004. Drop the extra zero, otherwise we land outside of regmap range.
--- drivers/clk/qcom/gcc-qcs615.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/gcc-qcs615.c +1 -1
@@ -3000,7 +3000,7 @@ static int gcc_qcs615_probe(struct platform_device *pdev)qcom_branch_set_clk_en (regmap,0x71004 );/* GCC_GPU_CFG_AHB_CLK */ qcom_branch_set_clk_en (regmap,0xb004 );/* GCC_VIDEO_AHB_CLK */ qcom_branch_set_clk_en (regmap,0xb040 );/* GCC_VIDEO_XO_CLK */ -qcom_branch_set_clk_en (regmap,0x480040 );/* GCC_CPUSS_GNOC_CLK */ +qcom_branch_set_clk_en (regmap,0x48004 );/* GCC_CPUSS_GNOC_CLK */ ret =qcom_cc_register_rcg_dfs (regmap, gcc_dfs_clocks,ARRAY_SIZE (gcc_dfs_clocks));
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 740/2151 wifi: ath12k: avoid double DMA unmap of held monitor RX buffers
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kang Yang <[email protected]>
[ Upstream commit febe1f8cbccc3434790bfc4d94d40c9dbd803065 ]
ath12k_dp_cc_cleanup() assumes that every rx_desc_info entry with a non-NULL skb still has an active DMA mapping and therefore always calls dma_unmap_single() before freeing the skb.
This assumption is not true for the monitor RX path. ath12k_wifi7_dp_rx_mon_mpdu_pop() may DMA-unmap a buffer and mark rxcb->unmapped before returning early to hold the MSDU for later reprocessing. In that state desc_info->skb remains populated, so module removal can trigger a second dma_unmap_single() from ath12k_dp_cc_cleanup().
IOMMU reports the issue as:
dma_unmap_phys()
dma_unmap_page_attrs()
ath12k_dp_cc_cleanup()
ath12k_dp_cmn_device_deinit()
ath12k_core_stop()
Skip dma_unmap_single() when rxcb->unmapped is already set and free the skb directly.
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c7-00108-QCAHMTSWPL_V1.0_V2.0_SILICONZ_UPSTREAM-3
--- drivers/net/wireless/ath/ath12k/dp.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath12k/dp.c +5 -4
@@ -1180,10 +1180,11 @@ static void ath12k_dp_cc_cleanup(struct ath12k_base *ab)if (!skb)continue ; -dma_unmap_single (ab->dev, -ATH12K_SKB_RXCB (skb)->paddr, - skb->len +skb_tailroom (skb), -DMA_FROM_DEVICE ); +if (!ATH12K_SKB_RXCB (skb)->unmapped) +dma_unmap_single (ab->dev, +ATH12K_SKB_RXCB (skb)->paddr, + skb->len +skb_tailroom (skb), +DMA_FROM_DEVICE );dev_kfree_skb_any (skb); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 741/2151 wifi: ath11k: fix reg_info_store leak in ath11k_service_ready_ext_event()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Johnson <[email protected]>
[ Upstream commit 64828f091c7de5c1324427b140fb545f93ef073f ]
Currently, while processing the WMI Service Ready Ext event, the iterator in ath11k_service_ready_ext_event() can dispatch the HAL Regulatory Capabilities handler ath11k_wmi_tlv_ext_soc_hal_reg_caps_parse() which can allocate ab->reg_info_store.
If a subsequent failure occurs during iteration, the ab->reg_info_store allocation is leaked.
Directly free and clear the pointer on the error path.
Note that the normal cleanup function ath11k_reg_free() cannot be used since other regulatory-related fields are not yet populated at this point.
Compile tested only.
--- drivers/net/wireless/ath/ath11k/wmi.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/net/wireless/ath/ath11k/wmi.c +9 -0
@@ -5084,6 +5084,15 @@ static int ath11k_service_ready_ext_event(struct ath11k_base *ab, err:kfree (svc_rdy_ext.mac_phy_caps); + +/* +* During TLV iteration the WMI_TAG_SOC_HAL_REG_CAPABILITIES +* handler may have allocated ab->reg_info_store, so free it +* on error to avoid a memory leak +*/ +kfree (ab->reg_info_store); + ab->reg_info_store =NULL ; +ath11k_wmi_free_dbring_caps (ab);return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 742/2151 writeback: size foreign flushes by target wb dirty pages
In reply to Greg Kroah-Hartman6.18-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
@@ -1166,7 +1166,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 */
@@ -1195,16 +1195,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 743/2151 ACPICA: Fix memory leak in acpi_ds_create_field()
In reply to Greg Kroah-Hartman6.18-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 744/2151 ACPICA: Fix PCC OperationRegion command offsets
In reply to Greg Kroah-Hartman6.18-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 745/2151 perf annotate-data: Resolve type DIEs in the debug file they came from
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 14ca0a28de37849afdda6ffd4c9047f58d8906c2 ]
'perf report -s type' hangs burning CPU on the dwz compressed debug info of libz.so.1 (zlib-ng): die_collect_vars() saves the dwarf_dieoffset() of the type DIE, which is relative to the file it lives in - the dwz alt file for the types shared by more than one CU - and update_var_state() resolves that offset in the main debug file, parsing whatever is at it, here a typedef whose DW_AT_type refers to itself.
Record whether the type DIE came from the alt file and resolve the offset with die_get_type_die() in that file, with no fallback.
--- tools/perf/util/annotate-data.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
tools/perf/util/annotate-data.c +15 -6
@@ -625,6 +625,8 @@ struct global_var_entry {u64 start;u64 end;u64 die_offset; +int die_tag; +bool from_alt;/* die_offset is relative to the alt (dwz) file */ };static int global_var_cmp (const void *_key,const struct rb_node *node)
@@ -662,7 +664,7 @@ static struct global_var_entry *global_var__find(struct data_loc_info *dloc, u64 }static bool global_var__add (struct data_loc_info *dloc,u64 addr, -const char *name,Dwarf_Die *type_die) +const char *name,Dwarf_Die *type_die,bool from_alt) {struct dso *dso =map__dso (dloc->ms->map);struct global_var_entry *gvar;
@@ -684,6 +686,8 @@ static bool global_var__add(struct data_loc_info *dloc, u64 addr, gvar->start = addr; gvar->end = addr + size; gvar->die_offset =dwarf_dieoffset (type_die); + gvar->die_tag =dwarf_tag (type_die); + gvar->from_alt = from_alt;rb_add (&gvar->node,dso__global_vars (dso), global_var_less);return true;
@@ -758,7 +762,8 @@ static void global_var__collect(struct data_loc_info *dloc)if (pos->reg !=-1 )continue ; -if (!dwarf_offdie (dwarf, pos->die_off, &type_die)) +if (!die_get_type_die (dwarf, pos->die_off, pos->die_tag, + pos->from_alt, &type_die))continue ; if (!get_global_var_info(dloc, pos->addr, &var_name,
@@ -768,7 +773,8 @@ static void global_var__collect(struct data_loc_info *dloc)if (var_offset !=0 )continue ; -global_var__add (dloc, pos->addr, var_name, &type_die); +global_var__add (dloc, pos->addr, var_name, &type_die, + pos->from_alt); }delete_var_types (var_types);
@@ -793,7 +799,8 @@ bool get_global_var_type(Dwarf_Die *cu_die, struct data_loc_info *dloc, gvar =global_var__find (dloc, var_addr);if (gvar) { -if (!dwarf_offdie (dloc->di->dbg, gvar->die_offset, type_die)) +if (!die_get_type_die (dloc->di->dbg, gvar->die_offset, + gvar->die_tag, gvar->from_alt, type_die))return false; *var_offset = var_addr - gvar->start;
@@ -824,7 +831,8 @@ bool get_global_var_type(Dwarf_Die *cu_die, struct data_loc_info *dloc, ok:/* The address should point to the start of the variable */ -global_var__add (dloc, var_addr - *var_offset, var_name, type_die); +global_var__add (dloc, var_addr - *var_offset, var_name, type_die, + !die_same_file (cu_die, type_die));return true; }
@@ -861,7 +869,8 @@ static void update_var_state(struct type_state *state, struct data_loc_info *dloif (var->addr != addr)continue ;/* Get the type DIE using the offset */ -if (!dwarf_offdie (dloc->di->dbg, var->die_off, &mem_die)) +if (!die_get_type_die (dloc->di->dbg, var->die_off, + var->die_tag, var->from_alt, &mem_die))continue ;if (var->reg ==DWARF_REG_FB || var->reg == fbreg || var->reg == state->stack_reg) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 746/2151 ACPI: PCC: Preserve shared memory signature in OpRegion handler
In reply to Greg Kroah-Hartman6.18-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 747/2151 ASoC: mediatek: mt8183: Fix wrong clock cleanup on clk_set_parent() failure
In reply to Greg Kroah-Hartman6.18-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 748/2151 ASoC: mediatek: mt8183: Fix clock handling in mux disable path
In reply to Greg Kroah-Hartman6.18-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 749/2151 ASoC: mediatek: mt8183: Fix APLL enable error handling
In reply to Greg Kroah-Hartman6.18-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 750/2151 dt-bindings: vendor-prefixes: Add Chip Wealth Technology
In reply to Greg Kroah-Hartman6.18-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
@@ -305,6 +305,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 751/2151 arm64: dts: qcom: sdm845-lg: fix sdcard pinctrl nodes
In reply to Greg Kroah-Hartman6.18-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 752/2151 hfs/hfsplus: serialize B-tree close against folio release
In reply to Greg Kroah-Hartman6.18-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 753/2151 x86/fpu: Fix potential underflow in xstate_calculate_size()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrei Vagin <[email protected]>
[ Upstream commit f1751b220bc8a9bd2dc38ecf61f5c29f3826ace0 ]
xstate_calculate_size() calculates the size required for a given set of xfeatures. It determines the topmost feature by finding the most significant bit in xfeatures using fls64(xfeatures) - 1.
If xfeatures is 0, fls64(0) returns 0, and topmost becomes -1. Previously, topmost was unsigned int, so -1 underflowed to UINT_MAX. This caused the subsequent check topmost <= XFEATURE_SSE to fail, and the code proceeded to access xstate arrays using topmost (UINT_MAX) as an index, leading to an out-of-bounds access.
[ bp: Remove text explaining what the patch does. ]
--- arch/x86/kernel/fpu/xstate.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
arch/x86/kernel/fpu/xstate.c +4 -3
@@ -588,12 +588,13 @@ static bool __init check_xstate_against_struct(int nr)static unsigned int xstate_calculate_size (u64 xfeatures,bool compacted) { -unsigned int topmost =fls64 (xfeatures) -1 ; -unsigned int offset, i; +unsigned int topmost, offset, i; -if (topmost <=XFEATURE_SSE ) +if (!(xfeatures & ~XFEATURE_MASK_FPSSE ))return sizeof (struct xregs_state ); + topmost =fls64 (xfeatures) -1 ; +if (compacted) { offset =xfeature_get_offset (xfeatures, topmost); }else {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 754/2151 arm64: dts: qcom: lemans-ride-common: fix SerDes PHY regulator supplies
In reply to Greg Kroah-Hartman6.18-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/lemans-ride-common.dtsi | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/lemans-ride-common.dtsi +6 -2
@@ -778,12 +778,16 @@ &qup_uart17_rx { }; &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 755/2151 arm64: dts: qcom: monaco-evk: fix SerDes PHY regulator supplies
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mohd Ayaan Anwar <[email protected]>
[ Upstream commit de7bc562fc363421902db7bdda8e347cc78a5173 ]
The SerDes PHY node was configured with 'phy-supply = <&vreg_l4a>', which only described one of the two supplies the hardware requires. While vreg_l4a is the correct 0.9V rail, the 1.2V rail (vreg_l5a) was missing entirely.
Replace phy-supply with the two named properties vdda-0p9-supply (vreg_l4a) and vdda-1p2-supply (vreg_l5a).
--- arch/arm64/boot/dts/qcom/monaco-evk.dts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/monaco-evk.dts +2 -1
@@ -427,7 +427,8 @@ &remoteproc_gpdsp { }; &serdes0 { - phy-supply = <&vreg_l4a>; + vdda-0p9-supply = <&vreg_l4a>; + vdda-1p2-supply = <&vreg_l5a>; status = "okay"; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 756/2151 arm64: dts: qcom: qcs8300-ride: fix SerDes PHY regulator supplies
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mohd Ayaan Anwar <[email protected]>
[ Upstream commit e55080f068f3f6b733235fd7618c12e61744244b ]
The SerDes PHY node was configured with 'phy-supply = <&vreg_l5a>', which only covered the 1.2V rail. The 0.9V rail (vreg_l4a) was missing entirely.
Replace phy-supply with the two named properties vdda-0p9-supply (vreg_l4a) and vdda-1p2-supply (vreg_l5a).
--- arch/arm64/boot/dts/qcom/qcs8300-ride.dts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/qcs8300-ride.dts +3 -1
@@ -337,7 +337,9 @@ &remoteproc_gpdsp { }; &serdes0 { - phy-supply = <&vreg_l5a>; + vdda-0p9-supply = <&vreg_l4a>; + vdda-1p2-supply = <&vreg_l5a>; + status = "okay"; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 757/2151 ARM: dts: qcom: msm8974: Sort header includes alphabetically
In reply to Greg Kroah-Hartman6.18-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 758/2151 ARM: dts: qcom: msm8974: add MDSS reset
In reply to Greg Kroah-Hartman6.18-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>;
@@ -1910,6 +1911,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 759/2151 dt-bindings: vendor-prefixes: Add LeEco
In reply to Greg Kroah-Hartman6.18-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
@@ -895,6 +895,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 760/2151 dt-bindings: vendor-prefixes: Add Retroid Pocket
In reply to Greg Kroah-Hartman6.18-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
@@ -1349,6 +1349,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 761/2151 bpf: Skip zero-length stream writes
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kumar Kartikeya Dwivedi <[email protected]>
[ Upstream commit f17bedcd29517739a6491c1c51cc6a593f6a0332 ]
A stream write whose formatted output is empty still allocates a stream element and links it into the stream log. Capacity accounting only counts payload bytes, so such elements never count against the stream limit, and a program that keeps producing empty output allocates elements without bound until a reader drains them.
Return success without allocating anything when there is nothing to write, for both bpf_stream_vprintk() and staged writes. Every element in a stream log then carries at least one byte, which later changes rely on when they derive read readiness from published byte counts.
--- kernel/bpf/stream.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
kernel/bpf/stream.c +8 -3
@@ -215,8 +215,13 @@ static void bpf_stream_release_capacity(struct bpf_stream *stream, int len)static int bpf_stream_push_str (struct bpf_stream *stream,const char *str,int len) { -int ret =bpf_stream_consume_capacity (stream, len); +int ret; + +/* Nothing to publish; do not allocate an element for it. */ +if (!len) +return 0 ; + ret =bpf_stream_consume_capacity (stream, len);if (ret)return ret;
@@ -458,8 +463,8 @@ int bpf_stream_stage_printk(struct bpf_stream_stage *ss, const char *fmt, ...)va_start (args, fmt); len =vscnprintf (buf->buf,ARRAY_SIZE (buf->buf), fmt, args);va_end (args); -/* Exclude NULL byte during push. */ - ret =__bpf_stream_push_str (&ss->log, buf->buf, len); +/* Exclude NULL byte during push; skip empty output entirely. */ + ret = len ?__bpf_stream_push_str (&ss->log, buf->buf, len) :0 ;if (!ret) ss->len += len;bpf_put_buffers ();
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 762/2151 tools/nolibc: provide the portable sys/select.h
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Willy Tarreau <[email protected]>
[ Upstream commit 10f407c66061524f0da0384de76827e30268f98a ]
Modern programs tend to include sys/select.h to get FD_SET() and FD_CLR() definitions as well as struct fd_set, but in our case it didn't exist.
The definitions were moved from types.h to sys/select.h, which is now included from nolibc.h, and the sys_select() definition moved there as well from sys.h.
Stable-dep-of: 929ea5b3481f ("tools/nolibc: fix FD_SET(), FD_CLR() and FD_ISSET() on 64-bit")
--- tools/include/nolibc/Makefile | 1 + tools/include/nolibc/nolibc.h | 1 + tools/include/nolibc/sys.h | 45 ------------- tools/include/nolibc/sys/select.h | 103 ++++++++++++++++++++++++++++++ tools/include/nolibc/types.h | 47 -------------- 5 files changed, 105 insertions(+), 92 deletions(-) create mode 100644 tools/include/nolibc/sys/select.h
tools/include/nolibc/Makefile +1 -0
@@ -56,6 +56,7 @@ all_files := \ sys/random.h \ sys/reboot.h \ sys/resource.h \ + sys/select.h \ sys/stat.h \ sys/syscall.h \ sys/sysmacros.h \
tools/include/nolibc/nolibc.h +1 -0
@@ -104,6 +104,7 @@#include "sys/random.h" #include "sys/reboot.h" #include "sys/resource.h" +#include "sys/select.h" #include "sys/stat.h" #include "sys/syscall.h" #include "sys/sysmacros.h"
tools/include/nolibc/sys.h +0 -45
51 lines not on this page · raw message
tools/include/nolibc/sys/select.h new file +103 -0
103 lines not on this page · raw message
tools/include/nolibc/types.h +0 -47
59 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 763/2151 tools/nolibc: fix FD_SET(), FD_CLR() and FD_ISSET() on 64-bit
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Danish Khateeb <[email protected]>
[ Upstream commit 929ea5b3481fdbbb419f3986703280fb2b819504 ]
Since commit feaf75658783 ("nolibc: fix fd_set type"), an fd_set is an array of unsigned long, but the FD_* macros still build their masks as an int or an unsigned int: 1 << n in FD_SET(), 1U << n in FD_CLR() and FD_ISSET(), where n is the fd modulo 64 on 64-bit architectures. So:
- FD_SET() of an fd with n == 31 sets the bits for n = 31-63, as 1 << 31 is negative and gets sign-extended.
- For n >= 32 the shifts are undefined. x86-64, for instance, masks the shift count, so FD_SET(40) and FD_ISSET(40) use the bit of fd 8.
- FD_CLR() zero-extends ~(1U << n), so it also clears the bits for n = 32-63, whichever fd it is given.
select() on fd 40, for instance, fails with EBADF, or watches fd 8 instead if that one is open.
Build the masks from 1UL.
--- tools/include/nolibc/sys/select.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/include/nolibc/sys/select.h +3 -3
@@ -26,7 +26,7 @@ typedef struct {int __fd = (fd); \if (__fd >=0 ) \ __set->fds[__fd /FD_SETIDXMASK ] &= \ - ~(1U << (__fd &FD_SETBITMASK )); \ + ~(1UL << (__fd &FD_SETBITMASK )); \ } while (0)#define FD_SET (fd, set) do { \
@@ -34,7 +34,7 @@ typedef struct {int __fd = (fd); \if (__fd >=0 ) \ __set->fds[__fd /FD_SETIDXMASK ] |= \ -1 << (__fd &FD_SETBITMASK ); \ +1UL << (__fd &FD_SETBITMASK ); \ } while (0) #define FD_ISSET(fd, set) ({ \
@@ -43,7 +43,7 @@ typedef struct {int __r =0 ; \if (__fd >=0 ) \ __r = !!(__set->fds[__fd /FD_SETIDXMASK ] & \ -1U << (__fd &FD_SETBITMASK )); \ +1UL << (__fd &FD_SETBITMASK )); \ __r; \ })
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 764/2151 MIPS: Octeon: size the swiotlb for a modular OHCI platform driver
In reply to Greg Kroah-Hartman6.18-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 765/2151 MIPS: Only check -msym32 when need-compiler
In reply to Greg Kroah-Hartman6.18-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
@@ -290,18 +290,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 766/2151 bus: mhi: host: pci_generic: Fix runtime PM imbalance for no_m3 devices
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexandra Lu <[email protected]>
[ Upstream commit 95601e9948b42f82600ff2d9e0c2f699a067d561 ]
mhi_pci_probe() drops the runtime PM reference taken by local_pci_probe() only when the device supports both PME from D3hot and M3, but mhi_pci_remove() re-takes it based on PME capability alone, without checking no_m3.
For a device that is PME capable and has no_m3 set, probe therefore never drops the reference while remove takes an extra one, leaving the runtime PM usage count one higher after every bind/unbind cycle. That is benign for the device being removed, since the PCI core resumes it to D0 on unbind regardless, but the struct device outlives the binding, so the count accumulates across repeated cycles and can end up preventing runtime suspend altogether.
Cache no_m3 in the driver's private data, as is already done for reset_on_remove, and gate the removal side on it as well. Unlike reset_on_remove it is cached for virtual functions too, because the probe side gate tests info->no_m3 for physical and virtual functions alike.
QDU100 is currently the only device that sets no_m3.
--- drivers/bus/mhi/host/pci_generic.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/bus/mhi/host/pci_generic.c +4 -1
@@ -1030,6 +1030,7 @@ struct mhi_pci_device {struct work_struct recovery_work;struct timer_list health_check_timer;unsigned long status; +bool no_m3;bool reset_on_remove; };
@@ -1341,6 +1342,8 @@ static int mhi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) mhi_cntrl->mru = info->mru_default; mhi_cntrl->name = info->name; + mhi_pdev->no_m3 = info->no_m3; +if (!pdev->is_virtfn) mhi_pdev->reset_on_remove = info->reset_on_remove;
@@ -1428,7 +1431,7 @@ static void mhi_pci_remove(struct pci_dev *pdev) }/* balancing probe put_noidle */ -if (pci_pme_capable (pdev, PCI_D3hot)) +if (pci_pme_capable (pdev, PCI_D3hot) && !mhi_pdev->no_m3)pm_runtime_get_noresume (&pdev->dev);if (mhi_pdev->reset_on_remove)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 767/2151 bitmap: bitmap_parse(): reject non-hex character before 8 digits
In reply to Greg Kroah-Hartman6.18-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 768/2151 bitmap: bitmap_parselist(): reject trailing characters after group size
In reply to Greg Kroah-Hartman6.18-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 769/2151 bitmap: bitmap_parselist(): dont wrap around on a huge group size
In reply to Greg Kroah-Hartman6.18-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 770/2151 m68k: apollo: Fix interrupt setup
In reply to Greg Kroah-Hartman6.18-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>
@@ -11,10 +12,13 @@ static 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 ; }
@@ -26,6 +30,8 @@ static 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); }static void apollo_irq_eoi (struct irq_data *data)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 771/2151 drm/msm/a6xx: Fix secondary rail vote in ARC votes
In reply to Greg Kroah-Hartman6.18-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
@@ -1539,10 +1539,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 772/2151 kbuild: Remove alignment on .modinfo section
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
[ Upstream commit 36d4a11b56aa98da4b4652a2e34d229ffcf36070 ]
Commit d50f21091358 ("kbuild: align modinfo section for Secureboot Authenticode EDK2 compat") aligned .modinfo because it appeared in the x86_64 compressed kernel image after commit 3e86e4d74c04 ("kbuild: keep .modinfo section in vmlinux.unstripped"), breaking boot.
Commit 8678591b4746 ("kbuild: Split .modinfo out from ELF_DETAILS") properly addresses .modinfo appearing in unexpected contexts like compressed images by moving it out of ELF_DETAILS and explicitly specifying its location in every architecture's vmlinux linker script or discarding it where it may appear elsewhere.
Effectively revert commit d50f21091358 ("kbuild: align modinfo section for Secureboot Authenticode EDK2 compat") and its follow up fix, commit a26a6c93edfe ("kbuild: Strip trailing padding bytes from modules.builtin.modinfo"), as they are no longer necessary in the current tree. This simplifies future cleanups.
Stable-dep-of: a98db7418797 ("kbuild: keep .modinfo when vmlinux is linked with --gc-sections")
--- include/asm-generic/vmlinux.lds.h | 2 +- scripts/Makefile.vmlinux | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-)
include/asm-generic/vmlinux.lds.h +1 -1
@@ -838,7 +838,7 @@ defined(CONFIG_AUTOFDO_CLANG) || defined(CONFIG_PROPELLER_CLANG) .shstrtab 0 : { *(.shstrtab) }#define MODINFO \ - .modinfo : { *(.modinfo) . = ALIGN(8); } + .modinfo : { *(.modinfo) }#ifdef CONFIG_GENERIC_BUG #define BUG_TABLE \
scripts/Makefile.vmlinux +0 -10
@@ -102,18 +102,8 @@ vmlinux: vmlinux.unstripped FORCE # modules.builtin.modinfo # --------------------------------------------------------------------------- -# .modinfo in vmlinux.unstripped is aligned to 8 bytes for compatibility with -# tools that expect vmlinux to have sufficiently aligned sections but the -# additional bytes used for padding .modinfo to satisfy this requirement break -# certain versions of kmod with -# -# depmod: ERROR: kmod_builtin_iter_next: unexpected string without modname prefix -# -# Strip the trailing padding bytes after extracting .modinfo to comply with -# what kmod expects to parse. quiet_cmd_modules_builtin_modinfo = GEN $@ cmd_modules_builtin_modinfo = $(cmd_objcopy); \ - sed -i 's/\x00\+$$/\x00/g' $@; \ chmod -x $@ OBJCOPYFLAGS_modules.builtin.modinfo := -j .modinfo -O binary
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 773/2151 kbuild: do not allocate .modinfo in vmlinux
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Stoakes (ARM) <[email protected]>
[ Upstream commit 5fe4dd59664105a9ea1a9468aa7391806b80364a ]
Commit 3e86e4d74c04 ("kbuild: keep .modinfo section in vmlinux.unstripped") placed MODULE_INFO() strings in the .modinfo section in vmlinux.unstripped, however it left the section allocatable, so it gets assigned an address and on arm64, arm and riscv, the section is tagged as PT_LOAD.
This is useless as the data is ultimately stripped anyway.
Doing this results in a lot of unnecessary work - each pass copies the whole file, 450 MiB with relocations for an x86 allmodconfig build and 250 MiB for an arm64 allmodconfig build.
This adds ~0.7s on the serial tail of every build for arm64 and ~0.2s for x86 (the tail is single-threaded work done after parallel work has finished).
Nothing requires .modinfo to exist at an address, so mark the output section (INFO) so that it's not allocated and use --dump-section to extract it as -O only emits allocated sections.
The dump doesn't pick up the arch's OBJCOPYFLAGS any longer as they should not impact the output of this section.
Image, bzImage, System.map and modules.builtin.modinfo are unchanged and the stripped vmlinux differs only in its program headers.
The objcopy passes are on the serial tail of every build that links vmlinux, no-op builds are unchanged.
Whole build, 128-thread Threadripper 9980X, best of N runs:
before after delta
-------------------------------
x86 defconfig, touch mm/vma.c, gcc 11.2s 11.1s -0.15s (-1%) x86 defconfig, touch mm/vma.c, clang 11.3s 11.1s -0.19s (-2%) x86 defconfig, clean, gcc 32.5s 32.3s -0.16s (-1%) x86 defconfig, clean, clang 34.5s 34.2s -0.26s (-1%) x86 allmodconfig, touch mm/vma.c, gcc 40.1s 39.7s -0.44s (-1%)
Stable-dep-of: a98db7418797 ("kbuild: keep .modinfo when vmlinux is linked with --gc-sections")
--- include/asm-generic/vmlinux.lds.h | 2 +- scripts/Makefile.vmlinux | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-)
include/asm-generic/vmlinux.lds.h +1 -1
@@ -838,7 +838,7 @@ defined(CONFIG_AUTOFDO_CLANG) || defined(CONFIG_PROPELLER_CLANG) .shstrtab 0 : { *(.shstrtab) }#define MODINFO \ - .modinfo : { *(.modinfo) } + .modinfo (INFO) : { *(.modinfo) }#ifdef CONFIG_GENERIC_BUG #define BUG_TABLE \
scripts/Makefile.vmlinux +2 -8
@@ -89,11 +89,8 @@ remove-section-$(CONFIG_ARCH_VMLINUX_NEEDS_RELOCS) += '.rel.*' remove-symbols := -w --strip-unneeded-symbol='__mod_device_table__*' -# To avoid warnings: "empty loadable segment detected at ..." from GNU objcopy, -# it is necessary to remove the PT_LOAD flag from the segment. quiet_cmd_strip_relocs = OBJCOPY $@ - cmd_strip_relocs = $(OBJCOPY) $(patsubst %,--set-section-flags %=noload,$(remove-section-y)) $< $@; \ - $(OBJCOPY) $(addprefix --remove-section=,$(remove-section-y)) $(remove-symbols) $@ + cmd_strip_relocs = $(OBJCOPY) $(addprefix --remove-section=,$(remove-section-y)) $(remove-symbols) $< $@ targets += vmlinux vmlinux: vmlinux.unstripped FORCE
@@ -103,10 +100,7 @@ vmlinux: vmlinux.unstripped FORCE # --------------------------------------------------------------------------- quiet_cmd_modules_builtin_modinfo = GEN $@ - cmd_modules_builtin_modinfo = $(cmd_objcopy); \ - chmod -x $@ - -OBJCOPYFLAGS_modules.builtin.modinfo := -j .modinfo -O binary + cmd_modules_builtin_modinfo = $(OBJCOPY) -O binary -j .modinfo --dump-section .modinfo=$@ $< /dev/null targets += modules.builtin.modinfo modules.builtin.modinfo: vmlinux.unstripped FORCE
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 774/2151 kbuild: keep .modinfo when vmlinux is linked with --gc-sections
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit a98db7418797bc27bef53c861b97ac748f598414 ]
Builds with CONFIG_LD_DEAD_CODE_DATA_ELIMINATION=y, such as arm allmodconfig, now fail while extracting modules.builtin.modinfo:
arm-linux-gnueabihf-objcopy: vmlinux.unstripped: can't dump section '.modinfo' - it does not exist: file format not recognized /bin/sh: 1: cannot open modules.builtin.modinfo: No such file
or, with LLVM:
llvm-objcopy: error: 'vmlinux.unstripped': section '.modinfo' not found
Nothing references the MODULE_INFO() strings, so --gc-sections discards every .modinfo input section and vmlinux.unstripped ends up with no .modinfo data. This is not new: ever since modules.builtin.modinfo started being extracted from vmlinux.unstripped, these builds have silently produced an empty file, losing the modinfo of every built-in module. An arm multi_v7_defconfig build with LD_DEAD_CODE_DATA_ELIMINATION on current mainline yields a 0 byte modules.builtin.modinfo. The switch to --dump-section only turned that into a build error.
Wrap the input section in KEEP() so that the linker retains it. The output section is still (INFO), so nothing is allocated for it. With the same arm config, modules.builtin.modinfo now has 14119 entries, and on x86_64 defconfig, where nothing is garbage collected, it is byte-identical before and after this change.
Found by KernelCI builds of the linus-next tree.
--- include/asm-generic/vmlinux.lds.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/asm-generic/vmlinux.lds.h +1 -1
@@ -838,7 +838,7 @@ defined(CONFIG_AUTOFDO_CLANG) || defined(CONFIG_PROPELLER_CLANG) .shstrtab 0 : { *(.shstrtab) }#define MODINFO \ - .modinfo (INFO) : { *(.modinfo) } + .modinfo (INFO) : { KEEP(*(.modinfo)) }#ifdef CONFIG_GENERIC_BUG #define BUG_TABLE \
Signature · 1 line
2.53.0