diff mbox series

[1/1,SRU,F,G,OEM-5.6] nvme-pci: prevent SK hynix PC400 from using Write Zeroes command

Message ID 20200728084554.14827-2-acelan.kao@canonical.com
State New
Headers show
Series blk_update_request error when mount nvme partition | expand

Commit Message

AceLan Kao July 28, 2020, 8:45 a.m. UTC
From: Kai-Heng Feng <kai.heng.feng@canonical.com>

After commit 6e02318eaea5 ("nvme: add support for the Write Zeroes
command"), SK hynix PC400 becomes very slow with the following error
message:

[  224.567695] blk_update_request: operation not supported error, dev nvme1n1, sector 499384320 op 0x9:(WRITE_ZEROES) flags 0x1000000 phys_seg 0 prio class 0]

SK Hynix PC400 has a buggy firmware that treats NLB as max value instead
of a range, so the NLB passed isn't a valid value to the firmware.

According to SK hynix there are three commands are affected:
- Write Zeroes
- Compare
- Write Uncorrectable

Right now only Write Zeroes is implemented, so disable it completely on
SK hynix PC400.

BugLink: https://bugs.launchpad.net/bugs/1872383
Cc: kyounghwan sohn <kyounghwan.sohn@sk.com>
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
(cherry picked from commit 5611ec2b9814bc91f7b0a8d804c1fc152e2025d9 nvme/nvme-5.8)
Signed-off-by: AceLan Kao <acelan.kao@canonical.com>
---
 drivers/nvme/host/pci.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Stefan Bader July 28, 2020, 9 a.m. UTC | #1
On 28.07.20 10:45, AceLan Kao wrote:
> From: Kai-Heng Feng <kai.heng.feng@canonical.com>
> 
> After commit 6e02318eaea5 ("nvme: add support for the Write Zeroes
> command"), SK hynix PC400 becomes very slow with the following error
> message:
> 
> [  224.567695] blk_update_request: operation not supported error, dev nvme1n1, sector 499384320 op 0x9:(WRITE_ZEROES) flags 0x1000000 phys_seg 0 prio class 0]
> 
> SK Hynix PC400 has a buggy firmware that treats NLB as max value instead
> of a range, so the NLB passed isn't a valid value to the firmware.
> 
> According to SK hynix there are three commands are affected:
> - Write Zeroes
> - Compare
> - Write Uncorrectable
> 
> Right now only Write Zeroes is implemented, so disable it completely on
> SK hynix PC400.
> 
> BugLink: https://bugs.launchpad.net/bugs/1872383
> Cc: kyounghwan sohn <kyounghwan.sohn@sk.com>
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> (cherry picked from commit 5611ec2b9814bc91f7b0a8d804c1fc152e2025d9 nvme/nvme-5.8)
> Signed-off-by: AceLan Kao <acelan.kao@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
> ---

It is a setup quirk for a very specific device, so it should be testable and
sounds acceptable for a stable release. But its not main linux tree or
linux-next, so I would flag it as "UBUNTU: SAUCE:" at least when applying to F.

-Stefan

>  drivers/nvme/host/pci.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index cd64ddb129e5..3208f378a46b 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -3125,6 +3125,8 @@ static const struct pci_device_id nvme_id_table[] = {
>  	{ PCI_DEVICE(0x1cc1, 0x8201),   /* ADATA SX8200PNP 512GB */
>  		.driver_data = NVME_QUIRK_NO_DEEPEST_PS |
>  				NVME_QUIRK_IGNORE_DEV_SUBNQN, },
> +	{ PCI_DEVICE(0x1c5c, 0x1504),   /* SK Hynix PC400 */
> +		.driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
>  	{ PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, 0xffffff) },
>  	{ PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2001),
>  		.driver_data = NVME_QUIRK_SINGLE_VECTOR },
>
diff mbox series

Patch

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index cd64ddb129e5..3208f378a46b 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -3125,6 +3125,8 @@  static const struct pci_device_id nvme_id_table[] = {
 	{ PCI_DEVICE(0x1cc1, 0x8201),   /* ADATA SX8200PNP 512GB */
 		.driver_data = NVME_QUIRK_NO_DEEPEST_PS |
 				NVME_QUIRK_IGNORE_DEV_SUBNQN, },
+	{ PCI_DEVICE(0x1c5c, 0x1504),   /* SK Hynix PC400 */
+		.driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
 	{ PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, 0xffffff) },
 	{ PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2001),
 		.driver_data = NVME_QUIRK_SINGLE_VECTOR },