From: Arnd Bergmann <arnd@arndb.de>
To: linuxppc-dev@lists.ozlabs.org
Cc: Timur Tabi <timur@freescale.com>,
alan@lxorguk.ukuu.org.uk, kumar.gala@freescale.com,
benh@kernel.crashing.org, greg@kroah.com, akpm@kernel.org,
cmetcalf@tilera.com, konrad.wilk@oracle.com, dsaxena@linaro.org,
linux-kernel@vger.kernel.org, linux-console@vger.kernel.org
Subject: Re: [PATCH 7/7] [v4] drivers/virt: introduce Freescale hypervisor management driver
Date: Thu, 9 Jun 2011 09:29:23 +0200 [thread overview]
Message-ID: <201106090929.23671.arnd@arndb.de> (raw)
In-Reply-To: <1307573154-15838-1-git-send-email-timur@freescale.com>
On Thursday 09 June 2011 00:45:54 Timur Tabi wrote:
> +struct fsl_hv_ioctl_memcpy {
> + __u32 ret;
> + __u32 source;
> + __u32 target;
> + __u64 local_vaddr;
> + __u64 remote_paddr;
> + __u64 count;
> +};
> +struct fsl_hv_ioctl_prop {
> + __u32 ret;
> + __u32 handle;
> + __u64 path;
> + __u64 propname;
> + __u64 propval;
> + __u32 proplen;
> +};
These structures have implied padding. Better make it explicit by
adding the appropriate __u32 __pad1 members or similar.
> +/*
> + * ioctl commands.
> + */
> +enum {
> + FSL_HV_IOCTL_PARTITION_RESTART = 1, /* Boot another partition */
> + FSL_HV_IOCTL_PARTITION_GET_STATUS = 2, /* Boot another partition */
> + FSL_HV_IOCTL_PARTITION_START = 3, /* Boot another partition */
> + FSL_HV_IOCTL_PARTITION_STOP = 4, /* Stop this or another partition */
> + FSL_HV_IOCTL_MEMCPY = 5, /* Copy data from one partition to another */
> + FSL_HV_IOCTL_DOORBELL = 6, /* Ring a doorbell */
> +
> + /* Get a property from another guest's device tree */
> + FSL_HV_IOCTL_GETPROP = 7,
> +
> + /* Set a property in another guest's device tree */
> + FSL_HV_IOCTL_SETPROP = 8,
> +};
As discussed before, this one should really be using the _IOC macros to define
the commands that you use based on the structure definitions above, e.g.
#define FSL_HV_IOCTL_GETPROP _IORW(FSL_HV, 8, struct fsl_hv_ioctl_prop)
Then get rid of all the code that takes apart the ioctl command numbers
again and just do a switch/case based on the command.
Arnd
Arnd
WARNING: multiple messages have this Message-ID (diff)
From: Arnd Bergmann <arnd@arndb.de>
To: linuxppc-dev@lists.ozlabs.org
Cc: konrad.wilk@oracle.com, kumar.gala@freescale.com,
linux-kernel@vger.kernel.org, cmetcalf@tilera.com,
akpm@kernel.org, dsaxena@linaro.org,
linux-console@vger.kernel.org, greg@kroah.com,
Timur Tabi <timur@freescale.com>,
alan@lxorguk.ukuu.org.uk
Subject: Re: [PATCH 7/7] [v4] drivers/virt: introduce Freescale hypervisor management driver
Date: Thu, 9 Jun 2011 09:29:23 +0200 [thread overview]
Message-ID: <201106090929.23671.arnd@arndb.de> (raw)
In-Reply-To: <1307573154-15838-1-git-send-email-timur@freescale.com>
On Thursday 09 June 2011 00:45:54 Timur Tabi wrote:
> +struct fsl_hv_ioctl_memcpy {
> + __u32 ret;
> + __u32 source;
> + __u32 target;
> + __u64 local_vaddr;
> + __u64 remote_paddr;
> + __u64 count;
> +};
> +struct fsl_hv_ioctl_prop {
> + __u32 ret;
> + __u32 handle;
> + __u64 path;
> + __u64 propname;
> + __u64 propval;
> + __u32 proplen;
> +};
These structures have implied padding. Better make it explicit by
adding the appropriate __u32 __pad1 members or similar.
> +/*
> + * ioctl commands.
> + */
> +enum {
> + FSL_HV_IOCTL_PARTITION_RESTART = 1, /* Boot another partition */
> + FSL_HV_IOCTL_PARTITION_GET_STATUS = 2, /* Boot another partition */
> + FSL_HV_IOCTL_PARTITION_START = 3, /* Boot another partition */
> + FSL_HV_IOCTL_PARTITION_STOP = 4, /* Stop this or another partition */
> + FSL_HV_IOCTL_MEMCPY = 5, /* Copy data from one partition to another */
> + FSL_HV_IOCTL_DOORBELL = 6, /* Ring a doorbell */
> +
> + /* Get a property from another guest's device tree */
> + FSL_HV_IOCTL_GETPROP = 7,
> +
> + /* Set a property in another guest's device tree */
> + FSL_HV_IOCTL_SETPROP = 8,
> +};
As discussed before, this one should really be using the _IOC macros to define
the commands that you use based on the structure definitions above, e.g.
#define FSL_HV_IOCTL_GETPROP _IORW(FSL_HV, 8, struct fsl_hv_ioctl_prop)
Then get rid of all the code that takes apart the ioctl command numbers
again and just do a switch/case based on the command.
Arnd
Arnd
next prev parent reply other threads:[~2011-06-09 7:29 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-08 22:45 [PATCH 7/7] [v4] drivers/virt: introduce Freescale hypervisor management driver Timur Tabi
2011-06-08 22:45 ` Timur Tabi
2011-06-08 23:10 ` Randy Dunlap
2011-06-08 23:10 ` Randy Dunlap
2011-06-08 23:10 ` Randy Dunlap
2011-06-08 23:16 ` Timur Tabi
2011-06-08 23:16 ` Timur Tabi
2011-06-08 23:16 ` Timur Tabi
2011-06-09 7:38 ` Arnd Bergmann
2011-06-09 7:38 ` Arnd Bergmann
2011-06-09 7:38 ` Arnd Bergmann
2011-06-09 16:32 ` Randy Dunlap
2011-06-09 16:32 ` Randy Dunlap
2011-06-09 16:32 ` Randy Dunlap
2011-06-09 16:36 ` Timur Tabi
2011-06-09 16:36 ` Timur Tabi
2011-06-09 16:36 ` Timur Tabi
2011-06-09 16:36 ` Timur Tabi
2011-06-09 16:42 ` Randy Dunlap
2011-06-09 16:42 ` Randy Dunlap
2011-06-09 16:42 ` Randy Dunlap
2011-06-09 16:48 ` Timur Tabi
2011-06-09 16:48 ` Timur Tabi
2011-06-09 16:48 ` Timur Tabi
2011-06-09 16:48 ` Timur Tabi
2011-06-10 14:17 ` Chris Metcalf
2011-06-10 14:17 ` Chris Metcalf
2011-06-10 14:17 ` Chris Metcalf
2011-06-10 14:17 ` Chris Metcalf
2011-06-10 15:36 ` Arnd Bergmann
2011-06-10 15:36 ` Arnd Bergmann
2011-06-10 15:36 ` Arnd Bergmann
2011-06-09 7:29 ` Arnd Bergmann [this message]
2011-06-09 7:29 ` Arnd Bergmann
2011-06-09 18:55 ` Timur Tabi
2011-06-09 18:55 ` Timur Tabi
2011-06-09 18:55 ` Timur Tabi
2011-06-09 20:20 ` Arnd Bergmann
2011-06-09 20:20 ` Arnd Bergmann
2011-06-09 20:24 ` Timur Tabi
2011-06-09 20:24 ` Timur Tabi
2011-06-09 20:24 ` Timur Tabi
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=201106090929.23671.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=akpm@kernel.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=benh@kernel.crashing.org \
--cc=cmetcalf@tilera.com \
--cc=dsaxena@linaro.org \
--cc=greg@kroah.com \
--cc=konrad.wilk@oracle.com \
--cc=kumar.gala@freescale.com \
--cc=linux-console@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=timur@freescale.com \
/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.