Received: by 10.223.185.116 with SMTP id b49csp3767262wrg; Mon, 26 Feb 2018 05:50:25 -0800 (PST) X-Google-Smtp-Source: AH8x226iXYuuf3I2wEwcWTQPqBdw7uQ50cYNUbqU89XlkVdVJXKSoWdqP9vcVs7DchOEZfpx20wc X-Received: by 10.98.231.26 with SMTP id s26mr10648275pfh.210.1519653025799; Mon, 26 Feb 2018 05:50:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519653025; cv=none; d=google.com; s=arc-20160816; b=RmehHr2eSb/nw0D7VJI4aI+6AGgEorfqfQQ0el+7691JhFtW8/SVM3huEpbJsaP96R /NEqptJsu2NciA8l4aeRU/Uwf12LsAZ3UGGSXjwkmo7Sk6l6H7uhFBjujAXf+ZX5Lo+c FDGOV9T4F3zuikSG3HiRDo4dxmcfIhoZiP7R5aD/TXbwVJV4wIbEhBAbQiomfS6guJKm B+uILxJCxMZdDzYoRcXqAW+5sQeG4pixhSEZcRCNezcTUyyA9ErHd+lZg9cyG1ETlMGg nQsCOHnerD/MV1gQZ29qbOoHMy3J5ALBWR9h+Rkrk8XJoUtswR65XznANgD9JK1eznPX cbBw== 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=RVZPqC3SDwr1LFIESstMbazqqb6tqKYnNa8bECnOokI=; b=dRyjpAxIuGA5uC4UQokeMlnyLtBhCYwQtfKoLmcKbKnQ45fsRCrHxeUlZs3zrTHw37 9s0mbeiRVFo3K0drxNmEzpey8DbWbzAnUaw92RXsKyUnc/O3McUky/AI7XyOg6f32wqq AA9wM2iDatZgm5pcVWVm7Ei5wtQYF+lHbZK5h3aRTNnCNM+TpmMom+wAW3bN5vO+srdJ iz5dR9NxZ9Vd+rv7SJ5tUbQf+CNIa+BWaNbB7PssMQ07OK5AMf02SXJg7PZaUpPS78W/ jexP8QeUy6H94s+y4GrpU50tfiGQx1hbN2GvUaS5yFegmdEVYCLJSUa45B3zAIhdTIBT BaLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lightnvm-io.20150623.gappssmtp.com header.s=20150623 header.b=HY7rmC94; 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 k11-v6si6808557plt.531.2018.02.26.05.50.10; Mon, 26 Feb 2018 05:50:25 -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=HY7rmC94; 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 S1752902AbeBZM4I (ORCPT + 99 others); Mon, 26 Feb 2018 07:56:08 -0500 Received: from mail-lf0-f65.google.com ([209.85.215.65]:40622 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752449AbeBZM4E (ORCPT ); Mon, 26 Feb 2018 07:56:04 -0500 Received: by mail-lf0-f65.google.com with SMTP id 37so22028175lfs.7 for ; Mon, 26 Feb 2018 04:56:04 -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=RVZPqC3SDwr1LFIESstMbazqqb6tqKYnNa8bECnOokI=; b=HY7rmC94SSvmu8VaEpk+dxPL4TDPDTLwKl77J5gyJI699ilf6QOSTohTouFOiP471L x7vBd78ITyP+wdkdJ8bQnx7EyvBWir7mAIOb6IDPnL95dwgbRuZDgsvLkkAn89Pca/J3 p9WhiOSl2UV3N+C8X2/JoanHlsAzeUBWw2U/gM5jEksrdN2VSjC97VYJak1ow3LmPllL +sBKqrqDQSUTj2LlILqY6ynQ7VUhA+vQZ9k+q3caHC8W5BENPodkbVuxHt2EWo3epjl5 XvwLJHE1IsAWg4CWwJu83WqV5itNw8IcWq5HGPsfmpMoIom5ayuXbMsvj3o6y7tmFOKE u5SQ== 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=RVZPqC3SDwr1LFIESstMbazqqb6tqKYnNa8bECnOokI=; b=g3Riq4trZkHQ0NuFM3GPgBzscTHS98/wVRypbB+vcB2SQgefsInXvQjwkPq0qId8x8 puvAif9KoVHadDPMqSJZrnOgVstqH0AjmW+8ZI7zkZS9+E7OfdPU7wFzJoWVI+EFfWjN vgAwhTxewQaKGS1VaYE0zHTZIRGMlf8lKpdhjFP+6hzhXMh19zHyF56R2A+lf57+/nSh B/AjhXZjAJDhxMlhCRJRlwW701yFZRLRF4KhpfBIa31JAepskIbDH6bPZqjA/tC6Ijf7 Zm/hEif+/zP0sP4itmiSNWYmp43QkQLc03vllzR7wTrjpnptm/eI4Ov8/W1tC6KghC39 cRZA== X-Gm-Message-State: APf1xPCzF9YrzrvLgRAUUyW+yXIM3Kl4uwwe2gq2DV9SFghXLxpHlQvf 1j1tIaPCNMIMXZQQ6+NgveJhk3CY X-Received: by 10.25.89.206 with SMTP id n197mr7987385lfb.134.1519649763313; Mon, 26 Feb 2018 04:56:03 -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 d27sm1515945lfb.73.2018.02.26.04.56.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Feb 2018 04:56:02 -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, jthumshirn@suse.de, =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [PATCH v2 1/1] nvme: implement log page low/high offset and dwords Date: Mon, 26 Feb 2018 13:55:40 +0100 Message-Id: <20180226125540.9513-2-mb@lightnvm.io> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180226125540.9513-1-mb@lightnvm.io> References: <20180226125540.9513-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..2e9e9f973a75 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; } +static 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 >> 32ULL); + + 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