On 04/10/2016 14:36, Peter Maydell wrote: > On 4 October 2016 at 13:17, Cédric Le Goater <c...@kaod.org> wrote: >> Some test scenarios require to access memory regions using a specific >> endianness, such as a device region, but the current qtest memory >> accessors are done in native endian, which means that the values are >> byteswapped in qtest if the endianness of the guest and the host are >> different. >> >> To maintain the endianness of a value, we need a new set of memory >> accessor. This can be done in two ways: >> >> - first, convert the value to the required endianness in libqtest and >> then use the memread/write routines so that qtest accesses the guest >> memory without doing any supplementary byteswapping >> >> - an alternative method would be to handle the byte swapping on the >> qtest side. For that, we would need to extend the read/write >> protocol with an ending word : "native|le|be" and modify the tswap >> calls accordingly under the qtest_process_command() routine. >> >> The result is the same and the first method is simpler. > > The difficulty with this patch is that it's hard to tell whether > it's really required, or if this is just adding an extra layer > of byteswapping that should really be done in some other location > in the stack. What's the actual test case here? >
We need that to implement PCI qtest with SPAPR, as PCI is always little-endian and SPAPR is big-endian by default, see my patch http://patchwork.ozlabs.org/patch/676591/ I'm going to resend my series based on Cédric's patch. Thanks, Laurent