From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Rini Date: Wed, 9 Aug 2017 21:31:21 -0400 Subject: [U-Boot] [PATCH 7/8] nvme: Handle zero Maximum Data Transfer Size (MDTS) In-Reply-To: <1501752663-25088-8-git-send-email-bmeng.cn@gmail.com> References: <1501752663-25088-1-git-send-email-bmeng.cn@gmail.com> <1501752663-25088-8-git-send-email-bmeng.cn@gmail.com> Message-ID: <20170810013121.GE5837@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Thu, Aug 03, 2017 at 02:31:02AM -0700, Bin Meng wrote: > Maximum Data Transfer Size (MDTS) field indicates the maximum > data transfer size between the host and the controller. The > host should not submit a command that exceeds this transfer > size. The value is in units of the minimum memory page size > and is reported as a power of two (2^n). > > The spec also says: a value of 0h indicates no restrictions > on transfer size. On the real NVMe card this is normally not > 0 due to hardware restrictions, but with QEMU emulated NVMe > device it reports as 0. In nvme_blk_read/write() below we > have the following algorithm for maximum number of logic > blocks per transfer: > > u16 lbas = 1 << (dev->max_transfer_shift - ns->lba_shift); > > dev->max_transfer_shift being 0 will for sure cause lbas to > overflow. Let's use 20. With this fix, the NVMe driver works > on QEMU emulated NVMe device. > > Signed-off-by: Bin Meng Reviewed-by: Tom Rini -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: