From: Niklas Cassel <Niklas.Cassel@wdc.com>
To: Keith Busch <kbusch@kernel.org>
Cc: "Fam Zheng" <fam@euphon.net>, "Kevin Wolf" <kwolf@redhat.com>,
"Damien Le Moal" <Damien.LeMoal@wdc.com>,
"qemu-block@nongnu.org" <qemu-block@nongnu.org>,
"Dmitry Fomichev" <Dmitry.Fomichev@wdc.com>,
"Klaus Jensen" <k.jensen@samsung.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"Maxim Levitsky" <mlevitsk@redhat.com>,
"Alistair Francis" <Alistair.Francis@wdc.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Matias Bjorling" <Matias.Bjorling@wdc.com>
Subject: Re: [PATCH v5 05/14] hw/block/nvme: Add support for Namespace Types
Date: Thu, 1 Oct 2020 16:23:56 +0000 [thread overview]
Message-ID: <20201001162355.GA339198@localhost.localdomain> (raw)
In-Reply-To: <20201001155931.GA564651@dhcp-10-100-145-180.wdl.wdc.com>
On Thu, Oct 01, 2020 at 08:59:31AM -0700, Keith Busch wrote:
> On Thu, Oct 01, 2020 at 03:50:35PM +0000, Niklas Cassel wrote:
> > On Thu, Oct 01, 2020 at 09:29:22AM -0600, Keith Busch wrote:
> > > On Thu, Oct 01, 2020 at 11:22:46AM +0000, Niklas Cassel wrote:
> > > > On Mon, Sep 28, 2020 at 11:35:19AM +0900, Dmitry Fomichev wrote:
> > > > > From: Niklas Cassel <niklas.cassel@wdc.com>
> > > > > @@ -2222,6 +2328,30 @@ static void nvme_write_bar(NvmeCtrl *n, hwaddr offset, uint64_t data,
> > > > > break;
> > > > > case 0x14: /* CC */
> > > > > trace_pci_nvme_mmio_cfg(data & 0xffffffff);
> > > > > +
> > > > > + if (NVME_CC_CSS(data) != NVME_CC_CSS(n->bar.cc)) {
> > > > > + if (NVME_CC_EN(n->bar.cc)) {
> > > >
> > > > I just saw this print when doing controller reset on a live system.
> > > >
> > > > Added a debug print:
> > > > nvme_write_bar WRITING: 0x0 previous: 0x464061
> > > >
> > > > so the second if-statement has to be:
> > > >
> > > > if (NVME_CC_EN(n->bar.cc) && NVME_CC_EN(data)) {
> > > >
> > > > Sorry for introducing the bug in the first place.
> > >
> > > No worries.
> > >
> > > I don't think the check should be here at all, really. The only check for valid
> > > CSS should be in nvme_start_ctrl(), which I posted yesterday.
> >
> > The reasoning for this additional check is this:
> >
> > From CC.CC register description:
> >
> > "This field shall only be changed when the controller
> > is disabled (CC.EN is cleared to ‘0’)."
> >
> > In the QEMU model, we have functions, e.g. nvme_cmd_effects(),
> > that uses n->bar.cc "at runtime".
> >
> > So I don't think that simply checking for valid CSS in
> > nvme_start_ctrl() is sufficient.
> >
> > Thoughts?
>
> The qemu controller accepts host register writes only for valid enable
> and shutdown bit transitions. Or at least it should. If not, then we
> need to fix that, but that's not specific to the CSS bits.
I simply added the second if-statement, (if (NVME_CC_EN(n->bar.cc))),
the rest of the NVME_CC_CSS was written by someone else.
But I see your point, all of this code:
if (NVME_CC_CSS(data) != NVME_CC_CSS(n->bar.cc)) {
if (NVME_CC_EN(n->bar.cc)) {
NVME_GUEST_ERR(pci_nvme_err_change_css_when_enabled,
"changing selected command set when enabled");
} else {
switch (NVME_CC_CSS(data)) {
case CSS_NVM_ONLY:
trace_pci_nvme_css_nvm_cset_selected_by_host(data &
0xffffffff);
break;
case CSS_CSI:
NVME_SET_CC_CSS(n->bar.cc, CSS_CSI);
trace_pci_nvme_css_all_csets_sel_by_host(data &
0xffffffff);
break;
case CSS_ADMIN_ONLY:
break;
default:
NVME_GUEST_ERR(pci_nvme_ub_unknown_css_value,
"unknown value in CC.CSS field");
}
}
}
should simply be dropped.
No need to call NVME_SET_CC_CSS() explicitly.
CC.CSS bit will be set futher down in this function anyway:
if (NVME_CC_EN(data) && !NVME_CC_EN(n->bar.cc)) {
n->bar.cc = data;
Kind regards,
Niklas
next prev parent reply other threads:[~2020-10-01 16:29 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-28 2:35 [PATCH v5 00/14] hw/block/nvme: Support Namespace Types and Zoned Namespace Command Set Dmitry Fomichev
2020-09-28 2:35 ` [PATCH v5 01/14] hw/block/nvme: Report actual LBA data shift in LBAF Dmitry Fomichev
2020-09-28 8:51 ` Klaus Jensen
2020-09-28 2:35 ` [PATCH v5 02/14] hw/block/nvme: Add Commands Supported and Effects log Dmitry Fomichev
2020-09-28 2:35 ` [PATCH v5 03/14] hw/block/nvme: Introduce the Namespace Types definitions Dmitry Fomichev
2020-09-30 8:08 ` Klaus Jensen
2020-09-30 15:21 ` Keith Busch
2020-09-28 2:35 ` [PATCH v5 04/14] hw/block/nvme: Define trace events related to NS Types Dmitry Fomichev
2020-09-28 2:35 ` [PATCH v5 05/14] hw/block/nvme: Add support for Namespace Types Dmitry Fomichev
2020-09-30 8:15 ` Klaus Jensen
2020-09-30 12:47 ` Niklas Cassel
2020-10-01 11:22 ` Niklas Cassel
2020-10-01 15:29 ` Keith Busch
2020-10-01 15:50 ` Niklas Cassel
2020-10-01 15:59 ` Keith Busch
2020-10-01 16:23 ` Niklas Cassel [this message]
2020-10-01 17:08 ` Keith Busch
2020-10-01 22:15 ` Klaus Jensen
2020-10-01 22:30 ` Dmitry Fomichev
2020-09-28 2:35 ` [PATCH v5 06/14] hw/block/nvme: Add support for active/inactive namespaces Dmitry Fomichev
2020-09-30 13:50 ` Niklas Cassel
2020-10-04 23:54 ` Dmitry Fomichev
2020-10-05 11:26 ` Niklas Cassel
2020-09-28 2:35 ` [PATCH v5 07/14] hw/block/nvme: Make Zoned NS Command Set definitions Dmitry Fomichev
2020-09-28 2:35 ` [PATCH v5 08/14] hw/block/nvme: Define Zoned NS Command Set trace events Dmitry Fomichev
2020-09-28 2:35 ` [PATCH v5 09/14] hw/block/nvme: Support Zoned Namespace Command Set Dmitry Fomichev
2020-09-28 6:44 ` Klaus Jensen
2020-09-28 10:42 ` Klaus Jensen
2020-09-30 5:20 ` Klaus Jensen
2020-10-05 0:53 ` Dmitry Fomichev
2020-09-30 5:59 ` Klaus Jensen
2020-10-04 23:48 ` Dmitry Fomichev
2020-09-30 14:50 ` Niklas Cassel
2020-09-30 18:23 ` Klaus Jensen
2020-10-04 23:57 ` Dmitry Fomichev
2020-10-05 11:41 ` Niklas Cassel
2020-10-05 23:08 ` Dmitry Fomichev
2020-09-30 15:12 ` Niklas Cassel
2020-09-28 2:35 ` [PATCH v5 10/14] hw/block/nvme: Introduce max active and open zone limits Dmitry Fomichev
2020-09-28 2:35 ` [PATCH v5 11/14] hw/block/nvme: Support Zone Descriptor Extensions Dmitry Fomichev
2020-09-28 2:35 ` [PATCH v5 12/14] hw/block/nvme: Add injection of Offline/Read-Only zones Dmitry Fomichev
2020-09-28 2:35 ` [PATCH v5 13/14] hw/block/nvme: Use zone metadata file for persistence Dmitry Fomichev
2020-09-28 7:51 ` Klaus Jensen
2020-09-29 15:43 ` Dmitry Fomichev
2020-09-29 16:46 ` Klaus Jensen
2020-09-28 2:35 ` [PATCH v5 14/14] hw/block/nvme: Document zoned parameters in usage text Dmitry Fomichev
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=20201001162355.GA339198@localhost.localdomain \
--to=niklas.cassel@wdc.com \
--cc=Alistair.Francis@wdc.com \
--cc=Damien.LeMoal@wdc.com \
--cc=Dmitry.Fomichev@wdc.com \
--cc=Matias.Bjorling@wdc.com \
--cc=fam@euphon.net \
--cc=k.jensen@samsung.com \
--cc=kbusch@kernel.org \
--cc=kwolf@redhat.com \
--cc=mlevitsk@redhat.com \
--cc=philmd@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.