aboutsummaryrefslogtreecommitdiff
path: root/include/qemu-common.h
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2013-03-26 13:38:00 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2013-03-26 13:38:00 -0500
commit18501ae6e825d8da72369fd091018ef71071bd87 (patch)
tree780fd5af5f8a5bcb13da79962107b5364e7f29aa /include/qemu-common.h
parentfad5593ca646010d3cb83f7926d78dd30c20c610 (diff)
parent500f0061d628b52220038939728f0d7aee634468 (diff)
Merge remote-tracking branch 'quintela/migration.next' into staging
# By Peter Lieven (9) and others # Via Juan Quintela * quintela/migration.next: (22 commits) Use qemu_put_buffer_async for guest memory pages Add qemu_put_buffer_async Use writev ops if available Store the data to send also in iovec Update bytes_xfer in qemu_put_byte Add socket_writev_buffer function Add QemuFileWritevBuffer QemuFileOps migration: use XBZRLE only after bulk stage migration: do not search dirty pages in bulk stage migration: do not sent zero pages in bulk stage migration: add an indicator for bulk state of ram migration migration: search for zero instead of dup pages bitops: unroll while loop in find_next_bit() buffer_is_zero: use vector optimizations if possible cutils: add a function to find non-zero content in a buffer move vector definitions to qemu-common.h savevm: Fix bugs in the VMSTATE_VBUFFER_MULTIPLY definition savevm: Add VMSTATE_STRUCT_VARRAY_POINTER_UINT32 savevm: Add VMSTATE_FLOAT64 helpers savevm: Add VMSTATE_UINTTL_EQUAL helper ...
Diffstat (limited to 'include/qemu-common.h')
-rw-r--r--include/qemu-common.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/include/qemu-common.h b/include/qemu-common.h
index 2371132c11..31fff22f32 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -448,4 +448,35 @@ int uleb128_decode_small(const uint8_t *in, uint32_t *n);
void hexdump(const char *buf, FILE *fp, const char *prefix, size_t size);
+/* vector definitions */
+#ifdef __ALTIVEC__
+#include <altivec.h>
+#define VECTYPE vector unsigned char
+#define SPLAT(p) vec_splat(vec_ld(0, p), 0)
+#define ALL_EQ(v1, v2) vec_all_eq(v1, v2)
+/* altivec.h may redefine the bool macro as vector type.
+ * Reset it to POSIX semantics. */
+#undef bool
+#define bool _Bool
+#elif defined __SSE2__
+#include <emmintrin.h>
+#define VECTYPE __m128i
+#define SPLAT(p) _mm_set1_epi8(*(p))
+#define ALL_EQ(v1, v2) (_mm_movemask_epi8(_mm_cmpeq_epi8(v1, v2)) == 0xFFFF)
+#else
+#define VECTYPE unsigned long
+#define SPLAT(p) (*(p) * (~0UL / 255))
+#define ALL_EQ(v1, v2) ((v1) == (v2))
+#endif
+
+#define BUFFER_FIND_NONZERO_OFFSET_UNROLL_FACTOR 8
+static inline bool
+can_use_buffer_find_nonzero_offset(const void *buf, size_t len)
+{
+ return (len % (BUFFER_FIND_NONZERO_OFFSET_UNROLL_FACTOR
+ * sizeof(VECTYPE)) == 0
+ && ((uintptr_t) buf) % sizeof(VECTYPE) == 0);
+}
+size_t buffer_find_nonzero_offset(const void *buf, size_t len);
+
#endif