Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp407763ybi; Mon, 15 Jul 2019 23:05:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqxUNomhGCHV7rXQmeEL2xOmG6VV7VqEalk/XqC01VcHHq9c27gBs7XlxhSHzTjrearCQBsJ X-Received: by 2002:a63:2606:: with SMTP id m6mr31262588pgm.436.1563257148960; Mon, 15 Jul 2019 23:05:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563257148; cv=none; d=google.com; s=arc-20160816; b=WCYgkL7ScK1L7CMcZYg6D+H6b+/J4lU94fXF7t+BNUEJwHUo2A6FDcwn2S9pZdHvlV 1fqbEGUXZezNQhJVLhlmmvY+GM9jNkuStnv7/yqZgPigtQPJd26NHUeqO2paq/PrxZGv nvrYrBRMyKg3PrZZObnkmWqIOmTj7aZlYL32CFetvF42dOSRF81AsqLKucxQVEzItPGA FRi9aUbAVTA9VUNjpethxbr1TZwFwjW3/TPOSRMePFhNK9caJR2sGDlZjC+v4rxbzWeQ 6ZLm7VnQ2uY+zMQFtmasxgIzl4PDxyZVh94un/DUIXJmFyaj0wgw5VNVIWgZmm7FxZBp U6RA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=E17/Q4ED9aYtzIjE6TWRHO17t9LMMfpGZMAVCt9LnRI=; b=A0IH/oHFUDuRq6YrmEszZQixU5ruthsrIDcJq/XNKBE6iOixlGqI2tbRV5xkLx+hrM Nkf42PvK1eKVrg9wxcs6WCgK/j41mwM0agTpYZjDwsknCWF6K0UpLI/raN5yendFMg4W EHlSCYCzBMI9reeB1dWS3KxRrE/IsTtVBbgp2HOMMR13+VN+bMhDBqxQ8kb9xRZ5B+q5 ++ZGt0RQhLDmA6YY8OKTqQHSWMBo7BPxM/f3dkRNgEtBy4EZe4LMAXnQ1ZxwQyhq2ssY uqbZXJ/R8zDHnYMLTpKZnW2v79b8k+sVlH1dZ7gMDett/XCFAt436EdsSddfZHrpIS/P ftUw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z6si17847019plo.193.2019.07.15.23.05.31; Mon, 15 Jul 2019 23:05:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731702AbfGPGEf (ORCPT + 99 others); Tue, 16 Jul 2019 02:04:35 -0400 Received: from verein.lst.de ([213.95.11.211]:38912 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726315AbfGPGEf (ORCPT ); Tue, 16 Jul 2019 02:04:35 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 6649468C65; Tue, 16 Jul 2019 08:04:31 +0200 (CEST) Date: Tue, 16 Jul 2019 08:04:30 +0200 From: Christoph Hellwig To: Benjamin Herrenschmidt Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, Jens Axboe , Keith Busch , Christoph Hellwig , Paul Pawlowski Subject: Re: [PATCH 2/3] nvme: Retrieve the required IO queue entry size from the controller Message-ID: <20190716060430.GB29414@lst.de> References: <20190716004649.17799-1-benh@kernel.crashing.org> <20190716004649.17799-2-benh@kernel.crashing.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190716004649.17799-2-benh@kernel.crashing.org> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > + /* Use default IOSQES. We'll update it later if needed */ > ctrl->ctrl_config |= NVME_CC_IOSQES | NVME_CC_IOCQES; > ctrl->ctrl_config |= NVME_CC_ENABLE; > > @@ -2698,6 +2699,30 @@ int nvme_init_identify(struct nvme_ctrl *ctrl) > ctrl->hmmin = le32_to_cpu(id->hmmin); > ctrl->hmminds = le32_to_cpu(id->hmminds); > ctrl->hmmaxd = le16_to_cpu(id->hmmaxd); > + > + /* Grab required IO queue size */ > + ctrl->iosqes = id->sqes & 0xf; > + if (ctrl->iosqes < NVME_NVM_IOSQES) { > + dev_err(ctrl->device, > + "unsupported required IO queue size %d\n", ctrl->iosqes); > + ret = -EINVAL; > + goto out_free; > + } > + /* > + * If our IO queue size isn't the default, update the setting > + * in CC:IOSQES. > + */ > + if (ctrl->iosqes != NVME_NVM_IOSQES) { > + ctrl->ctrl_config &= ~(0xfu << NVME_CC_IOSQES_SHIFT); > + ctrl->ctrl_config |= ctrl->iosqes << NVME_CC_IOSQES_SHIFT; > + ret = ctrl->ops->reg_write32(ctrl, NVME_REG_CC, > + ctrl->ctrl_config); > + if (ret) { > + dev_err(ctrl->device, > + "error updating CC register\n"); > + goto out_free; > + } > + } Actually, this doesn't work on a "real" nvme controller, to change CC values the controller needs to be disabled. So back to the version you circulated to me in private mail that just sets q->sqes and has a comment that this is magic for The Apple controller. If/when we get standardized large SQE support we'll need to discover that earlier or do a disable/enable dance. Sorry for misleading you down this road and creating the extra work.