summary refs log tree commit diff stats
path: root/chardev/char-parallel.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2024-01-31 18:31:40 +0100
committerKevin Wolf <kwolf@redhat.com>2024-02-07 15:26:04 +0100
commit10b2393e5e7f4c1d633f1ac8578465681c333efb (patch)
tree42d98884925d16acc97f1f17f26642cd234a3f47 /chardev/char-parallel.c
parent3089637461693837cafd2709ef36d0cf6a4a8ed8 (diff)
downloadfocaccia-qemu-10b2393e5e7f4c1d633f1ac8578465681c333efb.tar.gz
focaccia-qemu-10b2393e5e7f4c1d633f1ac8578465681c333efb.zip
blkio: Respect memory-alignment for bounce buffer allocations
blkio_alloc_mem_region() requires that the requested buffer size is a
multiple of the memory-alignment property. If it isn't, the allocation
fails with a return value of -EINVAL.

Fix the call in blkio_resize_bounce_pool() to make sure the requested
size is properly aligned.

I observed this problem with vhost-vdpa, which requires page aligned
memory. As the virtio-blk device behind it still had 512 byte blocks, we
got bs->bl.request_alignment = 512, but actually any request that needed
a bounce buffer and was not aligned to 4k would fail without this fix.

Suggested-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20240131173140.42398-1-kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'chardev/char-parallel.c')
0 files changed, 0 insertions, 0 deletions