From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Davidlohr Bueso <dave@stgolabs.net>
Cc: <linux-cxl@vger.kernel.org>,
Dan Williams <dan.j.williams@intel.com>, <linuxarm@huawei.com>,
Alison Schofield <alison.schofield@intel.com>,
"Ira Weiny" <ira.weiny@intel.com>,
Dave Jiang <dave.jiang@intel.com>,
"Shesha Bhushan Sreenivasamurthy" <sheshas@marvell.com>,
Gregory Price <gregory.price@memverge.com>,
Viacheslav Dubeyko <slava@dubeyko.com>, <fan.ni@samsung.com>,
<a.manzanares@samsung.com>
Subject: Re: [RFC PATCH v4 2/4] cxl: mbox: Factor out the mbox specific data for reuse in switch cci
Date: Fri, 4 Aug 2023 10:38:21 +0100 [thread overview]
Message-ID: <20230804103821.00004820@Huawei.com> (raw)
In-Reply-To: <klyeobxdmjsmbbu43pllrdu5uzcmply7ijdlaxegeriutzhxgs@ywp3ymuw5uqb>
On Fri, 21 Jul 2023 09:48:16 -0700
Davidlohr Bueso <dave@stgolabs.net> wrote:
> On Wed, 19 Jul 2023, Jonathan Cameron wrote:
>
> > #ifndef __CXLMBOX_H__
> > #define __CXLMBOX_H__
>
> Unrelated but looks like cxlmem.h needs s/__CXL_MEM_H__/__CXLMEM_H__
>
> >
> >-struct cxl_dev_state;
> >-int cxl_pci_mbox_wait_for_doorbell(struct cxl_dev_state *cxlds);
> >-bool cxl_mbox_background_complete(struct cxl_dev_state *cxlds);
> >+#include <linux/irqreturn.h>
> >+#include <linux/export.h>
> >+#include <linux/io.h>
> >+
> >+#include <uapi/linux/cxl_mem.h>
> >+
> >+struct device;
> >+struct cxl_mbox_cmd;
>
> Would it make sense to instead move the whole cxl_mbox_cmd out of
> cxlmem.h into here? Same for the cmd rc table stuff. Then cxlmem
> can include cxlmbox.
>
> >+struct cxl_mbox {
> >+ struct device *dev; /* Used for debug prints */
> >+ size_t payload_size;
> >+ struct mutex mbox_mutex; /* Protects device mailbox and firmware */
> >+ DECLARE_BITMAP(enabled_cmds, CXL_MEM_COMMAND_ID_MAX);
> >+ DECLARE_BITMAP(exclusive_cmds, CXL_MEM_COMMAND_ID_MAX);
> >+ struct rcuwait mbox_wait;
> >+ int (*mbox_send)(struct cxl_mbox *mbox,
> >+ struct cxl_mbox_cmd *cmd);
> >+ bool (*special_irq)(struct cxl_mbox *mbox, u16 opcode);
> >+ void (*special_init_poll)(struct cxl_mbox *mbox);
> >+ bool (*special_bg)(struct cxl_mbox *mbox, u16 opcode);
> >+ u64 (*get_status)(struct cxl_mbox *mbox);
> >+ bool (*can_run)(struct cxl_mbox *mbox, u16 opcode);
> >+ void (*extra_cmds)(struct cxl_mbox *mbox, u16 opcode);
>
> Ok, so most of these corner cases are wrt Sanitize. Do you have
> anything in mind what would require such any additional users
> in the future (such as completely taking over the device), beyond
> pci mailbox? Otherwise this feels too ad-hoc with only the naming
> being generic. Perhaps instead have some sort of mbox->type and
> handle accordingly directly in the core mbox calls? It would be
> nice to have these callbacks somewhat documented.
>
> Also the 'can_run' name is a bit disconnected from the sanitize
> special case, maybe be rename to something like 'special_canrun'?
I thought a bit more on this and the special_can_run is too specific
as it's not the special command that is restricted, but rather could
be any command as a result of a special command being in flight.
I can't think of a better name for that :(
>
> >+ /* Also needs access to registers */
> >+ void __iomem *status, *mbox;
> >+};
> >+
>
> Thanks,
> Davidlohr
next prev parent reply other threads:[~2023-08-04 9:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-19 9:19 [RFC PATCH v4 0/4] CXL: Standalone switch CCI driver Jonathan Cameron
2023-07-19 9:19 ` [RFC PATCH v4 1/4] cxl: mbox: Preparatory move of functions to core/mbox.c Jonathan Cameron
2023-07-19 9:19 ` [RFC PATCH v4 2/4] cxl: mbox: Factor out the mbox specific data for reuse in switch cci Jonathan Cameron
2023-07-21 16:48 ` Davidlohr Bueso
2023-08-03 16:47 ` Jonathan Cameron
2023-08-03 17:12 ` Jonathan Cameron
2023-08-04 9:38 ` Jonathan Cameron [this message]
2023-07-19 9:19 ` [RFC PATCH v4 3/4] PCI: Add PCI_CLASS_SERIAL_CXL_SWITCH_CCI class ID to pci_ids.h Jonathan Cameron
2023-07-19 9:19 ` [RFC PATCH v4 4/4] cxl/pci: Add support for stand alone CXL Switch mailbox CCI Jonathan Cameron
2023-07-26 16:29 ` Davidlohr Bueso
2023-07-26 20:00 ` Davidlohr Bueso
2023-07-27 9:49 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230804103821.00004820@Huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=a.manzanares@samsung.com \
--cc=alison.schofield@intel.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=fan.ni@samsung.com \
--cc=gregory.price@memverge.com \
--cc=ira.weiny@intel.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=sheshas@marvell.com \
--cc=slava@dubeyko.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox