diff options
author | Christoph Hellwig <hch@lst.de> | 2022-11-13 12:05:58 +0100 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2022-11-16 08:36:31 +0100 |
commit | acb71e53bb47a08731aa77497cd3f1871cba59c3 (patch) | |
tree | f78b5fba5bd6f8dd899303e4ae7617eb2a671fe1 /drivers/nvme | |
parent | 65a54646420e1409760c2b9f0e1a5e5feca1364e (diff) | |
download | linux-stable-acb71e53bb47a08731aa77497cd3f1871cba59c3.tar.gz linux-stable-acb71e53bb47a08731aa77497cd3f1871cba59c3.tar.bz2 linux-stable-acb71e53bb47a08731aa77497cd3f1871cba59c3.zip |
nvme-pci: move the HMPRE check into nvme_setup_host_mem
Check that a HMB is wanted into the allocation helper instead of the
caller. This makes life simpler for an upcoming second caller.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Diffstat (limited to 'drivers/nvme')
-rw-r--r-- | drivers/nvme/host/pci.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 4da339690ec6..57fb88396fd8 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -2102,6 +2102,9 @@ static int nvme_setup_host_mem(struct nvme_dev *dev) u32 enable_bits = NVME_HOST_MEM_ENABLE; int ret; + if (!dev->ctrl.hmpre) + return 0; + preferred = min(preferred, max); if (min > max) { dev_warn(dev->ctrl.device, @@ -2862,11 +2865,9 @@ static void nvme_reset_work(struct work_struct *work) nvme_dbbuf_dma_alloc(dev); - if (dev->ctrl.hmpre) { - result = nvme_setup_host_mem(dev); - if (result < 0) - goto out; - } + result = nvme_setup_host_mem(dev); + if (result < 0) + goto out; result = nvme_setup_io_queues(dev); if (result) |