aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/nvme.c
diff options
context:
space:
mode:
authorMatthew Wilcox <matthew.r.wilcox@intel.com>2012-01-11 09:29:56 -0500
committerMatthew Wilcox <matthew.r.wilcox@intel.com>2012-01-11 09:22:24 -0500
commitdf3481399042200792822b6243e36a95a557b57e (patch)
tree0d59f0f5dedb37abb0c988889976c0616a8a90e5 /drivers/block/nvme.c
parent366e8217e5ec6ce9f73aec19c46d983110fb4a98 (diff)
NVMe: Set number of queues correctly
The number of submission & completion queues should be set by calling Set Features, not Get Features. Reported-by: Kwok Kong <Kwok.Kong@idt.com> Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
Diffstat (limited to 'drivers/block/nvme.c')
-rw-r--r--drivers/block/nvme.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/block/nvme.c b/drivers/block/nvme.c
index 28c84b18712d..f4996b0e4b1a 100644
--- a/drivers/block/nvme.c
+++ b/drivers/block/nvme.c
@@ -840,7 +840,7 @@ static int nvme_identify(struct nvme_dev *dev, unsigned nsid, unsigned cns,
840} 840}
841 841
842static int nvme_get_features(struct nvme_dev *dev, unsigned fid, 842static int nvme_get_features(struct nvme_dev *dev, unsigned fid,
843 unsigned dword11, dma_addr_t dma_addr, u32 *result) 843 unsigned dword11, dma_addr_t dma_addr)
844{ 844{
845 struct nvme_command c; 845 struct nvme_command c;
846 846
@@ -850,6 +850,20 @@ static int nvme_get_features(struct nvme_dev *dev, unsigned fid,
850 c.features.fid = cpu_to_le32(fid); 850 c.features.fid = cpu_to_le32(fid);
851 c.features.dword11 = cpu_to_le32(dword11); 851 c.features.dword11 = cpu_to_le32(dword11);
852 852
853 return nvme_submit_admin_cmd(dev, &c, NULL);
854}
855
856static int nvme_set_features(struct nvme_dev *dev, unsigned fid,
857 unsigned dword11, dma_addr_t dma_addr, u32 *result)
858{
859 struct nvme_command c;
860
861 memset(&c, 0, sizeof(c));
862 c.features.opcode = nvme_admin_set_features;
863 c.features.prp1 = cpu_to_le64(dma_addr);
864 c.features.fid = cpu_to_le32(fid);
865 c.features.dword11 = cpu_to_le32(dword11);
866
853 return nvme_submit_admin_cmd(dev, &c, result); 867 return nvme_submit_admin_cmd(dev, &c, result);
854} 868}
855 869
@@ -1365,7 +1379,7 @@ static int set_queue_count(struct nvme_dev *dev, int count)
1365 u32 result; 1379 u32 result;
1366 u32 q_count = (count - 1) | ((count - 1) << 16); 1380 u32 q_count = (count - 1) | ((count - 1) << 16);
1367 1381
1368 status = nvme_get_features(dev, NVME_FEAT_NUM_QUEUES, q_count, 0, 1382 status = nvme_set_features(dev, NVME_FEAT_NUM_QUEUES, q_count, 0,
1369 &result); 1383 &result);
1370 if (status) 1384 if (status)
1371 return -EIO; 1385 return -EIO;
@@ -1482,7 +1496,7 @@ static int __devinit nvme_dev_add(struct nvme_dev *dev)
1482 continue; 1496 continue;
1483 1497
1484 res = nvme_get_features(dev, NVME_FEAT_LBA_RANGE, i, 1498 res = nvme_get_features(dev, NVME_FEAT_LBA_RANGE, i,
1485 dma_addr + 4096, NULL); 1499 dma_addr + 4096);
1486 if (res) 1500 if (res)
1487 continue; 1501 continue;
1488 1502