diff --git a/test/nvme/reset/reset.c b/test/nvme/reset/reset.c index 62f114034..73400d7ce 100644 --- a/test/nvme/reset/reset.c +++ b/test/nvme/reset/reset.c @@ -36,6 +36,7 @@ #include "spdk/nvme.h" #include "spdk/env.h" #include "spdk/string.h" +#include "spdk/pci_ids.h" struct ctrlr_entry { struct spdk_nvme_ctrlr *ctrlr; @@ -81,6 +82,7 @@ static struct ctrlr_entry *g_controllers = NULL; static struct ns_entry *g_namespaces = NULL; static int g_num_namespaces = 0; static struct worker_thread *g_workers = NULL; +static bool g_qemu_ssd_found = false; static uint64_t g_tsc_rate; @@ -525,6 +527,22 @@ static void attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid, struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts) { + if (trid->trtype == SPDK_NVME_TRANSPORT_PCIE) { + struct spdk_pci_device *dev = spdk_nvme_ctrlr_get_pci_device(ctrlr); + + /* QEMU emulated SSDs can't handle this test, so we will skip + * them. QEMU NVMe SSDs report themselves as VID == Intel. So we need + * to check this specific 0x5845 device ID to know whether it's QEMU + * or not. + */ + if (spdk_pci_device_get_vendor_id(dev) == SPDK_PCI_VID_INTEL && + spdk_pci_device_get_device_id(dev) == 0x5845) { + g_qemu_ssd_found = true; + printf("Skipping QEMU NVMe SSD at %s\n", trid->traddr); + return; + } + } + register_ctrlr(ctrlr); } @@ -656,7 +674,7 @@ int main(int argc, char **argv) if (!g_controllers) { printf("No NVMe controller found, %s exiting\n", argv[0]); - return 1; + return g_qemu_ssd_found ? 0 : 1; } task_pool = spdk_mempool_create("task_pool", TASK_POOL_NUM,