Re: [PATCH 7/7] [v2] drivers/misc: introduce Freescale hypervisormanagement driver

From: Scott Wood
Date: Wed Jun 01 2011 - 18:24:22 EST

On Wed, 1 Jun 2011 23:40:14 +0200
Arnd Bergmann <arnd@xxxxxxxx> wrote:

> > +static long ioctl_dtprop(struct fsl_hv_ioctl_prop __user *p, int set)
> > +{
> > + struct fsl_hv_ioctl_prop param;
> > + char __user *upath, *upropname;
> > + void __user *upropval;
> > + char *path = NULL, *propname = NULL;
> > + void *propval = NULL;
> > + int ret = 0;
> > +
> I'm not convinced that an ioctl interface is the right way to work with
> device tree properties. A more natural way would be to export it as
> a file system, or maybe as a flattened device tree blob (the latter option
> would require changing the hypervisor interface, which might not be
> possible).

I wanted to have the hypervisor take an update dtb (we already have special
meta-properties for things like deletion as part of the hv config
mechanism). But others on the project wanted to keep it simple, and so
get/set property it was. :-/

It's unlikely to change at this point without a real need.

As for a filesystem interface, it's not a good match either. You can't
iterate over anything to read out the full tree from the hv. You can't
delete anything. You can't create empty nodes. The hv interface was meant
to enable some specific management actions, rather than to provide general
device tree access. This driver is a thin wrapper around the management

There would still be other ioctls needed for starting/stopping the
partition, etc.

> > +/**
> > + * fsl_hv_ioctl: ioctl main entry point
> > + */
> > +static long fsl_hv_ioctl(struct file *file, unsigned int cmd,
> > + unsigned long argaddr)
> > +{
> > + union fsl_hv_ioctl_param __user *arg =
> > + (union fsl_hv_ioctl_param __user *)argaddr;
> > + long ret;
> > +
> For an ioctl, please follow the normal pattern of defining a separate
> structure for each case, no union.

And have fsl_hypervisor.h provide the full set of proper ioctl numbers, with
the specific struct for each ioctl referenced, rather than having the client program do
"ioctl(f, _IOWR(0, cmd, union fsl_hv_ioctl_param), p)".


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at