From: Christoph Hellwig <hch@lst.de>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org,
Jens Axboe <axboe@fb.com>, Keith Busch <kbusch@kernel.org>,
Christoph Hellwig <hch@lst.de>, Paul Pawlowski <paul@mrarm.io>
Subject: Re: [PATCH 2/3] nvme: Retrieve the required IO queue entry size from the controller
Date: Tue, 16 Jul 2019 08:04:30 +0200 [thread overview]
Message-ID: <20190716060430.GB29414@lst.de> (raw)
In-Reply-To: <20190716004649.17799-2-benh@kernel.crashing.org>
> + /* Use default IOSQES. We'll update it later if needed */
> ctrl->ctrl_config |= NVME_CC_IOSQES | NVME_CC_IOCQES;
> ctrl->ctrl_config |= NVME_CC_ENABLE;
>
> @@ -2698,6 +2699,30 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
> ctrl->hmmin = le32_to_cpu(id->hmmin);
> ctrl->hmminds = le32_to_cpu(id->hmminds);
> ctrl->hmmaxd = le16_to_cpu(id->hmmaxd);
> +
> + /* Grab required IO queue size */
> + ctrl->iosqes = id->sqes & 0xf;
> + if (ctrl->iosqes < NVME_NVM_IOSQES) {
> + dev_err(ctrl->device,
> + "unsupported required IO queue size %d\n", ctrl->iosqes);
> + ret = -EINVAL;
> + goto out_free;
> + }
> + /*
> + * If our IO queue size isn't the default, update the setting
> + * in CC:IOSQES.
> + */
> + if (ctrl->iosqes != NVME_NVM_IOSQES) {
> + ctrl->ctrl_config &= ~(0xfu << NVME_CC_IOSQES_SHIFT);
> + ctrl->ctrl_config |= ctrl->iosqes << NVME_CC_IOSQES_SHIFT;
> + ret = ctrl->ops->reg_write32(ctrl, NVME_REG_CC,
> + ctrl->ctrl_config);
> + if (ret) {
> + dev_err(ctrl->device,
> + "error updating CC register\n");
> + goto out_free;
> + }
> + }
Actually, this doesn't work on a "real" nvme controller, to change CC
values the controller needs to be disabled. So back to the version
you circulated to me in private mail that just sets q->sqes and has a
comment that this is magic for The Apple controller. If/when we get
standardized large SQE support we'll need to discover that earlier or
do a disable/enable dance. Sorry for misleading you down this road and
creating the extra work.
next prev parent reply other threads:[~2019-07-16 6:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-16 0:46 [PATCH 1/3] nvme: Pass the queue to SQ_SIZE/CQ_SIZE macros Benjamin Herrenschmidt
2019-07-16 0:46 ` [PATCH 2/3] nvme: Retrieve the required IO queue entry size from the controller Benjamin Herrenschmidt
2019-07-16 6:04 ` Christoph Hellwig [this message]
2019-07-16 6:21 ` Benjamin Herrenschmidt
2019-07-16 9:33 ` Christoph Hellwig
2019-07-16 10:58 ` Benjamin Herrenschmidt
2019-07-16 12:05 ` Christoph Hellwig
2019-07-16 12:17 ` Benjamin Herrenschmidt
2019-07-16 12:25 ` Christoph Hellwig
2019-07-16 0:46 ` [PATCH 3/3] nvme: Add support for Apple 2018+ models Benjamin Herrenschmidt
2019-07-16 6:06 ` Christoph Hellwig
2019-07-16 6:22 ` Benjamin Herrenschmidt
2019-07-16 0:49 ` [PATCH 1/3] nvme: Pass the queue to SQ_SIZE/CQ_SIZE macros Benjamin Herrenschmidt
2019-07-16 5:59 ` Christoph Hellwig
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=20190716060430.GB29414@lst.de \
--to=hch@lst.de \
--cc=axboe@fb.com \
--cc=benh@kernel.crashing.org \
--cc=kbusch@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=paul@mrarm.io \
/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