Linux-i3c Archive on lore.kernel.org
 help / color / Atom feed
From: Vitor Soares <Vitor.Soares@synopsys.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Joao Pinto <Joao.Pinto@synopsys.com>,
	Wolfram Sang <wsa@the-dreams.de>,
	gregkh <gregkh@linuxfoundation.org>,
	Boris Brezillon <bbrezillon@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Mark Brown <broonie@kernel.org>,
	"linux-i3c@lists.infradead.org" <linux-i3c@lists.infradead.org>
Subject: RE: [RFC 5/5] i3c: add i3cdev module to expose i3c dev in /dev
Date: Wed, 11 Dec 2019 15:07:36 +0000
Message-ID: <CH2PR12MB4216CE03448AF3B39C23D3BCAE5A0@CH2PR12MB4216.namprd12.prod.outlook.com> (raw)
In-Reply-To: <CAK8P3a00wfUbGU1a9nS1dtDsUo1GR1V1WqRwa+DmUKVStvicTw@mail.gmail.com>

Hi Arnd,

From: Arnd Bergmann <arnd@arndb.de>
Date: Tue, Dec 10, 2019 at 19:37:14

> On Tue, Dec 10, 2019 at 8:15 PM Vitor Soares <Vitor.Soares@synopsys.com> wrote:
> > From: Arnd Bergmann <arnd@arndb.de>
> > Date: Tue, Dec 10, 2019 at 17:51:14
> >
> > > On Tue, Dec 10, 2019 at 4:37 PM Vitor Soares <Vitor.Soares@synopsys.com> wrote:
> > > >
> > > > +/* IOCTL commands */
> > > > +#define I3C_DEV_IOC_MAGIC      0x07
> > > > +
> > > > +struct i3c_ioc_priv_xfer {
> > > > +       struct i3c_priv_xfer __user *xfers;     /* pointers to i3c_priv_xfer */
> > > > +       __u32 nxfers;                           /* number of i3c_priv_xfer */
> > > > +};
> > > > +
> > > > +#define I3C_IOC_PRIV_XFER      \
> > > > +       _IOW(I3C_DEV_IOC_MAGIC, 30, struct i3c_ioc_priv_xfer)
> > > > +
> > > > +#define  I3C_IOC_PRIV_XFER_MAX_MSGS    42
> > >
> > > This is not a great data structure for UAPI, please see
> > > https://urldefense.proofpoint.com/v2/url?u=https-3A__git.kernel.org_pub_scm_linux_kernel_git_arnd_playground.git_tree_Documentation_core-2Dapi_ioctl.rst-3Fh-3Dcompat-2Dioctl-2Dendgame-26id-3D927324b7900ee9b877691a8b237e272fabb21bf5&d=DwIBaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=qVuU64u9x77Y0Kd0PhDK_lpxFgg6PK9PateHwjb_DY0&m=5Q9WjK0o93NR7DQ9NM6So6mfdgpNnZnSaP8qMpgaC7E&s=LzzjrUQAG8fx5jkVyK73dBDrahNAvk09Cxxlx3KOiXI&e=
> > >
> > > for some background. I'm planning to submit that documentation for
> > > mainline integration soon.
> > >
> > >      Arnd
> >
> > Thanks for sharing the document.
> >
> > My understanding is that I should use a data structure like the struct
> > spi_ioc_transfer, with this I may also use the same ioctl command
> > definition. Am I right?
> 
> Yes, that would be an example of a structure that follows the best
> practices from my document. It is still rather complex, so if you
> can make it any simpler, that would be ideal.

I will try to do that.

> 
> > In the documentation you also refer the compact_ioctl() and It is not
> > clear to me if the compact_ioctl() is mandatory in this case. Should I
> > implement it as well?
> 
> If the structure is defined like that, you just need to set
> ".compat_ioctl=compat_ptr_ioctl," in the file_operations structure
> and it will work, but you cannot skip that step.

Thanks, now I know that is mandatory 😊.

> 
> As your interface is basically just read/write based, I wonder
> if there is a way to completely avoid the ioctl and instead
> use io_submit() as the primary interface.
> 
>       Arnd

I confess that I wasn't familiar with io_submit() until now and went 
straightway for the ioctl() approach.
So far, my understanding is that io_submit() will call .write or .read of 
i3cdev module depending on the iocb command. if so, we won't be able to 
do a repeated start between a multiple iocb in the same list, right?

Apart from this private read/write need, another requirement that leads 
me to use the ioctl() was:
- When we support HDR command in i3c subsystem we can expand the ioctl() 
command to support it.
- For now, device API doesn't expose CCC commands but some of them are 
used for a private contract between master and device and we likely need 
that support in the future as well.

Thanks,
Best regards,
Vitor Soares

_______________________________________________
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

  reply index

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-10 15:37 [RFC 0/5] Introduce i3c device userspace interface Vitor Soares
2019-12-10 15:37 ` [RFC 1/5] i3c: master: export i3c_masterdev_type Vitor Soares
2019-12-10 15:37 ` [RFC 2/5] i3c: master: export i3c_bus_type symbol Vitor Soares
2019-12-10 15:37 ` [RFC 3/5] i3c: device: expose transfer strutures to uapi Vitor Soares
2019-12-12 14:42   ` Greg KH
2019-12-12 14:48     ` Vitor Soares
2019-12-10 15:37 ` [RFC 4/5] i3c: master: add i3c_for_each_dev helper Vitor Soares
2019-12-10 15:37 ` [RFC 5/5] i3c: add i3cdev module to expose i3c dev in /dev Vitor Soares
2019-12-10 17:51   ` Arnd Bergmann
2019-12-10 19:15     ` Vitor Soares
2019-12-10 19:37       ` Arnd Bergmann
2019-12-11 15:07         ` Vitor Soares [this message]
2019-12-11 15:33           ` Arnd Bergmann
2019-12-20 12:39     ` Vitor Soares
2019-12-12 14:44   ` Greg KH
2019-12-12 14:56     ` Vitor Soares
2019-12-12 16:00       ` Greg KH
2019-12-12 17:25         ` Vitor Soares
2019-12-12 17:32           ` Greg KH
2019-12-12 14:46   ` Greg KH

Reply instructions:

You may reply publically 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=CH2PR12MB4216CE03448AF3B39C23D3BCAE5A0@CH2PR12MB4216.namprd12.prod.outlook.com \
    --to=vitor.soares@synopsys.com \
    --cc=Joao.Pinto@synopsys.com \
    --cc=arnd@arndb.de \
    --cc=bbrezillon@kernel.org \
    --cc=broonie@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-i3c@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wsa@the-dreams.de \
    /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

Linux-i3c Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-i3c/0 linux-i3c/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-i3c linux-i3c/ https://lore.kernel.org/linux-i3c \
		linux-i3c@lists.infradead.org
	public-inbox-index linux-i3c

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-i3c


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git