Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme-pci: expose active quirks in sysfs
@ 2025-10-28 14:29 Maurizio Lombardi
  2025-10-28 16:32 ` Bart Van Assche
  0 siblings, 1 reply; 10+ messages in thread
From: Maurizio Lombardi @ 2025-10-28 14:29 UTC (permalink / raw)
  To: mlombard, kbusch; +Cc: bgurney, linux-nvme

Currently, there is no straightforward way for a user to inspect
the quirks value from userspace.
Add a new read-only sysfs attribute "quirks";
reading this file will display the hexadecimal
value of the ctrl->quirks bitmask for the given NVMe device.

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
---
 drivers/nvme/host/pci.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index c916176bd9f0..de9febd32e83 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2497,6 +2497,15 @@ static ssize_t cmbsz_show(struct device *dev, struct device_attribute *attr,
 }
 static DEVICE_ATTR_RO(cmbsz);
 
+static ssize_t quirks_show(struct device *dev, struct device_attribute *attr,
+		char *buf)
+{
+	struct nvme_dev *ndev = to_nvme_dev(dev_get_drvdata(dev));
+
+	return sysfs_emit(buf, "0x%08lx\n", ndev->ctrl.quirks);
+}
+static DEVICE_ATTR_RO(quirks);
+
 static ssize_t hmb_show(struct device *dev, struct device_attribute *attr,
 			char *buf)
 {
@@ -2557,6 +2566,7 @@ static struct attribute *nvme_pci_attrs[] = {
 	&dev_attr_cmbloc.attr,
 	&dev_attr_cmbsz.attr,
 	&dev_attr_hmb.attr,
+	&dev_attr_quirks.attr,
 	NULL,
 };
 
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2025-10-30  6:58 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-28 14:29 [PATCH] nvme-pci: expose active quirks in sysfs Maurizio Lombardi
2025-10-28 16:32 ` Bart Van Assche
2025-10-28 17:00   ` Maurizio Lombardi
2025-10-29  5:47     ` Chaitanya Kulkarni
2025-10-29  8:02       ` Maurizio Lombardi
2025-10-29 23:25         ` Chaitanya Kulkarni
2025-10-30  6:18           ` Maurizio Lombardi
2025-10-30  6:46             ` Chaitanya Kulkarni
2025-10-30  6:55               ` Maurizio Lombardi
2025-10-30  6:57                 ` Maurizio Lombardi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox