From: Auger Eric <eric.auger@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>,
eric.auger.pro@gmail.com, qemu-devel@nongnu.org,
qemu-arm@nongnu.org, stefanha@redhat.com, fam@euphon.net,
alex.williamson@redhat.com
Cc: kwolf@redhat.com, mreitz@redhat.com
Subject: Re: [RFC 1/5] block/nvme: use some NVME_CAP_* macros
Date: Thu, 15 Oct 2020 18:11:56 +0200 [thread overview]
Message-ID: <a071c2f5-3571-293a-31a3-ead0012d2142@redhat.com> (raw)
In-Reply-To: <4787ed29-8659-b578-c804-8b27d4551212@redhat.com>
Hi Philippe,
On 10/15/20 3:36 PM, Philippe Mathieu-Daudé wrote:
> On 10/15/20 3:32 PM, Philippe Mathieu-Daudé wrote:
>> On 10/15/20 3:29 PM, Philippe Mathieu-Daudé wrote:
>>> On 10/15/20 1:52 PM, Eric Auger wrote:
>>>> let's use NVME_CAP_DSTRD, NVME_CAP_MPSMIN and NVME_CAP_TO macros
>>>>
>>>> Signed-off-by: Eric Auger <eric.auger@redhat.com>
>>>> ---
>>>> block/nvme.c | 6 +++---
>>>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/block/nvme.c b/block/nvme.c
>>>> index f4f27b6da7..e3d96f20d0 100644
>>>> --- a/block/nvme.c
>>>> +++ b/block/nvme.c
>>>> @@ -728,10 +728,10 @@ static int nvme_init(BlockDriverState *bs,
>>>> const char *device, int namespace,
>>>> goto out;
>>>> }
>>>> - s->page_size = MAX(4096, 1 << (12 + ((cap >> 48) & 0xF)));
>>>> - s->doorbell_scale = (4 << (((cap >> 32) & 0xF))) /
>>>> sizeof(uint32_t);
>>>> + s->page_size = MAX(4096, 1 << (12 + NVME_CAP_MPSMIN(cap)));
>>>
>>> Are you suggesting commit fad1eb68862 ("block/nvme: Use register
>>> definitions from 'block/nvme.h'") is buggy?
yes I think so. Sorry I messed up my rebase and failed to grab that patch.
>>
>> Buh I wonder how we missed that :/
>
> Since your patch doesn't apply anyway, I might fix as:
>
> s->page_size = 4096 << NVME_CAP_MPSMIN(cap);
1 << (12 + NVME_CAP_MPSMIN(cap)) matches the spec text so personally I
would keep that.
Thanks
Eric
>
>>
>>>
>>>> + s->doorbell_scale = (4 << ((NVME_CAP_DSTRD(cap)))) /
>>>> sizeof(uint32_t);
>>>> bs->bl.opt_mem_alignment = s->page_size;
>>>> - timeout_ms = MIN(500 * ((cap >> 24) & 0xFF), 30000);
>>>> + timeout_ms = MIN(500 * NVME_CAP_TO(cap), 30000);
>>>> /* Reset device to get a clean state. */
>>>> s->regs->ctrl.cc = cpu_to_le32(le32_to_cpu(s->regs->ctrl.cc) &
>>>> 0xFE);
>>>>
>>>
>>
>
>
next prev parent reply other threads:[~2020-10-15 16:13 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-15 11:52 [RFC 0/5] NVMe passthrough: Support 64kB page host Eric Auger
2020-10-15 11:52 ` [RFC 1/5] block/nvme: use some NVME_CAP_* macros Eric Auger
2020-10-15 13:29 ` Philippe Mathieu-Daudé
2020-10-15 13:32 ` Philippe Mathieu-Daudé
2020-10-15 13:36 ` Philippe Mathieu-Daudé
2020-10-15 16:11 ` Auger Eric [this message]
2020-10-15 11:52 ` [RFC 2/5] block/nvme: Change size and alignment of IDENTIFY response buffer Eric Auger
2020-10-20 10:59 ` Philippe Mathieu-Daudé
2020-10-20 11:31 ` Philippe Mathieu-Daudé
2020-10-15 11:52 ` [RFC 3/5] block/nvme: Change size and alignment of queue Eric Auger
2020-10-15 11:52 ` [RFC 4/5] block/nvme: Change size and alignment of prp_list_pages Eric Auger
2020-10-15 11:52 ` [RFC 5/5] block/nvme: Align iov's va and size on host page size Eric Auger
2020-10-20 11:33 ` Philippe Mathieu-Daudé
2020-10-15 13:49 ` [RFC 0/5] NVMe passthrough: Support 64kB page host Philippe Mathieu-Daudé
2020-10-15 16:15 ` Auger Eric
2020-10-15 18:01 ` Philippe Mathieu-Daudé
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=a071c2f5-3571-293a-31a3-ead0012d2142@redhat.com \
--to=eric.auger@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=eric.auger.pro@gmail.com \
--cc=fam@euphon.net \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-arm@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).