diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2016-04-14 06:10:50 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2016-04-14 06:10:50 +0000 |
commit | 3f2c4fdcf79b4fc12ee25a5f0d632511055f5f06 (patch) | |
tree | ccebe48a19ec2d132cc045e3669534db2a5c204f | |
parent | 6f9e8c4f783b9a66a85ae28d0700d5d58c3d0891 (diff) |
dont attach if the min nvme page size is bigger than the cpu page size
nvme and the host cpu need to agree on the page size because its
the implicit size of the elements in the chips scatter gather lists.
if the min nvme size is greater than the cpus page size then we
cant guarantee that io buffers are contig for nvme pages.
nvme 1.1 provides an alternative sgl mechanism, so if this really
becomes a problem in the future we can fix it on 1.1 and later
devices.
-rw-r--r-- | sys/dev/ic/nvme.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/dev/ic/nvme.c b/sys/dev/ic/nvme.c index a66f6341e86..184c3cbb5ab 100644 --- a/sys/dev/ic/nvme.c +++ b/sys/dev/ic/nvme.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nvme.c,v 1.38 2016/04/14 06:06:46 dlg Exp $ */ +/* $OpenBSD: nvme.c,v 1.39 2016/04/14 06:10:49 dlg Exp $ */ /* * Copyright (c) 2014 David Gwynne <dlg@openbsd.org> @@ -306,9 +306,13 @@ nvme_attach(struct nvme_softc *sc) cap = nvme_read8(sc, NVME_CAP); dstrd = NVME_CAP_DSTRD(cap); - if (NVME_CAP_MPSMIN(cap) > mps) - mps = NVME_CAP_MPSMIN(cap); - else if (NVME_CAP_MPSMAX(cap) < mps) + if (NVME_CAP_MPSMIN(cap) > PAGE_SHIFT) { + printf("%s: NVMe minimum page size %u " + "is greater than CPU page size %u\n", DEVNAME(sc), + 1 << NVME_CAP_MPSMIN(cap), 1 << PAGE_SHIFT); + return (1); + } + if (NVME_CAP_MPSMAX(cap) < mps) mps = NVME_CAP_MPSMAX(cap); sc->sc_rdy_to = NVME_CAP_TO(cap); |