qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] qtest: add read/write accessors with a specific


From: Cédric Le Goater
Subject: Re: [Qemu-devel] [PATCH] qtest: add read/write accessors with a specific endianness
Date: Thu, 6 Oct 2016 12:44:16 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0

On 10/06/2016 11:40 AM, Paolo Bonzini wrote:
> 
> 
> On 06/10/2016 10:37, David Gibson wrote:
>> On Thu, Oct 06, 2016 at 09:23:11AM +0200, Paolo Bonzini wrote:
>>>
>>>
>>> On 06/10/2016 05:45, David Gibson wrote:
>>>> qtest is about testing hardware, not the guest cpu, and whether you're
>>>> accessing MMIO space or buffers the hardware will read via DMA, it's
>>>> the hardware which determines the correct endianness, not the guest
>>>> cpu.
>>>
>>> Well, sort of... qtest writes are definitely injecting things from the
>>> point of view of the guest CPU.  For example see Laurent's patches that
>>> add RTAS commands to qtest.
>>
>> Sure.  My point is that any guest CPU can do both LE and BE accesses
>> pretty simply, so we might as well specify which we want.
>
> On this I do agree.

Yes. It is pretty confusing today from the test side. To clarify 
things a little, I came up with this  :

        +static inline uint32_t make_be32(uint32_t data)
        +{
        +    return bswap32(data);
        +}

        ...

        +    writel(ASPEED_FLASH_BASE, make_be32(some_page_addr));

Which is what a Little Endian CPU would do to write a BE value. So
it should probably be called, make_b32_on_le_cpu() to be correct. 

I am not sure there is a good interface for these accesses ...

 
C.



reply via email to

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