FAILED: patch "[PATCH] dmaengine: dw-edma: Initialize IRQ data before requesting" failed to apply to 5.10-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x 647217abea849d3d45f8cb0b8ee5b78d50f26985
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026090852-humble-naturist-e0d0@gregkh' --subject-prefix 'PATCH 5.10.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 647217abea849d3d45f8cb0b8ee5b78d50f26985 Mon Sep 17 00:00:00 2001
From: Koichiro Den <[email protected]>
Date: Tue, 21 Jul 2026 15:28:05 +0900
Subject: [PATCH] dmaengine: dw-edma: Initialize IRQ data before requesting
IRQs
dw_edma_irq_request() passes struct dw_edma_irq to request_irq() before dw_edma_channel_setup() fills the back pointer. A shared interrupt can therefore enter the handler with dw_irq->dw still NULL, leading to a NULL pointer dereference.
Set the back pointer before installing each handler.
drivers/dma/dw-edma/dw-edma-core.c +2 -1
@@ -969,7 +969,6 @@ static int dw_edma_channel_setup(struct dw_edma *dw, u32 wr_alloc, u32 rd_alloc)else bitmap_set (irq->rd_mask, chan->id,1 ); - irq->dw = dw;memcpy (&chan->msi, &irq->msi,sizeof (chan->msi)); dev_vdbg(dev, "MSI:\t\tChannel %s[%u] addr=0x%.8x%.8x, data=0x%.8x\n",
@@ -1051,6 +1050,7 @@ static int dw_edma_irq_request(struct dw_edma *dw,if (chip->nr_irqs ==1 ) {/* Common IRQ shared among all channels */ irq = chip->ops->irq_vector (dev,0 ); + dw->irq[0 ].dw = dw; err =request_irq (irq, dw_edma_interrupt_common,IRQF_SHARED , dw->name, &dw->irq[0 ]);if (err) {
@@ -1073,6 +1073,7 @@ static int dw_edma_irq_request(struct dw_edma *dw,for (i =0 ; i < (*wr_alloc + *rd_alloc); i++) { irq = chip->ops->irq_vector (dev, i); + dw->irq[i].dw = dw; err = request_irq(irq, i < *wr_alloc ? dw_edma_interrupt_write :
Sasha Levin
maintainerPATCH 1/2 dmaengine: dw-edma: Detach the private data and chip info structures
From: Frank Li <[email protected]>
[ Upstream commit 203184571388a988283543f0fd7da1a0da7c3f91 ]
"struct dw_edma_chip" contains an internal structure "struct dw_edma" that is used by the eDMA core internally and should not be touched by the eDMA controller drivers themselves. But currently, the eDMA controller drivers like "dw-edma-pci" allocate and populate this internal structure before passing it on to the eDMA core. The eDMA core further populates the structure and uses it. This is wrong!
Hence, move all the "struct dw_edma" specifics from controller drivers to the eDMA core.
[5.10 dependency adaptation for 647217abea849]
Move controller configuration and IRQ-vector operations into dw_edma_chip, and allocate the private dw_edma and IRQ array in the core as upstream. Use the stable tree's existing chan->dw and dw->chip back pointers, and replace its dw->core accesses with chip->ops.
Keep the 5.10 version/mode representation, static PCI platform data, and register BAR offsets and size. Preserve the existing shared-register locking and global debugfs teardown; pass the private dw pointer only to the existing debugfs setup callbacks. Drop hunks for absent HDMA support, 64-bit register accessors, and per-controller debugfs state. No functions are added.
Leave IRQ back-pointer initialization in channel setup for the target commit to move before request_irq(). The unchanged target applies cleanly with Git's three-way merge.
Stable-dep-of: 647217abea84 ("dmaengine: dw-edma: Initialize IRQ data before requesting IRQs")
--- drivers/dma/dw-edma/dw-edma-core.c | 87 +++++++++++++----------- drivers/dma/dw-edma/dw-edma-core.h | 29 -------- drivers/dma/dw-edma/dw-edma-pcie.c | 79 +++++++++------------ drivers/dma/dw-edma/dw-edma-v0-core.c | 20 +++--- drivers/dma/dw-edma/dw-edma-v0-core.h | 2 +- drivers/dma/dw-edma/dw-edma-v0-debugfs.c | 16 ++--- drivers/dma/dw-edma/dw-edma-v0-debugfs.h | 4 +- include/linux/dma/edma.h | 49 ++++++++++++- 8 files changed, 149 insertions(+), 137 deletions(-)
drivers/dma/dw-edma/dw-edma-core.c +47 -40
@@ -64,8 +64,8 @@ static struct dw_edma_burst *dw_edma_alloc_burst(struct dw_edma_chunk *chunk)static struct dw_edma_chunk *dw_edma_alloc_chunk (struct dw_edma_desc *desc) { +struct dw_edma_chip *chip = desc->chan->dw->chip;struct dw_edma_chan *chan = desc->chan; -struct dw_edma *dw = chan->chip->dw;struct dw_edma_chunk *chunk; chunk =kzalloc (sizeof (*chunk),GFP_NOWAIT );
@@ -82,11 +82,11 @@ static struct dw_edma_chunk *dw_edma_alloc_chunk(struct dw_edma_desc *desc)*/ chunk->cb = !(desc->chunks_alloc %2 );if (chan->dir ==EDMA_DIR_WRITE ) { - chunk->ll_region.paddr = dw->ll_region_wr[chan->id].paddr; - chunk->ll_region.vaddr = dw->ll_region_wr[chan->id].vaddr; + chunk->ll_region.paddr = chip->ll_region_wr[chan->id].paddr; + chunk->ll_region.vaddr = chip->ll_region_wr[chan->id].vaddr; }else { - chunk->ll_region.paddr = dw->ll_region_rd[chan->id].paddr; - chunk->ll_region.vaddr = dw->ll_region_rd[chan->id].vaddr; + chunk->ll_region.paddr = chip->ll_region_rd[chan->id].paddr; + chunk->ll_region.vaddr = chip->ll_region_rd[chan->id].vaddr; }if (desc->chunk) {
@@ -642,7 +642,7 @@ static int dw_edma_alloc_chan_resources(struct dma_chan *dchan)if (chan->status !=EDMA_ST_IDLE )return -EBUSY ; -pm_runtime_get (chan->chip->dev); +pm_runtime_get (chan->dw->chip->dev);return 0 ; }
@@ -664,15 +664,15 @@ static void dw_edma_free_chan_resources(struct dma_chan *dchan)cpu_relax (); } -pm_runtime_put (chan->chip->dev); +pm_runtime_put (chan->dw->chip->dev); } -static int dw_edma_channel_setup (struct dw_edma_chip *chip,bool write, +static int dw_edma_channel_setup (struct dw_edma *dw,bool write,u32 wr_alloc,u32 rd_alloc) { +struct dw_edma_chip *chip = dw->chip;struct dw_edma_region *dt_region;struct device *dev = chip->dev; -struct dw_edma *dw = chip->dw;struct dw_edma_chan *chan;struct dw_edma_irq *irq;struct dma_device *dma;
@@ -705,7 +705,6 @@ static int dw_edma_channel_setup(struct dw_edma_chip *chip, bool write, chan->vc.chan.private = dt_region; - chan->chip = chip; chan->dw = dw; chan->id = j; chan->dir = write ?EDMA_DIR_WRITE :EDMA_DIR_READ ;
@@ -714,9 +713,9 @@ static int dw_edma_channel_setup(struct dw_edma_chip *chip, bool write, chan->status =EDMA_ST_IDLE ;if (write) - chan->ll_max = (dw->ll_region_wr[j].sz /EDMA_LL_SZ ); + chan->ll_max = (chip->ll_region_wr[j].sz /EDMA_LL_SZ );else - chan->ll_max = (dw->ll_region_rd[j].sz /EDMA_LL_SZ ); + chan->ll_max = (chip->ll_region_rd[j].sz /EDMA_LL_SZ ); chan->ll_max -=1 ; dev_vdbg(dev, "L. List:\tChannel %s[%u] max_cnt=%u\n",
@@ -746,13 +745,13 @@ static int dw_edma_channel_setup(struct dw_edma_chip *chip, bool write,vchan_init (&chan->vc, dma);if (write) { - dt_region->paddr = dw->dt_region_wr[j].paddr; - dt_region->vaddr = dw->dt_region_wr[j].vaddr; - dt_region->sz = dw->dt_region_wr[j].sz; + dt_region->paddr = chip->dt_region_wr[j].paddr; + dt_region->vaddr = chip->dt_region_wr[j].vaddr; + dt_region->sz = chip->dt_region_wr[j].sz; }else { - dt_region->paddr = dw->dt_region_rd[j].paddr; - dt_region->vaddr = dw->dt_region_rd[j].vaddr; - dt_region->sz = dw->dt_region_rd[j].sz; + dt_region->paddr = chip->dt_region_rd[j].paddr; + dt_region->vaddr = chip->dt_region_rd[j].vaddr; + dt_region->sz = chip->dt_region_rd[j].sz; }dw_edma_v0_core_device_config (chan);
@@ -804,11 +803,11 @@ static inline void dw_edma_add_irq_mask(u32 *mask, u32 alloc, u16 cnt) (*mask)++; } -static int dw_edma_irq_request (struct dw_edma_chip *chip, +static int dw_edma_irq_request (struct dw_edma *dw,u32 *wr_alloc,u32 *rd_alloc) { -struct device *dev = chip->dev; -struct dw_edma *dw = chip->dw; +struct dw_edma_chip *chip = dw->chip; +struct device *dev = dw->chip->dev;u32 wr_mask =1 ;u32 rd_mask =1 ;int i, err =0 ;
@@ -817,12 +816,16 @@ static int dw_edma_irq_request(struct dw_edma_chip *chip, ch_cnt = dw->wr_ch_cnt + dw->rd_ch_cnt; -if (dw->nr_irqs <1 ) +if (chip->nr_irqs <1 || !chip->ops->irq_vector)return -EINVAL ; -if (dw->nr_irqs ==1 ) { + dw->irq =devm_kcalloc (dev, chip->nr_irqs,sizeof (*dw->irq),GFP_KERNEL ); +if (!dw->irq) +return -ENOMEM ; + +if (chip->nr_irqs ==1 ) {/* Common IRQ shared among all channels */ - irq = dw->core->irq_vector (dev,0 ); + irq = chip->ops->irq_vector (dev,0 ); err =request_irq (irq, dw_edma_interrupt_common,IRQF_SHARED , dw->name, &dw->irq[0 ]);if (err) {
@@ -832,9 +835,11 @@ static int dw_edma_irq_request(struct dw_edma_chip *chip,if (irq_get_msi_desc (irq))get_cached_msi_msg (irq, &dw->irq[0 ].msi); + + dw->nr_irqs =1 ; }else {/* Distribute IRQs equally among all channels */ -int tmp = dw->nr_irqs; +int tmp = chip->nr_irqs;while (tmp && (*wr_alloc + *rd_alloc) < ch_cnt) {dw_edma_dec_irq_alloc (&tmp, wr_alloc, dw->wr_ch_cnt);
@@ -845,7 +850,7 @@ static int dw_edma_irq_request(struct dw_edma_chip *chip,dw_edma_add_irq_mask (&rd_mask, *rd_alloc, dw->rd_ch_cnt);for (i =0 ; i < (*wr_alloc + *rd_alloc); i++) { - irq = dw->core->irq_vector (dev, i); + irq = chip->ops->irq_vector (dev, i); err = request_irq(irq, i < *wr_alloc ? dw_edma_interrupt_write :
@@ -879,20 +884,22 @@ int dw_edma_probe(struct dw_edma_chip *chip)return -EINVAL ; dev = chip->dev; -if (!dev) +if (!dev || !chip->ops)return -EINVAL ; - dw = chip->dw; -if (!dw || !dw->irq || !dw->core || !dw->core->irq_vector) -return -EINVAL ; + dw =devm_kzalloc (dev,sizeof (*dw),GFP_KERNEL ); +if (!dw) +return -ENOMEM ; + + dw->chip = chip;raw_spin_lock_init (&dw->lock); - dw->wr_ch_cnt =min_t (u16, dw->wr_ch_cnt, + dw->wr_ch_cnt =min_t (u16, chip->wr_ch_cnt,dw_edma_v0_core_ch_count (dw,EDMA_DIR_WRITE )); dw->wr_ch_cnt =min_t (u16, dw->wr_ch_cnt,EDMA_MAX_WR_CH ); - dw->rd_ch_cnt =min_t (u16, dw->rd_ch_cnt, + dw->rd_ch_cnt =min_t (u16, chip->rd_ch_cnt,dw_edma_v0_core_ch_count (dw,EDMA_DIR_READ )); dw->rd_ch_cnt =min_t (u16, dw->rd_ch_cnt,EDMA_MAX_RD_CH );
@@ -914,17 +921,17 @@ int dw_edma_probe(struct dw_edma_chip *chip)dw_edma_v0_core_off (dw);/* Request IRQs */ - err =dw_edma_irq_request (chip, &wr_alloc, &rd_alloc); + err =dw_edma_irq_request (dw, &wr_alloc, &rd_alloc);if (err)return err;/* Setup write channels */ - err =dw_edma_channel_setup (chip, true, wr_alloc, rd_alloc); + err =dw_edma_channel_setup (dw, true, wr_alloc, rd_alloc);if (err) goto err_irq_free;/* Setup read channels */ - err =dw_edma_channel_setup (chip, false, wr_alloc, rd_alloc); + err =dw_edma_channel_setup (dw, false, wr_alloc, rd_alloc);if (err) goto err_irq_free;
@@ -932,15 +939,15 @@ int dw_edma_probe(struct dw_edma_chip *chip)pm_runtime_enable (dev);/* Turn debugfs on */ -dw_edma_v0_core_debugfs_on (chip); +dw_edma_v0_core_debugfs_on (dw); + + chip->dw = dw;return 0 ; err_irq_free:for (i = (dw->nr_irqs -1 ); i >=0 ; i--) -free_irq (dw->core->irq_vector (dev, i), &dw->irq[i]); - - dw->nr_irqs =0 ; +free_irq (chip->ops->irq_vector (dev, i), &dw->irq[i]);return err; }
@@ -958,7 +965,7 @@ int dw_edma_remove(struct dw_edma_chip *chip)/* Free irqs */ for (i = (dw->nr_irqs -1 ); i >=0 ; i--) -free_irq (dw->core->irq_vector (dev, i), &dw->irq[i]); +free_irq (chip->ops->irq_vector (dev, i), &dw->irq[i]);/* Power management */ pm_runtime_disable (dev);
drivers/dma/dw-edma/dw-edma-core.h +0 -29
@@ -15,19 +15,12 @@#include "../virt-dma.h" #define EDMA_LL_SZ 24 -#define EDMA_MAX_WR_CH 8 -#define EDMA_MAX_RD_CH 8enum dw_edma_dir {EDMA_DIR_WRITE =0 ,EDMA_DIR_READ }; -enum dw_edma_mode { -EDMA_MODE_LEGACY =0 , -EDMA_MODE_UNROLL -}; -enum dw_edma_request {EDMA_REQ_NONE =0 ,EDMA_REQ_STOP ,
@@ -51,12 +44,6 @@ struct dw_edma_burst {u32 sz; }; -struct dw_edma_region { -phys_addr_t paddr; -void __iomem *vaddr; -size_t sz; -}; -struct dw_edma_chunk {struct list_head list;struct dw_edma_chan *chan;
@@ -81,7 +68,6 @@ struct dw_edma_desc {struct dw_edma_chan {struct virt_dma_chan vc; -struct dw_edma_chip *chip;struct dw_edma *dw;int id;enum dw_edma_dir dir;
@@ -104,10 +90,6 @@ struct dw_edma_irq {struct dw_edma *dw; }; -struct dw_edma_core_ops { -int (*irq_vector)(struct device *dev,unsigned int nr); -}; -struct dw_edma {char name[20 ];
@@ -117,25 +99,14 @@ struct dw_edma {struct dma_device rd_edma;u16 rd_ch_cnt; -struct dw_edma_region rg_region;/* Registers */ -struct dw_edma_region ll_region_wr[EDMA_MAX_WR_CH ]; -struct dw_edma_region ll_region_rd[EDMA_MAX_RD_CH ]; -struct dw_edma_region dt_region_wr[EDMA_MAX_WR_CH ]; -struct dw_edma_region dt_region_rd[EDMA_MAX_RD_CH ]; -struct dw_edma_irq *irq;int nr_irqs; -u32 version; -enum dw_edma_mode mode; -struct dw_edma_chan *chan;raw_spinlock_t lock;/* Protect v0 shared registers */ struct dw_edma_chip *chip; - -const struct dw_edma_core_ops *core; };struct dw_edma_sg {
drivers/dma/dw-edma/dw-edma-pcie.c +33 -46
144 lines not on this page · raw message
drivers/dma/dw-edma/dw-edma-v0-core.c +10 -10
@@ -25,7 +25,7 @@ enum dw_edma_control {static inline struct dw_edma_v0_regs __iomem *__dw_regs (struct dw_edma *dw) { -return dw->rg_region.vaddr; +return dw->chip->rg_region.vaddr; }#define SET (dw, name, value) \
@@ -56,7 +56,7 @@ static inline struct dw_edma_v0_regs __iomem *__dw_regs(struct dw_edma *dw)static inline struct dw_edma_v0_ch_regs __iomem *__dw_ch_regs (struct dw_edma *dw,enum dw_edma_dir dir,u16 ch) { -if (dw->mode ==EDMA_MODE_LEGACY ) +if (dw->chip->mode ==EDMA_MODE_LEGACY )return &(__dw_regs (dw)->type.legacy.ch);if (dir ==EDMA_DIR_WRITE )
@@ -68,7 +68,7 @@ __dw_ch_regs(struct dw_edma *dw, enum dw_edma_dir dir, u16 ch)static inline void writel_ch (struct dw_edma *dw,enum dw_edma_dir dir,u16 ch,u32 value,void __iomem *addr) { -if (dw->mode ==EDMA_MODE_LEGACY ) { +if (dw->chip->mode ==EDMA_MODE_LEGACY ) {u32 viewport_sel;unsigned long flags;
@@ -93,7 +93,7 @@ static inline u32 readl_ch(struct dw_edma *dw, enum dw_edma_dir dir, u16 ch, {u32 value; -if (dw->mode ==EDMA_MODE_LEGACY ) { +if (dw->chip->mode ==EDMA_MODE_LEGACY ) {u32 viewport_sel;unsigned long flags;
@@ -149,7 +149,7 @@ u16 dw_edma_v0_core_ch_count(struct dw_edma *dw, enum dw_edma_dir dir)enum dma_status dw_edma_v0_core_ch_status (struct dw_edma_chan *chan) { -struct dw_edma *dw = chan->chip->dw; +struct dw_edma *dw = chan->dw;u32 tmp; tmp = FIELD_GET(EDMA_V0_CH_STATUS_MASK,
@@ -165,7 +165,7 @@ enum dma_status dw_edma_v0_core_ch_status(struct dw_edma_chan *chan)void dw_edma_v0_core_clear_done_int (struct dw_edma_chan *chan) { -struct dw_edma *dw = chan->chip->dw; +struct dw_edma *dw = chan->dw;SET_RW_32 (dw, chan->dir, int_clear,FIELD_PREP (EDMA_V0_DONE_INT_MASK ,BIT (chan->id)));
@@ -173,7 +173,7 @@ void dw_edma_v0_core_clear_done_int(struct dw_edma_chan *chan)void dw_edma_v0_core_clear_abort_int (struct dw_edma_chan *chan) { -struct dw_edma *dw = chan->chip->dw; +struct dw_edma *dw = chan->dw;SET_RW_32 (dw, chan->dir, int_clear,FIELD_PREP (EDMA_V0_ABORT_INT_MASK ,BIT (chan->id)));
@@ -275,7 +275,7 @@ void dw_edma_v0_core_start(struct dw_edma_chunk *chunk, bool first)int dw_edma_v0_core_device_config (struct dw_edma_chan *chan) { -struct dw_edma *dw = chan->chip->dw; +struct dw_edma *dw = chan->dw;u32 tmp =0 ;/* MSI done addr - low, high */
@@ -345,9 +345,9 @@ int dw_edma_v0_core_device_config(struct dw_edma_chan *chan) }/* eDMA debugfs callbacks */ -void dw_edma_v0_core_debugfs_on (struct dw_edma_chip *chip) +void dw_edma_v0_core_debugfs_on (struct dw_edma *dw) { -dw_edma_v0_debugfs_on (chip); +dw_edma_v0_debugfs_on (dw); }void dw_edma_v0_core_debugfs_off (void )
drivers/dma/dw-edma/dw-edma-v0-core.h +1 -1
@@ -22,7 +22,7 @@ u32 dw_edma_v0_core_status_abort_int(struct dw_edma *chan, enum dw_edma_dir dir)void dw_edma_v0_core_start (struct dw_edma_chunk *chunk,bool first);int dw_edma_v0_core_device_config (struct dw_edma_chan *chan);/* eDMA debug fs callbacks */ -void dw_edma_v0_core_debugfs_on (struct dw_edma_chip *chip); +void dw_edma_v0_core_debugfs_on (struct dw_edma *dw);void dw_edma_v0_core_debugfs_off (void );#endif /* _DW_EDMA_V0_CORE_H */
drivers/dma/dw-edma/dw-edma-v0-debugfs.c +8 -8
@@ -55,7 +55,7 @@ struct debugfs_entries {static int dw_edma_debugfs_u32_get (void *data,u64 *val) {void __iomem *reg = (void __force __iomem *)data; -if (dw->mode ==EDMA_MODE_LEGACY && +if (dw->chip->mode ==EDMA_MODE_LEGACY && reg >= (void __iomem *)®s->type.legacy.ch) {void __iomem *ptr = ®s->type.legacy.ch;u32 viewport_sel =0 ;
@@ -174,7 +174,7 @@ static void dw_edma_debugfs_regs_wr(struct dentry *dir) nr_entries =ARRAY_SIZE (debugfs_regs);dw_edma_debugfs_create_x32 (debugfs_regs, nr_entries, regs_dir); -if (dw->mode ==EDMA_MODE_UNROLL ) { +if (dw->chip->mode ==EDMA_MODE_UNROLL ) { nr_entries =ARRAY_SIZE (debugfs_unroll_regs);dw_edma_debugfs_create_x32 (debugfs_unroll_regs, nr_entries, regs_dir);
@@ -243,7 +243,7 @@ static void dw_edma_debugfs_regs_rd(struct dentry *dir) nr_entries =ARRAY_SIZE (debugfs_regs);dw_edma_debugfs_create_x32 (debugfs_regs, nr_entries, regs_dir); -if (dw->mode ==EDMA_MODE_UNROLL ) { +if (dw->chip->mode ==EDMA_MODE_UNROLL ) { nr_entries =ARRAY_SIZE (debugfs_unroll_regs);dw_edma_debugfs_create_x32 (debugfs_unroll_regs, nr_entries, regs_dir);
@@ -283,13 +283,13 @@ static void dw_edma_debugfs_regs(void)dw_edma_debugfs_regs_rd (regs_dir); } -void dw_edma_v0_debugfs_on (struct dw_edma_chip *chip) +void dw_edma_v0_debugfs_on (struct dw_edma *_dw) { - dw = chip->dw; + dw = _dw;if (!dw)return ; - regs = dw->rg_region.vaddr; + regs = dw->chip->rg_region.vaddr;if (!regs)return ;
@@ -297,8 +297,8 @@ void dw_edma_v0_debugfs_on(struct dw_edma_chip *chip)if (!base_dir)return ; -debugfs_create_u32 ("version" ,0444 , base_dir, &dw->version); -debugfs_create_u32 ("mode" ,0444 , base_dir, &dw->mode); +debugfs_create_u32 ("version" ,0444 , base_dir, &dw->chip->version); +debugfs_create_u32 ("mode" ,0444 , base_dir, &dw->chip->mode);debugfs_create_u16 ("wr_ch_cnt" ,0444 , base_dir, &dw->wr_ch_cnt);debugfs_create_u16 ("rd_ch_cnt" ,0444 , base_dir, &dw->rd_ch_cnt);
drivers/dma/dw-edma/dw-edma-v0-debugfs.h +2 -2
@@ -12,10 +12,10 @@#include <linux/dma/edma.h> #ifdef CONFIG_DEBUG_FS -void dw_edma_v0_debugfs_on (struct dw_edma_chip *chip); +void dw_edma_v0_debugfs_on (struct dw_edma *dw);void dw_edma_v0_debugfs_off (void );#else -static inline void dw_edma_v0_debugfs_on (struct dw_edma_chip *chip) +static inline void dw_edma_v0_debugfs_on (struct dw_edma *dw) { }
include/linux/dma/edma.h +48 -1
65 lines not on this page · raw message
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/2 dmaengine: dw-edma: Initialize IRQ data before requesting IRQs
From: Koichiro Den <[email protected]>
[ Upstream commit 647217abea849d3d45f8cb0b8ee5b78d50f26985 ]
dw_edma_irq_request() passes struct dw_edma_irq to request_irq() before dw_edma_channel_setup() fills the back pointer. A shared interrupt can therefore enter the handler with dw_irq->dw still NULL, leading to a NULL pointer dereference.
Set the back pointer before installing each handler.
--- drivers/dma/dw-edma/dw-edma-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/dma/dw-edma/dw-edma-core.c +2 -1
@@ -733,7 +733,6 @@ static int dw_edma_channel_setup(struct dw_edma *dw, bool write,else irq->rd_mask |=BIT (j); - irq->dw = dw;memcpy (&chan->msi, &irq->msi,sizeof (chan->msi)); dev_vdbg(dev, "MSI:\t\tChannel %s[%u] addr=0x%.8x%.8x, data=0x%.8x\n",
@@ -826,6 +825,7 @@ static int dw_edma_irq_request(struct dw_edma *dw,if (chip->nr_irqs ==1 ) {/* Common IRQ shared among all channels */ irq = chip->ops->irq_vector (dev,0 ); + dw->irq[0 ].dw = dw; err =request_irq (irq, dw_edma_interrupt_common,IRQF_SHARED , dw->name, &dw->irq[0 ]);if (err) {
@@ -851,6 +851,7 @@ static int dw_edma_irq_request(struct dw_edma *dw,for (i =0 ; i < (*wr_alloc + *rd_alloc); i++) { irq = chip->ops->irq_vector (dev, i); + dw->irq[i].dw = dw; err = request_irq(irq, i < *wr_alloc ? dw_edma_interrupt_write :
Signature · 1 line
2.53.0