dmaengine fixes for v6.4

- AT HDMAC driver fixes for Flow Controller bitfield, peripheral ID
   handling and potential NULL dereference check
 - PL330 function rename to avoid conflicts
 - build warning fix for pm function in TI driver
 - IDXD driver fix for passing freed memory
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE+vs47OPLdNbVcHzyfBQHDyUjg0cFAmRzj7oACgkQfBQHDyUj
 g0fExxAAx8KJHqUDuV6xXzdL+O3KANgdEY5Qz1Pyv65g8AtMLXC7H+WC5+1puO5s
 w07wCQnGk2Vo9NtlBrhl2XyK1wvk9kUKG0VcV0sDBCyudCQyuvkF06jcfQHo7lU7
 7MrjzZlVbz+f1mqg7ib9lKC0WEzMxTlT2POZqWw2w7fq0/60sLVK4CQIrObxZOLi
 9EnKNwXj0yzpPK10GUs/0mKWIPaS0m+PL7vcHxNniBxljYGFVpS5zwZMO6N6BnEj
 FgwbllaQfXYioPFMf3Hf9P+BfJM7T7YQexkwGfeiFqowCN6kYX3ECAqQ9cI7OC/y
 Tx3hXSySWagvd514RwGICh5p2VLCmn5hLhjl+E+16Y5Gj+YxqBNG9Cwzuu5v/4N5
 5K2NM87J9KYuI7aPTqvvWhf+X0Ap6FhSPVyrQK4bhcnBGkLmQLlIi9Xo47s0cG2I
 rKrVZXcbxGtrGBYEdTWKLqBmkJRYhMWTSAQSZH/GTMhDjE3kn/OX0kSVFoDwy4dI
 ud1NpMYzMcEvi9IlDx37GWTF2QKjfERz3aXzI/CeQKKSg8TtevQsNsj1lc9GUH7N
 Y/yIrmixgCJXWDevohdfeSu/nnD1DtbRLAiTKWpzwDQE5J5EiZrautl2avXVWkIs
 otLhBECGQAWWBRf8KpKf/z8NEgYhRrrJkNw1Gx//ypBGqOZM/HI=
 =T3nh
 -----END PGP SIGNATURE-----

Merge tag 'dmaengine-fix-6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine

Pull dmaengine fixes from Vinod Koul:
 "Driver fixes for the at-hdmac, pl330, TI and IDXD drivers:

   - AT HDMAC driver fixes for Flow Controller bitfield, peripheral ID
     handling and potential NULL dereference check

   - PL330 function rename to avoid conflicts

   - build warning fix for pm function in TI driver

   - IDXD driver fix for passing freed memory"

* tag 'dmaengine-fix-6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine:
  dmaengine: at_hdmac: Extend the Flow Controller bitfield to three bits
  dmaengine: at_hdmac: Repair bitfield macros for peripheral ID handling
  dmaengine: pl330: rename _start to prevent build error
  dmaengine: at_xdmac: fix potential Oops in at_xdmac_prep_interleaved()
  dmaengine: ti: k3-udma: annotate pm function with __maybe_unused
  dmaengine: idxd: Fix passing freed memory in idxd_cdev_open()
This commit is contained in:
Linus Torvalds 2023-05-28 19:59:08 -04:00
commit dca389eb95
5 changed files with 21 additions and 16 deletions

View File

@ -132,7 +132,7 @@
#define ATC_DST_PIP BIT(12) /* Destination Picture-in-Picture enabled */ #define ATC_DST_PIP BIT(12) /* Destination Picture-in-Picture enabled */
#define ATC_SRC_DSCR_DIS BIT(16) /* Src Descriptor fetch disable */ #define ATC_SRC_DSCR_DIS BIT(16) /* Src Descriptor fetch disable */
#define ATC_DST_DSCR_DIS BIT(20) /* Dst Descriptor fetch disable */ #define ATC_DST_DSCR_DIS BIT(20) /* Dst Descriptor fetch disable */
#define ATC_FC GENMASK(22, 21) /* Choose Flow Controller */ #define ATC_FC GENMASK(23, 21) /* Choose Flow Controller */
#define ATC_FC_MEM2MEM 0x0 /* Mem-to-Mem (DMA) */ #define ATC_FC_MEM2MEM 0x0 /* Mem-to-Mem (DMA) */
#define ATC_FC_MEM2PER 0x1 /* Mem-to-Periph (DMA) */ #define ATC_FC_MEM2PER 0x1 /* Mem-to-Periph (DMA) */
#define ATC_FC_PER2MEM 0x2 /* Periph-to-Mem (DMA) */ #define ATC_FC_PER2MEM 0x2 /* Periph-to-Mem (DMA) */
@ -153,8 +153,6 @@
#define ATC_AUTO BIT(31) /* Auto multiple buffer tx enable */ #define ATC_AUTO BIT(31) /* Auto multiple buffer tx enable */
/* Bitfields in CFG */ /* Bitfields in CFG */
#define ATC_PER_MSB(h) ((0x30U & (h)) >> 4) /* Extract most significant bits of a handshaking identifier */
#define ATC_SRC_PER GENMASK(3, 0) /* Channel src rq associated with periph handshaking ifc h */ #define ATC_SRC_PER GENMASK(3, 0) /* Channel src rq associated with periph handshaking ifc h */
#define ATC_DST_PER GENMASK(7, 4) /* Channel dst rq associated with periph handshaking ifc h */ #define ATC_DST_PER GENMASK(7, 4) /* Channel dst rq associated with periph handshaking ifc h */
#define ATC_SRC_REP BIT(8) /* Source Replay Mod */ #define ATC_SRC_REP BIT(8) /* Source Replay Mod */
@ -181,10 +179,15 @@
#define ATC_DPIP_HOLE GENMASK(15, 0) #define ATC_DPIP_HOLE GENMASK(15, 0)
#define ATC_DPIP_BOUNDARY GENMASK(25, 16) #define ATC_DPIP_BOUNDARY GENMASK(25, 16)
#define ATC_SRC_PER_ID(id) (FIELD_PREP(ATC_SRC_PER_MSB, (id)) | \ #define ATC_PER_MSB GENMASK(5, 4) /* Extract MSBs of a handshaking identifier */
FIELD_PREP(ATC_SRC_PER, (id))) #define ATC_SRC_PER_ID(id) \
#define ATC_DST_PER_ID(id) (FIELD_PREP(ATC_DST_PER_MSB, (id)) | \ ({ typeof(id) _id = (id); \
FIELD_PREP(ATC_DST_PER, (id))) FIELD_PREP(ATC_SRC_PER_MSB, FIELD_GET(ATC_PER_MSB, _id)) | \
FIELD_PREP(ATC_SRC_PER, _id); })
#define ATC_DST_PER_ID(id) \
({ typeof(id) _id = (id); \
FIELD_PREP(ATC_DST_PER_MSB, FIELD_GET(ATC_PER_MSB, _id)) | \
FIELD_PREP(ATC_DST_PER, _id); })

View File

@ -1102,6 +1102,8 @@ at_xdmac_prep_interleaved(struct dma_chan *chan,
NULL, NULL,
src_addr, dst_addr, src_addr, dst_addr,
xt, xt->sgl); xt, xt->sgl);
if (!first)
return NULL;
/* Length of the block is (BLEN+1) microblocks. */ /* Length of the block is (BLEN+1) microblocks. */
for (i = 0; i < xt->numf - 1; i++) for (i = 0; i < xt->numf - 1; i++)
@ -1132,8 +1134,9 @@ at_xdmac_prep_interleaved(struct dma_chan *chan,
src_addr, dst_addr, src_addr, dst_addr,
xt, chunk); xt, chunk);
if (!desc) { if (!desc) {
list_splice_tail_init(&first->descs_list, if (first)
&atchan->free_descs_list); list_splice_tail_init(&first->descs_list,
&atchan->free_descs_list);
return NULL; return NULL;
} }

View File

@ -277,7 +277,6 @@ static int idxd_cdev_open(struct inode *inode, struct file *filp)
if (wq_dedicated(wq)) { if (wq_dedicated(wq)) {
rc = idxd_wq_set_pasid(wq, pasid); rc = idxd_wq_set_pasid(wq, pasid);
if (rc < 0) { if (rc < 0) {
iommu_sva_unbind_device(sva);
dev_err(dev, "wq set pasid failed: %d\n", rc); dev_err(dev, "wq set pasid failed: %d\n", rc);
goto failed_set_pasid; goto failed_set_pasid;
} }

View File

@ -1050,7 +1050,7 @@ static bool _trigger(struct pl330_thread *thrd)
return true; return true;
} }
static bool _start(struct pl330_thread *thrd) static bool pl330_start_thread(struct pl330_thread *thrd)
{ {
switch (_state(thrd)) { switch (_state(thrd)) {
case PL330_STATE_FAULT_COMPLETING: case PL330_STATE_FAULT_COMPLETING:
@ -1702,7 +1702,7 @@ static int pl330_update(struct pl330_dmac *pl330)
thrd->req_running = -1; thrd->req_running = -1;
/* Get going again ASAP */ /* Get going again ASAP */
_start(thrd); pl330_start_thread(thrd);
/* For now, just make a list of callbacks to be done */ /* For now, just make a list of callbacks to be done */
list_add_tail(&descdone->rqd, &pl330->req_done); list_add_tail(&descdone->rqd, &pl330->req_done);
@ -2089,7 +2089,7 @@ static void pl330_tasklet(struct tasklet_struct *t)
} else { } else {
/* Make sure the PL330 Channel thread is active */ /* Make sure the PL330 Channel thread is active */
spin_lock(&pch->thread->dmac->lock); spin_lock(&pch->thread->dmac->lock);
_start(pch->thread); pl330_start_thread(pch->thread);
spin_unlock(&pch->thread->dmac->lock); spin_unlock(&pch->thread->dmac->lock);
} }
@ -2107,7 +2107,7 @@ static void pl330_tasklet(struct tasklet_struct *t)
if (power_down) { if (power_down) {
pch->active = true; pch->active = true;
spin_lock(&pch->thread->dmac->lock); spin_lock(&pch->thread->dmac->lock);
_start(pch->thread); pl330_start_thread(pch->thread);
spin_unlock(&pch->thread->dmac->lock); spin_unlock(&pch->thread->dmac->lock);
power_down = false; power_down = false;
} }

View File

@ -5527,7 +5527,7 @@ static int udma_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int udma_pm_suspend(struct device *dev) static int __maybe_unused udma_pm_suspend(struct device *dev)
{ {
struct udma_dev *ud = dev_get_drvdata(dev); struct udma_dev *ud = dev_get_drvdata(dev);
struct dma_device *dma_dev = &ud->ddev; struct dma_device *dma_dev = &ud->ddev;
@ -5549,7 +5549,7 @@ static int udma_pm_suspend(struct device *dev)
return 0; return 0;
} }
static int udma_pm_resume(struct device *dev) static int __maybe_unused udma_pm_resume(struct device *dev)
{ {
struct udma_dev *ud = dev_get_drvdata(dev); struct udma_dev *ud = dev_get_drvdata(dev);
struct dma_device *dma_dev = &ud->ddev; struct dma_device *dma_dev = &ud->ddev;