From: Klaus Jensen <its@irrelevant.dk>
To: Christoph Hellwig <hch@lst.de>
Cc: Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@fb.com>,
Sagi Grimberg <sagi@grimberg.me>,
linux-nvme@lists.infradead.org,
Klaus Jensen <k.jensen@samsung.com>
Subject: Re: [PATCH] nvme: allow use of cmb on v1.4 controllers
Date: Fri, 15 Jan 2021 07:12:14 +0100 [thread overview]
Message-ID: <YAEyPrRkvJiRaoTr@apples.localdomain> (raw)
In-Reply-To: <20210114173313.GA31028@lst.de>
[-- Attachment #1.1: Type: text/plain, Size: 1789 bytes --]
On Jan 14 18:33, Christoph Hellwig wrote:
> On Thu, Jan 14, 2021 at 02:24:41PM +0100, Klaus Jensen wrote:
> > From: Klaus Jensen <k.jensen@samsung.com>
> >
> > Since NVMe v1.4 the Controller Memory Buffer must be explicitly enabled
> > by the host.
>
> Thanks, this has been on my TODO list for a while.
>
> > + vs = readl(dev->bar + NVME_REG_VS);
> > +
> > + if (vs >= NVME_VS(1, 4, 0)) {
> > + if (!NVME_CAP_CMBS(dev->ctrl.cap))
> > + return;
>
> We should not check the version here, but the presence of the new
> register so that controllers claiming an older version complicance
> that implement the new scheme are supported as well.
>
Understood!
> Given that the old scheme is highly dangerous in virtualized enviroments
> we should also warn about it and eventually required an explicit opt-in
> to use it.
>
Not completely sure what warning you'd want, so I'll leave it to you to
add an 'else dev_warn(...)'. :)
> > + if (vs >= NVME_VS(1, 4, 0)) {
> > + cmbmsc = pci_resource_start(pdev, bar);
> > + cmbmsc |= (NVME_CMBMSC_CRE | NVME_CMBMSC_CMSE);
> > +
> > + /*
> > + * Writing the low bits may cause the controller to check the
> > + * validity of the 52 bit controller base address in the CMBMSC
> > + * register, so write the high bits first.
> > + */
> > + writel(cmbmsc >> 32, dev->bar + NVME_REG_CMBMSC + 4);
> > + writel(cmbmsc, dev->bar + NVME_REG_CMBMSC);
>
> I think we should just use writeq here, with the hilo wrapper for 32-bit
> platforms here. The reason why NVMe has so avoided the 64-bit access
> is for buggy Apple controllers, but they are unlikely to implement CMB.
Right, I tried writeq, but on QEMU I observed two 4 byte writes in wrong
order anyway.
hi_lo_writeq looks good.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 158 bytes --]
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
next prev parent reply other threads:[~2021-01-15 6:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-14 13:24 [PATCH] nvme: allow use of cmb on v1.4 controllers Klaus Jensen
2021-01-14 17:33 ` Christoph Hellwig
2021-01-15 6:12 ` Klaus Jensen [this message]
2021-01-14 18:06 ` Keith Busch
2021-01-14 18:15 ` Keith Busch
2021-01-15 6:13 ` Klaus Jensen
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=YAEyPrRkvJiRaoTr@apples.localdomain \
--to=its@irrelevant.dk \
--cc=axboe@fb.com \
--cc=hch@lst.de \
--cc=k.jensen@samsung.com \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/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