Skip to content

Commit

Permalink
cxl/mbox: Move mailbox and other non-PCI specific infrastructure to t…
Browse files Browse the repository at this point in the history
…he core

Now that the internals of mailbox operations are abstracted from the PCI
specifics a bulk of infrastructure can move to the core.

The CXL_PMEM driver intends to proxy LIBNVDIMM UAPI and driver requests
to the equivalent functionality provided by the CXL hardware mailbox
interface. In support of that intent move the mailbox implementation to
a shared location for the CXL_PCI driver native IOCTL path and CXL_PMEM
nvdimm command proxy path to share.

A unit test framework seeks to implement a unit test backend transport
for mailbox commands to communicate mocked up payloads. It can reuse all
of the mailbox infrastructure minus the PCI specifics, so that also gets
moved to the core.

Finally with the mailbox infrastructure and ioctl handling being
transport generic there is no longer any need to pass file
file_operations to devm_cxl_add_memdev(). That allows all the ioctl
boilerplate to move into the core for unit test reuse.

No functional change intended, just code movement.

Acked-by: Ben Widawsky <ben.widawsky@intel.com>
Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/163116435233.2460985.16197340449713287180.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
  • Loading branch information
Dan Williams committed Sep 21, 2021
1 parent 4cb35f1 commit 4faf31b
Show file tree
Hide file tree
Showing 8 changed files with 975 additions and 949 deletions.
3 changes: 3 additions & 0 deletions Documentation/driver-api/cxl/memory-devices.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ CXL Core
.. kernel-doc:: drivers/cxl/core/regs.c
:doc: cxl registers

.. kernel-doc:: drivers/cxl/core/mbox.c
:doc: cxl mbox

External Interfaces
===================

Expand Down
1 change: 1 addition & 0 deletions drivers/cxl/core/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ cxl_core-y := bus.o
cxl_core-y += pmem.o
cxl_core-y += regs.o
cxl_core-y += memdev.o
cxl_core-y += mbox.o
4 changes: 4 additions & 0 deletions drivers/cxl/core/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,8 @@ static __init int cxl_core_init(void)
{
int rc;

cxl_mbox_init();

rc = cxl_memdev_init();
if (rc)
return rc;
Expand All @@ -646,13 +648,15 @@ static __init int cxl_core_init(void)

err:
cxl_memdev_exit();
cxl_mbox_exit();
return rc;
}

static void cxl_core_exit(void)
{
bus_unregister(&cxl_bus_type);
cxl_memdev_exit();
cxl_mbox_exit();
}

module_init(cxl_core_init);
Expand Down
8 changes: 8 additions & 0 deletions drivers/cxl/core/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@ static inline void unregister_cxl_dev(void *dev)
device_unregister(dev);
}

struct cxl_send_command;
struct cxl_mem_query_commands;
int cxl_query_cmd(struct cxl_memdev *cxlmd,
struct cxl_mem_query_commands __user *q);
int cxl_send_cmd(struct cxl_memdev *cxlmd, struct cxl_send_command __user *s);

int cxl_memdev_init(void);
void cxl_memdev_exit(void);
void cxl_mbox_init(void);
void cxl_mbox_exit(void);

#endif /* __CXL_CORE_H__ */
Loading

0 comments on commit 4faf31b

Please sign in to comment.