From 4196d2f0308cb1ae13ed450424ab7dfe154acda9 Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Tue, 12 May 2015 17:30:55 +0300 Subject: block: minimal bounce buffer alignment The patch introduces new concept: minimal memory alignment for bounce buffers. Original so called "optimal" value is actually minimal required value for aligment. It should be used for validation that the IOVec is properly aligned and bounce buffer is not required. Though, from the performance point of view, it would be better if bounce buffer or IOVec allocated by QEMU will be aligned stricter. The patch does not change any alignment value yet. Signed-off-by: Denis V. Lunev Reviewed-by: Kevin Wolf Message-id: 1431441056-26198-2-git-send-email-den@openvz.org CC: Paolo Bonzini Reviewed-by: Kevin Wolf CC: Stefan Hajnoczi Signed-off-by: Stefan Hajnoczi --- include/block/block.h | 2 ++ include/block/block_int.h | 3 +++ 2 files changed, 5 insertions(+) (limited to 'include') diff --git a/include/block/block.h b/include/block/block.h index 7d1a717..c1c963e 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -440,6 +440,8 @@ void bdrv_img_create(const char *filename, const char *fmt, /* Returns the alignment in bytes that is required so that no bounce buffer * is required throughout the stack */ +size_t bdrv_min_mem_align(BlockDriverState *bs); +/* Returns optimal alignment in bytes for bounce buffer */ size_t bdrv_opt_mem_align(BlockDriverState *bs); void bdrv_set_guest_block_size(BlockDriverState *bs, int align); void *qemu_blockalign(BlockDriverState *bs, size_t size); diff --git a/include/block/block_int.h b/include/block/block_int.h index db29b74..f004378 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -313,6 +313,9 @@ typedef struct BlockLimits { int max_transfer_length; /* memory alignment so that no bounce buffer is needed */ + size_t min_mem_alignment; + + /* memory alignment for bounce buffer */ size_t opt_mem_alignment; } BlockLimits; -- cgit v1.1