From nobody Mon Dec 06 17:25:41 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 49D6818C21D9; Mon, 6 Dec 2021 17:25:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4J79LZ04W1z3Q3q; Mon, 6 Dec 2021 17:25:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D6DC97CCC; Mon, 6 Dec 2021 17:25:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1B6HPfci055600; Mon, 6 Dec 2021 17:25:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1B6HPfTi055599; Mon, 6 Dec 2021 17:25:41 GMT (envelope-from git) Date: Mon, 6 Dec 2021 17:25:41 GMT Message-Id: <202112061725.1B6HPfTi055599@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 053f8ed6ebf2 - main - nvme: Move to a quirk for the Intel alignment data List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 053f8ed6ebf2355a92cb1798a9701f701610771c Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1638811542; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=u5CbeO7wgdi2GRHBQc/x6ITLiHDNFbRflO3ZNqJ+hV4=; b=dDoiT9NNelbIKX7o8ej6erXRzXeN2TG9svIT0+brjCdXAruxrxVnWi0+NGN0/Z4zNT4vcr NaTZdg6QB2PucKnS2Phhmy9JcAV/Qfi81X+msa4S/Jm7b3ICJXca7w3lPSJxTlzM4PxzCP KmHbSOm2+OWdlQefqpbxHFrsNoCKaUt2Q0aselogRHuxeGY7OpY7S7JQtp7VxTxW1Royge trvo4jOcfuJ5rycy0nxIgw1TN2NM/7PrpDGm6MLmWgj8fCwqvFYiu/DX4GopwnXeaVEQMd jHqve9bD0SSsHtaj9lLDvlSmhQgPcF/a8gxhlAw4YFT7jxtpRTJIIko5xP3QGw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1638811542; a=rsa-sha256; cv=none; b=bzxnNR1Y4oXYJHf+Snm4RD4mDngDjBN8BhQkn9LRrMttKR5rugpDo0O+Q4FqYg8iSfemI+ DTWcre9kRXKTimCBHNqJkUcb5SzSBKczc79lTyg0pLBMHx4Vys0U3dsGO5FvyVr4tSh8rt 6rwiUKbtA1IUoARUkzTMHbCKq4ppoJTmWDN13RSxKvVSLf3SWHbcH3dA/4UuOw1Zrv0ntB 3fmb47+9OyaP23wsL3iQl9CUY13r4l9s3CM4ODPuMxDYVkoS0hALdb0OnGsEuLrw7rrVrz fzuQwlumlsw/K/pPul4ZS8TWBp/+TJ9oVlPYxGcKROa8NqxEUtzkwm7dMl2tiA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=053f8ed6ebf2355a92cb1798a9701f701610771c commit 053f8ed6ebf2355a92cb1798a9701f701610771c Author: Warner Losh AuthorDate: 2021-12-06 17:22:50 +0000 Commit: Warner Losh CommitDate: 2021-12-06 17:23:40 +0000 nvme: Move to a quirk for the Intel alignment data Prior to NVMe 1.3, Intel produced a series of drives that had performance alignment data in the vendor specific space since no standard had been defined. Move testing the versions to a quick so the NVMe NS code doesn't know about PCI device info. Sponsored by: Netflix Reviewed by: mav Differential Revision: https://reviews.freebsd.org/D33284 --- sys/dev/nvme/nvme_ns.c | 10 ++-------- sys/dev/nvme/nvme_pci.c | 4 ++++ sys/dev/nvme/nvme_private.h | 1 + 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/sys/dev/nvme/nvme_ns.c b/sys/dev/nvme/nvme_ns.c index 8f97b08b88f4..ba6960e476f8 100644 --- a/sys/dev/nvme/nvme_ns.c +++ b/sys/dev/nvme/nvme_ns.c @@ -571,20 +571,14 @@ nvme_ns_construct(struct nvme_namespace *ns, uint32_t id, * that improves performance. If present use for the stripe size. NVMe * 1.3 standardized this as NOIOB, and newer Intel drives use that. */ - switch (pci_get_devid(ctrlr->dev)) { - case 0x09538086: /* Intel DC PC3500 */ - case 0x0a538086: /* Intel DC PC3520 */ - case 0x0a548086: /* Intel DC PC4500 */ - case 0x0a558086: /* Dell Intel P4600 */ + if ((ctrlr->quirks & QUIRK_INTEL_ALIGNMENT) != 0) { if (ctrlr->cdata.vs[3] != 0) ns->boundary = (1 << ctrlr->cdata.vs[3]) * ctrlr->min_page_size; else ns->boundary = 0; - break; - default: + } else { ns->boundary = ns->data.noiob * nvme_ns_get_sector_size(ns); - break; } if (nvme_ctrlr_has_dataset_mgmt(&ctrlr->cdata)) diff --git a/sys/dev/nvme/nvme_pci.c b/sys/dev/nvme/nvme_pci.c index e87860bde7e6..20ffe6574dce 100644 --- a/sys/dev/nvme/nvme_pci.c +++ b/sys/dev/nvme/nvme_pci.c @@ -85,6 +85,10 @@ static struct _pcsid { 0x09538086, 1, 0x3705, "DC P3500 SSD [2.5\" SFF]" }, { 0x09538086, 1, 0x3709, "DC P3600 SSD [Add-in Card]" }, { 0x09538086, 1, 0x370a, "DC P3600 SSD [2.5\" SFF]" }, + { 0x09538086, 0, 0, "Intel DC PC3500", QUIRK_INTEL_ALIGNMENT }, + { 0x0a538086, 0, 0, "Intel DC PC3520", QUIRK_INTEL_ALIGNMENT }, + { 0x0a548086, 0, 0, "Intel DC PC4500", QUIRK_INTEL_ALIGNMENT }, + { 0x0a558086, 0, 0, "Dell Intel P4600", QUIRK_INTEL_ALIGNMENT }, { 0x00031c58, 0, 0, "HGST SN100", QUIRK_DELAY_B4_CHK_RDY }, { 0x00231c58, 0, 0, "WDC SN200", QUIRK_DELAY_B4_CHK_RDY }, { 0x05401c5f, 0, 0, "Memblaze Pblaze4", QUIRK_DELAY_B4_CHK_RDY }, diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h index 9c7c1b46eab4..3f89f12cf8fd 100644 --- a/sys/dev/nvme/nvme_private.h +++ b/sys/dev/nvme/nvme_private.h @@ -240,6 +240,7 @@ struct nvme_controller { uint32_t quirks; #define QUIRK_DELAY_B4_CHK_RDY 1 /* Can't touch MMIO on disable */ #define QUIRK_DISABLE_TIMEOUT 2 /* Disable broken completion timeout feature */ +#define QUIRK_INTEL_ALIGNMENT 4 /* Pre NVMe 1.3 performance alignment */ bus_space_tag_t bus_tag; bus_space_handle_t bus_handle;