git: 0a19464bf7af - main - nvme: Only attach to storage NVMe devices
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 10 Dec 2025 22:53:59 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=0a19464bf7afa35ce2aa7649152bc3a7629faa98
commit 0a19464bf7afa35ce2aa7649152bc3a7629faa98
Author: Warner Losh <imp@FreeBSD.org>
AuthorDate: 2025-12-10 22:53:12 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2025-12-10 22:53:12 +0000
nvme: Only attach to storage NVMe devices
Only attach CAM to the nvme storage devices.
Sponsored by: Netflix
---
sys/cam/cam_ccb.h | 2 +-
sys/dev/nvme/nvme_sim.c | 9 ++++++++-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/sys/cam/cam_ccb.h b/sys/cam/cam_ccb.h
index 19f18f36b8c9..bb23c6bed26f 100644
--- a/sys/cam/cam_ccb.h
+++ b/sys/cam/cam_ccb.h
@@ -650,7 +650,7 @@ struct ccb_pathinq_settings_nvme {
uint8_t bus;
uint8_t slot;
uint8_t function;
- uint8_t extra;
+ uint8_t progif;
char dev_name[NVME_DEV_NAME_LEN]; /* nvme controller dev name for this device */
};
_Static_assert(sizeof(struct ccb_pathinq_settings_nvme) == 64,
diff --git a/sys/dev/nvme/nvme_sim.c b/sys/dev/nvme/nvme_sim.c
index d134d1daafc3..8b861cf3aa71 100644
--- a/sys/dev/nvme/nvme_sim.c
+++ b/sys/dev/nvme/nvme_sim.c
@@ -208,7 +208,7 @@ nvme_sim_action(struct cam_sim *sim, union ccb *ccb)
cpi->xport_specific.nvme.bus = pci_get_bus(dev);
cpi->xport_specific.nvme.slot = pci_get_slot(dev);
cpi->xport_specific.nvme.function = pci_get_function(dev);
- cpi->xport_specific.nvme.extra = 0;
+ cpi->xport_specific.nvme.progif = pci_get_progif(dev);
strlcpy(cpi->xport_specific.nvme.dev_name, device_get_nameunit(dev),
sizeof(cpi->xport_specific.nvme.dev_name));
cpi->hba_vendor = pci_get_vendor(dev);
@@ -314,6 +314,13 @@ nvme_sim_probe(device_t dev)
{
if (nvme_use_nvd)
return (ENXIO);
+ /*
+ * Only do storage devices with CAM. NVMHCI 1.0 interfaces are the only
+ * ones that have namespaces with LBA ranges on them.
+ */
+ if (pci_get_progif(device_get_parent(dev)) !=
+ PCIP_STORAGE_NVM_ENTERPRISE_NVMHCI_1_0)
+ return (ENXIO);
device_set_desc(dev, "nvme cam");
return (BUS_PROBE_DEFAULT);