Re: [PATCH v2 4/8] cxl/mem: Add basic IOCTL interface

2021-02-14 Thread Al Viro
On Sun, Feb 14, 2021 at 11:50:12PM +, Al Viro wrote: > check that len is reasonable > p = kmalloc(offsetof(struct foo, string[len]), GFP_KERNEL); > copy_from_user(p, user_object, len); offsetof(struct foo, string[len]), that is

Re: [PATCH v2 4/8] cxl/mem: Add basic IOCTL interface

2021-02-14 Thread Al Viro
On Sun, Feb 14, 2021 at 03:14:56PM -0800, Ben Widawsky wrote: > On 21-02-14 16:30:09, Al Viro wrote: > > On Tue, Feb 09, 2021 at 04:02:55PM -0800, Ben Widawsky wrote: > > > > > +static int handle_mailbox_cmd_from_user(struct cxl_memdev *cxlmd, > > > + const struct c

Re: [PATCH v2 4/8] cxl/mem: Add basic IOCTL interface

2021-02-14 Thread Ben Widawsky
On 21-02-14 16:30:09, Al Viro wrote: > On Tue, Feb 09, 2021 at 04:02:55PM -0800, Ben Widawsky wrote: > > > +static int handle_mailbox_cmd_from_user(struct cxl_memdev *cxlmd, > > + const struct cxl_mem_command *cmd, > > + u64 in_pa

Re: [PATCH v2 4/8] cxl/mem: Add basic IOCTL interface

2021-02-14 Thread Al Viro
On Tue, Feb 09, 2021 at 04:02:55PM -0800, Ben Widawsky wrote: > +static int handle_mailbox_cmd_from_user(struct cxl_memdev *cxlmd, > + const struct cxl_mem_command *cmd, > + u64 in_payload, u64 out_payload, > +

Re: [PATCH v2 4/8] cxl/mem: Add basic IOCTL interface

2021-02-11 Thread Ben Widawsky
On 21-02-11 10:06:46, Jonathan Cameron wrote: > On Wed, 10 Feb 2021 20:40:52 -0800 > Dan Williams wrote: > > > On Wed, Feb 10, 2021 at 10:47 AM Jonathan Cameron > > wrote: > > [..] > > > > +#define CXL_CMDS > > > >\ > > > > + ___C(IN

Re: [PATCH v2 4/8] cxl/mem: Add basic IOCTL interface

2021-02-11 Thread Jonathan Cameron
On Wed, 10 Feb 2021 20:40:52 -0800 Dan Williams wrote: > On Wed, Feb 10, 2021 at 10:47 AM Jonathan Cameron > wrote: > [..] > > > +#define CXL_CMDS > > > \ > > > + ___C(INVALID, "Invalid Command"), \ > >

Re: [PATCH v2 4/8] cxl/mem: Add basic IOCTL interface

2021-02-10 Thread Dan Williams
On Wed, Feb 10, 2021 at 10:47 AM Jonathan Cameron wrote: [..] > > +#define CXL_CMDS \ > > + ___C(INVALID, "Invalid Command"), \ > > + ___C(IDENTIFY, "Identify Command"), \

Re: [PATCH v2 4/8] cxl/mem: Add basic IOCTL interface

2021-02-10 Thread Ben Widawsky
On 21-02-10 18:45:40, Jonathan Cameron wrote: > On Tue, 9 Feb 2021 16:02:55 -0800 > Ben Widawsky wrote: > > > Add a straightforward IOCTL that provides a mechanism for userspace to > > query the supported memory device commands. CXL commands as they appear > > to userspace are described as part o

Re: [PATCH v2 4/8] cxl/mem: Add basic IOCTL interface

2021-02-10 Thread Jonathan Cameron
On Tue, 9 Feb 2021 16:02:55 -0800 Ben Widawsky wrote: > Add a straightforward IOCTL that provides a mechanism for userspace to > query the supported memory device commands. CXL commands as they appear > to userspace are described as part of the UAPI kerneldoc. The command > list returned via this

[PATCH v2 4/8] cxl/mem: Add basic IOCTL interface

2021-02-09 Thread Ben Widawsky
Add a straightforward IOCTL that provides a mechanism for userspace to query the supported memory device commands. CXL commands as they appear to userspace are described as part of the UAPI kerneldoc. The command list returned via this IOCTL will contain the full set of commands that the driver sup