Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2109316ybb; Sun, 29 Mar 2020 22:53:46 -0700 (PDT) X-Google-Smtp-Source: ADFU+vu4FHT8ADUdZcMhwZNoF6UhXAsypan/BQarVMCZGryKra/KfGQjJOEzAEYFtDLJxfdmsRhW X-Received: by 2002:a54:4083:: with SMTP id i3mr2506086oii.157.1585547626089; Sun, 29 Mar 2020 22:53:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585547626; cv=none; d=google.com; s=arc-20160816; b=klO8pAWkSSVEEXQU+vJyR95Kj/iHOi8/0d8K7zW5HkIEeeL4yWCXX84DAdkkrMesYT mOK+VFyfx04qpxo5NoPjpD8E8LIRl1nVQcOPzfQKRrk/U4OjqPGAQN0oVyK8uojq+3+w E2cduQdNmIV4t6VWwEN5PgDcJJnUfBDQMl+mkm9cNa5Dhuuh3Co17Zq6Z8SljknB05Rz UDIEN4JoiPmQrptsP8y0MOsd5hdJkogpTslmTzrIJdfSiVzRsyNP+XOwVrGo/b75omKx 9IOZECil4CBdYXYGcD/ACLAidJ3SM1/XfSfZL8Bi4E8NN39Gp/DgcB8A5HGDgCIx1WNM YQ8w== 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=5Uv335z3x1RJ5jiUf1b2B6HhFFuTw5y96uhstfxv96M=; b=bYSYIrM67hzwy5y6X7bYhuRCvGmFclQoT1Qa2gNEmPrs+hlVt8LlBAA8sH4gO4e4e1 wsY5ork0OIuSGySvI7jTnEPU6vMN24XR+AXEJWQHtR3Ci24s36PzOQtZ5xYwO2yOu3cj z1dDXfw8Xjnys5Z/+SQEsJWF1AD4fX+Gi2jlcHJ6t4sQ1SNlfCXWwIVEzLtgTU5wNTw/ 9zdZRzhWcuBu4bDXsPv1Qs5JAZS1sW7IwBypgkk3KMZ3EYkBuYyU0+LqWUyi1z0Y8xd9 wAxTvsWdKqtBWpoWWB6R18BmTXQIEpr93jyBgb+dlFx16SCiqo2V1cUUWj2VBEsLYAiD hm2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@d-silva.org header.s=201810a header.b=hoY0Amw8; 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 x64si5407059oig.34.2020.03.29.22.53.33; Sun, 29 Mar 2020 22:53:46 -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=hoY0Amw8; 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 S1728738AbgC3FxA (ORCPT + 99 others); Mon, 30 Mar 2020 01:53:00 -0400 Received: from ushosting.nmnhosting.com ([66.55.73.32]:37298 "EHLO ushosting.nmnhosting.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728492AbgC3FxA (ORCPT ); Mon, 30 Mar 2020 01:53:00 -0400 Received: from mail2.nmnhosting.com (unknown [202.169.106.97]) by ushosting.nmnhosting.com (Postfix) with ESMTPS id 7AF382DC6858; Mon, 30 Mar 2020 16:52:48 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=d-silva.org; s=201810a; t=1585547569; bh=g2tKnklWJ8nRzWz5jOb4SQnCXOC8tlA+PKeUIsvkvgs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hoY0Amw8E3jMSf124cMI1wOBWdhV16swXKrVuGoVuKJBlh/3/iI04X2bHZTflwSVT rXkGmTHKruF/ots8Q5MKXaWfN0FTpt6tBiDh44ZwOyTu+MjrxVmhH3f+1ZbJvqCY9T 8p4a6Z+1e0cD086gWlUP0filTlBTCQyDL6L4ikJ5KfcZAd/WFDiTUxYmERPNcQ8LO1 dVvD31gngYJE56oQA2OMztgkhZwDMSuUyo4rurny1G2ArnKsFgg755eAnzTE+dDBLB kusCv/GKPBY04EUChSAd95Z301G9lNDqGLp6YwFYrcwEk/0HugQDFLS/6em0wul/3e eJ1lBvVRdTCXPo2EenFtjKu9WVdT3b08+EVkoY7u01Tvsy8RUkHavAhN/EXnGBYy7b 6teojKsAvPV4TXtwVIlKKXPgk1+euhW7uNgDbDCu4wJ6aVdak6PuZFkaydM7I/Io+x GIsf1TuI8RrZUBymhW1SvPuTVpH2iedMZZwDQJKIA9RByNtaLZLszsx59gxS26bFfE cWr0XYAzlnA2pq1V4GBMTtfvLJ2bKIFX84BVuPasQ7aB0Gwk8tem7NaxLJAp910yoF +lXFcuTaHlxiopdYshGLHOXT1lwOv3FyRkv/jAc2cyQrqp7AdMd/4ovUfT2+/bYZ/C er5boYLjD7a0hnoy9MFr6D50= Received: from localhost.lan ([10.0.1.179]) by mail2.nmnhosting.com (8.15.2/8.15.2) with ESMTP id 02R7C4At045934; 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 20/25] nvdimm/ocxl: Add an IOCTL to request controller health & perf data Date: Fri, 27 Mar 2020 18:11:57 +1100 Message-Id: <20200327071202.2159885-21-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 When health & performance data is requested from the controller, it responds with an error log containing the requested information. This patch allows the request to be issued via an IOCTL, the data can later be collected in userspace via the error log IOCTL introduced in a previous patch. Userspace will be notified of pending error logs via an event. Signed-off-by: Alastair D'Silva --- drivers/nvdimm/ocxl/main.c | 16 ++++++++++++++++ include/uapi/nvdimm/ocxlpmem.h | 1 + 2 files changed, 17 insertions(+) diff --git a/drivers/nvdimm/ocxl/main.c b/drivers/nvdimm/ocxl/main.c index cb6cdc9eb899..a4315472683c 100644 --- a/drivers/nvdimm/ocxl/main.c +++ b/drivers/nvdimm/ocxl/main.c @@ -991,6 +991,18 @@ static int ioctl_event_check(struct ocxlpmem *ocxlpmem, u64 __user *uarg) return rc; } +/** + * req_controller_health_perf() - Request controller health & performance data + * @ocxlpmem: the device metadata + * Return: 0 on success, negative on failure + */ +int req_controller_health_perf(struct ocxlpmem *ocxlpmem) +{ + return ocxl_global_mmio_set64(ocxlpmem->ocxl_afu, GLOBAL_MMIO_HCI, + OCXL_LITTLE_ENDIAN, + GLOBAL_MMIO_HCI_REQ_HEALTH_PERF); +} + static long file_ioctl(struct file *file, unsigned int cmd, unsigned long args) { struct ocxlpmem *ocxlpmem = file->private_data; @@ -1028,6 +1040,10 @@ static long file_ioctl(struct file *file, unsigned int cmd, unsigned long args) case IOCTL_OCXLPMEM_EVENT_CHECK: rc = ioctl_event_check(ocxlpmem, (u64 __user *)args); break; + + case IOCTL_OCXLPMEM_REQUEST_HEALTH: + rc = req_controller_health_perf(ocxlpmem); + break; } return rc; diff --git a/include/uapi/nvdimm/ocxlpmem.h b/include/uapi/nvdimm/ocxlpmem.h index d573bd307e35..9c5c8585c1c2 100644 --- a/include/uapi/nvdimm/ocxlpmem.h +++ b/include/uapi/nvdimm/ocxlpmem.h @@ -91,5 +91,6 @@ struct ioctl_ocxlpmem_eventfd { #define IOCTL_OCXLPMEM_CONTROLLER_STATS _IO(OCXLPMEM_MAGIC, 0x34) #define IOCTL_OCXLPMEM_EVENTFD _IOW(OCXLPMEM_MAGIC, 0x35, struct ioctl_ocxlpmem_eventfd) #define IOCTL_OCXLPMEM_EVENT_CHECK _IOR(OCXLPMEM_MAGIC, 0x36, __u64) +#define IOCTL_OCXLPMEM_REQUEST_HEALTH _IO(OCXLPMEM_MAGIC, 0x37) #endif /* _UAPI_OCXL_SCM_H */ -- 2.24.1