All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: "Winkler, Tomas" <tomas.winkler@intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	"Hunter, Adrian" <adrian.hunter@intel.com>,
	James Bottomley <James.Bottomley@HansenPartnership.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Vinayak Holikatti <vinholikatti@gmail.com>,
	Andy Lutomirski <luto@kernel.org>,
	Arve Hj?nnev?g <arve@android.com>,
	Michael Ryleev <gmar@google.com>,
	Joao Pinto <Joao.Pinto@synopsys.com>,
	Christoph Hellwig <hch@lst.de>,
	Yaniv Gardi <ygardi@codeaurora.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH v5 4/8] char: rpmb: provide a user space interface
Date: Sun, 4 Sep 2016 22:20:29 +0200	[thread overview]
Message-ID: <20160904202029.GB31115@amd> (raw)
In-Reply-To: <5B8DA87D05A7694D9FA63FD143655C1B542C6CC0@hasmsx108.ger.corp.intel.com>

On Sun 2016-09-04 11:35:33, Winkler, Tomas wrote:
> 
> > On Thu, Sep 01, 2016 at 08:05:26PM +0000, Winkler, Tomas wrote:
> > >
> > > >
> > > > On Sun, Aug 07, 2016 at 09:44:03AM +0000, Winkler, Tomas wrote:
> > > > > >
> > > > > > On Mon 2016-07-18 23:27:49, Tomas Winkler wrote:
> > > > > > > The user space API is achieved via two synchronous IOCTL.
> > > > > >
> > > > > > IOCTLs?
> > > > >
> > > > > Will fix
> > > > >
> > > > > > > Simplified one, RPMB_IOC_REQ_CMD, were read result cycles is
> > > > > > performed
> > > > > > > by the framework on behalf the user and second,
> > > > > > > RPMB_IOC_SEQ_CMD
> > > > > > where
> > > > > > > the whole RPMB sequence including RESULT_READ is supplied by
> > > > > > > the
> > > > caller.
> > > > > > > The latter is intended for  easier adjusting  of the
> > > > > > > applications that use MMC_IOC_MULTI_CMD ioctl.
> > > > > >
> > > > > > Why "  "?
> > > > > Not sure I there is enough clue in your question.
> > > > > >
> > > > > > >
> > > > > > > Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
> > > > > >
> > > > > > > +
> > > > > > > +static long rpmb_ioctl(struct file *fp, unsigned int cmd,
> > > > > > > +unsigned long arg) {
> > > > > > > +	return __rpmb_ioctl(fp, cmd, (void __user *)arg); }
> > > > > > > +
> > > > > > > +#ifdef CONFIG_COMPAT
> > > > > > > +static long rpmb_compat_ioctl(struct file *fp, unsigned int cmd,
> > > > > > > +			      unsigned long arg)
> > > > > > > +{
> > > > > > > +	return	__rpmb_ioctl(fp, cmd, compat_ptr(arg));
> > > > > > > +}
> > > > > > > +#endif /* CONFIG_COMPAT */
> > > > > >
> > > > > > Description of the ioctl is missing,
> > > > > Will add.
> > > > >
> > > > > and it should certainly be designed in a way
> > > > > > that it does not need compat support.
> > > > >
> > > > > The compat_ioctl handler just casts the compat_ptr, I believe this
> > > > > should be done unless the ioctl is globaly registered in
> > > > > fs/compat_ioctl.c, but I might be wrong.
> > > >
> > > > You shouldn't need a compat ioctl for anything new that is added,
> > > > unless your api is really messed up.  Please test to be sure, and
> > > > not use a compat ioctl at all, it isn't that hard to do.
> > >
> > > compat_ioctl is called anyhow when CONFIG_COMPAT is set, there is no
> > > way around it, or I'm missing something?  Actually there is no more
> > > than that for the COMPAT support in this code.
> > 
> > If you don't provide a compat_ioctl() all should be fine, right?
> 
> No,  this doesn't work the driver has to provide compat_ioctl
> 
> You would expect something like
> if (!f.file->f_op->compat_ioctl) {
>                         error = f_op->f.file->f_op->unlocked_ioctl((f.file, cmd, compat_ptr(arg))
> }
> But there is no such code under  fs/compat_ioctl.c 
> 
> The translation has to implemented by the device driver or registered  directly in fs/compat_ioct.c in do_ioctl_trans or ioctl_pointer[]
> 
> If compat_ioct is not provided the application is receiving
> : ioctl failure -1: Inappropriate ioctl for device

Care to submit a patch? We should not really have to include
compat_ioctl support if it is already compatible...

Or maybe better provide empty function drivers can fill in when
compatible...?

									Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

  reply	other threads:[~2016-09-04 20:20 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-18 20:27 [PATCH v5 0/8] Replay Protected Memory Block (RPMB) subsystem Tomas Winkler
2016-07-18 20:27 ` [PATCH v5 1/8] rpmb: add " Tomas Winkler
2016-07-18 20:27 ` [PATCH v5 2/8] char: rpmb: add sysfs-class ABI documentation Tomas Winkler
2016-08-31 10:53   ` Greg Kroah-Hartman
2016-07-18 20:27 ` [PATCH v5 3/8] char: rpmb: add device attributes Tomas Winkler
2016-08-31 10:56   ` Greg Kroah-Hartman
2016-09-01 20:21     ` Winkler, Tomas
2016-07-18 20:27 ` [PATCH v5 4/8] char: rpmb: provide a user space interface Tomas Winkler
2016-07-18 22:15   ` Paul Gortmaker
2016-07-20  9:02     ` Winkler, Tomas
2016-07-20 14:21       ` Paul Gortmaker
2016-08-05 20:08   ` Pavel Machek
2016-08-07  9:44     ` Winkler, Tomas
2016-08-31 10:49       ` Greg Kroah-Hartman
2016-09-01 20:05         ` Winkler, Tomas
2016-09-01 20:46           ` Greg Kroah-Hartman
2016-09-04 11:35             ` Winkler, Tomas
2016-09-04 20:20               ` Pavel Machek [this message]
2016-09-04 20:56                 ` Winkler, Tomas
2016-07-18 20:27 ` [PATCH v5 5/8] char: rpmb: add RPMB simulation device Tomas Winkler
2016-08-31 10:57   ` Greg Kroah-Hartman
2016-08-31 10:58   ` Greg Kroah-Hartman
2016-09-01 20:25     ` Winkler, Tomas
2016-09-01 20:45       ` Greg Kroah-Hartman
2016-07-18 20:27 ` [PATCH v5 6/8] tools rpmb: add RPBM access tool Tomas Winkler
2016-07-18 20:27 ` [PATCH v5 7/8] mmc: block: register RPMB partition with the RPMB subsystem Tomas Winkler
2016-07-18 20:27 ` [PATCH v5 8/8] scsi: ufs: connect to " Tomas Winkler
2016-07-23  7:44 ` [PATCH v5 0/8] Replay Protected Memory Block (RPMB) subsystem Winkler, Tomas
2016-08-05 20:06 ` Pavel Machek

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=20160904202029.GB31115@amd \
    --to=pavel@ucw.cz \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=Joao.Pinto@synopsys.com \
    --cc=adrian.hunter@intel.com \
    --cc=arve@android.com \
    --cc=gmar@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=tomas.winkler@intel.com \
    --cc=ulf.hansson@linaro.org \
    --cc=vinholikatti@gmail.com \
    --cc=ygardi@codeaurora.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.