From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C5CA72 for ; Thu, 2 Sep 2021 17:07:56 +0000 (UTC) Received: from fraeml715-chm.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4H0nPr0Dd7z67Ntg; Fri, 3 Sep 2021 01:06:08 +0800 (CST) Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by fraeml715-chm.china.huawei.com (10.206.15.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Thu, 2 Sep 2021 19:07:53 +0200 Received: from localhost (10.52.127.69) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Thu, 2 Sep 2021 18:07:52 +0100 Date: Thu, 2 Sep 2021 18:07:53 +0100 From: Jonathan Cameron To: Dan Williams CC: , Ben Widawsky , , , , Subject: Re: [PATCH v3 16/28] cxl/mbox: Introduce the mbox_send operation Message-ID: <20210902180753.00006c02@Huawei.com> In-Reply-To: <162982121207.1124374.6113172345033386781.stgit@dwillia2-desk3.amr.corp.intel.com> References: <162982112370.1124374.2020303588105269226.stgit@dwillia2-desk3.amr.corp.intel.com> <162982121207.1124374.6113172345033386781.stgit@dwillia2-desk3.amr.corp.intel.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; i686-w64-mingw32) Precedence: bulk X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.52.127.69] X-ClientProxiedBy: lhreml715-chm.china.huawei.com (10.201.108.66) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected On Tue, 24 Aug 2021 09:06:52 -0700 Dan Williams wrote: > In preparation for implementing a unit test backend transport for ioctl > operations, and making the mailbox available to the cxl/pmem > infrastructure, move the existing PCI specific portion of mailbox handling > to an "mbox_send" operation. > > With this split all the PCI-specific transport details are comprehended > by a single operation and the rest of the mailbox infrastructure is > 'struct cxl_mem' and 'struct cxl_memdev' generic. > > Acked-by: Ben Widawsky > Signed-off-by: Dan Williams > --- > drivers/cxl/cxlmem.h | 42 ++++++++++++++++++++++++++++ > drivers/cxl/pci.c | 76 ++++++++++++++------------------------------------ > 2 files changed, 63 insertions(+), 55 deletions(-) > > diff --git a/drivers/cxl/cxlmem.h b/drivers/cxl/cxlmem.h > index 8397daea9d9b..a56d8f26a157 100644 > --- a/drivers/cxl/cxlmem.h > +++ b/drivers/cxl/cxlmem.h > @@ -66,6 +66,45 @@ struct cxl_memdev * > devm_cxl_add_memdev(struct device *host, struct cxl_mem *cxlm, > const struct cdevm_file_operations *cdevm_fops); > > +/** > + * struct mbox_cmd - A command to be submitted to hardware. struct cxl_mbox_cmd > + * @opcode: (input) The command set and command submitted to hardware. > + * @payload_in: (input) Pointer to the input payload. > + * @payload_out: (output) Pointer to the output payload. Must be allocated by > + * the caller. > + * @size_in: (input) Number of bytes to load from @payload_in. > + * @size_out: (input) Max number of bytes loaded into @payload_out. > + * (output) Number of bytes generated by the device. For fixed size > + * outputs commands this is always expected to be deterministic. For > + * variable sized output commands, it tells the exact number of bytes > + * written. > + * @return_code: (output) Error code returned from hardware. > + * > + * This is the primary mechanism used to send commands to the hardware. > + * All the fields except @payload_* correspond exactly to the fields described in > + * Command Register section of the CXL 2.0 8.2.8.4.5. @payload_in and > + * @payload_out are written to, and read from the Command Payload Registers > + * defined in CXL 2.0 8.2.8.4.8. > + */ > +struct cxl_mbox_cmd { > + u16 opcode; > + void *payload_in; > + void *payload_out; > + size_t size_in; > + size_t size_out; > + u16 return_code; > +#define CXL_MBOX_SUCCESS 0 > +};