aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeith Busch <keith.busch@intel.com>2017-04-04 15:32:16 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-04-12 06:41:18 -0400
commit43cfff65c989c0ef722bfcd2335b07a48e09aab9 (patch)
treee9acd44cd8016f80435ec6a8f2fa62932513dc6d
parent8d620dff40bab02f4da98c95e2fd47f445f5440a (diff)
nvme: simplify stripe quirk
[ Upstream commit e6282aef7b89a11d26e731060c4409b7aac278bf ] Some OEMs believe they own the Identify Controller vendor specific region and will repurpose it with their own values. While not common, we can't rely on the PCI VID:DID to tell use how to decode the field we reserved for this as the stripe size so we need to do something else for the list of devices using this quirk. The field was supposed to allow flexibility on the device's back-end striping, but it turned out that never materialized; the chunk is always the same as MDTS in the products subscribing to this quirk, so this patch removes the stripe_size field and sets the chunk to the max hw transfer size for the devices using this quirk. Signed-off-by: Keith Busch <keith.busch@intel.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/nvme/host/core.c17
-rw-r--r--drivers/nvme/host/nvme.h1
2 files changed, 2 insertions, 16 deletions
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index bde769b11e3b..5f2feeef8905 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1204,8 +1204,8 @@ static void nvme_set_queue_limits(struct nvme_ctrl *ctrl,
1204 blk_queue_max_hw_sectors(q, ctrl->max_hw_sectors); 1204 blk_queue_max_hw_sectors(q, ctrl->max_hw_sectors);
1205 blk_queue_max_segments(q, min_t(u32, max_segments, USHRT_MAX)); 1205 blk_queue_max_segments(q, min_t(u32, max_segments, USHRT_MAX));
1206 } 1206 }
1207 if (ctrl->stripe_size) 1207 if (ctrl->quirks & NVME_QUIRK_STRIPE_SIZE)
1208 blk_queue_chunk_sectors(q, ctrl->stripe_size >> 9); 1208 blk_queue_chunk_sectors(q, ctrl->max_hw_sectors);
1209 blk_queue_virt_boundary(q, ctrl->page_size - 1); 1209 blk_queue_virt_boundary(q, ctrl->page_size - 1);
1210 if (ctrl->vwc & NVME_CTRL_VWC_PRESENT) 1210 if (ctrl->vwc & NVME_CTRL_VWC_PRESENT)
1211 vwc = true; 1211 vwc = true;
@@ -1261,19 +1261,6 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
1261 ctrl->max_hw_sectors = 1261 ctrl->max_hw_sectors =
1262 min_not_zero(ctrl->max_hw_sectors, max_hw_sectors); 1262 min_not_zero(ctrl->max_hw_sectors, max_hw_sectors);
1263 1263
1264 if ((ctrl->quirks & NVME_QUIRK_STRIPE_SIZE) && id->vs[3]) {
1265 unsigned int max_hw_sectors;
1266
1267 ctrl->stripe_size = 1 << (id->vs[3] + page_shift);
1268 max_hw_sectors = ctrl->stripe_size >> (page_shift - 9);
1269 if (ctrl->max_hw_sectors) {
1270 ctrl->max_hw_sectors = min(max_hw_sectors,
1271 ctrl->max_hw_sectors);
1272 } else {
1273 ctrl->max_hw_sectors = max_hw_sectors;
1274 }
1275 }
1276
1277 nvme_set_queue_limits(ctrl, ctrl->admin_q); 1264 nvme_set_queue_limits(ctrl, ctrl->admin_q);
1278 ctrl->sgls = le32_to_cpu(id->sgls); 1265 ctrl->sgls = le32_to_cpu(id->sgls);
1279 ctrl->kas = le16_to_cpu(id->kas); 1266 ctrl->kas = le16_to_cpu(id->kas);
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index d47f5a5d18c7..8edafd8cb8ce 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -121,7 +121,6 @@ struct nvme_ctrl {
121 121
122 u32 page_size; 122 u32 page_size;
123 u32 max_hw_sectors; 123 u32 max_hw_sectors;
124 u32 stripe_size;
125 u16 oncs; 124 u16 oncs;
126 u16 vid; 125 u16 vid;
127 atomic_t abort_limit; 126 atomic_t abort_limit;