]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
nvme-pci: refresh visible attrs after being checked
authorEugen Hristev <eugen.hristev@collabora.com>
Fri, 13 Jun 2025 19:21:01 +0000 (16:21 -0300)
committerChristoph Hellwig <hch@lst.de>
Mon, 30 Jun 2025 06:42:47 +0000 (08:42 +0200)
The sysfs attributes are registered early, but the driver does not know
whether they are needed or not at that moment.

For the CMB attributes, commit e917a849c3fc ("nvme-pci: refresh visible
attrs for cmb attributes") solved this problem by
calling nvme_update_attrs after mapping the CMB.  However the issue
persists for the HMB attributes. To solve the problem, moved the call to
nvme_update_attrs after nvme_setup_host_mem, which sets up the HMB.

Fixes: e917a849c3fc ("nvme-pci: refresh visible attrs for cmb attributes")
Fixes: 86adbf0cdb9e ("nvme: simplify transport specific device attribute handling")
Signed-off-by: Eugen Hristev <eugen.hristev@collabora.com>
Signed-off-by: André Almeida <andrealmeid@igalia.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/pci.c

index 8ff12e415cb5d1529d760b33f3e0cf3b8d1555f1..320aaa41ec394cf0473a1a48b50aad1240787bab 100644 (file)
@@ -2101,8 +2101,6 @@ static void nvme_map_cmb(struct nvme_dev *dev)
        if ((dev->cmbsz & (NVME_CMBSZ_WDS | NVME_CMBSZ_RDS)) ==
                        (NVME_CMBSZ_WDS | NVME_CMBSZ_RDS))
                pci_p2pmem_publish(pdev, true);
-
-       nvme_update_attrs(dev);
 }
 
 static int nvme_set_host_mem(struct nvme_dev *dev, u32 bits)
@@ -3010,6 +3008,8 @@ static void nvme_reset_work(struct work_struct *work)
        if (result < 0)
                goto out;
 
+       nvme_update_attrs(dev);
+
        result = nvme_setup_io_queues(dev);
        if (result)
                goto out;
@@ -3343,6 +3343,8 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
        if (result < 0)
                goto out_disable;
 
+       nvme_update_attrs(dev);
+
        result = nvme_setup_io_queues(dev);
        if (result)
                goto out_disable;