svn commit: r356955 - stable/12/sys/dev/nvme
Alexander Motin
mav at FreeBSD.org
Wed Jan 22 00:43:52 UTC 2020
Author: mav
Date: Wed Jan 22 00:43:51 2020
New Revision: 356955
URL: https://svnweb.freebsd.org/changeset/base/356955
Log:
MFC r355631 (by imp): Move reset to the interrutp processing stage
This trims the boot time a bit more for AWS and other platforms that have nvme
drives. There's no reason too do this inline. This has been in my tree a while,
but IIRC I talked to Jim Harris about this at one of our face to face meetings.
Modified:
stable/12/sys/dev/nvme/nvme.c
stable/12/sys/dev/nvme/nvme_ctrlr.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/sys/dev/nvme/nvme.c
==============================================================================
--- stable/12/sys/dev/nvme/nvme.c Wed Jan 22 00:41:18 2020 (r356954)
+++ stable/12/sys/dev/nvme/nvme.c Wed Jan 22 00:43:51 2020 (r356955)
@@ -130,25 +130,6 @@ nvme_attach(device_t dev)
int status;
status = nvme_ctrlr_construct(ctrlr, dev);
-
- if (status != 0) {
- nvme_ctrlr_destruct(ctrlr, dev);
- return (status);
- }
-
- /*
- * Reset controller twice to ensure we do a transition from cc.en==1 to
- * cc.en==0. This is because we don't really know what status the
- * controller was left in when boot handed off to OS. Linux doesn't do
- * this, however. If we adopt that policy, see also nvme_ctrlr_resume().
- */
- status = nvme_ctrlr_hw_reset(ctrlr);
- if (status != 0) {
- nvme_ctrlr_destruct(ctrlr, dev);
- return (status);
- }
-
- status = nvme_ctrlr_hw_reset(ctrlr);
if (status != 0) {
nvme_ctrlr_destruct(ctrlr, dev);
return (status);
Modified: stable/12/sys/dev/nvme/nvme_ctrlr.c
==============================================================================
--- stable/12/sys/dev/nvme/nvme_ctrlr.c Wed Jan 22 00:41:18 2020 (r356954)
+++ stable/12/sys/dev/nvme/nvme_ctrlr.c Wed Jan 22 00:43:51 2020 (r356955)
@@ -909,6 +909,25 @@ void
nvme_ctrlr_start_config_hook(void *arg)
{
struct nvme_controller *ctrlr = arg;
+ int status;
+
+ /*
+ * Reset controller twice to ensure we do a transition from cc.en==1 to
+ * cc.en==0. This is because we don't really know what status the
+ * controller was left in when boot handed off to OS. Linux doesn't do
+ * this, however. If we adopt that policy, see also nvme_ctrlr_resume().
+ */
+ status = nvme_ctrlr_hw_reset(ctrlr);
+ if (status != 0) {
+ nvme_ctrlr_fail(ctrlr);
+ return;
+ }
+
+ status = nvme_ctrlr_hw_reset(ctrlr);
+ if (status != 0) {
+ nvme_ctrlr_fail(ctrlr);
+ return;
+ }
nvme_qpair_reset(&ctrlr->adminq);
nvme_admin_qpair_enable(&ctrlr->adminq);
More information about the svn-src-all
mailing list