From nobody Sun Feb 8 15:25:14 2026 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD8EF29E0E6 for ; Fri, 23 Jan 2026 11:31:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.24 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769167888; cv=none; b=QzZ/+vWRd1oIeVra9hJ2wtxZQjkPyoSaH8HbMUIuIFjIlZ5u7ybFBRpD9R9BlGZ7c4calt+r7uHMM2Pycwd4QLgiohk32neSurna5Om79YgDA3TWF13tIbM8/upbXIcCp/ztdAwE0aTGnpur2N/8ZxCBX7TfMNZthDcuMkiQPAc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769167888; c=relaxed/simple; bh=4qHt/xDniKwMgIY1YwmQ3xcp6PYkSm9xkRL07p9cspo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=WBU5aDYaqo3qlT1kvdckECkCb9mAfHrUXJfiKyyd/n3/MwEzF++eeTHIMykiO7xGlSaKKwafaqHoW8jYrzLKg6uQYEdqQnJVnDEm/OG8q+KFZvK3MoiSmdWrqn7GQ4eNt6HoYVy7Puh1onQhWArPWFuIQTZrOI3gINLYjyDYoUc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=rZ3jx9qw; arc=none smtp.client-ip=203.254.224.24 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="rZ3jx9qw" Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20260123113125epoutp0191b592a1dedf969caa0c02617a0b8d66~NWNFyFtB_1520115201epoutp01X for ; Fri, 23 Jan 2026 11:31:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20260123113125epoutp0191b592a1dedf969caa0c02617a0b8d66~NWNFyFtB_1520115201epoutp01X DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1769167885; bh=lcO44Gsz1PNJ0v4h4R3IOLaklgF6IhzTyQAvIp2tLAc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rZ3jx9qwiXneEuhmrXK9MU8x/+fF69hIQUqhLO+mKLTvIsPQsnifrDK4L7gTXlH7i jMPBylgky0IMYH+8peBOIj2H8yazsytKpjruRWdbFWMaTyIhXUlkcMy4v8CjtrIKdM NH3uVxskBSFh+Ud9c0KIZVfGMhW5eg2iKh3LQj8M= Received: from epsnrtp04.localdomain (unknown [182.195.42.156]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPS id 20260123113124epcas5p23161e0ff9be78f2df3b8c419cffb3938~NWNFiqJ5v1670216702epcas5p2J; Fri, 23 Jan 2026 11:31:24 +0000 (GMT) Received: from epcas5p4.samsung.com (unknown [182.195.38.89]) by epsnrtp04.localdomain (Postfix) with ESMTP id 4dyG3J1rDnz6B9m8; Fri, 23 Jan 2026 11:31:24 +0000 (GMT) Received: from epsmtip2.samsung.com (unknown [182.195.34.31]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20260123113123epcas5p1cd55b845a358fccd305e655664b4f042~NWNEaF1Rd2762827628epcas5p1e; Fri, 23 Jan 2026 11:31:23 +0000 (GMT) Received: from test-PowerEdge-R740xd.samsungds.net (unknown [107.99.41.79]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20260123113122epsmtip2fa77e7e4601f1a7c8bad555be188016d~NWNC1_Xgg2355523555epsmtip2e; Fri, 23 Jan 2026 11:31:21 +0000 (GMT) From: Neeraj Kumar To: linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev, linux-kernel@vger.kernel.org, gost.dev@samsung.com Cc: a.manzanares@samsung.com, vishak.g@samsung.com, neeraj.kernel@gmail.com, Neeraj Kumar Subject: [PATCH V6 01/18] nvdimm/label: Introduce NDD_REGION_LABELING flag to set region label Date: Fri, 23 Jan 2026 17:00:55 +0530 Message-Id: <20260123113112.3488381-2-s.neeraj@samsung.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260123113112.3488381-1-s.neeraj@samsung.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CMS-MailID: 20260123113123epcas5p1cd55b845a358fccd305e655664b4f042 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" CMS-TYPE: 105P cpgsPolicy: CPGSC10-542,Y X-CFilter-Loop: Reflected X-CMS-RootMailID: 20260123113123epcas5p1cd55b845a358fccd305e655664b4f042 References: <20260123113112.3488381-1-s.neeraj@samsung.com> Prior to LSA 2.1 version, LSA contain only namespace labels. LSA 2.1 introduced in CXL 2.0 Spec, which contain region label along with namespace label. NDD_LABELING flag is used for namespace. Introduced NDD_REGION_LABELING flag for region label. Based on these flags nvdimm driver performs operation on namespace label or region label. NDD_REGION_LABELING will be utilized by cxl driver to enable LSA 2.1 region label support Accordingly updated label index version Reviewed-by: Ira Weiny Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang Signed-off-by: Neeraj Kumar --- drivers/nvdimm/dimm.c | 1 + drivers/nvdimm/dimm_devs.c | 7 +++++++ drivers/nvdimm/label.c | 21 +++++++++++++++++---- drivers/nvdimm/nd.h | 1 + include/linux/libnvdimm.h | 3 +++ 5 files changed, 29 insertions(+), 4 deletions(-) diff --git a/drivers/nvdimm/dimm.c b/drivers/nvdimm/dimm.c index 2f6c26cc6a3e..07f5c5d5e537 100644 --- a/drivers/nvdimm/dimm.c +++ b/drivers/nvdimm/dimm.c @@ -62,6 +62,7 @@ static int nvdimm_probe(struct device *dev) if (rc < 0) dev_dbg(dev, "failed to unlock dimm: %d\n", rc); =20 + ndd->cxl =3D nvdimm_region_label_supported(ndd->dev); =20 /* * EACCES failures reading the namespace label-area-properties diff --git a/drivers/nvdimm/dimm_devs.c b/drivers/nvdimm/dimm_devs.c index e1349ef5f8fd..3363a97cc5b5 100644 --- a/drivers/nvdimm/dimm_devs.c +++ b/drivers/nvdimm/dimm_devs.c @@ -18,6 +18,13 @@ =20 static DEFINE_IDA(dimm_ida); =20 +bool nvdimm_region_label_supported(struct device *dev) +{ + struct nvdimm *nvdimm =3D to_nvdimm(dev); + + return test_bit(NDD_REGION_LABELING, &nvdimm->flags); +} + /* * Retrieve bus and dimm handle and return if this bus supports * get_config_data commands diff --git a/drivers/nvdimm/label.c b/drivers/nvdimm/label.c index 04f4a049599a..0a9b6c5cb2c3 100644 --- a/drivers/nvdimm/label.c +++ b/drivers/nvdimm/label.c @@ -688,11 +688,24 @@ static int nd_label_write_index(struct nvdimm_drvdata= *ndd, int index, u32 seq, - (unsigned long) to_namespace_index(ndd, 0); nsindex->labeloff =3D __cpu_to_le64(offset); nsindex->nslot =3D __cpu_to_le32(nslot); - nsindex->major =3D __cpu_to_le16(1); - if (sizeof_namespace_label(ndd) < 256) + + /* Set LSA Label Index Version */ + if (ndd->cxl) { + /* CXL r3.2: Table 9-9 Label Index Block Layout */ + nsindex->major =3D __cpu_to_le16(2); nsindex->minor =3D __cpu_to_le16(1); - else - nsindex->minor =3D __cpu_to_le16(2); + } else { + nsindex->major =3D __cpu_to_le16(1); + /* + * NVDIMM Namespace Specification + * Table 2: Namespace Label Index Block Fields + */ + if (sizeof_namespace_label(ndd) < 256) + nsindex->minor =3D __cpu_to_le16(1); + else /* UEFI 2.7: Label Index Block Definitions */ + nsindex->minor =3D __cpu_to_le16(2); + } + nsindex->checksum =3D __cpu_to_le64(0); if (flags & ND_NSINDEX_INIT) { unsigned long *free =3D (unsigned long *) nsindex->free; diff --git a/drivers/nvdimm/nd.h b/drivers/nvdimm/nd.h index b199eea3260e..f631bd84d6f0 100644 --- a/drivers/nvdimm/nd.h +++ b/drivers/nvdimm/nd.h @@ -522,6 +522,7 @@ void nvdimm_set_labeling(struct device *dev); void nvdimm_set_locked(struct device *dev); void nvdimm_clear_locked(struct device *dev); int nvdimm_security_setup_events(struct device *dev); +bool nvdimm_region_label_supported(struct device *dev); #if IS_ENABLED(CONFIG_NVDIMM_KEYS) int nvdimm_security_unlock(struct device *dev); #else diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h index 28f086c4a187..5696715c33bb 100644 --- a/include/linux/libnvdimm.h +++ b/include/linux/libnvdimm.h @@ -44,6 +44,9 @@ enum { /* dimm provider wants synchronous registration by __nvdimm_create() */ NDD_REGISTER_SYNC =3D 8, =20 + /* dimm supports region labels (LSA Format 2.1) */ + NDD_REGION_LABELING =3D 9, + /* need to set a limit somewhere, but yes, this is likely overkill */ ND_IOCTL_MAX_BUFLEN =3D SZ_4M, ND_CMD_MAX_ELEM =3D 5, --=20 2.34.1