From: Eric Blake <eblake@redhat.com>
To: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
keith.busch@intel.com, kwolf@redhat.com, mreitz@redhat.com,
jsnow@redhat.com, pbonzini@redhat.com, qemu-devel@nongnu.org,
qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/2] dma-helpers: explicitly pass alignment into dma-helpers
Date: Mon, 10 Oct 2016 11:34:51 -0500 [thread overview]
Message-ID: <97da94bb-e32c-8d9f-7309-ca4bef4bbe7c@redhat.com> (raw)
In-Reply-To: <1476031419-6805-2-git-send-email-mark.cave-ayland@ilande.co.uk>
[-- Attachment #1: Type: text/plain, Size: 1104 bytes --]
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 <mark.cave-ayland@ilande.co.uk>
> ---
> @@ -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 <eblake@redhat.com>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2016-10-10 16:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-09 16:43 [Qemu-devel] [PATCH 0/2] dma-helpers: explicitly pass alignment into dma-helpers Mark Cave-Ayland
2016-10-09 16:43 ` [Qemu-devel] [PATCH 1/2] " Mark Cave-Ayland
2016-10-10 16:34 ` Eric Blake [this message]
2016-10-10 19:23 ` Mark Cave-Ayland
2016-10-11 15:47 ` John Snow
2016-10-12 10:22 ` Kevin Wolf
2016-10-12 16:04 ` John Snow
2016-10-09 16:43 ` [Qemu-devel] [PATCH 2/2] macio: switch over to new byte-aligned DMA helpers Mark Cave-Ayland
2016-10-10 16:50 ` Eric Blake
2016-10-11 16:58 ` John Snow
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=97da94bb-e32c-8d9f-7309-ca4bef4bbe7c@redhat.com \
--to=eblake@redhat.com \
--cc=jsnow@redhat.com \
--cc=keith.busch@intel.com \
--cc=kwolf@redhat.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).