Skip to content

Commit 3f30a79

Browse files
author
Christoph Hellwig
committed
nvme-pci: set constant paramters in nvme_pci_alloc_ctrl
Move setting of low-level constant parameters from nvme_reset_work to nvme_pci_alloc_ctrl. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Keith Busch <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Reviewed-by: Chaitanya Kulkarni <[email protected]> Tested-by Gerd Bayer <[email protected]>
1 parent 2e87570 commit 3f30a79

File tree

1 file changed

+17
-21
lines changed

1 file changed

+17
-21
lines changed

drivers/nvme/host/pci.c

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2841,21 +2841,6 @@ static void nvme_reset_work(struct work_struct *work)
28412841
nvme_start_admin_queue(&dev->ctrl);
28422842
}
28432843

2844-
dma_set_min_align_mask(dev->dev, NVME_CTRL_PAGE_SIZE - 1);
2845-
2846-
/*
2847-
* Limit the max command size to prevent iod->sg allocations going
2848-
* over a single page.
2849-
*/
2850-
dev->ctrl.max_hw_sectors = min_t(u32,
2851-
NVME_MAX_KB_SZ << 1, dma_max_mapping_size(dev->dev) >> 9);
2852-
dev->ctrl.max_segments = NVME_MAX_SEGS;
2853-
2854-
/*
2855-
* Don't limit the IOMMU merged segment size.
2856-
*/
2857-
dma_set_max_seg_size(dev->dev, 0xffffffff);
2858-
28592844
mutex_unlock(&dev->shutdown_lock);
28602845

28612846
/*
@@ -2869,12 +2854,6 @@ static void nvme_reset_work(struct work_struct *work)
28692854
goto out;
28702855
}
28712856

2872-
/*
2873-
* We do not support an SGL for metadata (yet), so we are limited to a
2874-
* single integrity segment for the separate metadata pointer.
2875-
*/
2876-
dev->ctrl.max_integrity_segments = 1;
2877-
28782857
result = nvme_init_ctrl_finish(&dev->ctrl, was_suspend);
28792858
if (result)
28802859
goto out;
@@ -3133,6 +3112,23 @@ static struct nvme_dev *nvme_pci_alloc_dev(struct pci_dev *pdev,
31333112
quirks);
31343113
if (ret)
31353114
goto out_put_device;
3115+
3116+
dma_set_min_align_mask(&pdev->dev, NVME_CTRL_PAGE_SIZE - 1);
3117+
dma_set_max_seg_size(&pdev->dev, 0xffffffff);
3118+
3119+
/*
3120+
* Limit the max command size to prevent iod->sg allocations going
3121+
* over a single page.
3122+
*/
3123+
dev->ctrl.max_hw_sectors = min_t(u32,
3124+
NVME_MAX_KB_SZ << 1, dma_max_mapping_size(&pdev->dev) >> 9);
3125+
dev->ctrl.max_segments = NVME_MAX_SEGS;
3126+
3127+
/*
3128+
* There is no support for SGLs for metadata (yet), so we are limited to
3129+
* a single integrity segment for the separate metadata pointer.
3130+
*/
3131+
dev->ctrl.max_integrity_segments = 1;
31363132
return dev;
31373133

31383134
out_put_device:

0 commit comments

Comments
 (0)