RE: Question about calculate trbs in xhci

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

 



From: Mathias Nyman
> On 10/01/2014 05:50 PM, vichy wrote:
> > hi Mathias:
> >
> >>
> >> In xhci-ring.c,  static int xhci_queue_isoc_tx():
> >>
> >> /* Calculate TRB length */
> >>   trb_buff_len = TRB_MAX_BUFF_SIZE - (addr & ((1 << TRB_MAX_BUFF_SHIFT) - 1));
> >>
> >> where  addr = start_addr + urb->iso_frame_desc[i].offset;
> >>
> >> this limits the trb_buff_len to stop the trb buffer at TRB_MAX_BUFF_SIZE boundary
> > Yes, you are right.
> > the above is make sure trb buffer will not cross over
> > TRB_MAX_BUFF_SIZE boundary.
> > But it still possible to cross the page boundary for ISO trb, right?
> > (suppose page boundary is 4KB, TRB_MAX_BUFF_SIZE is 64KB)
> >
> > appreciate your kind help,
> >
> 
> Hi
> 
> 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."
> "

The ohci hardware requires that scatter-gather boundaries occur on USB message boundaries.

The xhi hardware doesn't have that constraint, but has the different constraints:
1) A buffer must not cross a 64k address boundary.
2) A LINK TRB (at the end of the ring) must only occur at a USB message boundary
   (actually it is a slightly tighter constraint).
In combination those two are a PITA.

	David

��.n��������+%������w��{.n�����{���)��jg��������ݢj����G�������j:+v���w�m������w�������h�����٥





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

  Powered by Linux