aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatias Bjørling <m@bjorling.me>2015-11-28 10:49:26 -0500
committerJens Axboe <axboe@fb.com>2015-11-29 16:34:58 -0500
commit09f2e716096811081b204c6afd6264c2e64d1210 (patch)
tree026e798bc14a99b33366adbdcef4837aaee3b959
parentd160147b5c96ef5ec842c604ccd79f5f03306677 (diff)
lightnvm: refactor and change vendor id for qemu
The QEMU NVMe implementation uses Intel vendor, Intel device id, and the first vendor specific byte to identify a LightNVM compatible nvme instance. Instead of using the Intel specific, use a preallocated from CNEX Labs instead. This lets us uniquely identify a QEMU lightnvm device without breaking other vendor specific work in the qemu device driver. Reported-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Matias Bjørling <m@bjorling.me> Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r--drivers/nvme/host/lightnvm.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
index 07451d6c6ae8..b9e5cc74053f 100644
--- a/drivers/nvme/host/lightnvm.c
+++ b/drivers/nvme/host/lightnvm.c
@@ -569,18 +569,25 @@ void nvme_nvm_unregister(struct request_queue *q, char *disk_name)
569 nvm_unregister(disk_name); 569 nvm_unregister(disk_name);
570} 570}
571 571
572/* move to shared place when used in multiple places. */
573#define PCI_VENDOR_ID_CNEX 0x1d1d
574#define PCI_DEVICE_ID_CNEX_WL 0x2807
575#define PCI_DEVICE_ID_CNEX_QEMU 0x1f1f
576
572int nvme_nvm_ns_supported(struct nvme_ns *ns, struct nvme_id_ns *id) 577int nvme_nvm_ns_supported(struct nvme_ns *ns, struct nvme_id_ns *id)
573{ 578{
574 struct nvme_dev *dev = ns->dev; 579 struct nvme_dev *dev = ns->dev;
575 struct pci_dev *pdev = to_pci_dev(dev->dev); 580 struct pci_dev *pdev = to_pci_dev(dev->dev);
576 581
577 /* QEMU NVMe simulator - PCI ID + Vendor specific bit */ 582 /* QEMU NVMe simulator - PCI ID + Vendor specific bit */
578 if (pdev->vendor == PCI_VENDOR_ID_INTEL && pdev->device == 0x5845 && 583 if (pdev->vendor == PCI_VENDOR_ID_CNEX &&
584 pdev->device == PCI_DEVICE_ID_CNEX_QEMU &&
579 id->vs[0] == 0x1) 585 id->vs[0] == 0x1)
580 return 1; 586 return 1;
581 587
582 /* CNEX Labs - PCI ID + Vendor specific bit */ 588 /* CNEX Labs - PCI ID + Vendor specific bit */
583 if (pdev->vendor == 0x1d1d && pdev->device == 0x2807 && 589 if (pdev->vendor == PCI_VENDOR_ID_CNEX &&
590 pdev->device == PCI_DEVICE_ID_CNEX_WL &&
584 id->vs[0] == 0x1) 591 id->vs[0] == 0x1)
585 return 1; 592 return 1;
586 593