From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Fam Zheng <fam@euphon.net>, Kevin Wolf <kwolf@redhat.com>,
qemu-devel@nongnu.org, qemu-block@nongnu.org,
Max Reitz <mreitz@redhat.com>
Subject: Re: [PATCH 1/3] block/nvme: Initialize constant values with const_le32()
Date: Thu, 17 Sep 2020 15:52:07 +0200 [thread overview]
Message-ID: <d4a7bb78-5f2f-70a2-44c6-7c4198bd0426@redhat.com> (raw)
In-Reply-To: <20200917095521.GC809514@stefanha-x1.localdomain>
On 9/17/20 11:55 AM, Stefan Hajnoczi wrote:
> On Wed, Sep 16, 2020 at 10:40:02PM +0200, Philippe Mathieu-Daudé wrote:
>> To avoid multiple endianess conversion, as we know the device
>> registers are in little-endian, directly use const_le32() with
>> constant values.
>
> Can cpu_to_X() be extended to handle constant expressions? That way the
> programmer doesn't need to remember the const_X() API exists.
>
> Maybe __builtin_constant_p() can be used:
> https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html#index-_005f_005fbuiltin_005fconstant_005fp
Yes it works! Good idea :)
next prev parent reply other threads:[~2020-09-17 13:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-16 20:40 [PATCH 0/3] block/nvme: Fix NVMeRegs alignment/packing and use atomic operations Philippe Mathieu-Daudé
2020-09-16 20:40 ` [PATCH 1/3] block/nvme: Initialize constant values with const_le32() Philippe Mathieu-Daudé
2020-09-17 9:55 ` Stefan Hajnoczi
2020-09-17 13:52 ` Philippe Mathieu-Daudé [this message]
2020-09-16 20:40 ` [PATCH 2/3] block/nvme: Use atomic operations instead of 'volatile' keyword Philippe Mathieu-Daudé
2020-09-17 10:42 ` Stefan Hajnoczi
2020-09-16 20:40 ` [PATCH 3/3] block/nvme: Align NVMeRegs structure to 4KiB and mark it packed Philippe Mathieu-Daudé
2020-09-17 11:07 ` Stefan Hajnoczi
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=d4a7bb78-5f2f-70a2-44c6-7c4198bd0426@redhat.com \
--to=philmd@redhat.com \
--cc=fam@euphon.net \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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).