Re: [Qemu-devel] [PATCH v5 11/15] memory: Single byte swap along the I/O path

2019-07-26 Thread Richard Henderson
On 7/26/19 2:39 AM, Paolo Bonzini wrote: > Then memory_region_endianness_inverted can be: > > if (mr->ops->endianness == DEVICE_NATIVE_ENDIAN) > return (op & MO_BSWAP) != MO_TE; > else if (mr->ops->endianness == DEVICE_BIG_ENDIAN) > return (op & MO_BSWAP) != MO_BE; > else if (mr->ops

Re: [Qemu-devel] [PATCH v5 11/15] memory: Single byte swap along the I/O path

2019-07-26 Thread Richard Henderson
On 7/26/19 2:26 AM, Paolo Bonzini wrote: > On 26/07/19 08:47, tony.ngu...@bt.com wrote: >> +        op = SIZE_MEMOP(size); >> +        if (need_bswap(big_endian)) { >> +            op ^= MO_BSWAP; >> +        } > > And this has the same issue as the first version. It should be > > op = SIZ

Re: [Qemu-devel] [PATCH v5 11/15] memory: Single byte swap along the I/O path

2019-07-26 Thread Paolo Bonzini
On 26/07/19 08:47, tony.ngu...@bt.com wrote: > +static bool memory_region_endianness_inverted(MemoryRegion *mr) >  { >  #ifdef TARGET_WORDS_BIGENDIAN >      return mr->ops->endianness == DEVICE_LITTLE_ENDIAN; > @@ -361,23 +361,27 @@ static bool > memory_region_wrong_endianness(MemoryRegion *mr) >  

Re: [Qemu-devel] [PATCH v5 11/15] memory: Single byte swap along the I/O path

2019-07-26 Thread Paolo Bonzini
On 26/07/19 08:47, tony.ngu...@bt.com wrote: > +        op = SIZE_MEMOP(size); > +        if (need_bswap(big_endian)) { > +            op ^= MO_BSWAP; > +        } And this has the same issue as the first version. It should be op = SIZE_MEMOP(size) | (big_endian ? MO_BE : MO_LE); and ev

[Qemu-devel] [PATCH v5 11/15] memory: Single byte swap along the I/O path

2019-07-25 Thread tony.nguyen
Now that MemOp has been pushed down into the memory API, we can collapse the two byte swaps adjust_endianness and handle_bswap into the former. Collapsing byte swaps along the I/O path enables additional endian inversion logic, e.g. SPARC64 Invert Endian TTE bit, with redundant byte swaps cancelli