aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio/vhost.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2014-06-11 18:05:21 +0100
committerPeter Maydell <peter.maydell@linaro.org>2014-06-11 18:05:21 +0100
commit706808585a49bfd266e00b1c7723b6e1b0f4ff35 (patch)
tree661e735294e244c1c07fcc88ea76dfdb4fe93e58 /hw/virtio/vhost.c
parentc5cb1afc4675bf5ff66e7a149d2a8cffba2eaa9e (diff)
parentc4af6d4b13cc263b20133096f4de7b48e0aa7b46 (diff)
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-bsd-user-20140611' into staging
bsd-user queue: * build fixes * improvements to strace # gpg: Signature made Wed 11 Jun 2014 15:23:40 BST using RSA key ID 14360CDE # gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" * remotes/pmaydell/tags/pull-bsd-user-20140611: bsd-user: Fix syscall format, add strace support for more syscalls bsd-user: Implement strace support for thr_* syscalls bsd-user: Implement strace support for extattr_* syscalls bsd-user: Implement strace support for __acl_* syscalls bsd-user: Implement strace support for print_ioctl syscall bsd-user: Implement strace support for print_sysctl syscall bsd-user: GPL v2 attribution update and style bsd-user: add HOST_VARIANT_DIR for various *BSD dependent code exec: replace ffsl with ctzl vhost: replace ffsl with ctzl xen: replace ffsl with ctzl util/qemu-openpty: fix build with musl libc by include termios.h as fallback bsd-user/mmap.c: Don't try to override g_malloc/g_free util/hbitmap.c: Use ctpopl rather than reimplementing a local equivalent bsd-user: refresh freebsd system call numbers Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/virtio/vhost.c')
-rw-r--r--hw/virtio/vhost.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 9e336ad81e..f62cfaf38e 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;