aboutsummaryrefslogtreecommitdiffstats
path: root/main/qemu/0004-vhost-replace-ffsl-with-ctzl.patch
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2014-04-29 16:58:45 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2014-04-29 17:00:14 +0200
commit61a7a1b77a868e3b940c0b25e6c2b2a6c32caf20 (patch)
tree18280f2794e0bd731a92488c0ebf9ed77749f0ac /main/qemu/0004-vhost-replace-ffsl-with-ctzl.patch
parent7dc7dfaf5ee97c22fdb1ce15f6702fb9c8c324cd (diff)
downloadaports-61a7a1b77a868e3b940c0b25e6c2b2a6c32caf20.tar.bz2
aports-61a7a1b77a868e3b940c0b25e6c2b2a6c32caf20.tar.xz
main/qemu: replace patches with the ones sent upstream
Patches sent upstream: http://lists.nongnu.org/archive/html/qemu-devel/2014-04/msg04773.html
Diffstat (limited to 'main/qemu/0004-vhost-replace-ffsl-with-ctzl.patch')
-rw-r--r--main/qemu/0004-vhost-replace-ffsl-with-ctzl.patch49
1 files changed, 49 insertions, 0 deletions
diff --git a/main/qemu/0004-vhost-replace-ffsl-with-ctzl.patch b/main/qemu/0004-vhost-replace-ffsl-with-ctzl.patch
new file mode 100644
index 0000000000..3853dd5a73
--- /dev/null
+++ b/main/qemu/0004-vhost-replace-ffsl-with-ctzl.patch
@@ -0,0 +1,49 @@
+From f5fba0976a2841e2f4033a01076161ce2ede0477 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Tue, 29 Apr 2014 14:34:12 +0200
+Subject: [PATCH 4/6] vhost: replace ffsl with ctzl
+
+Avoid using the GNU extesion ffsl which is not implemented in musl libc.
+
+The atomic_xchg() means we know that vhost_log_chunk_t will never be
+larger than the 'long' type, so ctzl() is always sufficient.
+
+See also commit fbeadf50 (bitops: unify bitops_ffsl with the one in
+host-utils.h, call it bitops_ctzl) on why ctzl should be used instead
+of ffsl.
+
+Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
+---
+ hw/virtio/vhost.c | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
+index 9e336ad..f62cfaf 100644
+--- a/hw/virtio/vhost.c
++++ b/hw/virtio/vhost.c
+@@ -41,7 +41,6 @@ static void vhost_dev_sync_region(struct vhost_dev *dev,
+
+ for (;from < to; ++from) {
+ vhost_log_chunk_t log;
+- int bit;
+ /* We first check with non-atomic: much cheaper,
+ * and we expect non-dirty to be the common case. */
+ if (!*from) {
+@@ -51,12 +50,11 @@ static void vhost_dev_sync_region(struct vhost_dev *dev,
+ /* Data must be read atomically. We don't really need barrier semantics
+ * but it's easier to use atomic_* than roll our own. */
+ log = atomic_xchg(from, 0);
+- while ((bit = sizeof(log) > sizeof(int) ?
+- ffsll(log) : ffs(log))) {
++ while (log) {
++ int bit = ctzl(log);
+ hwaddr page_addr;
+ hwaddr section_offset;
+ hwaddr mr_offset;
+- bit -= 1;
+ page_addr = addr + bit * VHOST_LOG_PAGE;
+ section_offset = page_addr - section->offset_within_address_space;
+ mr_offset = section_offset + section->offset_within_region;
+--
+1.9.2
+