From 644bd3743aa8771ef7ecb7b7239308d6da2a5b35 Mon Sep 17 00:00:00 2001 Message-Id: <644bd3743aa8771ef7ecb7b7239308d6da2a5b35.1668448794.git.stefan@agner.ch> In-Reply-To: <135d886b4e5077c8fa96a5449a70d81ae9c1c3d0.1668448794.git.stefan@agner.ch> References: <135d886b4e5077c8fa96a5449a70d81ae9c1c3d0.1668448794.git.stefan@agner.ch> From: Stefan Agner Date: Thu, 23 Sep 2021 23:43:31 +0200 Subject: [PATCH] Revert "nvme: Correct the prps per page calculation method" This reverts commit 859b33c948945f7904f60a2c12a3792d356d51ad. If there is more than one PRP List the last entry is a pointer to the next list. From the NVM Express specification: "The last entry within a memory page, as indicated by the memory page size in the CC.MPS field, shall be a PRP List pointer if there is more than a single memory page of data to be transferred." For the purpose of calculating the number of pages required for PRP lists we should always assume that the last entry is required for the next PRP list. Signed-off-by: Stefan Agner Cc: Wesley Sheng --- drivers/nvme/nvme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c index 6d0d3f3ca2..73db80a294 100644 --- a/drivers/nvme/nvme.c +++ b/drivers/nvme/nvme.c @@ -52,7 +52,7 @@ 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; + u32 prps_per_page = (page_size >> 3) - 1; u32 num_pages; length -= (page_size - offset); -- 2.38.1