Received: by 10.223.185.116 with SMTP id b49csp3593821wrg; Tue, 13 Feb 2018 04:51:15 -0800 (PST) X-Google-Smtp-Source: AH8x226Nm2WVVPgPAPl4Et6twr+GgUpdV2CftAcf7sOFGwL6IsX9jOmD+zyVP8og453+B9V50BCP X-Received: by 10.101.100.147 with SMTP id e19mr961615pgv.88.1518526275146; Tue, 13 Feb 2018 04:51:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518526275; cv=none; d=google.com; s=arc-20160816; b=arj9jy0egCRxQl3QIePyzzZHV8J6yyWTWnUqJC2WN6DFOkfOxQhfriraHHcOvzW/GF RoOpXFUDu+2xwIEFwSirnVbiJw8YFLe0rR9Ndq3T6m9kYhmijRrpflVFJLLdiGIh9IaY 8CII84+ZjxhP1kQSmC6zyfBlbRg/00QKINs0puCbhF0pikCixasOO6YW0ijeHnKKDaIj 2ekzOip+NlPeACjOUnghxxeuePtyJ01CsgSoYZeYS8I1GM8zIMc7FRdxpEg1Vxp57BUI McHEE+SSlsYQPs8XfBHuhU5ErYw7l9zpae+y+sVY5JwR7n2D+WRRImVbPFf+w6O9eJSz 0/1w== 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:arc-authentication-results; bh=bHJmoO+9lBAqY46bj9ZOb70ORyug1F023GVQ5y3Qqz0=; b=V6zEGdpTMsNa5PIvF5QnQ0NmVUl/JGjMmZ/CXRc6WfbMcR9v7WoHlysNp9Qp+8IUgk mUH9fKpWyP+E8ii/TbZ9bQuQeMp/+SVSNeQ3d7tp8AolbAOylvrHHsUIJflSb29N+dUX Qaa97oQZSR9I8Y8HGOjE1rdK1J6bqGiyWz6E4IfHc93ubD7cgSf/fDemIJpIEF8sH8VL foYiLo0ekf3rfxxG5HwOwdixrP12J4+1sYY6SybJO6Xqxf/qOF31S0sqp0sWP4P33oeD YR7G1pKCWIKLDdSEfwOs2cr+IGN3hlNs0IbFEmAh9ysH4QgppNrlMJaXL/yCaDl8C/Jn o8KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lightnvm-io.20150623.gappssmtp.com header.s=20150623 header.b=dPbfsKjG; 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 n9si1240798pgc.36.2018.02.13.04.51.00; Tue, 13 Feb 2018 04:51:15 -0800 (PST) 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=@lightnvm-io.20150623.gappssmtp.com header.s=20150623 header.b=dPbfsKjG; 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 S964796AbeBMMuT (ORCPT + 99 others); Tue, 13 Feb 2018 07:50:19 -0500 Received: from mail-lf0-f65.google.com ([209.85.215.65]:34840 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935079AbeBMMuP (ORCPT ); Tue, 13 Feb 2018 07:50:15 -0500 Received: by mail-lf0-f65.google.com with SMTP id a204so24898826lfa.2 for ; Tue, 13 Feb 2018 04:50:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lightnvm-io.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bHJmoO+9lBAqY46bj9ZOb70ORyug1F023GVQ5y3Qqz0=; b=dPbfsKjGnSS7xGEGt4OIFsX7MFqtntsVe57joiFPgEY7GE1ioAZ178kr9PgLljwBSD W2G8yBlqLNpvwq14sIzDzOLle1ht9/3itHiFjhHPLAK1K8JUdW/bs1KU4QEqT9ZJ6FkI UEGN68OMeygQDDA5QFB2+N3S9qt7ck4dK1FYIXnHFECjc4t6ONt3Q2JpNbrUQD3sYwkk 3j/VQjhtnvenJpKaDIZoINAf7bWLOIa3/UKC1MTVrsXUII9zo0brt2sMuOT6UlvnS//n a0eWra7gidF074HRBZlfLJ+ggloaUsroqSUv4Fwrep15j4IBdWny6u8KwbvzyKhyVILv P5mA== 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:mime-version:content-transfer-encoding; bh=bHJmoO+9lBAqY46bj9ZOb70ORyug1F023GVQ5y3Qqz0=; b=J0HtXXjTEymw5XwKdGZqt2ZwNTIGwsu/sjYH94wI0XxNjc0CF+/+q24McinujNF7/a jmHmGKVWUkclYD3m1lu44xa8VdD2cT1k0/Z+ytK7TZrA+o+Bz4V9S1zCPdpPIPvtMb1y THbMI79zj1Vb+13zgz3cwvFUtVXcjvpQmMq+WJ4qITe0ozVlseKmxTgNiScEdijSoxAm LOD9XsGxujak+99sRRkoHUilCdH48tj1bRNFOWSusbY1A8tVOwvLFFC0kv9X+7sURs8C o3HZqZ+qIHPjpZJ6xVzyQXXp6dtgettisbH1O+5xN5V87JnyEBV0l0IYrWwo+8agIqiO ExDA== X-Gm-Message-State: APf1xPBgVhU9PBi4R351BXstmJsTa4+PAIvqQw7yz5QlMUK02am3JEE2 LCvR04bD2TT+uRkfHpsemp8nUQ== X-Received: by 10.46.60.24 with SMTP id j24mr909306lja.140.1518526214110; Tue, 13 Feb 2018 04:50:14 -0800 (PST) Received: from Macroninja.cnexlabs.com (x1-6-a4-08-f5-18-3c-3a.cpe.webspeed.dk. [188.176.29.198]) by smtp.gmail.com with ESMTPSA id m18sm2166776lfj.34.2018.02.13.04.50.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Feb 2018 04:50:13 -0800 (PST) From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: hch@lst.de, keith.busch@intel.com Cc: linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, javier@cnexlabs.com, =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [PATCH 1/1] nvme: implement log page low/high offset and dwords Date: Tue, 13 Feb 2018 13:49:16 +0100 Message-Id: <20180213124916.28653-2-mb@lightnvm.io> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180213124916.28653-1-mb@lightnvm.io> References: <20180213124916.28653-1-mb@lightnvm.io> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org NVMe 1.2.1 extends the get log page interface to include 64 bit offset and increases the number of dwords to 32 bits. Implement for future use. Signed-off-by: Matias Bjørling --- drivers/nvme/host/core.c | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 740ceb28067c..f59527b93444 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -80,11 +80,6 @@ static struct class *nvme_subsys_class; static void nvme_ns_remove(struct nvme_ns *ns); static int nvme_revalidate_disk(struct gendisk *disk); -static __le32 nvme_get_log_dw10(u8 lid, size_t size) -{ - return cpu_to_le32((((size / 4) - 1) << 16) | lid); -} - int nvme_reset_ctrl(struct nvme_ctrl *ctrl) { if (!nvme_change_ctrl_state(ctrl, NVME_CTRL_RESETTING)) @@ -2132,16 +2127,33 @@ static int nvme_init_subsystem(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id) return ret; } +int nvme_get_log_ext(struct nvme_ctrl *ctrl, struct nvme_ns *ns, + u8 log_page, void *log, + size_t size, size_t offset) +{ + struct nvme_command c = { }; + unsigned long dwlen = (size / 4) - 1; + + c.get_log_page.opcode = nvme_admin_get_log_page; + + if (ns) + c.get_log_page.nsid = cpu_to_le32(ns->head->ns_id); + else + c.get_log_page.nsid = cpu_to_le32(NVME_NSID_ALL); + + c.get_log_page.lid = log_page; + c.get_log_page.numdl = cpu_to_le16(dwlen & ((1 << 16) - 1)); + c.get_log_page.numdu = cpu_to_le16(dwlen >> 16); + c.get_log_page.lpol = cpu_to_le32(offset & ((1ULL << 32) - 1)); + c.get_log_page.lpou = cpu_to_le32(offset >> 32); + + return nvme_submit_sync_cmd(ctrl->admin_q, &c, log, size); +} + static int nvme_get_log(struct nvme_ctrl *ctrl, u8 log_page, void *log, size_t size) { - struct nvme_command c = { }; - - c.common.opcode = nvme_admin_get_log_page; - c.common.nsid = cpu_to_le32(NVME_NSID_ALL); - c.common.cdw10[0] = nvme_get_log_dw10(log_page, size); - - return nvme_submit_sync_cmd(ctrl->admin_q, &c, log, size); + return nvme_get_log_ext(ctrl, NULL, log_page, log, size, 0); } static int nvme_get_effects_log(struct nvme_ctrl *ctrl) -- 2.11.0