aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorMatthew Wilcox <matthew.r.wilcox@intel.com>2012-01-06 15:42:45 -0500
committerMatthew Wilcox <matthew.r.wilcox@intel.com>2012-01-10 14:54:05 -0500
commit497421880acecd0281d3182d534f3d28c927caec (patch)
tree06efff97926506f1797e551b5a35506b28636188 /drivers/block
parentff976d724a74e4522e9ca2de1fb37ac4520f454f (diff)
NVMe: Fix DMA mapping for admin commands
We were always mapping as DMA_FROM_DEVICE then unmapping with DMA_TO_DEVICE which was clearly not correct. Follow the same pattern as nvme_submit_io() and key off the bottom bit of the opcode to determine whether this is a read or a write. Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/nvme.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/block/nvme.c b/drivers/block/nvme.c
index 1cc01872f6dc..3f8cae9dc960 100644
--- a/drivers/block/nvme.c
+++ b/drivers/block/nvme.c
@@ -1165,7 +1165,8 @@ static int nvme_user_admin_cmd(struct nvme_ns *ns,
1165 1165
1166 length = cmd.data_len; 1166 length = cmd.data_len;
1167 if (cmd.data_len) { 1167 if (cmd.data_len) {
1168 iod = nvme_map_user_pages(dev, 1, cmd.addr, length); 1168 iod = nvme_map_user_pages(dev, cmd.opcode & 1, cmd.addr,
1169 length);
1169 if (IS_ERR(iod)) 1170 if (IS_ERR(iod))
1170 return PTR_ERR(iod); 1171 return PTR_ERR(iod);
1171 length = nvme_setup_prps(dev, &c.common, iod, length, 1172 length = nvme_setup_prps(dev, &c.common, iod, length,
@@ -1178,7 +1179,8 @@ static int nvme_user_admin_cmd(struct nvme_ns *ns,
1178 status = nvme_submit_admin_cmd(dev, &c, NULL); 1179 status = nvme_submit_admin_cmd(dev, &c, NULL);
1179 1180
1180 if (cmd.data_len) { 1181 if (cmd.data_len) {
1181 nvme_unmap_user_pages(dev, 0, cmd.addr, cmd.data_len, iod); 1182 nvme_unmap_user_pages(dev, cmd.opcode & 1, cmd.addr,
1183 cmd.data_len, iod);
1182 nvme_free_iod(dev, iod); 1184 nvme_free_iod(dev, iod);
1183 } 1185 }
1184 return status; 1186 return status;