Hi On 04.05.2017 22:13, Matthias Lange wrote:
Hi, I am wondering what the reason for the GFP_DMA flag in xhci_segment_alloc() (drivers/usb/host/xhci-mem.c:59) is. It is causing me problems in a virtualization setup with enabled IOMMU (x86_64). The result is that USB is not working in the VM. Could someone please shed some light on this?
You refer to this line, right: seg->bounce_buf = kzalloc(max_packet, flags | GFP_DMA); GFP_DMA was set as to make sure seg->bounce_buf is within the dma_mask as it is used as the *cpu_addr in dma_map_single() later. But looks like this is complete overkill and it will make sure it is within the first 16MB ISA DMA addresses instead. DMA-API.txt states for dma_map_single that: "To ensure that the memory allocated by kmalloc is within the dma_mask, the driver may specify various platform-dependent flags to restrict the DMA address range of the allocation (e.g., on x86, GFP_DMA guarantees to be within the first 16MB of available DMA addresses, as required by ISA devices)." So I don't think there is any reason it couldn't be just GFP_KERNEL instead -Mathias -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html