nvme: adding support for Apple's NVMe controller
Subsystems (2)
cover nvme: adding support for Apple's NVMe controller
Adding support for Apple's NVMe controller. Patches are tested on linux-4.3 on a MacBook8,1. /dev/nvme0n1p* are recognized, bulk transfers work, and the previous patches have been confirmed to work on NVMe-based MacBookAir7,1 (see patches for details).
Stephan G?nther (2):
nvme: enforce ordered split transfers
nvme: add pci device id for Apple NVMe controller
drivers/block/nvme-core.c | 9 +++++++++ 1 file changed, 9 insertions(+)
PATCH 1/2 nvme: add support for Apple NVMe controller
Some controllers may require ordered split transfers even on 64bit machines, e.g. Apple's NVMe controller as found in the MacBook8,1 and MacBookAir7,1 (256/512GB models).
This patch enforces ordered split transfers on 64bit platforms, which works around that issue for all controllers. As pointed out by Christoph
[1] there should be no performance impact due to that modification.
[1] http://lists.infradead.org/pipermail/linux-nvme/2015-November/002965.html
--- drivers/block/nvme-core.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/block/nvme-core.c +8 -0
@@ -43,6 +43,14 @@#include <scsi/sg.h> #include <asm-generic/io-64-nonatomic-lo-hi.h> +/* +* Some controllers may require ordered split transfers even on 64bit +* platforms, e.g. Apple's NVMe controller as found in the MacBook8,1 and +* MacBookAir7,1 (256/512GB models). +*/ +#define readq lo_hi_readq +#define writeq lo_hi_writeq +#define NVME_MINORS (1U << MINORBITS)#define NVME_Q_DEPTH 1024#define NVME_AQ_DEPTH 256
PATCH 2/2 nvme: add support for Apple NVMe controller
In reply to Stephan GüntherAdd PCI ID of Apple's NVMe controller.
--- drivers/block/nvme-core.c | 1 + 1 file changed, 1 insertion(+)
drivers/block/nvme-core.c +1 -0
@@ -3326,6 +3326,7 @@ static const struct pci_error_handlers nvme_err_handler = {static const struct pci_device_id nvme_id_table[] = { {PCI_DEVICE_CLASS (PCI_CLASS_STORAGE_EXPRESS ,0xffffff ) }, + {PCI_DEVICE (PCI_VENDOR_ID_APPLE ,0x2001 ) }, {0 , } };MODULE_DEVICE_TABLE (pci, nvme_id_table);
cover nvme: adding support for Apple's NVMe controller
In reply to Stephan GüntherLooks fine,
cover nvme: adding support for Apple's NVMe controller
Quoted 4 lines · Christoph Hellwig
Looks fine,
Reviewed-by Christoph Hellwig <hch at lst.de>
So far I had 2 feedbacks regarding controller resets and data loss using the patch while debootstrapping or using a partition as root file system.
Might be that controller properties exported to userspace are subject to the same issue with 64bit atomic operations like the NVMe module itself.
We will further investigate those problems in our spare time, and of course welcome any suggestions what might cause those issues.
Although I was not able to reproduce the problem so far (there is also a firmware upgrade going on with OSX 10.11.2), I must point out more I did before that using our Apple NVMe patch might cause data loss if being used careless.
Jens Axboe
maintainercover nvme: adding support for Apple's NVMe controller
In reply to Stephan GüntherQuoted 8 lines · Stephan G?nther
Adding support for Apple's NVMe controller. Patches are tested on linux-4.3 on a MacBook8,1.
/dev/nvme0n1p*are recognized, bulk transfers work, and the previous patches have been confirmed to work on NVMe-based MacBookAir7,1 (see patches for details).Stephan G?nther (2):
nvme: enforce ordered split transfers
nvme: add pci device id for Apple NVMe controller
Added for 4.4.
Signature · 1 line
Jens Axboe