Re: [Qemu-devel] [PATCH] memory: make ram device read/write endian sensitive

2017-02-26 Thread Yongji Xie
on 2017/2/27 11:25, Alexey Kardashevskiy wrote: On 27/02/17 13:25, Michael Roth wrote: Quoting Alexey Kardashevskiy (2017-02-22 22:20:25) On 21/02/17 17:46, Yongji Xie wrote: At the moment ram device's memory regions are NATIVE_ENDIAN. This does not work on PPC64 because VFIO PCI device is

Re: [Qemu-devel] [PATCH] memory: make ram device read/write endian sensitive

2017-02-26 Thread Alexey Kardashevskiy
On 27/02/17 13:25, Michael Roth wrote: > Quoting Alexey Kardashevskiy (2017-02-22 22:20:25) >> On 21/02/17 17:46, Yongji Xie wrote: >>> At the moment ram device's memory regions are NATIVE_ENDIAN. This does >>> not work on PPC64 because VFIO PCI device is little endian but PPC64 >>> always defines

Re: [Qemu-devel] [PATCH] memory: make ram device read/write endian sensitive

2017-02-26 Thread Michael Roth
Quoting Alexey Kardashevskiy (2017-02-22 22:20:25) > On 21/02/17 17:46, Yongji Xie wrote: > > At the moment ram device's memory regions are NATIVE_ENDIAN. This does > > not work on PPC64 because VFIO PCI device is little endian but PPC64 > > always defines static macro TARGET_WORDS_BIGENDIAN. > >

Re: [Qemu-devel] [PATCH] memory: make ram device read/write endian sensitive

2017-02-23 Thread David Gibson
On Thu, Feb 23, 2017 at 12:43:37PM +0100, Paolo Bonzini wrote: > > > On 23/02/2017 12:34, Peter Maydell wrote: > > On 23 February 2017 at 10:33, Paolo Bonzini wrote: > >> > >> > >> On 23/02/2017 11:23, Peter Maydell wrote: > >>> On 23 February 2017 at 10:10, Paolo Bonzini

Re: [Qemu-devel] [PATCH] memory: make ram device read/write endian sensitive

2017-02-23 Thread David Gibson
On Fri, Feb 24, 2017 at 01:14:09AM +0800, Yongji Xie wrote: > on 2017/2/24 0:15, Paolo Bonzini wrote: > > > > > On 23/02/2017 17:08, Peter Maydell wrote: > > > On 23 February 2017 at 15:58, Paolo Bonzini wrote: > > > > However, DEVICE_NATIVE_ENDIAN would have to be paired

Re: [Qemu-devel] [PATCH] memory: make ram device read/write endian sensitive

2017-02-23 Thread Paul Mackerras
On Thu, Feb 23, 2017 at 03:29:53PM +, Peter Maydell wrote: > On 23 February 2017 at 15:21, Paolo Bonzini wrote: > > > > > > On 23/02/2017 15:35, Peter Maydell wrote: > >> On 23 February 2017 at 12:53, Paolo Bonzini wrote: > >>> > >>> > >>> On

Re: [Qemu-devel] [PATCH] memory: make ram device read/write endian sensitive

2017-02-23 Thread Yongji Xie
on 2017/2/24 0:15, Paolo Bonzini wrote: On 23/02/2017 17:08, Peter Maydell wrote: On 23 February 2017 at 15:58, Paolo Bonzini wrote: However, DEVICE_NATIVE_ENDIAN would have to be paired with tswap, which the current code does not do, hence the bug. To have no swap at

Re: [Qemu-devel] [PATCH] memory: make ram device read/write endian sensitive

2017-02-23 Thread Paolo Bonzini
On 23/02/2017 17:08, Peter Maydell wrote: > On 23 February 2017 at 15:58, Paolo Bonzini wrote: >> However, DEVICE_NATIVE_ENDIAN would have to be paired with tswap, which >> the current code does not do, hence the bug. To have no swap at all, >> you'd need

Re: [Qemu-devel] [PATCH] memory: make ram device read/write endian sensitive

2017-02-23 Thread Alex Williamson
On Thu, 23 Feb 2017 16:47:23 +0100 Paolo Bonzini wrote: > On 23/02/2017 16:39, Alex Williamson wrote: > > On Thu, 23 Feb 2017 16:21:47 +0100 > > Paolo Bonzini wrote: > > > >> On 23/02/2017 15:35, Peter Maydell wrote: > >>> On 23 February 2017 at

Re: [Qemu-devel] [PATCH] memory: make ram device read/write endian sensitive

2017-02-23 Thread Peter Maydell
On 23 February 2017 at 15:58, Paolo Bonzini wrote: > > > On 23/02/2017 16:29, Peter Maydell wrote: >>> No, they look entirely the same. The only difference is that they go >>> through MemoryRegionOps instead of memcpy. >> Then we have a different problem, because the thing

Re: [Qemu-devel] [PATCH] memory: make ram device read/write endian sensitive

2017-02-23 Thread Paolo Bonzini
On 23/02/2017 16:29, Peter Maydell wrote: >> No, they look entirely the same. The only difference is that they go >> through MemoryRegionOps instead of memcpy. > Then we have a different problem, because the thing this patch > is claiming to fix is that the memory the device is backed by >

Re: [Qemu-devel] [PATCH] memory: make ram device read/write endian sensitive

2017-02-23 Thread Paolo Bonzini
On 23/02/2017 16:39, Alex Williamson wrote: > On Thu, 23 Feb 2017 16:21:47 +0100 > Paolo Bonzini wrote: > >> On 23/02/2017 15:35, Peter Maydell wrote: >>> On 23 February 2017 at 12:53, Paolo Bonzini wrote: On 23/02/2017 13:26, Peter

Re: [Qemu-devel] [PATCH] memory: make ram device read/write endian sensitive

2017-02-23 Thread Alex Williamson
On Thu, 23 Feb 2017 16:21:47 +0100 Paolo Bonzini wrote: > On 23/02/2017 15:35, Peter Maydell wrote: > > On 23 February 2017 at 12:53, Paolo Bonzini wrote: > >> > >> > >> On 23/02/2017 13:26, Peter Maydell wrote: > >>> On 23 February 2017 at 11:43,

Re: [Qemu-devel] [PATCH] memory: make ram device read/write endian sensitive

2017-02-23 Thread Peter Maydell
On 23 February 2017 at 15:21, Paolo Bonzini wrote: > > > On 23/02/2017 15:35, Peter Maydell wrote: >> On 23 February 2017 at 12:53, Paolo Bonzini wrote: >>> >>> >>> On 23/02/2017 13:26, Peter Maydell wrote: On 23 February 2017 at 11:43, Paolo

Re: [Qemu-devel] [PATCH] memory: make ram device read/write endian sensitive

2017-02-23 Thread Paolo Bonzini
On 23/02/2017 15:35, Peter Maydell wrote: > On 23 February 2017 at 12:53, Paolo Bonzini wrote: >> >> >> On 23/02/2017 13:26, Peter Maydell wrote: >>> On 23 February 2017 at 11:43, Paolo Bonzini wrote: On 23/02/2017 12:34, Peter Maydell wrote:

Re: [Qemu-devel] [PATCH] memory: make ram device read/write endian sensitive

2017-02-23 Thread Peter Maydell
On 23 February 2017 at 12:53, Paolo Bonzini wrote: > > > On 23/02/2017 13:26, Peter Maydell wrote: >> On 23 February 2017 at 11:43, Paolo Bonzini wrote: >>> On 23/02/2017 12:34, Peter Maydell wrote: We should probably update the doc comment to note

Re: [Qemu-devel] [PATCH] memory: make ram device read/write endian sensitive

2017-02-23 Thread Paolo Bonzini
On 23/02/2017 13:26, Peter Maydell wrote: > On 23 February 2017 at 11:43, Paolo Bonzini wrote: >> On 23/02/2017 12:34, Peter Maydell wrote: >>> We should probably update the doc comment to note that the >>> pointer is to host-endianness memory (and that this is not >>> like

Re: [Qemu-devel] [PATCH] memory: make ram device read/write endian sensitive

2017-02-23 Thread Peter Maydell
On 23 February 2017 at 11:43, Paolo Bonzini wrote: > On 23/02/2017 12:34, Peter Maydell wrote: >> We should probably update the doc comment to note that the >> pointer is to host-endianness memory (and that this is not >> like normal RAM which is target-endian)... > > I

Re: [Qemu-devel] [PATCH] memory: make ram device read/write endian sensitive

2017-02-23 Thread Paolo Bonzini
On 23/02/2017 12:34, Peter Maydell wrote: > On 23 February 2017 at 10:33, Paolo Bonzini wrote: >> >> >> On 23/02/2017 11:23, Peter Maydell wrote: >>> On 23 February 2017 at 10:10, Paolo Bonzini wrote: On 23/02/2017 11:02, Peter Maydell wrote:

Re: [Qemu-devel] [PATCH] memory: make ram device read/write endian sensitive

2017-02-23 Thread Peter Maydell
On 23 February 2017 at 10:33, Paolo Bonzini wrote: > > > On 23/02/2017 11:23, Peter Maydell wrote: >> On 23 February 2017 at 10:10, Paolo Bonzini wrote: >>> On 23/02/2017 11:02, Peter Maydell wrote: I'm really not convinced we need

Re: [Qemu-devel] [PATCH] memory: make ram device read/write endian sensitive

2017-02-23 Thread Alexey Kardashevskiy
On 23/02/17 19:35, Paolo Bonzini wrote: > > > On 23/02/2017 05:20, Alexey Kardashevskiy wrote: >> First, Paolo is right and ram_device_mem_ops::endianness should be >> host-endian which happens to be little in our test case (ppc64le) > > So you tested a ppc64 BE guest and it works? Yes.

Re: [Qemu-devel] [PATCH] memory: make ram device read/write endian sensitive

2017-02-23 Thread Paolo Bonzini
On 23/02/2017 11:23, Peter Maydell wrote: > On 23 February 2017 at 10:10, Paolo Bonzini wrote: >> On 23/02/2017 11:02, Peter Maydell wrote: >>> I'm really not convinced we need DEVICE_HOST_ENDIAN. RAM >>> areas should be target-endian (you can probably define >>> "target

Re: [Qemu-devel] [PATCH] memory: make ram device read/write endian sensitive

2017-02-23 Thread Peter Maydell
On 23 February 2017 at 10:10, Paolo Bonzini wrote: > On 23/02/2017 11:02, Peter Maydell wrote: >> I'm really not convinced we need DEVICE_HOST_ENDIAN. RAM >> areas should be target-endian (you can probably define >> "target endianness" as "the endianness that RAM areas

Re: [Qemu-devel] [PATCH] memory: make ram device read/write endian sensitive

2017-02-23 Thread Paolo Bonzini
On 23/02/2017 11:02, Peter Maydell wrote: > On 23 February 2017 at 08:35, Paolo Bonzini wrote: >> >> >> On 23/02/2017 05:20, Alexey Kardashevskiy wrote: >>> First, Paolo is right and ram_device_mem_ops::endianness should be >>> host-endian which happens to be little in our

Re: [Qemu-devel] [PATCH] memory: make ram device read/write endian sensitive

2017-02-23 Thread Peter Maydell
On 23 February 2017 at 08:35, Paolo Bonzini wrote: > > > On 23/02/2017 05:20, Alexey Kardashevskiy wrote: >> First, Paolo is right and ram_device_mem_ops::endianness should be >> host-endian which happens to be little in our test case (ppc64le) > > So you tested a ppc64 BE

Re: [Qemu-devel] [PATCH] memory: make ram device read/write endian sensitive

2017-02-23 Thread Paolo Bonzini
On 23/02/2017 05:20, Alexey Kardashevskiy wrote: > First, Paolo is right and ram_device_mem_ops::endianness should be > host-endian which happens to be little in our test case (ppc64le) So you tested a ppc64 BE guest and it works? > Keep things where they are in the VFIO department and just

Re: [Qemu-devel] [PATCH] memory: make ram device read/write endian sensitive

2017-02-22 Thread Alexey Kardashevskiy
On 21/02/17 17:46, Yongji Xie wrote: > At the moment ram device's memory regions are NATIVE_ENDIAN. This does > not work on PPC64 because VFIO PCI device is little endian but PPC64 > always defines static macro TARGET_WORDS_BIGENDIAN. > > This fixes endianness for ram device the same way as it is

Re: [Qemu-devel] [PATCH] memory: make ram device read/write endian sensitive

2017-02-22 Thread Paolo Bonzini
On 21/02/2017 19:44, Alex Williamson wrote: >>> In other words, would Yongji's patch just work if it used >>> DEVICE_BIG_ENDIAN and beNN_to_cpu/cpu_to_beNN? If so, then I think the >>> patch is okay. > > The part where I get lost is that if PPC64 always sets the target > to big endian, then

Re: [Qemu-devel] [PATCH] memory: make ram device read/write endian sensitive

2017-02-21 Thread Yongji Xie
on 2017/2/22 2:44, Alex Williamson wrote: On Tue, 21 Feb 2017 18:09:04 + Peter Maydell wrote: On 21 February 2017 at 16:34, Paolo Bonzini wrote: On 21/02/2017 17:21, Alex Williamson wrote: On Tue, 21 Feb 2017 14:46:55 +0800 Yongji Xie

Re: [Qemu-devel] [PATCH] memory: make ram device read/write endian sensitive

2017-02-21 Thread Peter Maydell
On 21 February 2017 at 18:53, Paolo Bonzini wrote: > On 21/02/2017 19:09, Peter Maydell wrote: >> In this instance I don't understand the patch. The ram_device >> mem-ops are there to deal with memory regions backed by a >> lump of RAM, right? Lumps of memory are always the

Re: [Qemu-devel] [PATCH] memory: make ram device read/write endian sensitive

2017-02-21 Thread Paolo Bonzini
On 21/02/2017 19:09, Peter Maydell wrote: > In this instance I don't understand the patch. The ram_device > mem-ops are there to deal with memory regions backed by a > lump of RAM, right? Lumps of memory are always the endianness > of the host CPU by definition, so DEVICE_NATIVE_ENDIAN and > no

Re: [Qemu-devel] [PATCH] memory: make ram device read/write endian sensitive

2017-02-21 Thread Alex Williamson
On Tue, 21 Feb 2017 18:09:04 + Peter Maydell wrote: > On 21 February 2017 at 16:34, Paolo Bonzini wrote: > > > > > > On 21/02/2017 17:21, Alex Williamson wrote: > >> On Tue, 21 Feb 2017 14:46:55 +0800 > >> Yongji Xie

Re: [Qemu-devel] [PATCH] memory: make ram device read/write endian sensitive

2017-02-21 Thread Peter Maydell
On 21 February 2017 at 16:34, Paolo Bonzini wrote: > > > On 21/02/2017 17:21, Alex Williamson wrote: >> On Tue, 21 Feb 2017 14:46:55 +0800 >> Yongji Xie wrote: >> >>> At the moment ram device's memory regions are NATIVE_ENDIAN. This does >>> not

Re: [Qemu-devel] [PATCH] memory: make ram device read/write endian sensitive

2017-02-21 Thread Paolo Bonzini
On 21/02/2017 17:21, Alex Williamson wrote: > On Tue, 21 Feb 2017 14:46:55 +0800 > Yongji Xie wrote: > >> At the moment ram device's memory regions are NATIVE_ENDIAN. This does >> not work on PPC64 because VFIO PCI device is little endian but PPC64 >> always defines

Re: [Qemu-devel] [PATCH] memory: make ram device read/write endian sensitive

2017-02-21 Thread Alex Williamson
On Tue, 21 Feb 2017 14:46:55 +0800 Yongji Xie wrote: > At the moment ram device's memory regions are NATIVE_ENDIAN. This does > not work on PPC64 because VFIO PCI device is little endian but PPC64 > always defines static macro TARGET_WORDS_BIGENDIAN. > > This fixes

[Qemu-devel] [PATCH] memory: make ram device read/write endian sensitive

2017-02-20 Thread Yongji Xie
At the moment ram device's memory regions are NATIVE_ENDIAN. This does not work on PPC64 because VFIO PCI device is little endian but PPC64 always defines static macro TARGET_WORDS_BIGENDIAN. This fixes endianness for ram device the same way as it is done for VFIO region in commit