Signed-off-by: Christoph Hellwig <hch@xxxxxx> --- drivers/nvme/host/core.c | 10 ++++++++++ drivers/nvme/host/nvme.h | 1 + 2 files changed, 11 insertions(+) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 8a3c3e32a704..e86d07589f18 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -926,6 +926,15 @@ static void __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id) ns->pi_type = pi_type; blk_queue_logical_block_size(ns->queue, bs); + /* + * Advertisze the maximum atomic write size. Don't bother with the + * per-namespace values due to their alignment constraints. + */ + if (ns->ctrl->awupf > 1) { + blk_queue_max_atomic_write_sectors(ns->queue, + (ns->ctrl->awupf + 1) << (ns->lba_shift - 9)); + } + if (ns->ms && !blk_get_integrity(disk) && !ns->ext) nvme_init_integrity(ns); if (ns->ms && !(ns->ms == 8 && ns->pi_type) && !blk_get_integrity(disk)) @@ -1232,6 +1241,7 @@ int nvme_init_identify(struct nvme_ctrl *ctrl) ctrl->vid = le16_to_cpu(id->vid); ctrl->oncs = le16_to_cpup(&id->oncs); + ctrl->awupf = le16_to_cpu(id->awupf); atomic_set(&ctrl->abort_limit, id->acl + 1); ctrl->vwc = id->vwc; ctrl->cntlid = le16_to_cpup(&id->cntlid); diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index aead6d08ed2c..020ffd6f7863 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -143,6 +143,7 @@ struct nvme_ctrl { u32 vs; u32 sgls; u16 kas; + u16 awupf; unsigned int kato; bool subsystem; unsigned long quirks; -- 2.11.0 -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html