From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2B4CC83026 for ; Thu, 2 Sep 2021 17:07:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8CB63610A0 for ; Thu, 2 Sep 2021 17:07:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234491AbhIBRIz (ORCPT ); Thu, 2 Sep 2021 13:08:55 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:3718 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346535AbhIBRIy (ORCPT ); Thu, 2 Sep 2021 13:08:54 -0400 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) 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 Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org 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 > +};