Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2109195ybb; Sun, 29 Mar 2020 22:53:32 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtx0o/4I1m9F8lwG2cl9JdhmDCXgJksBZFu6uU8hFA8Vn//JliyJeDbMO+r/VKE5gJtde8b X-Received: by 2002:aca:aa81:: with SMTP id t123mr6656767oie.117.1585547612298; Sun, 29 Mar 2020 22:53:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585547612; cv=none; d=google.com; s=arc-20160816; b=WIbV9XdD9Z6l2piSgTwfHdRSuVtHa6EITPzhi0t9WAvvkGIEgyhiLNwJDg6WFc5cXf uqzKr4CttsUTZZzaAHPIgOvXlldSEaOoMn/QFc7W/KDZixR2AQ9Nt3RNdTFvbXdTOPRt Ptiyz8I+g2SJZmESYErqHvstdEHqmQDQkfPRpRPJZa7AHyP2NE7V7ujiwJdWOGPuobhr 7IbUj2+CjpWi37x+EFiSAj5cTFsERCeJ1qrMwFxsYQBdvRC8GlFilMAOb/QolOsE8ViV Kf+5haM9dlOT0G7AcTf0lyATymntMM+r9LbC9xuhHZl/DVYgwfs1dhkq/iltcHy5trY1 wIdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=AZ1i37KVhT8B8mmargap6HV4DiWyp24odBac0NXd86Q=; b=L1q06B8xb3nwdv5QxDGqiusRa3liV/tj3J7LMCi4trVJY93NDx1vQ7jdyp/odqxN+I zhW2SHE++UCaAbBE2U81lvXlXJqD1s0aVLiqo4TSVacQf2jzMWhNa9MqdL8W4757uxXl GLcYB7A6p2s0qjB/X07tngSBJtH4T/Ab2hIr86c37x+2BlPIGWJYLX2AG2cqbFxy3LRg W9+kWEVBIcU3aox/jp92URE4NhjZ7IBwve3dTGsmyTjhf4QS9+mu5p7stvqg62WUwF0F HaT5JQz5Fv1R+wtUs0xgcakoB+rCW69D7AtgZP8IUvIGhwuwIvhJp2yO9Qj+k2w/DF30 qrlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@d-silva.org header.s=201810a header.b=iMjl+0uX; 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 f26si6444535otc.182.2020.03.29.22.53.19; Sun, 29 Mar 2020 22:53:32 -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; dkim=pass header.i=@d-silva.org header.s=201810a header.b=iMjl+0uX; 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 S1728699AbgC3Fw5 (ORCPT + 99 others); Mon, 30 Mar 2020 01:52:57 -0400 Received: from ushosting.nmnhosting.com ([66.55.73.32]:37154 "EHLO ushosting.nmnhosting.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728492AbgC3Fw5 (ORCPT ); Mon, 30 Mar 2020 01:52:57 -0400 Received: from mail2.nmnhosting.com (unknown [202.169.106.97]) by ushosting.nmnhosting.com (Postfix) with ESMTPS id 277FA2DC684C; Mon, 30 Mar 2020 16:52:46 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=d-silva.org; s=201810a; t=1585547567; bh=/c0sygyGptvZJ7mjxJ2I2ERy9RY2BO4lgAUmGcAOvOI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iMjl+0uXIk2WsRYFK7QMnoeZwiXtbQvngMc30HklM7M/UaYiwbRU0QE9+G/GnjCpF 6TnIi2bluBUjI33oB/IGG++wI53XGTIwCq5K0VlcVhmAbh8fhf/pZM4Ced6P4QxUan 4mCoqUpqEQuPXCesRSY06c5qvKiv1LsP8cfIca3WUYgQYOJ/q/s8LwSNJX9HBkkIhn gDlQa2bD02tm9GPOYMeF42o7Bj/XBxnHbDvb+sZWgfzyMO+XkIa7CR1jZ4i6HRAFM+ YbdnR295TH0kUDCjW5WeNmhPseRb1h1xcrGkr1E7ZJs7ZsylKwzALmMvOAhH9LL5vq 3sSEcN0wjhm82H8oqQYmkz6pFE9Ngz7Yk7lRcCnGpzQVRWYRpVTksaPYJsbD/6F8t2 MetLhu1IrJSl7OBndz4jJBgg6mmUQXdE5qPmzLqjrTwMXPbnNkvRn55MI0MKPAsiA2 v3UhZHqDsS3yj8k9ftzhbgmpM9o3tilShHFLuLa6EEPGAyGhkC0JmK4UJSSU4vuBsl DAAPAo9W0AH+Quua6imoMGuoYzJ2F3ro6L2zDSZSLZw6BC3GtyzRpLXvgZ5C/FjG+f tIZ+HRu9YYQm06ECg8BUrm41v1jxxG21JM4D7E34KQMuRdIJeivVBNTbxAwVDV35Ax wfbVKJDpJWOjuCjbEN7nnoZA= Received: from localhost.lan ([10.0.1.179]) by mail2.nmnhosting.com (8.15.2/8.15.2) with ESMTP id 02R7C4Au045934; Fri, 27 Mar 2020 18:12:19 +1100 (AEDT) (envelope-from alastair@d-silva.org) From: "Alastair D'Silva" To: alastair@d-silva.org Cc: "Aneesh Kumar K . V" , "Oliver O'Halloran" , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Frederic Barrat , Andrew Donnellan , Arnd Bergmann , Greg Kroah-Hartman , Dan Williams , Vishal Verma , Dave Jiang , Ira Weiny , Andrew Morton , Mauro Carvalho Chehab , "David S. Miller" , Rob Herring , Anton Blanchard , Krzysztof Kozlowski , Mahesh Salgaonkar , Madhavan Srinivasan , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Anju T Sudhakar , Hari Bathini , Thomas Gleixner , Greg Kurz , Nicholas Piggin , Masahiro Yamada , Alexey Kardashevskiy , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-nvdimm@lists.01.org, linux-mm@kvack.org Subject: [PATCH v4 21/25] nvdimm/ocxl: Implement the heartbeat command Date: Fri, 27 Mar 2020 18:11:58 +1100 Message-Id: <20200327071202.2159885-22-alastair@d-silva.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200327071202.2159885-1-alastair@d-silva.org> References: <20200327071202.2159885-1-alastair@d-silva.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mail2.nmnhosting.com [10.0.1.20]); Fri, 27 Mar 2020 18:12:19 +1100 (AEDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 controller. Signed-off-by: Alastair D'Silva Reviewed-by: Andrew Donnellan --- drivers/nvdimm/ocxl/main.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/nvdimm/ocxl/main.c b/drivers/nvdimm/ocxl/main.c index a4315472683c..2fbe3f2f77d9 100644 --- a/drivers/nvdimm/ocxl/main.c +++ b/drivers/nvdimm/ocxl/main.c @@ -272,6 +272,30 @@ static int setup_command_metadata(struct ocxlpmem *ocxlpmem) return 0; } +/** + * heartbeat() - Issue a heartbeat command to the controller + * @ocxlpmem: the device metadata + * Return: 0 if the controller responded correctly, negative on error + */ +static int heartbeat(struct ocxlpmem *ocxlpmem) +{ + int rc; + + mutex_lock(&ocxlpmem->admin_command.lock); + + rc = admin_command_execute(ocxlpmem, ADMIN_COMMAND_HEARTBEAT); + if (rc < 0) + goto out; + if (rc != STATUS_SUCCESS) + warn_status(ocxlpmem, "Unexpected status from heartbeat", rc); + + (void)admin_response_handled(ocxlpmem); + +out: + mutex_unlock(&ocxlpmem->admin_command.lock); + return rc; +} + /** * allocate_minor() - Allocate a minor number to use for an OpenCAPI pmem device * @ocxlpmem: the device metadata @@ -1460,6 +1484,12 @@ static int probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto err; } + rc = heartbeat(ocxlpmem); + if (rc) { + dev_err(&pdev->dev, "Heartbeat failed\n"); + goto err; + } + elapsed = 0; timeout = ocxlpmem->readiness_timeout + ocxlpmem->memory_available_timeout; -- 2.24.1