[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200203151148.00000ae0@Huawei.com>
Date: Mon, 3 Feb 2020 15:11:48 +0000
From: Jonathan Cameron <Jonathan.Cameron@...wei.com>
To: Alastair D'Silva <alastair@....ibm.com>
CC: <alastair@...ilva.org>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Michael Ellerman <mpe@...erman.id.au>,
Frederic Barrat <fbarrat@...ux.ibm.com>,
Andrew Donnellan <ajd@...ux.ibm.com>,
Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Dan Williams <dan.j.williams@...el.com>,
"Vishal Verma" <vishal.l.verma@...el.com>,
Dave Jiang <dave.jiang@...el.com>,
"Keith Busch" <keith.busch@...el.com>,
Ira Weiny <ira.weiny@...el.com>,
"Andrew Morton" <akpm@...ux-foundation.org>,
Mauro Carvalho Chehab <mchehab+samsung@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
"Rob Herring" <robh@...nel.org>,
Anton Blanchard <anton@...abs.org>,
"Krzysztof Kozlowski" <krzk@...nel.org>,
Mahesh Salgaonkar <mahesh@...ux.vnet.ibm.com>,
Madhavan Srinivasan <maddy@...ux.vnet.ibm.com>,
"Cédric Le Goater" <clg@...d.org>,
Anju T Sudhakar <anju@...ux.vnet.ibm.com>,
"Hari Bathini" <hbathini@...ux.ibm.com>,
Thomas Gleixner <tglx@...utronix.de>,
"Greg Kurz" <groug@...d.org>, Nicholas Piggin <npiggin@...il.com>,
Masahiro Yamada <yamada.masahiro@...ionext.com>,
Alexey Kardashevskiy <aik@...abs.ru>,
<linux-kernel@...r.kernel.org>, <linuxppc-dev@...ts.ozlabs.org>,
<linux-nvdimm@...ts.01.org>, <linux-mm@...ck.org>
Subject: Re: [PATCH v2 22/27] nvdimm/ocxl: Implement the heartbeat command
On Tue, 3 Dec 2019 14:46:50 +1100
Alastair D'Silva <alastair@....ibm.com> wrote:
> From: Alastair D'Silva <alastair@...ilva.org>
>
> The heartbeat admin command is a simple admin command that exercises
> the communication mechanisms within the controller.
>
> This patch issues a heartbeat command to the card during init to ensure
> we can communicate with the card's crontroller.
controller
>
> Signed-off-by: Alastair D'Silva <alastair@...ilva.org>
> ---
> drivers/nvdimm/ocxl/scm.c | 43 +++++++++++++++++++++++++++++++++++++++
> 1 file changed, 43 insertions(+)
>
> diff --git a/drivers/nvdimm/ocxl/scm.c b/drivers/nvdimm/ocxl/scm.c
> index 8a30c887b5ed..e8b34262f397 100644
> --- a/drivers/nvdimm/ocxl/scm.c
> +++ b/drivers/nvdimm/ocxl/scm.c
> @@ -353,6 +353,44 @@ static bool scm_is_usable(const struct scm_data *scm_data)
> return true;
> }
>
> +/**
> + * scm_heartbeat() - Issue a heartbeat command to the controller
> + * @scm_data: a pointer to the SCM device data
> + * Return: 0 if the controller responded correctly, negative on error
> + */
> +static int scm_heartbeat(struct scm_data *scm_data)
> +{
> + int rc;
> +
> + mutex_lock(&scm_data->admin_command.lock);
> +
> + rc = scm_admin_command_request(scm_data, ADMIN_COMMAND_HEARTBEAT);
> + if (rc)
> + goto out;
> +
> + rc = scm_admin_command_execute(scm_data);
> + if (rc)
> + goto out;
> +
> + rc = scm_admin_command_complete_timeout(scm_data, ADMIN_COMMAND_HEARTBEAT);
> + if (rc < 0) {
> + dev_err(&scm_data->dev, "Heartbeat timeout\n");
> + goto out;
> + }
> +
> + rc = scm_admin_response(scm_data);
> + if (rc < 0)
> + goto out;
> + if (rc != STATUS_SUCCESS)
> + scm_warn_status(scm_data, "Unexpected status from heartbeat", rc);
> +
> + rc = scm_admin_response_handled(scm_data);
> +
> +out:
> + mutex_unlock(&scm_data->admin_command.lock);
> + return rc;
> +}
> +
> /**
> * allocate_scm_minor() - Allocate a minor number to use for an SCM device
> * @scm_data: The SCM device to associate the minor with
> @@ -1508,6 +1546,11 @@ static int scm_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
> goto err;
> }
>
> + if (scm_heartbeat(scm_data)) {
> + dev_err(&pdev->dev, "SCM Heartbeat failed\n");
> + goto err;
> + }
> +
> elapsed = 0;
> timeout = scm_data->readiness_timeout + scm_data->memory_available_timeout;
> while (!scm_is_usable(scm_data)) {
Powered by blists - more mailing lists