qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] Curious about this code in the ohci_service_td()


From: Peter Maydell
Subject: Re: [Qemu-devel] Curious about this code in the ohci_service_td()
Date: Sun, 19 Feb 2012 12:54:08 +0000

On 19 February 2012 07:56, Wei Yang <address@hidden> wrote:
> 2012/2/19 Peter Maydell <address@hidden>:
>> On 18 February 2012 16:19, Wei Yang <address@hidden> wrote:
>>> I am reading the code in ohci_service_td().
>>>
>>> There is a calculation of the length of the buffer.
>>>
>>>        if ((td.cbp & 0xfffff000) != (td.be & 0xfffff000)) {
>>>            len = (td.be & 0xfff) + 0x1001 - (td.cbp & 0xfff);
>>>        } else {
>>>            len = (td.be - td.cbp) + 1;
>>>        }
>>>
>>> I am curious about the first case.
>>> So the td.be could be less than the tb.cbp?
>>
> Thanks Peter.
>
>> Yes. See the OHCI spec:
>> ftp://ftp.compaq.com/pub/supportinformation/papers/hcir1_0a.pdf
>> and specifically section 4.3: the data buffer described by a
>> TD may span two separate physically disjoint pages. The exact
>
> I see this sentence. So this sentence means.
> For example, I have
> page 1
> page 2
> page 3
> which contains the content of the TD. (In the guest I think.)
>
> TD buffer could locate at page1 and page 3, without touching page 2?

Yes.

> And I am wondering, the buffer in the guest is page aligned or not?

No, the buffer in the guest need not be page aligned. (Even
if it was originally, if the USB endpoint reads part of the
data, when it updates cbp it will leave cbp non-aligned.)

> Now come to my previous question again.
> tb.cbp and tb.be is pointing to the address in the guest.
> This means
> tb.be may point to page 1
> while
> tb.cbp may point to page 3?
>
> So tb.cbp > tb.be?

Yes, this is a possible configuration.

-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]