History

USB: use genalloc for USB HCs with local memory

For HCs that have local memory, replace the current DMA API usage with a genalloc generic allocator to manage the mappings for these devices. To help users, introduce a new HCD API, usb_hcd_setup_local_mem() that will setup up the genalloc backing up the device local memory. It will be used in subsequent patches. This is in preparation for dropping the existing "coherent" dma mem declaration APIs. The current implementation was relying on a short circuit in the DMA API that in the end, was acting as an allocator for these type of devices.

Laurentiu Tudor committed 7 years ago

Commit b0310c21 parent da83a727 files · +102 −9Browse files

Showing the changes to include/linux (1 of 7 files). Show all

Unified · Split

include/linux/usb/hcd.h+5−0
@@ -216,6 +216,9 @@ struct usb_hcd { · 215 unmodified lines
216216 #define HC_IS_RUNNING(state) ((state) & __ACTIVE)
217217 #define HC_IS_SUSPENDED(state) ((state) & __SUSPEND)
218218
219+ /* memory pool for HCs having local memory, or %NULL */
220+ struct gen_pool *localmem_pool;
221+
219222 /* more shared queuing code would be good; it should support
220223 * smarter scheduling, handle transaction translators, etc;
221224 * input size of periodic table to an interrupt scheduler.
@@ -461,6 +464,8 @@ extern int usb_add_hcd(struct usb_hcd *hcd, · 239 unmodified lines
461464 unsigned int irqnum, unsigned long irqflags);
462465 extern void usb_remove_hcd(struct usb_hcd *hcd);
463466 extern int usb_hcd_find_raw_port_number(struct usb_hcd *hcd, int port1);
467+int usb_hcd_setup_local_mem(struct usb_hcd *hcd, phys_addr_t phys_addr,
468+ dma_addr_t dma, size_t size);
464469
465470 struct platform_device;
466471 extern void usb_hcd_platform_shutdown(struct platform_device *dev);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t