From patchwork Tue Jun 22 13:16:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1495670 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=ItWGzMe/; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G8RkQ4Z2Hz9sT6 for ; Tue, 22 Jun 2021 23:16:46 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 07D17828EB; Tue, 22 Jun 2021 15:16:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ItWGzMe/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 14B02829A6; Tue, 22 Jun 2021 15:16:38 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E5B4E80F32 for ; Tue, 22 Jun 2021 15:16:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pj1-x1033.google.com with SMTP id t19-20020a17090ae513b029016f66a73701so1716763pjy.3 for ; Tue, 22 Jun 2021 06:16:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=EDA1JqJT7F/a2MUq/6cWJNXGDp5vuDnCfyk8LD4quy0=; b=ItWGzMe/1l2UPyAEgaz8h+CWlb9v5bFv7QTlX0adJP9FzJJMivLLZIj+vs82GHSoU/ pVIwTDjzUNBQzOc+bcRF19MYoo+l+G5gkb/QG6W26bHJ1n/z+jRQ4aJpAgUnoeveLSKI rGv4YXFQRzHtL37X0vhuKlShLLj+UZHdUskfTFNHAnO/3kbPutVrQPSXHn7XI+oubWZG u1HfF5nxOOAqXp/oDL1fqnH7LpV8a/7NCp0V9KwL0LN8UmsUO/lDlwbFdg9SmpU3dX4k jCF/WBNLv0nT/xwX4rEdZJT3J39LFzfm7WWpsmf3HQMn/n/eQ95eSzC6mth618HxKeaI OJBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=EDA1JqJT7F/a2MUq/6cWJNXGDp5vuDnCfyk8LD4quy0=; b=GK1uLcBItdA1ydNTR6yfAE7wWlTvi4fuCo+1HHhM4xnyRVjJ0H5QUh3cRC+ZKhdlvJ z+u6Ml2/hPJca2BZgZlOAh4HOgFU3zu/0eNXoDxfjOwWsC4SEZ8z1qvu+Y/jNKww1EA1 UsEdcxEFAQPBXfiFvnEVUPrtjIobv+LpyAgsaQjn2bl8Po33b5umK7iMNhx9Mjc5F9sC 3Y2czqPdBDfa7dDNFV90FcvoQANfOJK6gXoVieyM5W+hbBa+2rN9O1kQNZy2+heOC3Da hJ0WM1qy+kS3bpkWMJtaK30S3dacymb+GLA8orIfNq9dUR4MoFm0MuMWbfLQuB+vPutX u9zQ== X-Gm-Message-State: AOAM530H9nUAaxsefw2nh4xKNb1Q3YtSi2OK6N6xiS2SXvSu3ow4T6cw KGfTMe8DEkTJ8feDVby6QM0= X-Google-Smtp-Source: ABdhPJw4W5yOIEBCbisPDeDAuARHUfQp0b2nfIrrWJccTRJydjqKMQO7jC498+8S16qAEyUj2Ffmmg== X-Received: by 2002:a17:902:eac2:b029:107:b14c:423d with SMTP id p2-20020a170902eac2b0290107b14c423dmr7766532pld.77.1624367791071; Tue, 22 Jun 2021 06:16:31 -0700 (PDT) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id j24sm18456482pfe.58.2021.06.22.06.16.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jun 2021 06:16:30 -0700 (PDT) From: Bin Meng To: Tom Rini , u-boot@lists.denx.de Cc: Bin Meng Subject: [PATCH v2 1/7] nvme: Move block dev creation from uclass post_probe() to driver probe() Date: Tue, 22 Jun 2021 21:16:17 +0800 Message-Id: <20210622131623.21265-1-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 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 At present the block device creation happens in the NVMe uclass driver post_probe() phase. In preparation to support multiple namespaces, we should issue namespace identify before creating block devices but that touches the underlying hardware hence it is not appropriate to do such in the uclass driver post_probe(). Let's move it to driver probe() phase instead. Signed-off-by: Bin Meng --- Changes in v2: - drop the nvme per-child platdata change drivers/nvme/nvme-uclass.c | 30 ------------------------------ drivers/nvme/nvme.c | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 30 deletions(-) diff --git a/drivers/nvme/nvme-uclass.c b/drivers/nvme/nvme-uclass.c index 277e31e1f3..610166d76e 100644 --- a/drivers/nvme/nvme-uclass.c +++ b/drivers/nvme/nvme-uclass.c @@ -5,39 +5,9 @@ */ #include -#include -#include #include -#include -#include "nvme.h" - -static int nvme_uclass_post_probe(struct udevice *udev) -{ - char name[20]; - struct udevice *ns_udev; - int i, ret; - struct nvme_dev *ndev = dev_get_priv(udev); - - /* Create a blk device for each namespace */ - for (i = 0; i < ndev->nn; i++) { - /* - * Encode the namespace id to the device name so that - * we can extract it when doing the probe. - */ - sprintf(name, "blk#%d", i); - - /* The real blksz and size will be set by nvme_blk_probe() */ - ret = blk_create_devicef(udev, "nvme-blk", name, IF_TYPE_NVME, - -1, 512, 0, &ns_udev); - if (ret) - return ret; - } - - return 0; -} UCLASS_DRIVER(nvme) = { .name = "nvme", .id = UCLASS_NVME, - .post_probe = nvme_uclass_post_probe, }; diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c index c61dab20c5..29735a6ad8 100644 --- a/drivers/nvme/nvme.c +++ b/drivers/nvme/nvme.c @@ -879,6 +879,24 @@ static int nvme_probe(struct udevice *udev) nvme_get_info_from_identify(ndev); + /* Create a blk device for each namespace */ + for (int i = 0; i < ndev->nn; i++) { + struct udevice *ns_udev; + char name[20]; + + /* + * Encode the namespace id to the device name so that + * we can extract it when doing the probe. + */ + sprintf(name, "blk#%d", i); + + /* The real blksz and size will be set by nvme_blk_probe() */ + ret = blk_create_devicef(udev, "nvme-blk", name, IF_TYPE_NVME, + -1, 512, 0, &ns_udev); + if (ret) + goto free_queue; + } + return 0; free_queue: From patchwork Tue Jun 22 13:16:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1495671 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=Zv+Gif56; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G8Rkd47gbz9sS8 for ; Tue, 22 Jun 2021 23:16:57 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1BC49829BE; Tue, 22 Jun 2021 15:16:46 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Zv+Gif56"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D5EE9829A6; Tue, 22 Jun 2021 15:16:39 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5B466828EB for ; Tue, 22 Jun 2021 15:16:36 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pf1-x433.google.com with SMTP id p13so16435366pfw.0 for ; Tue, 22 Jun 2021 06:16:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fRHIjOMv6Oj4xPxRxniZDJiwL2VeSe40CXnRiNImuW4=; b=Zv+Gif56SwTeIOwEH4IuucMF5ch/Qi/mnZbUeC+k7sTOzDpZajvp272484bLtTJxhY VHJy+2eF1Q6+1cBrZ6cNiaDShZ59Q8YvmrdYKfVULqBBNkIdO9cqAYxFEi3vju8ZqSHY n8sH5YsEWv3z9L6ZpJn5TBslNQgI5NWVu/ZWEE44b3kQGr5oJH62adVLyzZqAhgagDOB kNZfFsBiw2l4981bA1NXO+4RzNAi8tduXpiGL4q5Q3HMHwb9eYCjKfmzYB+bhgTc7OjD NEr9oEWLi/sf2tPSyJXaHwsG3sjs5HWefhEI2DsVV9QB59xY/6hkgSFo/MlaVMH25Kpy agRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fRHIjOMv6Oj4xPxRxniZDJiwL2VeSe40CXnRiNImuW4=; b=MEjr327Tg3GpJtsI73JFJGAU54iRpPDcZpcq+aKzWPDlyfJ/MUMRvnLNww/RsyOm8x 7LPGaIIUmvmBtRaU/c9BDRfnOPrn0eFAv7211b/v4NeqYuAfSMFnUKSEhMmdc5jn8QRn EXLBLw6u8UlTPAWDJgchqqSQO0p852V8GFRfQ0SXyE6HXGNJ/umYpE2SqAvM4oL9UadG ffS5nF7LZegI5FP095YRYE2BiayxM8MLFOuoxUPKOTtCGyMnemretxw7Ujg3ojBZL0OV uja0CNI2/obmzaV9DPHM4gN8pCxJSsxpqSuuvUlV70rD2l8cAYNmhYz8sxtreBtQxPOB IDfA== X-Gm-Message-State: AOAM5303k30p5ofIs7ibmkNf3Dz9eRuDehXc5r4lejhfKuxr/vgP/3h6 bYtAd890lkDX3QHOLSlLf28= X-Google-Smtp-Source: ABdhPJy4Xcm8Efr8DNhuJj6jKJAolUq6kzLtikRPivufTKL+9Chn4HrPpROze7u5CJqolzQuNa8hpQ== X-Received: by 2002:a62:3344:0:b029:24c:735c:4546 with SMTP id z65-20020a6233440000b029024c735c4546mr3711663pfz.1.1624367794785; Tue, 22 Jun 2021 06:16:34 -0700 (PDT) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id j24sm18456482pfe.58.2021.06.22.06.16.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jun 2021 06:16:33 -0700 (PDT) From: Bin Meng To: Tom Rini , u-boot@lists.denx.de Cc: Bin Meng , Heinrich Schuchardt Subject: [PATCH v2 2/7] nvme: Skip block device creation for inactive namespaces Date: Tue, 22 Jun 2021 21:16:18 +0800 Message-Id: <20210622131623.21265-2-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210622131623.21265-1-bmeng.cn@gmail.com> References: <20210622131623.21265-1-bmeng.cn@gmail.com> MIME-Version: 1.0 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 At present for each namespace there is a block device created for it. There is no issue if the number of supported namespaces reported from the NVMe device is only 1. Since QEMU commit 7f0f1acedf15 ("hw/block/nvme: support multiple namespaces"), the number of supported namespaces reported has been changed from 1 to 256, but not all of them are active namespaces. The actual active one depends on the QEMU command line parameters. A common case is that namespace 1 being active and all other 255 being inactive. If a namespace is inactive, the namespace identify command returns a zero filled data structure. We can use field NSZE (namespace size) to decide whether a block device should be created for it. Reported-by: Heinrich Schuchardt Signed-off-by: Bin Meng --- (no changes since v1) drivers/nvme/nvme.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c index 29735a6ad8..bb24c9cdd3 100644 --- a/drivers/nvme/nvme.c +++ b/drivers/nvme/nvme.c @@ -835,6 +835,7 @@ static int nvme_probe(struct udevice *udev) { int ret; struct nvme_dev *ndev = dev_get_priv(udev); + struct nvme_id_ns *id; ndev->instance = trailing_strtol(udev->name); @@ -880,10 +881,27 @@ static int nvme_probe(struct udevice *udev) nvme_get_info_from_identify(ndev); /* Create a blk device for each namespace */ + + id = memalign(ndev->page_size, sizeof(struct nvme_id_ns)); + if (!id) { + ret = -ENOMEM; + goto free_queue; + } + for (int i = 0; i < ndev->nn; i++) { struct udevice *ns_udev; char name[20]; + memset(id, 0, sizeof(*id)); + if (nvme_identify(ndev, i + 1, 0, (dma_addr_t)(long)id)) { + ret = -EIO; + goto free_id; + } + + /* skip inactive namespace */ + if (!id->nsze) + continue; + /* * Encode the namespace id to the device name so that * we can extract it when doing the probe. @@ -894,11 +912,14 @@ static int nvme_probe(struct udevice *udev) ret = blk_create_devicef(udev, "nvme-blk", name, IF_TYPE_NVME, -1, 512, 0, &ns_udev); if (ret) - goto free_queue; + goto free_id; } + free(id); return 0; +free_id: + free(id); free_queue: free((void *)ndev->queues); free_nvme: From patchwork Tue Jun 22 13:16:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1495672 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=vAcf9CyH; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G8Rkr31XMz9sT6 for ; Tue, 22 Jun 2021 23:17:08 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2C94F829C7; Tue, 22 Jun 2021 15:16:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="vAcf9CyH"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BFE79829BE; Tue, 22 Jun 2021 15:16:42 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id BF16C80F32 for ; Tue, 22 Jun 2021 15:16:38 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pj1-x102f.google.com with SMTP id t19-20020a17090ae513b029016f66a73701so1716926pjy.3 for ; Tue, 22 Jun 2021 06:16:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Na9ybL3tob7Jd7ptzEIvsGhJv2yN6/Ogm+FhSPkaFcw=; b=vAcf9CyH3w5voJwSJvwDugzyN4xtlrcvUJqHLqJxLxHhZ2FHz2+FE6/tRsiwyRqd1b HcXhTCIo7iO48k9P9yxvj60UhNNFaO/319rnaBMJuWar3Jq7yHy+tbXjjjuqP0ZKUlmF J1puJiwlLfzzlC/Iqc4Yoo3PhWb4W6z/7xQ7sgdC2j2XBlp6ICFCLpGzMwlmGTUN2KWA 2yZEarRW6sgW2d5Ixv8c66+PJpE9Zq6+KGpNsSj4Wve7iMmDT+dYa+M3iiTULyMPtjX+ uN93rRQ4E8xtJDKWZDdtPfL44SAZD3zG3SUN5wc4nASoi59MtYgdJhjFmhqR3z2MZ/jK QpZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Na9ybL3tob7Jd7ptzEIvsGhJv2yN6/Ogm+FhSPkaFcw=; b=tVL9VDO9Ln5wYBn8NqqGoWBqohr1tlA8QFAUNkXtDPHZVzuJaSw5kL67ip8BYR0fxo 8EIGJ7urHbrn/d0OLkM4WsDWtGEmB8EIQaL3MJWRPEPLFSRNDf3QQSbulAAGI6vEz3Wu v5yjNKqJC8q9SQWKCKjYmA1V/q6xCQk5NLn/vpKmL9xmkuCEXO4CJzsAa67+Yhf/6pcW lVgiBrXoieYBAgCiQf3Gzv/rUkghOfYvuGp7FtEbqz/IuBz/YI5NFsZZ1XVVCg16hpmH BmlPBVvgNRtZ82Gx3/fjYNyqt8KB2YHBa2emIpYhr5qPu9zPbfAJwRJFhXHRNMl50FwD eC9A== X-Gm-Message-State: AOAM532bpeo+Dy39jQWSaveOhwQYfJTbMxD6WAn5Fcwk+MH3abssBvP4 EKIe4Dmlys+BKkd8XYoeXuw= X-Google-Smtp-Source: ABdhPJw4eDVEQBarGUwPsJVH6LIx3pM0wf2e8/hRxlmZ0IZjGqTL3g0k008ZKqyoql08G92gMycLXA== X-Received: by 2002:a17:902:7085:b029:114:eb3f:fe29 with SMTP id z5-20020a1709027085b0290114eb3ffe29mr23022265plk.40.1624367797265; Tue, 22 Jun 2021 06:16:37 -0700 (PDT) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id j24sm18456482pfe.58.2021.06.22.06.16.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jun 2021 06:16:36 -0700 (PDT) From: Bin Meng To: Tom Rini , u-boot@lists.denx.de Cc: Bin Meng , Heinrich Schuchardt Subject: [PATCH v2 3/7] nvme: Eliminate the offset of one during block dev creation Date: Tue, 22 Jun 2021 21:16:19 +0800 Message-Id: <20210622131623.21265-3-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210622131623.21265-1-bmeng.cn@gmail.com> References: <20210622131623.21265-1-bmeng.cn@gmail.com> MIME-Version: 1.0 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 At present there is an offset of one added during the creation of block device. This can be very confusing as we wanted to encode the namespace id in the block device name but namespae id cannot be zero. This changes to use the namespace id directly in the block device name, eliminating the offset of one effectively. Suggested-by: Heinrich Schuchardt Signed-off-by: Bin Meng --- Changes in v2: - new patch: Eliminate the offset of one during block dev creation drivers/nvme/nvme.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c index bb24c9cdd3..97c665d6a3 100644 --- a/drivers/nvme/nvme.c +++ b/drivers/nvme/nvme.c @@ -709,7 +709,7 @@ static int nvme_blk_probe(struct udevice *udev) memset(ns, 0, sizeof(*ns)); ns->dev = ndev; /* extract the namespace id from the block device name */ - ns->ns_id = trailing_strtol(udev->name) + 1; + ns->ns_id = trailing_strtol(udev->name); if (nvme_identify(ndev, ns->ns_id, 0, (dma_addr_t)(long)id)) { free(id); return -EIO; @@ -888,12 +888,12 @@ static int nvme_probe(struct udevice *udev) goto free_queue; } - for (int i = 0; i < ndev->nn; i++) { + for (int i = 1; i <= ndev->nn; i++) { struct udevice *ns_udev; char name[20]; memset(id, 0, sizeof(*id)); - if (nvme_identify(ndev, i + 1, 0, (dma_addr_t)(long)id)) { + if (nvme_identify(ndev, i, 0, (dma_addr_t)(long)id)) { ret = -EIO; goto free_id; } From patchwork Tue Jun 22 13:16:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1495674 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=De+5X3bu; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G8RlH0KtXz9sS8 for ; Tue, 22 Jun 2021 23:17:30 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EED3D829D5; Tue, 22 Jun 2021 15:16:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="De+5X3bu"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A120E829C8; Tue, 22 Jun 2021 15:16:47 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id F154C829B9 for ; Tue, 22 Jun 2021 15:16:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pl1-x633.google.com with SMTP id m17so7241625plx.7 for ; Tue, 22 Jun 2021 06:16:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rnCGiX86oUOVR4Sn2iiF0xVKIW+oWH/1g/nd/gvrDpI=; b=De+5X3buD+UofXH4t8ngDXm3y73UMIWCJCTejqW+QSqfZS8L9B/iGjGWnoMbMckF2f 7xQ/7RWzbhAx2Sv2qro/wE2o5e25V2F/E0t8UuOiEmtDEyslhXK+QMvGt0tRnZu5rFOh XvvdDujYbTdeRpm4xDHOo2CP0V0FWw8ojseWPCKGda7O61dcl/2tcP3QpUbLF8RlPA/A Am3DyW5OC7w7cErspAGDJn/X3cBTaEGQrd5Fxx6iOrYpufjlBSiIAg/tMTI0JkoS4K2Q 1WfU28tM2FkEPNq978QnSAylhC6GibQkeU8Rx+iKoh+bONMNHmueSPxkLsZXFpTIPmc6 90AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rnCGiX86oUOVR4Sn2iiF0xVKIW+oWH/1g/nd/gvrDpI=; b=IJSuywU7j8WXb1XVJdc+0qM5xtSycDvf6gnx0LTuY2AubKaGoVcFeVdux+qmh5Ojz9 PpVAMEBRHAFc7Fy0cr4i2bOAQnRv614MumLfBbNYTvtDvTi1FMuO/rj6miCAuW+VbpJ4 j2dE/U7OH8gOH/GSMgfXoegFLUMiEhDhWog5a2GypwB50qvUKNmNf+7FgWJEV+r0OYcC j+/0/CGkXVE2xPCvSkL1lRaZ1U2jV+KG+DDlYvXI8+BJ3WbSRkF9yCraw5i96vYxKhxj Yk9JpMh3zC60A4ayFxGW4CMmAP7KYX3Sb0BDTaRj9Sua4Q82qxz5am0fjJHkleL/iUpC 87SQ== X-Gm-Message-State: AOAM5328wVTiRXgXzK8sZjQQaKerYcsSDnEwEOWRl82RA9Hu1KGBPpE0 24W6Olxus7u4fbTFFt1nNhuvDFg4FQI= X-Google-Smtp-Source: ABdhPJzWH43jZWL9L5siR6q1G61u/zAeNQfYl2bQuahXEK5jlt6TxQhAIHjwn5iDKm5zAwaJS/A7gw== X-Received: by 2002:a17:90a:c791:: with SMTP id gn17mr3761012pjb.221.1624367799530; Tue, 22 Jun 2021 06:16:39 -0700 (PDT) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id j24sm18456482pfe.58.2021.06.22.06.16.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jun 2021 06:16:39 -0700 (PDT) From: Bin Meng To: Tom Rini , u-boot@lists.denx.de Cc: Bin Meng Subject: [PATCH v2 4/7] nvme: Drop useless members of 'struct nvme_ns' Date: Tue, 22 Jun 2021 21:16:20 +0800 Message-Id: <20210622131623.21265-4-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210622131623.21265-1-bmeng.cn@gmail.com> References: <20210622131623.21265-1-bmeng.cn@gmail.com> MIME-Version: 1.0 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 mode_select_num_blocks and mode_select_block_len in 'struct nvme_ns' are not useful. Drop them. Signed-off-by: Bin Meng --- Changes in v2: - new patch: Drop useless members of 'struct nvme_ns' drivers/nvme/nvme.c | 4 +--- drivers/nvme/nvme.h | 2 -- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c index 97c665d6a3..e2e13dbf66 100644 --- a/drivers/nvme/nvme.c +++ b/drivers/nvme/nvme.c @@ -719,11 +719,9 @@ static int nvme_blk_probe(struct udevice *udev) flbas = id->flbas & NVME_NS_FLBAS_LBA_MASK; ns->flbas = flbas; ns->lba_shift = id->lbaf[flbas].ds; - ns->mode_select_num_blocks = le64_to_cpu(id->nsze); - ns->mode_select_block_len = 1 << ns->lba_shift; list_add(&ns->list, &ndev->namespaces); - desc->lba = ns->mode_select_num_blocks; + desc->lba = le64_to_cpu(id->nsze); desc->log2blksz = ns->lba_shift; desc->blksz = 1 << ns->lba_shift; desc->bdev = udev; diff --git a/drivers/nvme/nvme.h b/drivers/nvme/nvme.h index aa4b3bac67..c6aae4da5d 100644 --- a/drivers/nvme/nvme.h +++ b/drivers/nvme/nvme.h @@ -633,8 +633,6 @@ struct nvme_ns { int devnum; int lba_shift; u8 flbas; - u64 mode_select_num_blocks; - u32 mode_select_block_len; }; #endif /* __DRIVER_NVME_H__ */ From patchwork Tue Jun 22 13:16:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1495673 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=KvhOIZql; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G8Rl3502tz9sS8 for ; Tue, 22 Jun 2021 23:17:19 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7DE95829B9; Tue, 22 Jun 2021 15:16:54 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="KvhOIZql"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 85FF0829C4; Tue, 22 Jun 2021 15:16:48 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2397680F32 for ; Tue, 22 Jun 2021 15:16:43 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pl1-x62c.google.com with SMTP id i4so6718281plt.12 for ; Tue, 22 Jun 2021 06:16:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DNnR6iW8SNu9UmQd+CCKTLV4tyG+WMCDJqFcXgZBJKY=; b=KvhOIZql+1v6rWqAx3eBJwRx66WQzFfszlulSNixFSQBxtAAy5fLxLzJ1vKj3ewhq7 ESofiMflXZ+bFIU09lq8Lcm4CeFq3PRr4YIAFGuJCwNtCxouVwiJV+ZJSLiYLLDKmpRq BW3SD4hyjDmEQ4ywof0GNjDvnEADeNqBFev6ID7RLPfWPTG+B10rJWxR5ZzN7ILHisls Cg91sher4msDz7mVLRDF/91Z+ZAvXurQ1U3PiCLeljgywPMkeyjfWZimGBcAFFS/MEI+ GYzRtqB9lvAFolh8qXw3ue8ZrNCxEuQ04g+c2skHWEfL6m+ifjKR3ktIjJ1WeZNuAMYw LWmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DNnR6iW8SNu9UmQd+CCKTLV4tyG+WMCDJqFcXgZBJKY=; b=XA2BEi27YY66i1gwJ3+CMja3se80L2JCm1jdWWNupSababqmWBwI2P6yKGO+4O5T7A OfRwX8hRhSgvVsLk/AejvVmF1EOHRdAFm5ZXIeCut6SIkJasBP7XkkECElGjH6ts+P40 q3PWSVn9E6/eR+ae71M8Pzm2zByvO1K3JQ3W02+Q8fnqY253g0tPwnaFv/q4sOoiBK2I 1ovPBrd3CorntuFA8Z/Qtgxmlyezr963WFWQd6YO0pwL6rhUZFOb8Omh76mgsLQBNDxf nGXtkWLrU9Dp2CiRYKDE1wtw2iMbwD18ZS4TJlJGkyR9rEOOdGrw7WugIUJSXj2Mm3Ib gXDw== X-Gm-Message-State: AOAM533TM7uFIow8wLuNHOPON0eVTz3BJtTf4vtZLmTIV2nHGYzYPk0J NsZsFPN6CNR1TbidvcwgHPA= X-Google-Smtp-Source: ABdhPJxBliYalagfV2OJmRKet+nUuIEBViE7U2Lm06FQZ8QIm7Y2Cn8LirDLOzslS7NdR2e9MWA6Pg== X-Received: by 2002:a17:90b:a4e:: with SMTP id gw14mr1653128pjb.223.1624367801751; Tue, 22 Jun 2021 06:16:41 -0700 (PDT) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id j24sm18456482pfe.58.2021.06.22.06.16.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jun 2021 06:16:41 -0700 (PDT) From: Bin Meng To: Tom Rini , u-boot@lists.denx.de Cc: Bin Meng Subject: [PATCH v2 5/7] nvme: Don't clear nvme blk device's priv space Date: Tue, 22 Jun 2021 21:16:21 +0800 Message-Id: <20210622131623.21265-5-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210622131623.21265-1-bmeng.cn@gmail.com> References: <20210622131623.21265-1-bmeng.cn@gmail.com> MIME-Version: 1.0 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 A udevice's priv space is cleared in alloc_priv() in the DM core. Don't do it again in its probe() routine. Signed-off-by: Bin Meng --- Changes in v2: - new patch: Don't clear nvme blk device's priv space drivers/nvme/nvme.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c index e2e13dbf66..0527198aa6 100644 --- a/drivers/nvme/nvme.c +++ b/drivers/nvme/nvme.c @@ -706,7 +706,6 @@ static int nvme_blk_probe(struct udevice *udev) if (!id) return -ENOMEM; - memset(ns, 0, sizeof(*ns)); ns->dev = ndev; /* extract the namespace id from the block device name */ ns->ns_id = trailing_strtol(udev->name); From patchwork Tue Jun 22 13:16:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1495675 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=lNXuk+Ng; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G8RlT6Rczz9sVp for ; Tue, 22 Jun 2021 23:17:41 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A0493829E7; Tue, 22 Jun 2021 15:16:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="lNXuk+Ng"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4AE79829CF; Tue, 22 Jun 2021 15:16:51 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E121D829AE for ; Tue, 22 Jun 2021 15:16:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pf1-x431.google.com with SMTP id 21so1410130pfp.3 for ; Tue, 22 Jun 2021 06:16:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3QGEx2harsscxSE9VG3jmsf2kGD2yCF9mga9ZXZ7rqA=; b=lNXuk+NgEKkEp4tzKzjqh7xB8u6DDyVBN0RjwsMqSzS8b0OE3Q7WPEy2Zljd+EdQOu 7AJFYn+EgCXinHcMOj9plCzrESrMJPRAkBqNcddLrLw8v9MBlpO4lNJi4+08ta0xdL9N soqbyVO09LK9ImJFmJISsP60FiNRZldL4h/qudo7vYYX8RmpMnYkHCtEBteap6GTW6ph uC07PB3xf2mulSoiGoxJBaTyrNp4PqrtR7tML+ixn8ZrOAzScurw0E5G2e1AClMViH+5 D6phX7cBjpFb/+xl12SK23gX+KE4GtaEbku7cpLCMB/MJVJmwCnXK4E//Tmjm3BGhsUy AXNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3QGEx2harsscxSE9VG3jmsf2kGD2yCF9mga9ZXZ7rqA=; b=nShTtPd1nUZRMP3Mh+xWA4jdQ1z4CQla69C67uHQCI7dFsvT3fner6nbm53mE0PdWY zOrdFrVdh3jjfoNJbFwfYXpPT819P+A+N98bGInJEp7DJ6tyaN9Q6qYrICJfdxVaLrKS B7Ue3gtuhUfZ5N8urMtqxL1E6oLp02m0KyPODeZzEddQX5AZEajRUAt5aitl7xd1LwOJ fKoS6eTeMCcPLA7MHHAYLwOJ8rmQt3VNlMHqyoOhjmQgOm6H/+/IhBbgg4hVSeaeH7UC 2owb5FD39T/cLTFbkt3KLM69P0ZEgX5CQtgJECylzATwhx/GIg1YG9KPNSN60C9ZUACQ 5yew== X-Gm-Message-State: AOAM531A1YFv2EuE+Skk5TLe5ogEHfXqUHMhBUXzs4BANeV9oLzT1OsY JsDAx9RzxBjZczWDsB7erT8= X-Google-Smtp-Source: ABdhPJzkjxQo4PJDt0j10KgRemc6A0ytyFEyQoegtowtooU2KN5vCfYqeUTQ3vSWAsJU+uWLYy6z8Q== X-Received: by 2002:a63:5d5c:: with SMTP id o28mr3796409pgm.22.1624367804134; Tue, 22 Jun 2021 06:16:44 -0700 (PDT) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id j24sm18456482pfe.58.2021.06.22.06.16.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jun 2021 06:16:43 -0700 (PDT) From: Bin Meng To: Tom Rini , u-boot@lists.denx.de Cc: Bin Meng Subject: [PATCH v2 6/7] doc: develop: Convert README.nvme to reST Date: Tue, 22 Jun 2021 21:16:22 +0800 Message-Id: <20210622131623.21265-6-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210622131623.21265-1-bmeng.cn@gmail.com> References: <20210622131623.21265-1-bmeng.cn@gmail.com> MIME-Version: 1.0 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 converts the existing README.nvme to reST, and puts it under the develop/driver-model/ directory. Signed-off-by: Bin Meng --- Changes in v2: - new patch: Convert README.nvme to reST doc/develop/driver-model/index.rst | 1 + .../driver-model/nvme.rst} | 25 ++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) rename doc/{README.nvme => develop/driver-model/nvme.rst} (88%) diff --git a/doc/develop/driver-model/index.rst b/doc/develop/driver-model/index.rst index 10a76256b0..7366ef818c 100644 --- a/doc/develop/driver-model/index.rst +++ b/doc/develop/driver-model/index.rst @@ -19,6 +19,7 @@ subsystems i2c-howto livetree migration + nvme of-plat pci-info pmic-framework diff --git a/doc/README.nvme b/doc/develop/driver-model/nvme.rst similarity index 88% rename from doc/README.nvme rename to doc/develop/driver-model/nvme.rst index e8f9be149e..736c0a063d 100644 --- a/doc/README.nvme +++ b/doc/develop/driver-model/nvme.rst @@ -1,11 +1,13 @@ -# SPDX-License-Identifier: GPL-2.0+ -# -# Copyright (C) 2017 NXP Semiconductors -# Copyright (C) 2017 Bin Meng +.. SPDX-License-Identifier: GPL-2.0+ +.. Copyright (C) 2017 NXP Semiconductors +.. Copyright (C) 2017 Bin Meng -What is NVMe +NVMe Support ============ +What is NVMe +------------ + NVM Express (NVMe) is a register level interface that allows host software to communicate with a non-volatile memory subsystem. This interface is optimized for enterprise and client solid state drives, typically attached to the PCI @@ -48,6 +50,8 @@ identified. To list all of the NVMe hard disks, try: +.. code-block:: none + => nvme info Device 0: Vendor: 0x8086 Rev: 8DV10131 Prod: CVFT535600LS400BGN Type: Hard Disk @@ -55,10 +59,14 @@ To list all of the NVMe hard disks, try: and print out detailed information for controller and namespaces via: +.. code-block:: none + => nvme detail Raw block read/write to can be done via the 'nvme read/write' commands: +.. code-block:: none + => nvme read a0000000 0 11000 => tftp 80000000 /tftpboot/kernel.itb @@ -66,6 +74,8 @@ Raw block read/write to can be done via the 'nvme read/write' commands: Of course, file system command can be used on the NVMe hard disk as well: +.. code-block:: none + => fatls nvme 0:1 32376967 kernel.itb 22929408 100m @@ -81,4 +91,7 @@ QEMU supports NVMe emulation and we can test NVMe driver with QEMU x86 running U-Boot. Please see README.x86 for how to build u-boot.rom image for QEMU x86. Example command line to call QEMU x86 below with emulated NVMe device: -$ ./qemu-system-i386 -drive file=nvme.img,if=none,id=drv0 -device nvme,drive=drv0,serial=QEMUNVME0001 -bios u-boot.rom + +.. code-block:: bash + + $ ./qemu-system-i386 -drive file=nvme.img,if=none,id=drv0 -device nvme,drive=drv0,serial=QEMUNVME0001 -bios u-boot.rom From patchwork Tue Jun 22 13:16:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1495676 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=r+yqEWca; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G8Rlj0y72z9sT6 for ; Tue, 22 Jun 2021 23:17:52 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1B1C8829EF; Tue, 22 Jun 2021 15:17:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="r+yqEWca"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 002F4829BF; Tue, 22 Jun 2021 15:16:52 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id CC622829B9 for ; Tue, 22 Jun 2021 15:16:47 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pf1-x433.google.com with SMTP id x16so16348777pfa.13 for ; Tue, 22 Jun 2021 06:16:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dLjQ5I8HR2Nqz3cZx/ofrSzDQ4+mz3UR3LcBuMyV/pg=; b=r+yqEWca1mFTcByfME4XngmXXECQwBTXdlycLJ7stI+Mo/XKdJYGd+VjSKj9N5GKAd 3g2ifKDRsKca6gCn3gJTSLv0A3L/EqbTi6n8Lfcw1T4VW2WLlK2CIXxt/vgyq6wYWk4A 0yaJMQnbPuaBKihUoIAnjuJ7SZnsJZdhObEJqZWnxrUNM0kM293JGRC0NX6IvzMlg7VM 2HtcJ5W6kUzwB4xK5qIH0it+EhPslXETLJU6MnLX0w3z6gQwGhOGovwNqRxqndPD5XbV 3vCXXOh1TpBM0YfrmIgVbMkGNUgdAjCTVg7xAMTxMs1K9BLQ4bn4DLcYmMuT+o+wW8HF 5Khg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dLjQ5I8HR2Nqz3cZx/ofrSzDQ4+mz3UR3LcBuMyV/pg=; b=MQ2T2Rs0AM9HlmD9WiXnkchfiMzfJ1aqjk44P6Yt48p+cnl2epidrjBV9Wek/89NKW BDh0fxfEsGlVW8Nu3yGwRxpWgfYVvRS79iQUnSLLASnQ4b3MlXjkS6xLn4x7NlESA4fy KiAhAVZnLU0dirz0GFDosqPCzSos85avyNsGLLAO1rHw46JvkdA1hiE3Mro5pu5osLCK xzY/RNgB0bD9d4vthLo2PXHxXspUZVZyZg1zeTW+lW7KyJ2isAgNS68VOjWVdJOUx//Q GF90jFZD9/GAC/0oklCPc4zRVeTykm55PW5EUkW4nrrtgI4zmFKwISABu8NsJvJMrJWO AsKw== X-Gm-Message-State: AOAM532QY7QFGaimt80AFpbjdpTbMK3A13LpfvxfE9EuzZQCCOAUtWik DS3HrF0BArZu3+D+wfqqSbo= X-Google-Smtp-Source: ABdhPJw/B0Y8ajLQMceYaHY9mK/wjU/S/caMh0tD6i3Pykx1tIDWcOoOMhAFcuKKGV4p75ayxDXsnQ== X-Received: by 2002:a63:5c04:: with SMTP id q4mr3737551pgb.127.1624367806376; Tue, 22 Jun 2021 06:16:46 -0700 (PDT) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id j24sm18456482pfe.58.2021.06.22.06.16.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jun 2021 06:16:46 -0700 (PDT) From: Bin Meng To: Tom Rini , u-boot@lists.denx.de Cc: Bin Meng Subject: [PATCH v2 7/7] MAINTAINERS: Add an entry for NVMe Date: Tue, 22 Jun 2021 21:16:23 +0800 Message-Id: <20210622131623.21265-7-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210622131623.21265-1-bmeng.cn@gmail.com> References: <20210622131623.21265-1-bmeng.cn@gmail.com> MIME-Version: 1.0 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 was missed when NVMe support was initially brought to U-Boot back in 2017. Add an entry for it and list myself as the maintainer. Signed-off-by: Bin Meng Reviewed-by: Tom Rini --- Changes in v2: - new patch: Add an entry for NVMe MAINTAINERS | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 2accd1fb83..81190f8f8f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -913,6 +913,14 @@ S: Maintained T: git https://source.denx.de/u-boot/custodians/u-boot-nios.git F: arch/nios2/ +NVMe +M: Bin Meng +S: Maintained +F: drivers/nvme/ +F: cmd/nvme.c +F: include/nvme.h +F: doc/develop/driver-model/nvme.rst + ONENAND #M: Lukasz Majewski S: Orphaned (Since 2017-01)