qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] virtio: fix vring_align() on 64-bit win32 platforms
@ 2017-03-24 21:21 Andrew Baumann
  2017-03-24 22:20 ` [Qemu-devel] [PATCH for-2.9 " Eric Blake
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Baumann @ 2017-03-24 21:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: Eric Blake, Stefan Weil, Michael S . Tsirkin, Andrew Baumann

long is 32-bits on win32, 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 <Andrew.Baumann@microsoft.com>
---
 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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH for-2.9 v2] virtio: fix vring_align() on 64-bit win32 platforms
  2017-03-24 21:21 [Qemu-devel] [PATCH v2] virtio: fix vring_align() on 64-bit win32 platforms Andrew Baumann
@ 2017-03-24 22:20 ` Eric Blake
  2017-03-24 23:11   ` Andrew Baumann
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Blake @ 2017-03-24 22:20 UTC (permalink / raw)
  To: Andrew Baumann, qemu-devel; +Cc: Stefan Weil, Michael S . Tsirkin

[-- Attachment #1: Type: text/plain, Size: 646 bytes --]

On 03/24/2017 04:21 PM, Andrew Baumann wrote:

So is 'win32' really a 64-bit platform, or should the subject be '64-bit
windows'?

> long is 32-bits on win32, 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 <Andrew.Baumann@microsoft.com>
> ---
>  include/hw/virtio/virtio.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH for-2.9 v2] virtio: fix vring_align() on 64-bit win32 platforms
  2017-03-24 22:20 ` [Qemu-devel] [PATCH for-2.9 " Eric Blake
@ 2017-03-24 23:11   ` Andrew Baumann
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Baumann @ 2017-03-24 23:11 UTC (permalink / raw)
  To: Eric Blake, qemu-devel@nongnu.org; +Cc: Stefan Weil, Michael S . Tsirkin

> From: Eric Blake [mailto:eblake@redhat.com]
> Sent: Friday, 24 March 2017 15:20

> So is 'win32' really a 64-bit platform, or should the subject be '64-bit
> windows'?

Sigh. Yes, ok, it's a little silly if you put it like that. I guess I was thinking of the _WIN32 ifdef and the files named *win32.

I'll send you a v3...

Andrew


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-24 23:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-24 21:21 [Qemu-devel] [PATCH v2] virtio: fix vring_align() on 64-bit win32 platforms Andrew Baumann
2017-03-24 22:20 ` [Qemu-devel] [PATCH for-2.9 " Eric Blake
2017-03-24 23:11   ` Andrew Baumann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).