[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [Qemu-devel] [PATCH 1/2] dma-helpers: explicitly pass a
From: |
Eric Blake |
Subject: |
Re: [Qemu-block] [Qemu-devel] [PATCH 1/2] dma-helpers: explicitly pass alignment into dma-helpers |
Date: |
Mon, 10 Oct 2016 11:34:51 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 |
On 10/09/2016 11:43 AM, Mark Cave-Ayland wrote:
> The hard-coded default alignment is BDRV_SECTOR_SIZE, however this is not
> necessarily the case for all platforms. Use this as the default alignment for
> all current callers.
>
> Signed-off-by: Mark Cave-Ayland <address@hidden>
> ---
> @@ -160,8 +161,8 @@ static void dma_blk_cb(void *opaque, int ret)
> return;
> }
>
> - if (dbs->iov.size & ~BDRV_SECTOR_MASK) {
> - qemu_iovec_discard_back(&dbs->iov, dbs->iov.size &
> ~BDRV_SECTOR_MASK);
> + if (dbs->iov.size & (dbs->align - 1)) {
> + qemu_iovec_discard_back(&dbs->iov, dbs->iov.size & (dbs->align - 1));
Would it be any smarter to use osdep.h's QEMU_IS_ALIGNED(dbs->iov.size,
dbs->align) and QEMU_ALIGN_DOWN(dbs->iov.size, dbs->align)?
Semantically it is the same, but the macros make it obvious what the
bit-twiddling is doing.
Unless you think that needs a tweak,
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
[Qemu-block] [PATCH 2/2] macio: switch over to new byte-aligned DMA helpers, Mark Cave-Ayland, 2016/10/09