Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C69CC433EF for ; Thu, 23 Sep 2021 23:21:33 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D601061214 for ; Thu, 23 Sep 2021 23:21:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D601061214 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=agner.ch Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5765F8341D; Fri, 24 Sep 2021 01:21:27 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=agner.ch Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=agner.ch header.i=@agner.ch header.b="iyuzZn8L"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6FC56833DA; Fri, 24 Sep 2021 01:21:09 +0200 (CEST) Received: from mail.kmu-office.ch (mail.kmu-office.ch [IPv6:2a02:418:6a02::a2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 10C388336B for ; Fri, 24 Sep 2021 01:21:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=agner.ch Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=stefan@agner.ch Received: from localhost.localdomain (unknown [IPv6:2a02:169:3df5:10:5c1d:e28a:f461:57d5]) by mail.kmu-office.ch (Postfix) with ESMTPSA id B72055C2B75; Fri, 24 Sep 2021 01:21:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1632439263; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=o/nhzTm68dbqeoHEe3JDHiqmro6XFH4MyRa+IcvUxVU=; b=iyuzZn8La0mimS55aNIEcZCd0UFk82kaHHn1/UmS08eX4ZTCi3UuQVoqzx5wA2iMk/NlOd 2Vk6pXgdJAedcMZkcDz4+irp/3P7uSG/2SBJ912y/yO+7FsNS09xAaQmgDYrr9ylyU+buh qMHU9ZxHxYH6owE/xXgBrYCNIL2oNTc= From: Stefan Agner To: bmeng.cn@gmail.com Cc: nsaenz@kernel.org, u-boot@lists.denx.de, mbrugger@suse.com, m.szyprowski@samsung.com, s.nawrocki@samsung.com, Stefan Agner , Wesley Sheng Subject: [RFC PATCH 1/4] Revert "nvme: Correct the prps per page calculation method" Date: Fri, 24 Sep 2021 01:20:32 +0200 Message-Id: <10aa393df8062f14fbca0faff35e05efdcfffe96.1632439220.git.stefan@agner.ch> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean 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 f6465ea7f4..1ae3001a90 100644 --- a/drivers/nvme/nvme.c +++ b/drivers/nvme/nvme.c @@ -81,7 +81,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.33.0