Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1400083pxj; Fri, 21 May 2021 13:19:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7EL5jKOjpoCmrtcc9ZRxk7KeMiU5UMFcIVryowwb0OdjPDgNIbRD9kooLy7tdw0Px/dFx X-Received: by 2002:a05:6e02:be8:: with SMTP id d8mr635076ilu.63.1621628350067; Fri, 21 May 2021 13:19:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621628350; cv=none; d=google.com; s=arc-20160816; b=J89OuEuStv9D3UzSisyeeBvNXrhVSpP3KnmGPEbOz85HKnnmpxNpkF9BR8Kq2ybBuX Z/IncX+xf4BBmSUgXCzSfpkAvIxsP5P9GVOGJS+JfYI5odvHR+K4PygTNRGWj06EnAh+ Xe9VpxGg8+fmpgYUsP5gxm4iza1929pCaAxXZ85U+febernaIPzU3ZxhVIRZtNa5YMuE nr4s5ZHFOh6nyAo7W7wRgwlhKSSHaub6eempO+I553ClIVNVgnNNeUIRQaniSnAQ0yys +BbVFcUHpdAaeMnZfIcSVKVfG/t9ciuy1PWMdmouTNRMvw90aBSqHWN047zK8BCkWhIt bPIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=7USNjf2Ns//LZri0H+DuisbSg6YWoeNKnKynPBXMbp0=; b=eYp2gy1H7zPy6nOkBLKS3IRFEHbu3ZDlVWr/y03xLSQC5jkiAynxSG4j4jcy3KSn7k ALeJJn2bWvYiftVP/44ejExHyP+mLPdo3cq13aC0mskzHfSRffnOlN3mhgMU2Hy4HgjK pwzM3q2KABV1Ks6W2ta/cFz+cM4MEE1oGqmTW1lIplBtzZXcMJbIe5nfWa2W571xQ/Dk 6OR65hQjQ/QTqfZr+5pEJAEtC5bWu4psa2o4viDYTpu2huTFLn9+hCrhyfkWRqTbr+GX iTEvMpSAUWV6gugwBkxO/2TTKDuZjSJQiUPBSg1+xV6ZPg6uyYcjNTuqhyaZu9mtkAk0 41yw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a13si5989514iok.48.2021.05.21.13.18.57; Fri, 21 May 2021 13:19:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237050AbhEUOtE (ORCPT + 99 others); Fri, 21 May 2021 10:49:04 -0400 Received: from mx2.suse.de ([195.135.220.15]:52574 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237016AbhEUOtC (ORCPT ); Fri, 21 May 2021 10:49:02 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 88E05AC11; Fri, 21 May 2021 14:47:38 +0000 (UTC) From: Daniel Wagner To: linux-nvme@lists.infradead.org Cc: linux-kernel@vger.kernel.org, Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Daniel Wagner Subject: [PATCH] nvme: Use NN for max_namespaces if MNAN is zero Date: Fri, 21 May 2021 16:47:34 +0200 Message-Id: <20210521144734.90044-1-dwagner@suse.de> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org NVMe 1.4 states that MNAN might be zero, in which case we should evaluate NN to get the number of supported namespaces. Signed-off-by: Daniel Wagner --- drivers/nvme/host/core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index e7441ccaa8db..32457c77c9ab 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2905,6 +2905,8 @@ static int nvme_init_identify(struct nvme_ctrl *ctrl) ctrl->sgls = le32_to_cpu(id->sgls); ctrl->kas = le16_to_cpu(id->kas); ctrl->max_namespaces = le32_to_cpu(id->mnan); + if (!ctrl->max_namespaces) + ctrl->max_namespaces = le32_to_cpu(id->nn); ctrl->ctratt = le32_to_cpu(id->ctratt); if (id->rtd3e) { -- 2.29.2