Re: [Qemu-devel] [PATCH 10/21] memory: make section size a 128-bit integer

2013-06-06 Thread Alexey Kardashevskiy
On 05/31/2013 07:16 AM, Paolo Bonzini wrote: So far, the size of all regions passed to listeners could fit in 64 bits, because artificial regions (containers and aliases) are eliminated by the memory core, leaving only device regions which have reasonable sizes An IOMMU however cannot be

Re: [Qemu-devel] [PATCH 10/21] memory: make section size a 128-bit integer

2013-06-06 Thread Paolo Bonzini
Il 06/06/2013 04:36, Alexey Kardashevskiy ha scritto: diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c index 693a9ff..c89676b 100644 --- a/hw/misc/vfio.c +++ b/hw/misc/vfio.c @@ -1953,7 +1953,7 @@ static void vfio_listener_region_add(MemoryListener *listener, } iova =

Re: [Qemu-devel] [PATCH 10/21] memory: make section size a 128-bit integer

2013-06-06 Thread Alexey Kardashevskiy
On 06/07/2013 11:09 AM, Paolo Bonzini wrote: Il 06/06/2013 04:36, Alexey Kardashevskiy ha scritto: diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c index 693a9ff..c89676b 100644 --- a/hw/misc/vfio.c +++ b/hw/misc/vfio.c @@ -1953,7 +1953,7 @@ static void vfio_listener_region_add(MemoryListener

Re: [Qemu-devel] [PATCH 10/21] memory: make section size a 128-bit integer

2013-06-06 Thread Paolo Bonzini
Il 06/06/2013 21:23, Alexey Kardashevskiy ha scritto: On 06/07/2013 11:09 AM, Paolo Bonzini wrote: Il 06/06/2013 04:36, Alexey Kardashevskiy ha scritto: diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c index 693a9ff..c89676b 100644 --- a/hw/misc/vfio.c +++ b/hw/misc/vfio.c @@ -1953,7 +1953,7 @@

Re: [Qemu-devel] [PATCH 10/21] memory: make section size a 128-bit integer

2013-06-02 Thread Paolo Bonzini
Il 01/06/2013 00:18, Richard Henderson ha scritto: On 05/30/2013 02:16 PM, Paolo Bonzini wrote: +static inline Int128 int128_rshift(Int128 a, int n) +{ +return (Int128) { (a.lo n) | (a.hi (64 - n)), (a.hi n) }; +} Produces wrong results for n == 0, since (a.hi 64) is undefined.

Re: [Qemu-devel] [PATCH 10/21] memory: make section size a 128-bit integer

2013-06-02 Thread Peter Maydell
On 31 May 2013 23:18, Richard Henderson r...@twiddle.net wrote: On 05/30/2013 02:16 PM, Paolo Bonzini wrote: +static inline Int128 int128_rshift(Int128 a, int n) +{ +return (Int128) { (a.lo n) | (a.hi (64 - n)), (a.hi n) }; +} Produces wrong results for n == 0, since (a.hi 64) is

Re: [Qemu-devel] [PATCH 10/21] memory: make section size a 128-bit integer

2013-06-02 Thread Paolo Bonzini
Il 02/06/2013 16:18, Peter Maydell ha scritto: On 31 May 2013 23:18, Richard Henderson r...@twiddle.net wrote: On 05/30/2013 02:16 PM, Paolo Bonzini wrote: +static inline Int128 int128_rshift(Int128 a, int n) +{ +return (Int128) { (a.lo n) | (a.hi (64 - n)), (a.hi n) }; +} Produces

Re: [Qemu-devel] [PATCH 10/21] memory: make section size a 128-bit integer

2013-06-02 Thread Peter Maydell
On 2 June 2013 15:36, Paolo Bonzini pbonz...@redhat.com wrote: This should work: int64_t h; if (!n) { return a; } h = a.hi n; This is undefined for n = 64. if (n = 64) { return (Int128) { h, h 63 }; } else { return (Int128) { (a.lo n)

Re: [Qemu-devel] [PATCH 10/21] memory: make section size a 128-bit integer

2013-06-02 Thread Paolo Bonzini
Il 02/06/2013 16:50, Peter Maydell ha scritto: On 2 June 2013 15:36, Paolo Bonzini pbonz...@redhat.com wrote: This should work: int64_t h; if (!n) { return a; } h = a.hi n; This is undefined for n = 64. Yes, it has to be a.hi (n 63). I would suggest looking

Re: [Qemu-devel] [PATCH 10/21] memory: make section size a 128-bit integer

2013-05-31 Thread Alexey Kardashevskiy
On 05/31/2013 07:16 AM, Paolo Bonzini wrote: So far, the size of all regions passed to listeners could fit in 64 bits, because artificial regions (containers and aliases) are eliminated by the memory core, leaving only device regions which have reasonable sizes An IOMMU however cannot be

Re: [Qemu-devel] [PATCH 10/21] memory: make section size a 128-bit integer

2013-05-31 Thread Paolo Bonzini
Il 31/05/2013 08:56, Alexey Kardashevskiy ha scritto: On 05/31/2013 07:16 AM, Paolo Bonzini wrote: So far, the size of all regions passed to listeners could fit in 64 bits, because artificial regions (containers and aliases) are eliminated by the memory core, leaving only device regions which

Re: [Qemu-devel] [PATCH 10/21] memory: make section size a 128-bit integer

2013-05-31 Thread Richard Henderson
On 05/30/2013 02:16 PM, Paolo Bonzini wrote: +static inline Int128 int128_rshift(Int128 a, int n) +{ +return (Int128) { (a.lo n) | (a.hi (64 - n)), (a.hi n) }; +} Produces wrong results for n == 0, since (a.hi 64) is undefined. r~

[Qemu-devel] [PATCH 10/21] memory: make section size a 128-bit integer

2013-05-30 Thread Paolo Bonzini
So far, the size of all regions passed to listeners could fit in 64 bits, because artificial regions (containers and aliases) are eliminated by the memory core, leaving only device regions which have reasonable sizes An IOMMU however cannot be eliminated by the memory core, and may have an