nvme-apple: Add NVME_QUIRK_IDENTIFY_CNS quirk to fix regression

Message ID 20230104092148.15578-1-marcan@marcan.st
State New
Headers
Series nvme-apple: Add NVME_QUIRK_IDENTIFY_CNS quirk to fix regression |

Commit Message

Hector Martin Jan. 4, 2023, 9:21 a.m. UTC
  From the get-go, this driver and the ANS syslog have been complaining
about namespace identification. In 6.2-rc1, commit 811f4de0344d ("nvme:
avoid fallback to sequential scan due to transient issues") regressed
the driver by no longer allowing fallback to sequential namespace scans,
leaving us with no namespaces.

It turns out that the real problem is that this controller claiming
NVMe 1.1 compat is treating the CNS field as a binary field, as in NVMe
1.0. This already has a quirk, NVME_QUIRK_IDENTIFY_CNS, so set it for
the controller to fix all this nonsense (including other errors
triggered by other CNS commands).

Fixes: 811f4de0344d ("nvme: avoid fallback to sequential scan due to transient issues")
Fixes: 5bd2927aceba ("nvme-apple: Add initial Apple SoC NVMe driver")
Signed-off-by: Hector Martin <marcan@marcan.st>
---
 drivers/nvme/host/apple.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.35.1
  

Comments

Sven Peter Jan. 4, 2023, 9:33 a.m. UTC | #1
Hi,


On Wed, Jan 4, 2023, at 10:21, Hector Martin wrote:
> From the get-go, this driver and the ANS syslog have been complaining
> about namespace identification. In 6.2-rc1, commit 811f4de0344d ("nvme:
> avoid fallback to sequential scan due to transient issues") regressed
> the driver by no longer allowing fallback to sequential namespace scans,
> leaving us with no namespaces.
>
> It turns out that the real problem is that this controller claiming
> NVMe 1.1 compat is treating the CNS field as a binary field, as in NVMe
> 1.0. This already has a quirk, NVME_QUIRK_IDENTIFY_CNS, so set it for
> the controller to fix all this nonsense (including other errors
> triggered by other CNS commands).
>
> Fixes: 811f4de0344d ("nvme: avoid fallback to sequential scan due to 
> transient issues")
> Fixes: 5bd2927aceba ("nvme-apple: Add initial Apple SoC NVMe driver")
> Signed-off-by: Hector Martin <marcan@marcan.st>

Nice, I've been meaning to look into those weird namespace scanning errors
for a while now but never got around to it because they didn't break anything.

There's a chance this is also required for the later T2/x86 Macs in pci.c
(PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2005)) since they share a similar firmware but
I don't have access to those to test if this is actually required.

Reviewed-by: Sven Peter <sven@svenpeter.dev>



Best,

Sven
  
Christoph Hellwig Jan. 8, 2023, 6:15 p.m. UTC | #2
Thanks,

I've applied both patches to nvme-6.2.
  

Patch

diff --git a/drivers/nvme/host/apple.c b/drivers/nvme/host/apple.c
index e17d3a8a0107..e13a992b6096 100644
--- a/drivers/nvme/host/apple.c
+++ b/drivers/nvme/host/apple.c
@@ -1553,7 +1553,7 @@  static int apple_nvme_probe(struct platform_device *pdev)
 	}

 	ret = nvme_init_ctrl(&anv->ctrl, anv->dev, &nvme_ctrl_ops,
-			     NVME_QUIRK_SKIP_CID_GEN);
+			     NVME_QUIRK_SKIP_CID_GEN | NVME_QUIRK_IDENTIFY_CNS);
 	if (ret) {
 		dev_err_probe(dev, ret, "Failed to initialize nvme_ctrl");
 		goto put_dev;