Index: sys/conf/files =================================================================== --- sys/conf/files +++ sys/conf/files @@ -86,9 +86,9 @@ cam/ata/ata_all.c optional scbus cam/ata/ata_xpt.c optional scbus cam/ata/ata_pmp.c optional scbus -cam/nvme/nvme_all.c optional scbus nvme !nvd -cam/nvme/nvme_da.c optional scbus nvme da !nvd -cam/nvme/nvme_xpt.c optional scbus nvme !nvd +cam/nvme/nvme_all.c optional scbus nvme +cam/nvme/nvme_da.c optional scbus nvme da +cam/nvme/nvme_xpt.c optional scbus nvme cam/scsi/scsi_xpt.c optional scbus cam/scsi/scsi_all.c optional scbus cam/scsi/scsi_cd.c optional cd Index: sys/conf/files.amd64 =================================================================== --- sys/conf/files.amd64 +++ sys/conf/files.amd64 @@ -341,7 +341,7 @@ dev/nvme/nvme_ns.c optional nvme dev/nvme/nvme_ns_cmd.c optional nvme dev/nvme/nvme_qpair.c optional nvme -dev/nvme/nvme_sim.c optional nvme scbus !nvd +dev/nvme/nvme_sim.c optional nvme scbus dev/nvme/nvme_sysctl.c optional nvme dev/nvme/nvme_test.c optional nvme dev/nvme/nvme_util.c optional nvme Index: sys/dev/nvd/nvd.c =================================================================== --- sys/dev/nvd/nvd.c +++ sys/dev/nvd/nvd.c @@ -41,6 +41,8 @@ #include +extern int nvme_use_nvd; + #define NVD_STR "nvd" struct nvd_disk; @@ -134,6 +136,8 @@ static int nvd_load() { + if (!nvme_use_nvd) + return 0; TAILQ_INIT(&ctrlr_head); TAILQ_INIT(&disk_head); @@ -150,6 +154,9 @@ struct nvd_controller *ctrlr; struct nvd_disk *disk; + if (!nvme_use_nvd) + return; + while (!TAILQ_EMPTY(&ctrlr_head)) { ctrlr = TAILQ_FIRST(&ctrlr_head); TAILQ_REMOVE(&ctrlr_head, ctrlr, tailq); Index: sys/dev/nvme/nvme_sim.c =================================================================== --- sys/dev/nvme/nvme_sim.c +++ sys/dev/nvme/nvme_sim.c @@ -63,6 +63,8 @@ struct cam_path *s_path; }; +extern int nvme_use_nvd; + static void nvme_sim_nvmeio_done(void *ccb_arg, const struct nvme_completion *cpl) { @@ -371,6 +373,8 @@ static void nvme_sim_init(void) { + if (nvme_use_nvd) + return; consumer_cookie = nvme_register_consumer(nvme_sim_new_ns, nvme_sim_new_controller, NULL, nvme_sim_controller_fail); @@ -382,6 +386,8 @@ static void nvme_sim_uninit(void) { + if (nvme_use_nvd) + return; /* XXX Cleanup */ nvme_unregister_consumer(consumer_cookie); Index: sys/dev/nvme/nvme_sysctl.c =================================================================== --- sys/dev/nvme/nvme_sysctl.c +++ sys/dev/nvme/nvme_sysctl.c @@ -33,6 +33,12 @@ #include "nvme_private.h" +int nvme_use_nvd = 1; + +SYSCTL_NODE(_hw, OID_AUTO, nvme, CTLFLAG_RD, 0, "NVME sysctl tunables"); +SYSCTL_INT(_hw_nvme, OID_AUTO, use_nvd, CTLFLAG_RDTUN, + &nvme_use_nvd, 1, "1 = Create NVD deviecs, 0 = Create NDA devices"); + /* * CTLTYPE_S64 and sysctl_handle_64 were added in r217616. Define these * explicitly here for older kernels that don't include the r217616