git: bfb7c81f93b5 - main - nvmecontrol: Remove an incorrect use of PAGE_SIZE

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Wed, 18 Feb 2026 15:16:01 UTC
The branch main has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=bfb7c81f93b534f8c10928d80ea56c8177a6f39f

commit bfb7c81f93b534f8c10928d80ea56c8177a6f39f
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2026-02-18 14:20:57 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2026-02-18 15:15:41 +0000

    nvmecontrol: Remove an incorrect use of PAGE_SIZE
    
    The mdts value is in terms of the nvme page size, not the host page
    size. On many architectures these are both 4k, however on arm64 it is
    possible to build a system with the host page size of 16k.
    
    Use NVME_MPS_SHIFT to get the correct nvme page shift.
    
    Reviewed by:    imp
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D55334
---
 sbin/nvmecontrol/identify_ext.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sbin/nvmecontrol/identify_ext.c b/sbin/nvmecontrol/identify_ext.c
index 95ca4b5187d4..13b1d21ce97e 100644
--- a/sbin/nvmecontrol/identify_ext.c
+++ b/sbin/nvmecontrol/identify_ext.c
@@ -106,7 +106,7 @@ nvme_print_controller(struct nvme_controller_data *cdata)
 	if (cdata->mdts == 0)
 		printf("Unlimited\n");
 	else
-		printf("%ld bytes\n", PAGE_SIZE * (1L << cdata->mdts));
+		printf("%ld bytes\n", 1L << (cdata->mdts + NVME_MPS_SHIFT));
 	printf("Sanitize Crypto Erase:       %s\n",
 	    NVMEV(NVME_CTRLR_DATA_SANICAP_CES, cdata->sanicap) != 0 ?
 	    "Supported" : "Not Supported");