Skip to contentSkip to conversation

usb: dwc2: add missing SLAB_CACHE_DMA flag for desc_hsisoc_cache

PATCH Superseded Karthikeyan K S 2 participants 2 messages Jan 11

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
---
 drivers/usb/dwc2/hcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/dwc2/hcd.c +1 -1
index 30eb85066..556d6ab36 100644
@@ -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");
Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 38 lines · 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")
---
 drivers/usb/dwc2/hcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/dwc2/hcd.c +1 -1
index 30eb85066..556d6ab36 100644
@@ -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");
Signature · 1 line
2.43.0

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree.

You are receiving this message because of the following common error(s) as indicated below:

- This looks like a new version of a previously submitted patch, but you did not list below the --- line any changes from the previous version. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/process/submitting-patches.rst for what needs to be done here to properly describe this.

If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers.

thanks,

greg k-h's patch email bot