From nobody Fri Apr 15 20:46:48 2022 X-Original-To: dev-commits-src-main@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 1189A5D73A1; Fri, 15 Apr 2022 20:46:49 +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 4Kg7fc5PsDz4tbC; Fri, 15 Apr 2022 20:46:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1650055608; 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=hi7imuJqC/Vv9Fk6rA4KlXOaVt8MXjW/oHZhNg3tOuM=; b=VI4x7GQCyjscQVdX4cEJlkhuJFLNPONQCewErEcEbX5Qsud8VyoCN0N0IZaDNRhYYBu7gm WLDaJXVF8zbkxn81l1T9JP2s83UOjpAqfSCvzfCqhWNIDQi4oxwaPCc+E16g3ZplBiV03m WzeCj2Bk8xhwtdCmTAyEKG4OLA6uHgHd06yylc6Ig7eHXo0TDaC5RAYo7iLfaVcxQe8KK2 tOj14kE2ZODYKN/IMPqCnuk6mZIvFxxLy+avO4VFPYzK3R5aSKb24IIPowKLTXU01N1BaF mXEQ2QFDn5CANwCOC7WYyA8yAXV4htw3a422Wom6590kvfRVQ0MAOjE/43XVkA== 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 7EF5F1C434; Fri, 15 Apr 2022 20:46:48 +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 23FKkmLv079382; Fri, 15 Apr 2022 20:46:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 23FKkmKo079381; Fri, 15 Apr 2022 20:46:48 GMT (envelope-from git) Date: Fri, 15 Apr 2022 20:46:48 GMT Message-Id: <202204152046.23FKkmKo079381@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: 3086efe895d5 - main - nvme: Remove NVME_MAX_XFER_SIZE, replace inline calculation List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: 3086efe895d5e7656c8a1a5343adf6de7c716b4d Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1650055608; 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=hi7imuJqC/Vv9Fk6rA4KlXOaVt8MXjW/oHZhNg3tOuM=; b=iBHmcEDT/tTXYpXmy2bvqNJcDaYpKSBRTmWunyOmWN4IBanQ8XW8qWRoC8ReqirRy6YIZI IQlnqEn7T5mdnz0+yQRibbHuJljpEon4DcWNOvXAhpvXZ7RWxOM3aO6yF82Zl3ERAtev7V zDWKIgQdaIAlz4zv2lU4L79MOCssPXvQU9W6cUMWcceJFD94zYJm91dVas+85mwFqHDR7r QpkdkASP1u1XOv8RkKs3lxUXHMPEyNDM49a+ogONdzprCo4hV/TWLxWIbqUVUSuWJdm+4I DwRcw1AvdDsYbF8MGqIMuG2FJxLgQQoiJ6DeBMDtOBGJHZvP1myJNvjnAJbF+Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1650055608; a=rsa-sha256; cv=none; b=F3Eq/w4EZD6AUNRwriGzeyQnUPoEzKH0u4huaFzp46Joxr7O0RXV+ZVSp1MrzNs9OzH6Cq Y8pxSTjVerT4fwAd8nLMNL9AYowVuIgUPxu4v7tqNDh8w51Oi8FybPiH6uT6a178X7zAE1 cjOmZMAwAqXGB2xgFWe/hgBu9VooiySzDOOJjAo8EPXdWM7dihZ69qaxuMC8U7baeHE6mi xvvv+x2YaNm5cO2NOahFpqm8e16Y51m+fK/rr3PW5GhPpuRtRGs2B+4JjjOlD+LZ+Ntadr yChxcxuwYYGSOyYkvvfaXp7os2/ROlxPS/IPoDQjbGwt70ir+OkoUg2fUeGWZA== 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=3086efe895d5e7656c8a1a5343adf6de7c716b4d commit 3086efe895d5e7656c8a1a5343adf6de7c716b4d Author: Warner Losh AuthorDate: 2022-04-15 20:41:30 +0000 Commit: Warner Losh CommitDate: 2022-04-15 20:46:18 +0000 nvme: Remove NVME_MAX_XFER_SIZE, replace inline calculation NVME_MAX_XFER_SIZE used to be a constant (back when MAXPHYS was a constant) to denote the smaller of MAXPHYS or the largest PRP we could encode with our prealloation scheme. However, it's no longer constant since MAXPHYS varies at runtime. In addition, the actual maximum is now based on the drive's currently in use page_size, which is also a runtime expression. As such, remove the define and expand it inline in the one place its used still in the tree. Sponsored by: Netflix Reviewed by: chuck Differential Revision: https://reviews.freebsd.org/D34870 --- sys/dev/nvme/nvme.h | 3 --- sys/dev/nvme/nvme_ctrlr.c | 3 ++- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h index e120656d0050..9aefc5c47973 100644 --- a/sys/dev/nvme/nvme.h +++ b/sys/dev/nvme/nvme.h @@ -59,9 +59,6 @@ */ #define NVME_GLOBAL_NAMESPACE_TAG ((uint32_t)0xFFFFFFFF) -/* Cap transfers by the maximum addressable by page-sized PRP (4KB -> 2MB). */ -#define NVME_MAX_XFER_SIZE MIN(maxphys, (PAGE_SIZE/8*PAGE_SIZE)) - /* Host memory buffer sizes are always in 4096 byte chunks */ #define NVME_HMB_UNITS 4096 diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index d78b46d043ae..2a386269f21a 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -1454,7 +1454,8 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, device_t dev) ctrlr->enable_aborts = 0; TUNABLE_INT_FETCH("hw.nvme.enable_aborts", &ctrlr->enable_aborts); - ctrlr->max_xfer_size = NVME_MAX_XFER_SIZE; + /* Cap transfers by the maximum addressable by page-sized PRP (4KB pages -> 2MB). */ + ctrlr->max_xfer_size = MIN(maxphys, (ctrlr->page_size / 8 * ctrlr->page_size)); if (nvme_ctrlr_construct_admin_qpair(ctrlr) != 0) return (ENXIO);