Re: Question about calculate trbs in xhci

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/06/2014 11:37 AM, vichy wrote:
> hi Mathias:
>> As I understood it, it is ok to cross page boundaries as long as the buffer is physically contiguous. As our dma case should be.
>> xhci specification section 3.2.8 says that:
>>
>> "Note that no constraints are placed on the TRB Length fields in a Scatter/Gather list. Classically all the
>> buffers pointed to by a scatter gather list were required to be “page size” in length except for the first and
>> last (as illustrated by the example above). The xHCI does not require this constraint. Any buffer pointed to
>> by a Normal, Data Stage, or Isoch TRB in a TD may be any size between 0 and 64K bytes in size. For
>> instance, if when an OS translates a virtual memory buffer into a list of physical pages, some of the entries
>> in the list reference multiple contiguous pages, the flexible Length fields of TRBs allow a 1:1 mapping of list
>> entries to TRBs, i.e. a multi-page list entry does not need to be defined as multiple page sized TRBs."
>> "
> Yes, you are correct. ^^
> there is no page boundary limitation for Scatter/Gather list, but how
> about iso transfer?
> for iso TRB, it seems a limitation for not crossing page boundary in
> section 3.2.11.
> 
> appreciate all your kind help,
> 

As I interpreted it the page crossing limitation is all about buffers in virtual memory that are not contiguous in physical memory.
In that case we have to dig out the physical address of each page, and use chained TRBs to represent each non-continuous
physical memory chunk.

The limitaition says:
"If the data required by an Isoch TD is not physically contiguous (e.g. crosses a page boundary), then
one or more additional Normal TRBs shall be chained to the Isoch TRB by the host."

But we have physically contiguous memory.

Data Buffer Pointer Hi and Lo in the TRB structure point to physical memory. For isoc transfers xhci
uses urb->transfer_dma for the data buffer pointers. urb->transfer_dma is DMA mapped memory of type dma_addr_t 
and should be physically contiguous. So we don't need to worry about page sizes.

But I'm not an expert on memory management, this is how I understand it and how xhci driver is implemented, and it seems to work.

-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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux