RE: Question about calculate trbs in xhci

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

 



> From: linux-usb-owner@xxxxxxxxxxxxxxx [mailto:linux-usb-owner@xxxxxxxxxxxxxxx] On Behalf Of David Laight
> Sent: Friday, October 03, 2014 6:08 AM
> 
> 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.

Hi David,

May I ask where in the xHCI spec is 2) stated? I'm not finding it
(looking at "Revision 1.0 with errata to 7/12/12").

I can't find "message boundary" anywhere in the spec. Did you mean packet
boundary?

If so, there is some text in the spec which contradicts that. In 4.11.7.1,
it says:

"In Figure 26 the IOC flag only may be set in TRBs 5 and 10 ...
 Note that THE LINK TRB DOES NOT LAND ON A PACKET BOUNDARY relative
 to the start of TD Fragment 1, so its IOC flag may not be set."

(emphasis mine)

-- 
Paul

��.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