[PATCH v2] vme_user: Update API to work in mixed environments
Martyn Welch
martyn.welch at ge.com
Wed Dec 11 13:38:18 UTC 2013
On 09/12/13 16:05, Aaron Sierra wrote:
> This patch updates the vme_master and vme_slave structures to use
> types with well defined size and to prevent the compiler from
> inserting padding (between enable and vme_addr for one).
>
> The original vme_master and vme_slave structs would be different
> sizes and have different layouts depending on whether they were built
> for a 32-bit or 64-bit system.
>
> On x86 it is possible to have a 32-bit userspace and a 64-bit kernel.
> In this type of environment, the userspace and kernel vme_user APIs
> would disagree and prevent ioctls from executing (based on ioctl
> signatures from _IOR and _IOW).
>
> Signed-off-by: Aaron Sierra <asierra at xes-inc.com>
If Greg's happy with this (he'd suggested re-arranging to avoid the need for
packing):
Acked-by: Martyn Welch <martyn.welch at ge.com>
> ---
> drivers/staging/vme/devices/vme_user.h | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/staging/vme/devices/vme_user.h b/drivers/staging/vme/devices/vme_user.h
> index 280ccc7..c3b4964 100644
> --- a/drivers/staging/vme/devices/vme_user.h
> +++ b/drivers/staging/vme/devices/vme_user.h
> @@ -7,10 +7,10 @@
> * VMEbus Master Window Configuration Structure
> */
> struct vme_master {
> - int enable; /* State of Window */
> - unsigned long long vme_addr; /* Starting Address on the VMEbus */
> - unsigned long long size; /* Window Size */
> - u32 aspace; /* Address Space */
> + u32 enable; /* State of Window */
> + u64 vme_addr; /* Starting Address on the VMEbus */
> + u64 size; /* Window Size */
> + u32 aspace; /* Address Space */
> u32 cycle; /* Cycle properties */
> u32 dwidth; /* Maximum Data Width */
> #if 0
> @@ -18,7 +18,7 @@ struct vme_master {
> int prefetchsize; /* Prefetch Read Size (Cache Lines) */
> char wrpostenable; /* Write Post State */
> #endif
> -};
> +} __packed;
>
>
> /*
> @@ -31,17 +31,17 @@ struct vme_master {
>
> /* VMEbus Slave Window Configuration Structure */
> struct vme_slave {
> - int enable; /* State of Window */
> - unsigned long long vme_addr; /* Starting Address on the VMEbus */
> - unsigned long long size; /* Window Size */
> - u32 aspace; /* Address Space */
> + u32 enable; /* State of Window */
> + u64 vme_addr; /* Starting Address on the VMEbus */
> + u64 size; /* Window Size */
> + u32 aspace; /* Address Space */
> u32 cycle; /* Cycle properties */
> #if 0
> char wrpostenable; /* Write Post State */
> char rmwlock; /* Lock PCI during RMW Cycles */
> char data64bitcapable; /* non-VMEbus capable of 64-bit Data */
> #endif
> -};
> +} __packed;
>
> struct vme_irq_id {
> __u8 level;
>
--
Martyn Welch (Lead Software Engineer) | Registered in England and Wales
GE Intelligent Platforms | (3828642) at 100 Barbirolli Square
T +44(0)1327322748 | Manchester, M2 3AB
E martyn.welch at ge.com | VAT:GB 927559189
More information about the devel
mailing list