All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Laura Abbott <labbott@redhat.com>
Cc: devel@driverdev.osuosl.org, "Jon Medhurst" <tixy@linaro.org>,
	"Android Kernel Team" <kernel-team@android.com>,
	"Jeremy Gebben" <jgebben@codeaurora.org>,
	"Daniel Vetter" <daniel.vetter@ffwll.ch>,
	"Liviu Dudau" <Liviu.Dudau@arm.com>,
	"Arve Hjønnevåg" <arve@android.com>,
	linux-kernel@vger.kernel.org, linaro-mm-sig@lists.linaro.org,
	"Riley Andrews" <riandrews@android.com>,
	"John Stultz" <john.stultz@linaro.org>,
	"Eun Taik Lee" <eun.taik.lee@samsung.com>,
	"Bryan Huntsman" <bryanh@codeaurora.org>,
	"Sumit Semwal" <sumit.semwal@linaro.org>,
	"Chen Feng" <puck.chen@hisilicon.com>,
	"Brian Starkey" <brian.starkey@arm.com>
Subject: Re: [PATCHv2 4/4] staging: android: ion: Add ioctl to query available heaps
Date: Sat, 3 Sep 2016 14:55:06 +0200	[thread overview]
Message-ID: <20160903125506.GA11457@kroah.com> (raw)
In-Reply-To: <6e6578da-45c0-00e4-cd99-09b6931abe22@redhat.com>

On Fri, Sep 02, 2016 at 01:41:48PM -0700, Laura Abbott wrote:
> On 09/01/2016 11:14 PM, Greg Kroah-Hartman wrote:
> > On Thu, Sep 01, 2016 at 03:40:44PM -0700, Laura Abbott wrote:
> > > 
> > > Ion clients currently lack a good method to determine what
> > > heaps are available and what ids they map to. This leads
> > > to tight coupling between user and kernel space and headaches.
> > > Add a query ioctl to let userspace know the availability of
> > > heaps.
> > > 
> > > Signed-off-by: Laura Abbott <labbott@redhat.com>
> > > ---
> > >  drivers/staging/android/ion/ion-ioctl.c | 11 +++++++++
> > >  drivers/staging/android/ion/ion.c       | 44 +++++++++++++++++++++++++++++++++
> > >  drivers/staging/android/ion/ion_priv.h  |  3 +++
> > >  drivers/staging/android/uapi/ion.h      | 39 +++++++++++++++++++++++++++++
> > >  4 files changed, 97 insertions(+)
> > > 
> > > diff --git a/drivers/staging/android/ion/ion-ioctl.c b/drivers/staging/android/ion/ion-ioctl.c
> > > index 53b9520..e76d517 100644
> > > --- a/drivers/staging/android/ion/ion-ioctl.c
> > > +++ b/drivers/staging/android/ion/ion-ioctl.c
> > > @@ -28,6 +28,7 @@ union ion_ioctl_arg {
> > >  	struct ion_handle_data handle;
> > >  	struct ion_custom_data custom;
> > >  	struct ion_abi_version abi_version;
> > > +	struct ion_heap_query query;
> > >  };
> > > 
> > >  static int validate_ioctl_arg(unsigned int cmd, union ion_ioctl_arg *arg)
> > > @@ -38,6 +39,11 @@ static int validate_ioctl_arg(unsigned int cmd, union ion_ioctl_arg *arg)
> > >  	case ION_IOC_ABI_VERSION:
> > >  		ret = arg->abi_version.reserved != 0;
> > >  		break;
> > > +	case ION_IOC_HEAP_QUERY:
> > > +		ret = arg->query.reserved0 != 0;
> > > +		ret |= arg->query.reserved1 != 0;
> > > +		ret |= arg->query.reserved2 != 0;
> > > +		break;
> > >  	default:
> > >  		break;
> > >  	}
> > > @@ -162,6 +168,11 @@ long ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
> > >  		data.abi_version.abi_version = ION_ABI_VERSION;
> > >  		break;
> > >  	}
> > > +	case ION_IOC_HEAP_QUERY:
> > > +	{
> > > +		ret = ion_query_heaps(client, &data.query);
> > > +		break;
> > > +	}
> > 
> > Minor nit, the { } aren't needed here.  Yeah, I know the other cases
> > have them, but they aren't all needed there either, no need to keep
> > copying bad code style :)
> > 
> 
> Huh, might deserve a checkpatch addition then. Never heard that one before.

It's not a checkpatch issue, just a "is this { } even needed" type of an
issue :)

> > >  	default:
> > >  		return -ENOTTY;
> > >  	}
> > > diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
> > > index 975b48f..91b765c 100644
> > > --- a/drivers/staging/android/ion/ion.c
> > > +++ b/drivers/staging/android/ion/ion.c
> > > @@ -1174,6 +1174,49 @@ int ion_sync_for_device(struct ion_client *client, int fd)
> > >  	return 0;
> > >  }
> > > 
> > > +int ion_query_heaps(struct ion_client *client, struct ion_heap_query *query)
> > > +{
> > > +	struct ion_device *dev = client->dev;
> > > +	struct ion_heap_data __user *buffer =
> > > +		(struct ion_heap_data __user *)query->heaps;
> > 
> > Shouldn't query be marked as __user instead of having this cast?
> > 
> 
> No, the query structure itself is copied into the kernel in ion_ioctl.
> The sub field query->heaps is a user pointer which is marked as _u64
> for compatability ala botching-ioctls.txt hence the cast.

Ah, ok.  Messy :)

thanks,

greg k-h

      reply	other threads:[~2016-09-03 12:55 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-01 22:40 [PATCHv2 0/4] New Ion ioctls Laura Abbott
2016-09-01 22:40 ` [PATCHv2 1/4] staging: android: ion: Drop heap type masks Laura Abbott
2016-09-02 13:41   ` Brian Starkey
2016-09-02 19:36     ` Laura Abbott
2016-09-05 11:20       ` Brian Starkey
2016-09-06 22:16         ` Laura Abbott
2016-09-07  8:50           ` Brian Starkey
2016-09-01 22:40 ` [PATCHv2 2/4] staging: android: ion: Pull out ion ioctls to a separate file Laura Abbott
2016-09-02 12:44   ` Greg Kroah-Hartman
2016-09-02 19:53     ` Laura Abbott
2016-09-01 22:40 ` [PATCHv2 3/4] staging: android: ion: Add an ioctl for ABI checking Laura Abbott
2016-09-02  6:10   ` Greg Kroah-Hartman
2016-09-02 20:26     ` Laura Abbott
2016-09-02  9:02   ` [Linaro-mm-sig] " Arnd Bergmann
2016-09-02 20:33     ` Laura Abbott
2016-09-02 21:33       ` Arnd Bergmann
2016-09-02 22:14         ` Laura Abbott
2016-09-01 22:40 ` [PATCHv2 4/4] staging: android: ion: Add ioctl to query available heaps Laura Abbott
2016-09-01 23:44   ` kbuild test robot
2016-09-02 21:27     ` Laura Abbott
2016-09-02 21:37       ` [Linaro-mm-sig] " Arnd Bergmann
2016-09-02 21:53         ` Laura Abbott
2016-09-02  6:14   ` Greg Kroah-Hartman
2016-09-02 20:41     ` Laura Abbott
2016-09-03 12:55       ` Greg Kroah-Hartman [this message]

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=20160903125506.GA11457@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=Liviu.Dudau@arm.com \
    --cc=arve@android.com \
    --cc=brian.starkey@arm.com \
    --cc=bryanh@codeaurora.org \
    --cc=daniel.vetter@ffwll.ch \
    --cc=devel@driverdev.osuosl.org \
    --cc=eun.taik.lee@samsung.com \
    --cc=jgebben@codeaurora.org \
    --cc=john.stultz@linaro.org \
    --cc=kernel-team@android.com \
    --cc=labbott@redhat.com \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=puck.chen@hisilicon.com \
    --cc=riandrews@android.com \
    --cc=sumit.semwal@linaro.org \
    --cc=tixy@linaro.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.