Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4273371yba; Sun, 12 May 2019 08:56:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqw2TWxjRVAkrkR9JIXepTJIwGsyIMep3l6NJllKoJq/jsKXjV2vhM1NXGPeixHxx4LSzjrJ X-Received: by 2002:a63:5012:: with SMTP id e18mr25805483pgb.383.1557676567712; Sun, 12 May 2019 08:56:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557676567; cv=none; d=google.com; s=arc-20160816; b=geDVcke82Yt3MJzp/AItFvfBw2SEHYSTMgMbqWWZcvv6EBg3ROeVnkF8qpcv6g1L6U z83WgSNRMN1Bv4E8wbeZa0es1XhqK3OCg/0h1qXOEJoKvfASsVepGWip+2eqsLr80JRf bKAc86qniXpublk4j4qhGxJyRU2OA0rtvQfwf+RrC0BTGBIrbIIvUut7LrYguy+L1wDr z6TNcgfPbd91AagSJivbFlLXEc900ak0rQpS24opUdCx1WpInmT0YbPTDthdNovI8MvF j3qD4sL3CmQG/AjZUqe+DaBlNGs9ke6Pbok90BjnPEvpZ+reZp80veCfwHkpcINNLqJL Zzow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=d2wWJz4YMrtwlEJecuuUCAduDMfeNvXVgccKamh1L2Q=; b=TFVam9S9zoGc43Ocbw9nNg39+mAo1vGKaqMBq4uV186NJzuGEFMkpwY3Gh79NCogDS lKuEqTPyfuOdF9unYxwLEdIajdWa7lL+p+gJG5TT6DvBIOSrRDU1QhCxzRKxLY6hkOYR Tb8SAX7AYHrh0COWAT7VpfSflPI0g3E/0TpbgBgWILCafdT4UjJYcXeKQ1QSH8X649Od OX6puBzEZb80/cqysZLSarhntA/z/CW+ecmCdv00znp7WwqACStg0AZhOvZ/APomKWuM H80f18MO4LRhaozrD1uJ807mXLe2viux8U3bCrSIYUEMfBF4xlIQFUMGdGP9LgGuEWvV 2+SA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HTyF8V1i; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 20si14881403pgk.44.2019.05.12.08.55.51; Sun, 12 May 2019 08:56:07 -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=@gmail.com header.s=20161025 header.b=HTyF8V1i; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726910AbfELPyx (ORCPT + 99 others); Sun, 12 May 2019 11:54:53 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:33070 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726478AbfELPyv (ORCPT ); Sun, 12 May 2019 11:54:51 -0400 Received: by mail-pg1-f195.google.com with SMTP id h17so5458574pgv.0 for ; Sun, 12 May 2019 08:54:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=d2wWJz4YMrtwlEJecuuUCAduDMfeNvXVgccKamh1L2Q=; b=HTyF8V1iLjPVxWHbZrbWrT5ZaAU4mLUUHpZIcejE7e9hY0xzp+108g1aABAR2PpEDY 8uWGlXfcIjem/w4djblB78fN/3fnWfukobhZ9J8uuYyhMwEuyDm+PP1c+VfkG4mJNgw1 f2bR7qdWIgGUQbyYzd120QyA4Is98EqOVYY3Q54LyOzkZRe+Mnu4BwYCjwJoOt05/Q55 7uDUOpg6E3LZNgsQONUlaiV1XwFPvFd29eGU2fXe4qHtkCZyuU7YYBUEl8Xr5Ga9GKKJ jsxv/C8j05CN9Oq3RiF2lUuUWvrvMiTSMWJntkP6+S+pr0OYdWRitmmeeQuZhYY1C18v qU4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=d2wWJz4YMrtwlEJecuuUCAduDMfeNvXVgccKamh1L2Q=; b=sMUw6aE05IchlMdF6cKBZj6bOC1P4bdemMHIKHJquScINCl14H/O3fKUFVMEu1laA3 UrEoGIYkjKMLmH0US0tNKlEIJbMpqaaciJbujKnSaes2bvMKoMWBBv4zv03WMk30Il4x vNKItTTARIlNjqLr7oYpmyLTweYRvcCbbBCo8M0aTW5O0LvJGhuAIaqJIhgRTii2lQ4/ NoSFP7PQUb5o1JkNdduTiYFfrdkgBwHOWVe1MezXTJXE3dGpOI2ZwqP/Vy+Me4yqtafr VEiITA5pDoy2THkCeGGQ8xhZnzH/BIoEcpi1EK6indaAAGJt5LoC8k8k0oerRk/COoHd FT8g== X-Gm-Message-State: APjAAAVZ1ohHXQZTUXO6GkvGJwBdUtqRg+p1MDkvu75LtCvYYrm2jOGL FduKK4o3cSBBeOqufN0Zsqc= X-Received: by 2002:a63:1a03:: with SMTP id a3mr26445478pga.412.1557676490807; Sun, 12 May 2019 08:54:50 -0700 (PDT) Received: from mita-MS-7A45.lan ([240f:34:212d:1:918e:f7e4:1728:3f45]) by smtp.gmail.com with ESMTPSA id v2sm4470058pgr.2.2019.05.12.08.54.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 12 May 2019 08:54:50 -0700 (PDT) From: Akinobu Mita To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Akinobu Mita , Johannes Berg , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Minwoo Im , Kenneth Heitke Subject: [PATCH v3 4/7] nvme: add basic facility to get telemetry log page Date: Mon, 13 May 2019 00:54:14 +0900 Message-Id: <1557676457-4195-5-git-send-email-akinobu.mita@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1557676457-4195-1-git-send-email-akinobu.mita@gmail.com> References: <1557676457-4195-1-git-send-email-akinobu.mita@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This adds the required definisions to get telemetry log page. The telemetry log page structure and identifier are copied from nvme-cli. We also need a facility to check log page attributes in order to know the controller supports the telemetry log pages and log page offset field for the Get Log Page command. The telemetry data area could be larger than maximum data transfer size, so we may need to split into multiple transfers with incremental page offset. Cc: Johannes Berg Cc: Keith Busch Cc: Jens Axboe Cc: Christoph Hellwig Cc: Sagi Grimberg Cc: Minwoo Im Cc: Kenneth Heitke Signed-off-by: Akinobu Mita --- * v3 - Merge 'add telemetry log page definisions' patch and 'add facility to check log page attributes' patch - Copy struct nvme_telemetry_log_page_hdr from the latest nvme-cli - Add BUILD_BUG_ON for the size of struct nvme_telemetry_log_page_hdr drivers/nvme/host/core.c | 2 ++ drivers/nvme/host/nvme.h | 1 + include/linux/nvme.h | 17 +++++++++++++++++ 3 files changed, 20 insertions(+) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index a6644a2..0cea2a8 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2585,6 +2585,7 @@ int nvme_init_identify(struct nvme_ctrl *ctrl) } else ctrl->shutdown_timeout = shutdown_timeout; + ctrl->lpa = id->lpa; ctrl->npss = id->npss; ctrl->apsta = id->apsta; prev_apst_enabled = ctrl->apst_enabled; @@ -3898,6 +3899,7 @@ static inline void _nvme_check_size(void) BUILD_BUG_ON(sizeof(struct nvme_id_ctrl) != NVME_IDENTIFY_DATA_SIZE); BUILD_BUG_ON(sizeof(struct nvme_id_ns) != NVME_IDENTIFY_DATA_SIZE); BUILD_BUG_ON(sizeof(struct nvme_lba_range_type) != 64); + BUILD_BUG_ON(sizeof(struct nvme_telemetry_log_page_hdr) != 512); BUILD_BUG_ON(sizeof(struct nvme_smart_log) != 512); BUILD_BUG_ON(sizeof(struct nvme_dbbuf) != 64); BUILD_BUG_ON(sizeof(struct nvme_directive_cmd) != 64); diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index 5ee75b5..7f6f1fc 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -195,6 +195,7 @@ struct nvme_ctrl { u32 vs; u32 sgls; u16 kas; + u8 lpa; u8 npss; u8 apsta; u32 oaes; diff --git a/include/linux/nvme.h b/include/linux/nvme.h index c40720c..8c0b29d 100644 --- a/include/linux/nvme.h +++ b/include/linux/nvme.h @@ -294,6 +294,8 @@ enum { NVME_CTRL_OACS_DIRECTIVES = 1 << 5, NVME_CTRL_OACS_DBBUF_SUPP = 1 << 8, NVME_CTRL_LPA_CMD_EFFECTS_LOG = 1 << 1, + NVME_CTRL_LPA_EXTENDED_DATA = 1 << 2, + NVME_CTRL_LPA_TELEMETRY_LOG = 1 << 3, }; struct nvme_lbaf { @@ -396,6 +398,20 @@ enum { NVME_NIDT_UUID = 0x03, }; +struct nvme_telemetry_log_page_hdr { + __u8 lpi; /* Log page identifier */ + __u8 rsvd[4]; + __u8 iee_oui[3]; + __le16 dalb1; /* Data area 1 last block */ + __le16 dalb2; /* Data area 2 last block */ + __le16 dalb3; /* Data area 3 last block */ + __u8 rsvd1[368]; + __u8 ctrlavail; /* Controller initiated data avail?*/ + __u8 ctrldgn; /* Controller initiated telemetry Data Gen # */ + __u8 rsnident[128]; + __u8 telemetry_dataarea[0]; +}; + struct nvme_smart_log { __u8 critical_warning; __u8 temperature[2]; @@ -832,6 +848,7 @@ enum { NVME_LOG_FW_SLOT = 0x03, NVME_LOG_CHANGED_NS = 0x04, NVME_LOG_CMD_EFFECTS = 0x05, + NVME_LOG_TELEMETRY_CTRL = 0x08, NVME_LOG_ANA = 0x0c, NVME_LOG_DISC = 0x70, NVME_LOG_RESERVATION = 0x80, -- 2.7.4