Re: [Qemu-devel] [PATCH v3] virtio: fix vring_align() on 64-bit windows

2017-03-28 Thread Michael S. Tsirkin
On Fri, Mar 24, 2017 at 04:19:43PM -0700, Andrew Baumann wrote:
> long is 32-bits on 64-bit windows, which caused the top half of the
> address to be truncated; this patch changes it to use the
> QEMU_ALIGN_UP macro which does not suffer the same problem
> 
> Signed-off-by: Andrew Baumann 
> Reviewed-by: Eric Blake 

Reviewed-by: Michael S. Tsirkin 

> ---
>  include/hw/virtio/virtio.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
> index 15efcf2..7b6edba 100644
> --- a/include/hw/virtio/virtio.h
> +++ b/include/hw/virtio/virtio.h
> @@ -34,7 +34,7 @@ struct VirtQueue;
>  static inline hwaddr vring_align(hwaddr addr,
>   unsigned long align)
>  {
> -return (addr + align - 1) & ~(align - 1);
> +return QEMU_ALIGN_UP(addr, align);
>  }
>  
>  typedef struct VirtQueue VirtQueue;
> -- 
> 2.8.3



[Qemu-devel] [PATCH v3] virtio: fix vring_align() on 64-bit windows

2017-03-24 Thread Andrew Baumann
long is 32-bits on 64-bit windows, which caused the top half of the
address to be truncated; this patch changes it to use the
QEMU_ALIGN_UP macro which does not suffer the same problem

Signed-off-by: Andrew Baumann 
Reviewed-by: Eric Blake 
---
 include/hw/virtio/virtio.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index 15efcf2..7b6edba 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -34,7 +34,7 @@ struct VirtQueue;
 static inline hwaddr vring_align(hwaddr addr,
  unsigned long align)
 {
-return (addr + align - 1) & ~(align - 1);
+return QEMU_ALIGN_UP(addr, align);
 }
 
 typedef struct VirtQueue VirtQueue;
-- 
2.8.3