Hi Aaron, On Fri, Aug 23, 2019 at 2:05 AM Aaron Williams <[email protected]> wrote: > > When large writes take place I saw a Samsung EVO 970+ return a status > value of 0x13, PRP Offset Invalid. I tracked this down to the > improper handling of PRP entries. The blocks the PRP entries are > placed in cannot cross a page boundary and thus should be allocated > on page boundaries. This is how the Linux kernel driver works. > > With this patch, the PRP pool is allocated on a page boundary and > other than the very first allocation, the pool size is a multiple of > the page size. Each page can hold (4096 / 8) - 1 entries since the > last entry must point to the next page in the pool. > > Signed-off-by: Aaron Williams <[email protected]> > Reviewed-by: Bin Meng <[email protected]> > --- > drivers/nvme/nvme.c | 28 ++++++++++++++++++---------- > 1 file changed, 18 insertions(+), 10 deletions(-) > > diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c > index d4965e2ef6..bc4cf40b40 100644 > --- a/drivers/nvme/nvme.c > +++ b/drivers/nvme/nvme.c > @@ -73,6 +73,9 @@ static int nvme_setup_prps(struct nvme_dev *dev, u64 *prp2, > u64 *prp_pool; > int length = total_len; > int i, nprps; > + u32 prps_per_page = (page_size >> 3) - 1; > + u32 num_pages; > + > length -= (page_size - offset); > > if (length <= 0) { > @@ -89,15 +92,19 @@ static int nvme_setup_prps(struct nvme_dev *dev, u64 > *prp2, > } > > nprps = DIV_ROUND_UP(length, page_size); > + num_pages = DIV_ROUND_UP(nprps, prps_per_page); > > if (nprps > dev->prp_entry_num) { > free(dev->prp_pool); > - dev->prp_pool = malloc(nprps << 3); > + /* Always increase in increments of pages. It doesn't waste
It seems you forgot the address this multi-line comment format issue. Please resend the patch. thanks! > + * much memory and reduces the number of allocations. > + */ [snip] Regards, Bin _______________________________________________ U-Boot mailing list [email protected] https://lists.denx.de/listinfo/u-boot

