All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] nvme: adding support for Apple's NVMe controller
@ 2015-11-03 23:31 Stephan Günther
  2015-11-03 23:47 ` [PATCH 1/2] nvme: add support for Apple " Stephan Günther
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Stephan Günther @ 2015-11-03 23:31 UTC (permalink / raw)


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(+)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] nvme: add support for Apple NVMe controller
  2015-11-03 23:31 [PATCH 0/2] nvme: adding support for Apple's NVMe controller Stephan Günther
@ 2015-11-03 23:47 ` Stephan Günther
  2015-11-03 23:49 ` [PATCH 2/2] " Stephan Günther
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Stephan Günther @ 2015-11-03 23:47 UTC (permalink / raw)


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

Signed-off-by: Stephan Guenther <guenther at tum.de>
Signed-off-by: Maurice Leclaire <leclaire at in.tum.de>
---
 drivers/block/nvme-core.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index ccc0c1f..2f1766b 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] nvme: add support for Apple NVMe controller
  2015-11-03 23:31 [PATCH 0/2] nvme: adding support for Apple's NVMe controller Stephan Günther
  2015-11-03 23:47 ` [PATCH 1/2] nvme: add support for Apple " Stephan Günther
@ 2015-11-03 23:49 ` Stephan Günther
  2015-11-04 14:25 ` [PATCH 0/2] nvme: adding support for Apple's " Christoph Hellwig
  2015-11-08  0:20 ` Jens Axboe
  3 siblings, 0 replies; 6+ messages in thread
From: Stephan Günther @ 2015-11-03 23:49 UTC (permalink / raw)


Add PCI ID of Apple's NVMe controller.

Signed-off-by: Stephan Guenther <guenther at tum.de>
Signed-off-by: Maurice Leclaire <leclaire at in.tum.de>
---
 drivers/block/nvme-core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index 2f1766b..ed088cf 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -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);

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 0/2] nvme: adding support for Apple's NVMe controller
  2015-11-03 23:31 [PATCH 0/2] nvme: adding support for Apple's NVMe controller Stephan Günther
  2015-11-03 23:47 ` [PATCH 1/2] nvme: add support for Apple " Stephan Günther
  2015-11-03 23:49 ` [PATCH 2/2] " Stephan Günther
@ 2015-11-04 14:25 ` Christoph Hellwig
  2015-11-07  1:32   ` Stephan Günther
  2015-11-08  0:20 ` Jens Axboe
  3 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2015-11-04 14:25 UTC (permalink / raw)


Looks fine,

Reviewed-by: Christoph Hellwig <hch at lst.de>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 0/2] nvme: adding support for Apple's NVMe controller
  2015-11-04 14:25 ` [PATCH 0/2] nvme: adding support for Apple's " Christoph Hellwig
@ 2015-11-07  1:32   ` Stephan Günther
  0 siblings, 0 replies; 6+ messages in thread
From: Stephan Günther @ 2015-11-07  1:32 UTC (permalink / raw)


On 2015/November/04 06:25, Christoph Hellwig wrote:
> 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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 0/2] nvme: adding support for Apple's NVMe controller
  2015-11-03 23:31 [PATCH 0/2] nvme: adding support for Apple's NVMe controller Stephan Günther
                   ` (2 preceding siblings ...)
  2015-11-04 14:25 ` [PATCH 0/2] nvme: adding support for Apple's " Christoph Hellwig
@ 2015-11-08  0:20 ` Jens Axboe
  3 siblings, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2015-11-08  0:20 UTC (permalink / raw)


On 11/03/2015 04:31 PM, Stephan G?nther wrote:
> 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.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-11-08  0:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-03 23:31 [PATCH 0/2] nvme: adding support for Apple's NVMe controller Stephan Günther
2015-11-03 23:47 ` [PATCH 1/2] nvme: add support for Apple " Stephan Günther
2015-11-03 23:49 ` [PATCH 2/2] " Stephan Günther
2015-11-04 14:25 ` [PATCH 0/2] nvme: adding support for Apple's " Christoph Hellwig
2015-11-07  1:32   ` Stephan Günther
2015-11-08  0:20 ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.