From mboxrd@z Thu Jan 1 00:00:00 1970 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=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=unavailable 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 F2FBAC33CAC for ; Mon, 3 Feb 2020 14:25:03 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AF4E62082E for ; Mon, 3 Feb 2020 14:25:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AF4E62082E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=Huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 48B98F5PJpzDqPv for ; Tue, 4 Feb 2020 01:25:01 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=huawei.com (client-ip=185.176.76.210; helo=huawei.com; envelope-from=jonathan.cameron@huawei.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=Huawei.com Received: from huawei.com (lhrrgout.huawei.com [185.176.76.210]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 48B95v5kGnzDqG0 for ; Tue, 4 Feb 2020 01:22:59 +1100 (AEDT) Received: from lhreml707-cah.china.huawei.com (unknown [172.18.7.108]) by Forcepoint Email with ESMTP id CEB0FD4404B5C2881A6C; Mon, 3 Feb 2020 14:22:56 +0000 (GMT) Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by lhreml707-cah.china.huawei.com (10.201.108.48) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 3 Feb 2020 14:22:56 +0000 Received: from localhost (10.202.226.57) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 3 Feb 2020 14:22:56 +0000 Date: Mon, 3 Feb 2020 14:22:54 +0000 From: Jonathan Cameron To: Alastair D'Silva Subject: Re: [PATCH v2 14/27] nvdimm/ocxl: Add support for near storage commands Message-ID: <20200203142254.00007377@Huawei.com> In-Reply-To: <20191203034655.51561-15-alastair@au1.ibm.com> References: <20191203034655.51561-1-alastair@au1.ibm.com> <20191203034655.51561-15-alastair@au1.ibm.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.226.57] X-ClientProxiedBy: lhreml745-chm.china.huawei.com (10.201.108.195) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Madhavan Srinivasan , Alexey Kardashevskiy , Keith Busch , Masahiro Yamada , Paul Mackerras , Mauro Carvalho Chehab , Ira Weiny , Thomas Gleixner , Rob Herring , Dave Jiang , linux-nvdimm@lists.01.org, Vishal Verma , Mahesh Salgaonkar , Krzysztof Kozlowski , Anju T Sudhakar , alastair@d-silva.org, Andrew Donnellan , Arnd Bergmann , Greg Kurz , Nicholas Piggin , =?ISO-8859-1?Q?C=E9dric?= Le Goater , Dan Williams , Hari Bathini , linux-mm@kvack.org, Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Frederic Barrat , Andrew Morton , linuxppc-dev@lists.ozlabs.org, "David S. Miller" Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Tue, 3 Dec 2019 14:46:42 +1100 Alastair D'Silva wrote: > From: Alastair D'Silva > > Similar to the previous patch, this adds support for near storage commands. > > Signed-off-by: Alastair D'Silva > --- > drivers/nvdimm/ocxl/scm.c | 6 +++++ > drivers/nvdimm/ocxl/scm_internal.c | 41 ++++++++++++++++++++++++++++++ > drivers/nvdimm/ocxl/scm_internal.h | 38 +++++++++++++++++++++++++++ > 3 files changed, 85 insertions(+) > > diff --git a/drivers/nvdimm/ocxl/scm.c b/drivers/nvdimm/ocxl/scm.c > index 1e175f3c3cf2..6c16ca7fabfa 100644 > --- a/drivers/nvdimm/ocxl/scm.c > +++ b/drivers/nvdimm/ocxl/scm.c > @@ -310,12 +310,18 @@ static int scm_setup_command_metadata(struct scm_data *scm_data) > int rc; > > mutex_init(&scm_data->admin_command.lock); > + mutex_init(&scm_data->ns_command.lock); > > rc = scm_extract_command_metadata(scm_data, GLOBAL_MMIO_ACMA_CREQO, > &scm_data->admin_command); > if (rc) > return rc; > > + rc = scm_extract_command_metadata(scm_data, GLOBAL_MMIO_NSCMA_CREQO, > + &scm_data->ns_command); > + if (rc) > + return rc; > + Ah. So much for my comment in previous patch. Ignore that... > return 0; > } > > diff --git a/drivers/nvdimm/ocxl/scm_internal.c b/drivers/nvdimm/ocxl/scm_internal.c > index 7b11b56863fb..c405f1d8afb8 100644 > --- a/drivers/nvdimm/ocxl/scm_internal.c > +++ b/drivers/nvdimm/ocxl/scm_internal.c > @@ -132,6 +132,47 @@ int scm_admin_response_handled(const struct scm_data *scm_data) > OCXL_LITTLE_ENDIAN, GLOBAL_MMIO_CHI_ACRA); > } > > +int scm_ns_command_request(struct scm_data *scm_data, u8 op_code) > +{ > + u64 val; > + int rc = ocxl_global_mmio_read64(scm_data->ocxl_afu, GLOBAL_MMIO_CHI, > + OCXL_LITTLE_ENDIAN, &val); > + if (rc) > + return rc; > + > + if (!(val & GLOBAL_MMIO_CHI_NSCRA)) > + return -EBUSY; > + > + return scm_command_request(scm_data, &scm_data->ns_command, op_code); > +} > + > +int scm_ns_response(const struct scm_data *scm_data) > +{ > + return scm_command_response(scm_data, &scm_data->ns_command); > +} > + > +int scm_ns_command_execute(const struct scm_data *scm_data) > +{ > + return ocxl_global_mmio_set64(scm_data->ocxl_afu, GLOBAL_MMIO_HCI, > + OCXL_LITTLE_ENDIAN, GLOBAL_MMIO_HCI_NSCRW); > +} > + > +bool scm_ns_command_complete(const struct scm_data *scm_data) > +{ > + u64 val = 0; > + int rc = scm_chi(scm_data, &val); > + > + WARN_ON(rc); > + > + return (val & GLOBAL_MMIO_CHI_NSCRA) != 0; > +} > + > +int scm_ns_response_handled(const struct scm_data *scm_data) > +{ > + return ocxl_global_mmio_set64(scm_data->ocxl_afu, GLOBAL_MMIO_CHIC, > + OCXL_LITTLE_ENDIAN, GLOBAL_MMIO_CHI_NSCRA); > +} > + > void scm_warn_status(const struct scm_data *scm_data, const char *message, > u8 status) > { > diff --git a/drivers/nvdimm/ocxl/scm_internal.h b/drivers/nvdimm/ocxl/scm_internal.h > index 9bff684cd069..9575996a89e7 100644 > --- a/drivers/nvdimm/ocxl/scm_internal.h > +++ b/drivers/nvdimm/ocxl/scm_internal.h > @@ -108,6 +108,7 @@ struct scm_data { > struct ocxl_context *ocxl_context; > void *metadata_addr; > struct command_metadata admin_command; > + struct command_metadata ns_command; > struct resource scm_res; > struct nd_region *nd_region; > char fw_version[8+1]; > @@ -176,6 +177,42 @@ int scm_admin_command_complete_timeout(const struct scm_data *scm_data, > */ > int scm_admin_response_handled(const struct scm_data *scm_data); > > +/** > + * scm_ns_command_request() - Issue a near storage command request > + * @scm_data: a pointer to the SCM device data > + * @op_code: The op-code for the command > + * Returns an identifier for the command, or negative on error > + */ > +int scm_ns_command_request(struct scm_data *scm_data, u8 op_code); > + > +/** > + * scm_ns_response() - Validate a near storage response > + * @scm_data: a pointer to the SCM device data > + * Returns the status code of the command, or negative on error > + */ > +int scm_ns_response(const struct scm_data *scm_data); > + > +/** > + * scm_ns_command_execute() - Notify the controller to start processing a pending near storage command > + * @scm_data: a pointer to the SCM device data > + * Returns 0 on success, negative on error > + */ > +int scm_ns_command_execute(const struct scm_data *scm_data); > + > +/** > + * scm_ns_command_complete() - Is a near storage command executing > + * scm_data: a pointer to the SCM device data > + * Returns true if the previous admin command has completed > + */ > +bool scm_ns_command_complete(const struct scm_data *scm_data); > + > +/** > + * scm_ns_response_handled() - Notify the controller that the near storage response has been handled > + * scm_data: a pointer to the SCM device data > + * Returns 0 on success, negative on failure > + */ > +int scm_ns_response_handled(const struct scm_data *scm_data); > + > /** > * scm_warn_status() - Emit a kernel warning showing a command status. > * @scm_data: a pointer to the SCM device data > @@ -184,3 +221,4 @@ int scm_admin_response_handled(const struct scm_data *scm_data); > */ > void scm_warn_status(const struct scm_data *scm_data, const char *message, > u8 status); > + Stray blank line! Now we are into the real nitpicks. Not enough coffee. Jonathan