Skip to contentSkip to conversation

nvme-pci: Add IGNORE_DEV_SUBNQN quirk for Phison E19

PATCH New Paul Menzel 2 participants 2 messages Nov 23 NVMe

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme-pci: Add IGNORE_DEV_SUBNQN quirk for Phison E19

The Phison E19 (198:5019) in a Dell XPS 13 9315 reports:

    $ sudo nvme id-ctrl /dev/nvme0 | grep -E '^(vid|mn|fr|ver|subnqn) '
    vid       : 0x1987
    mn        : ESE2A044-512 NVMe Phison 512GB
    fr        : 19010008
    ver       : 0x10400
    subnqn    :

So every boot warns:

nvme nvme0: missing or invalid SUBNQN field.

and the kernel falls back to the generated NQN anyway:

    $ cat /sys/class/nvme/nvme0/subsysnqn
    nqn.2014.08.org.nvmexpress:19871987298E07241E4B00121487ESE2A044-512 NVMe Phison 512GB

Add NVME_QUIRK_IGNORE_DEV_SUBNQN, as for the Phison E16 (1987:5016), to use the generated NQN without the warning. For this drive the subsystem NQN stays the same.

---
 drivers/nvme/host/pci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/host/pci.c +2 -1
index 076603df01abb..ba5b1cdbb95e1 100644
@@ -4398,7 +4398,8 @@ static const struct pci_device_id nvme_id_table[] = {
 		.driver_data = NVME_QUIRK_IGNORE_DEV_SUBNQN |
 				NVME_QUIRK_BOGUS_NID, },
 	{ PCI_DEVICE(0x1987, 0x5019),  /* phison E19 */
-		.driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
+		.driver_data = NVME_QUIRK_IGNORE_DEV_SUBNQN |
+				NVME_QUIRK_DISABLE_WRITE_ZEROES, },
 	{ PCI_DEVICE(0x1987, 0x5021),   /* Phison E21 */
 		.driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
 	{ PCI_DEVICE(0x1b4b, 0x1092),	/* Lexar 256 GB SSD */
Signature · 1 line
2.54.0
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] nvme-pci: NVME_QUIRK_IGNORE_DEV_SUBNQN on 1987:5019 drops valid subnqn --

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Medium] nvme-pci: NVME_QUIRK_IGNORE_DEV_SUBNQN on 1987:5019 drops valid subnqn
--

commit 33a2a53ded342ddae773b6729c39a64a9a776cbe
Author: Paul Menzel <[email protected]>

nvme-pci: Add IGNORE_DEV_SUBNQN quirk for Phison E19

This commit adds NVME_QUIRK_IGNORE_DEV_SUBNQN to the Phison E19 PCI ID entry (0x1987:0x5019) in nvme_id_table to silence the missing SUBNQN warning on a Dell OEM SSD.

drivers/nvme/host/pci.c static const struct pci_device_id nvme_id_table[] = { · line 4402

Quoted 11 lines
drivers/nvme/host/pci.c +2 -1
index 076603df01abb..ba5b1cdbb95e1 100644
@@ -4398,7 +4398,8 @@ static const struct pci_device_id nvme_id_table[] = {
 		.driver_data = NVME_QUIRK_IGNORE_DEV_SUBNQN |
 				NVME_QUIRK_BOGUS_NID, },
 	{ PCI_DEVICE(0x1987, 0x5019),  /* phison E19 */
-		.driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
+		.driver_data = NVME_QUIRK_IGNORE_DEV_SUBNQN |
+				NVME_QUIRK_DISABLE_WRITE_ZEROES, },

[Severity: Medium]
Does setting NVME_QUIRK_IGNORE_DEV_SUBNQN on the generic Phison E19 PCI ID (0x1987:0x5019) cause nvme_init_subnqn() to discard valid id->subnqn values on other SSD models and firmware revisions using this controller?

When id->subnqn is empty, nvme_init_subnqn() already warns for NVMe >= 1.2.1 and falls back to generating a unique NQN from the device serial and model numbers:

drivers/nvme/host/core.c:nvme_init_subnqn() {
	if(!(ctrl->quirks & NVME_QUIRK_IGNORE_DEV_SUBNQN)) {
		nqnlen = strnlen(id->subnqn, NVMF_NQN_SIZE);
		if (nqnlen > 0 && nqnlen < NVMF_NQN_SIZE) {
			strscpy(subsys->subnqn, id->subnqn, NVMF_NQN_SIZE);
			return;
		}

		if (ctrl->vs >= NVME_VS(1, 2, 1))
			dev_warn(ctrl->device, "missing or invalid SUBNQN field.\n");
	}
	...
}

NVME_QUIRK_IGNORE_DEV_SUBNQN is intended for firmware that reports a non-empty duplicate SUBNQN across distinct physical drives, and commit 40df2172853f ("Revert "nvme: add quirk NVME_QUIRK_IGNORE_DEV_SUBNQN for 144d:a808"") rejected adding this quirk to nvme_id_table just to suppress the warning for an empty SUBNQN field.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1