From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756825AbcLSVu0 (ORCPT ); Mon, 19 Dec 2016 16:50:26 -0500 Received: from mga14.intel.com ([192.55.52.115]:62805 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753235AbcLSVuZ (ORCPT ); Mon, 19 Dec 2016 16:50:25 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,375,1477983600"; d="scan'208";a="800196536" Date: Mon, 19 Dec 2016 16:59:54 -0500 From: Keith Busch To: Scott Bauer Cc: linux-nvme@lists.infradead.org, Rafael.Antognolli@intel.com, axboe@fb.com, jonathan.derrick@intel.com, viro@zeniv.linux.org.uk, hch@infradead.org, linux-kernel@vger.kernel.org, sagi@grimberg.me Subject: Re: [PATCH v3 4/5] nvme: Implement resume_from_suspend and SED Allocation code. Message-ID: <20161219215954.GB10634@localhost.localdomain> References: <1482176149-2257-1-git-send-email-scott.bauer@intel.com> <1482176149-2257-5-git-send-email-scott.bauer@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1482176149-2257-5-git-send-email-scott.bauer@intel.com> User-Agent: Mutt/1.7.0 (2016-08-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 19, 2016 at 12:35:48PM -0700, Scott Bauer wrote: > +static int nvme_sec_submit(struct nvme_ctrl *ctrl, u16 spsp, u8 secp, > + void *buffer, size_t len, u8 opcode) > +{ > + struct nvme_command cmd = { 0 }; > + struct nvme_ns *ns = NULL; > + > + mutex_lock(&ctrl->namespaces_mutex); > + if (!list_empty(&ctrl->namespaces)) > + ns = list_first_entry(&ctrl->namespaces, struct nvme_ns, list); > + > + mutex_unlock(&ctrl->namespaces_mutex); > + if (!ns) > + return -ENODEV; > + > + cmd.common.opcode = opcode; > + cmd.common.nsid = ns->ns_id; Should be: cmd.common.nsid = cpu_to_le32(ns->ns_id); But now wondering how you can send a security command to different namespaces. That's why I thought it'd make more sense to threa this through block_device, but maybe Christoph had some idea on how to get the same functionality without that? From mboxrd@z Thu Jan 1 00:00:00 1970 From: keith.busch@intel.com (Keith Busch) Date: Mon, 19 Dec 2016 16:59:54 -0500 Subject: [PATCH v3 4/5] nvme: Implement resume_from_suspend and SED Allocation code. In-Reply-To: <1482176149-2257-5-git-send-email-scott.bauer@intel.com> References: <1482176149-2257-1-git-send-email-scott.bauer@intel.com> <1482176149-2257-5-git-send-email-scott.bauer@intel.com> Message-ID: <20161219215954.GB10634@localhost.localdomain> On Mon, Dec 19, 2016@12:35:48PM -0700, Scott Bauer wrote: > +static int nvme_sec_submit(struct nvme_ctrl *ctrl, u16 spsp, u8 secp, > + void *buffer, size_t len, u8 opcode) > +{ > + struct nvme_command cmd = { 0 }; > + struct nvme_ns *ns = NULL; > + > + mutex_lock(&ctrl->namespaces_mutex); > + if (!list_empty(&ctrl->namespaces)) > + ns = list_first_entry(&ctrl->namespaces, struct nvme_ns, list); > + > + mutex_unlock(&ctrl->namespaces_mutex); > + if (!ns) > + return -ENODEV; > + > + cmd.common.opcode = opcode; > + cmd.common.nsid = ns->ns_id; Should be: cmd.common.nsid = cpu_to_le32(ns->ns_id); But now wondering how you can send a security command to different namespaces. That's why I thought it'd make more sense to threa this through block_device, but maybe Christoph had some idea on how to get the same functionality without that?