Message ID | 20221025104243.20836-3-Jonathan.Cameron@huawei.com |
---|---|
State | New, archived |
Headers | show |
Series | CXL: Standalone switch CCI driver | expand |
Jonathan Cameron wrote: > Intent here is to enable CXL switch CCIs in the following patch. > > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> > --- > drivers/cxl/core/core.h | 5 ++++- > drivers/cxl/core/mbox.c | 5 ++--- > drivers/cxl/core/memdev.c | 4 +++- > 3 files changed, 9 insertions(+), 5 deletions(-) > > diff --git a/drivers/cxl/core/core.h b/drivers/cxl/core/core.h > index 1d8f87be283f..0835942bcea6 100644 > --- a/drivers/cxl/core/core.h > +++ b/drivers/cxl/core/core.h > @@ -41,9 +41,12 @@ static inline void cxl_region_exit(void) > > struct cxl_send_command; > struct cxl_mem_query_commands; > +struct cxl_dev_state; > +struct device; > 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_send_cmd(struct cxl_dev_state *cxlds, struct device *dev, > + struct cxl_send_command __user *s); Me thinks this wants another level of indirection to move the generic mailbox bits out of 'struct cxl_dev_state' into a common structure that endpoint and switch drivers can include in their local driver states. > void __iomem *devm_cxl_iomap_block(struct device *dev, resource_size_t addr, > resource_size_t length); > > diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c > index dd9e0aac37ae..3823d450fdd2 100644 > --- a/drivers/cxl/core/mbox.c > +++ b/drivers/cxl/core/mbox.c > @@ -526,10 +526,9 @@ static int handle_mailbox_cmd_from_user(struct cxl_dev_state *cxlds, > return rc; > } > > -int cxl_send_cmd(struct cxl_memdev *cxlmd, struct cxl_send_command __user *s) > +int cxl_send_cmd(struct cxl_dev_state *cxlds, struct device *dev, > + struct cxl_send_command __user *s) > { > - struct cxl_dev_state *cxlds = cxlmd->cxlds; > - struct device *dev = &cxlmd->dev; > struct cxl_send_command send; > struct cxl_mbox_cmd mbox_cmd; > int rc; > diff --git a/drivers/cxl/core/memdev.c b/drivers/cxl/core/memdev.c > index 20ce488a7754..62840a6da140 100644 > --- a/drivers/cxl/core/memdev.c > +++ b/drivers/cxl/core/memdev.c > @@ -269,11 +269,13 @@ static struct cxl_memdev *cxl_memdev_alloc(struct cxl_dev_state *cxlds, > static long __cxl_memdev_ioctl(struct cxl_memdev *cxlmd, unsigned int cmd, > unsigned long arg) > { > + struct cxl_dev_state *cxlds = cxlmd->cxlds; > + struct device *dev = &cxlmd->dev; > switch (cmd) { > case CXL_MEM_QUERY_COMMANDS: > return cxl_query_cmd(cxlmd, (void __user *)arg); > case CXL_MEM_SEND_COMMAND: > - return cxl_send_cmd(cxlmd, (void __user *)arg); > + return cxl_send_cmd(cxlds, dev, (void __user *)arg); > default: > return -ENOTTY; > } > -- > 2.37.2 >
diff --git a/drivers/cxl/core/core.h b/drivers/cxl/core/core.h index 1d8f87be283f..0835942bcea6 100644 --- a/drivers/cxl/core/core.h +++ b/drivers/cxl/core/core.h @@ -41,9 +41,12 @@ static inline void cxl_region_exit(void) struct cxl_send_command; struct cxl_mem_query_commands; +struct cxl_dev_state; +struct device; 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_send_cmd(struct cxl_dev_state *cxlds, struct device *dev, + struct cxl_send_command __user *s); void __iomem *devm_cxl_iomap_block(struct device *dev, resource_size_t addr, resource_size_t length); diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c index dd9e0aac37ae..3823d450fdd2 100644 --- a/drivers/cxl/core/mbox.c +++ b/drivers/cxl/core/mbox.c @@ -526,10 +526,9 @@ static int handle_mailbox_cmd_from_user(struct cxl_dev_state *cxlds, return rc; } -int cxl_send_cmd(struct cxl_memdev *cxlmd, struct cxl_send_command __user *s) +int cxl_send_cmd(struct cxl_dev_state *cxlds, struct device *dev, + struct cxl_send_command __user *s) { - struct cxl_dev_state *cxlds = cxlmd->cxlds; - struct device *dev = &cxlmd->dev; struct cxl_send_command send; struct cxl_mbox_cmd mbox_cmd; int rc; diff --git a/drivers/cxl/core/memdev.c b/drivers/cxl/core/memdev.c index 20ce488a7754..62840a6da140 100644 --- a/drivers/cxl/core/memdev.c +++ b/drivers/cxl/core/memdev.c @@ -269,11 +269,13 @@ static struct cxl_memdev *cxl_memdev_alloc(struct cxl_dev_state *cxlds, static long __cxl_memdev_ioctl(struct cxl_memdev *cxlmd, unsigned int cmd, unsigned long arg) { + struct cxl_dev_state *cxlds = cxlmd->cxlds; + struct device *dev = &cxlmd->dev; switch (cmd) { case CXL_MEM_QUERY_COMMANDS: return cxl_query_cmd(cxlmd, (void __user *)arg); case CXL_MEM_SEND_COMMAND: - return cxl_send_cmd(cxlmd, (void __user *)arg); + return cxl_send_cmd(cxlds, dev, (void __user *)arg); default: return -ENOTTY; }
Intent here is to enable CXL switch CCIs in the following patch. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> --- drivers/cxl/core/core.h | 5 ++++- drivers/cxl/core/mbox.c | 5 ++--- drivers/cxl/core/memdev.c | 4 +++- 3 files changed, 9 insertions(+), 5 deletions(-)