public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: dwc2: add missing SLAB_CACHE_DMA flag for desc_hsisoc_cache
@ 2026-01-11 11:36 Karthikeyan K S
  2026-01-11 12:23 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Karthikeyan K S @ 2026-01-11 11:36 UTC (permalink / raw)
  To: hminas, gregkh; +Cc: gregory.herrero, linux-usb, linux-kernel, Karthikeyan K S

The desc_hsisoc_cache kmem_cache is used to allocate DMA descriptors
for High-Speed isochronous transfers. These descriptors are passed to
the hardware via dma_map_single() in dwc2_desc_list_alloc().

The desc_gen_cache, which serves the same purpose for other transfer
types, correctly specifies SLAB_CACHE_DMA. However, desc_hsisoc_cache
was created without this flag, despite both caches being used
identically for DMA descriptor allocation.

Add the missing SLAB_CACHE_DMA flag to desc_hsisoc_cache for
consistency and correctness on platforms with DMA zone restrictions.
This also protects against future allocations from this cache that
might omit GFP_DMA.

Fixes: 3b5fcc9ac2f4 ("usb: dwc2: host: use kmem cache to allocate descriptors")

Signed-off-by: Karthikeyan K S <karthiproffesional@gmail.com>
---
 drivers/usb/dwc2/hcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
index 30eb85066..556d6ab36 100644
--- a/drivers/usb/dwc2/hcd.c
+++ b/drivers/usb/dwc2/hcd.c
@@ -5273,7 +5273,7 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg)
 
 		hsotg->desc_hsisoc_cache = kmem_cache_create("dwc2-hsisoc-desc",
 				sizeof(struct dwc2_dma_desc) *
-				MAX_DMA_DESC_NUM_HS_ISOC, 512, 0, NULL);
+				MAX_DMA_DESC_NUM_HS_ISOC, 512, SLAB_CACHE_DMA, NULL);
 		if (!hsotg->desc_hsisoc_cache) {
 			dev_err(hsotg->dev,
 				"unable to create dwc2 hs isoc desc cache\n");
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [PATCH] usb: dwc2: add missing SLAB_CACHE_DMA flag for desc_hsisoc_cache
@ 2026-01-11  7:31 karthikeyan K S
  2026-01-11  7:50 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: karthikeyan K S @ 2026-01-11  7:31 UTC (permalink / raw)
  To: hminas, gregkh; +Cc: gregory.herrero, linux-usb, linux-kernel

From 39cd652d071184e3bab97ba92f6da30152289905 Mon Sep 17 00:00:00 2001
From: karthikeyan <karthiproffesional@gmail.com>
Date: Sun, 11 Jan 2026 08:36:25 +0200
Subject: [PATCH] usb: dwc2: add missing SLAB_CACHE_DMA flag for
 desc_hsisoc_cache

The desc_hsisoc_cache kmem_cache is used to allocate DMA descriptors
for High-Speed isochronous transfers. These descriptors are passed to
the hardware via dma_map_single() in dwc2_desc_list_alloc().

The desc_gen_cache, which serves the same purpose for other transfer
types, correctly specifies SLAB_CACHE_DMA. However, desc_hsisoc_cache
was created without this flag, despite both caches being used
identically for DMA descriptor allocation.

Add the missing SLAB_CACHE_DMA flag to desc_hsisoc_cache for
consistency and correctness on platforms with DMA zone restrictions.
This also protects against future allocations from this cache that
might omit GFP_DMA.

Fixes: 3b5fcc9ac2f4 ("usb: dwc2: host: use kmem cache to allocate descriptors")
Signed-off-by: karthikeyan <karthiproffesional@gmail.com>
---
 drivers/usb/dwc2/hcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
index 30eb8506617c..556d6ab36930 100644
--- a/drivers/usb/dwc2/hcd.c
+++ b/drivers/usb/dwc2/hcd.c
@@ -5273,7 +5273,7 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg)

                hsotg->desc_hsisoc_cache = kmem_cache_create("dwc2-hsisoc-desc",
                                sizeof(struct dwc2_dma_desc) *
-                               MAX_DMA_DESC_NUM_HS_ISOC, 512, 0, NULL);
+                               MAX_DMA_DESC_NUM_HS_ISOC, 512,
SLAB_CACHE_DMA, NULL);
                if (!hsotg->desc_hsisoc_cache) {
                        dev_err(hsotg->dev,
                                "unable to create dwc2 hs isoc desc cache\n");
--
2.34.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-01-11 12:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-11 11:36 [PATCH] usb: dwc2: add missing SLAB_CACHE_DMA flag for desc_hsisoc_cache Karthikeyan K S
2026-01-11 12:23 ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2026-01-11  7:31 karthikeyan K S
2026-01-11  7:50 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox