Re: [PATCH] AGPGART compat ioctl

2007-01-31 Thread Dave Jones
On Tue, Jan 30, 2007 at 09:50:24PM -0800, Zwane Mwaikambo wrote:
 > On Tue, 30 Jan 2007, Kyle McMartin wrote:
 > 
 > > On Sat, Jan 27, 2007 at 07:28:07PM -0800, Zwane Mwaikambo wrote:
 > > > Hi Dave,
 > > >  The following video card requires the agpgart driver ioctl 
 > > > interface in order to detect video memory.
 > > > 
 > > 
 > > Tested with testgart.c on parisc64, seems to work alright. Thanks for
 > > doing this work, Zwane. I've been meaning to do compat_ioctl for
 > > agpgart for months.
 > 
 > Kyle,
 >  Thanks for testing! Hopefully Dave can just queue it up for me.

Looks ok, I'll queue it up into agpgart.git tonight for merging in 2.6.21
(whilst it's unlikely to break anything, .20 is really dragging on a bit)

Thanks.

Dave

-- 
http://www.codemonkey.org.uk
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] AGPGART compat ioctl

2007-01-31 Thread Dave Jones
On Tue, Jan 30, 2007 at 09:50:24PM -0800, Zwane Mwaikambo wrote:
  On Tue, 30 Jan 2007, Kyle McMartin wrote:
  
   On Sat, Jan 27, 2007 at 07:28:07PM -0800, Zwane Mwaikambo wrote:
Hi Dave,
 The following video card requires the agpgart driver ioctl 
interface in order to detect video memory.

   
   Tested with testgart.c on parisc64, seems to work alright. Thanks for
   doing this work, Zwane. I've been meaning to do compat_ioctl for
   agpgart for months.
  
  Kyle,
   Thanks for testing! Hopefully Dave can just queue it up for me.

Looks ok, I'll queue it up into agpgart.git tonight for merging in 2.6.21
(whilst it's unlikely to break anything, .20 is really dragging on a bit)

Thanks.

Dave

-- 
http://www.codemonkey.org.uk
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] AGPGART compat ioctl

2007-01-30 Thread Zwane Mwaikambo
On Tue, 30 Jan 2007, Kyle McMartin wrote:

> On Sat, Jan 27, 2007 at 07:28:07PM -0800, Zwane Mwaikambo wrote:
> > Hi Dave,
> > The following video card requires the agpgart driver ioctl 
> > interface in order to detect video memory.
> > 
> 
> Tested with testgart.c on parisc64, seems to work alright. Thanks for
> doing this work, Zwane. I've been meaning to do compat_ioctl for
> agpgart for months.

Kyle,
Thanks for testing! Hopefully Dave can just queue it up for me.

Cheers,
Zwane
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] AGPGART compat ioctl

2007-01-30 Thread Kyle McMartin
On Sat, Jan 27, 2007 at 07:28:07PM -0800, Zwane Mwaikambo wrote:
> Hi Dave,
>   The following video card requires the agpgart driver ioctl 
> interface in order to detect video memory.
> 

Tested with testgart.c on parisc64, seems to work alright. Thanks for
doing this work, Zwane. I've been meaning to do compat_ioctl for
agpgart for months.

Cheers,
Kyle M.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] AGPGART compat ioctl

2007-01-30 Thread Kyle McMartin
On Sat, Jan 27, 2007 at 07:28:07PM -0800, Zwane Mwaikambo wrote:
 Hi Dave,
   The following video card requires the agpgart driver ioctl 
 interface in order to detect video memory.
 

Tested with testgart.c on parisc64, seems to work alright. Thanks for
doing this work, Zwane. I've been meaning to do compat_ioctl for
agpgart for months.

Cheers,
Kyle M.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] AGPGART compat ioctl

2007-01-30 Thread Zwane Mwaikambo
On Tue, 30 Jan 2007, Kyle McMartin wrote:

 On Sat, Jan 27, 2007 at 07:28:07PM -0800, Zwane Mwaikambo wrote:
  Hi Dave,
  The following video card requires the agpgart driver ioctl 
  interface in order to detect video memory.
  
 
 Tested with testgart.c on parisc64, seems to work alright. Thanks for
 doing this work, Zwane. I've been meaning to do compat_ioctl for
 agpgart for months.

Kyle,
Thanks for testing! Hopefully Dave can just queue it up for me.

Cheers,
Zwane
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] AGPGART compat ioctl

2007-01-29 Thread Zwane Mwaikambo
Hi Christoph,
Thanks for the input. The following has your recommendations;

drivers/char/agp/Makefile   |1
drivers/char/agp/agp.h  |2
drivers/char/agp/compat_ioctl.c |  282 
drivers/char/agp/compat_ioctl.h |  105 ++
drivers/char/agp/frontend.c |   31 ++--
5 files changed, 407 insertions(+), 14 deletions(-)

Index: linux-2.6.20-rc4-mm1/drivers/char/agp/Makefile
===
RCS file: /home/cvsroot/linux-2.6.20-rc4-mm1/drivers/char/agp/Makefile,v
retrieving revision 1.1.1.1
diff -u -p -B -r1.1.1.1 Makefile
--- linux-2.6.20-rc4-mm1/drivers/char/agp/Makefile  27 Jan 2007 22:03:38 
-  1.1.1.1
+++ linux-2.6.20-rc4-mm1/drivers/char/agp/Makefile  30 Jan 2007 04:42:21 
-
@@ -1,6 +1,7 @@
 agpgart-y := backend.o frontend.o generic.o isoch.o
 
 obj-$(CONFIG_AGP)  += agpgart.o
+obj-$(CONFIG_COMPAT)   += compat_ioctl.o
 obj-$(CONFIG_AGP_ALI)  += ali-agp.o
 obj-$(CONFIG_AGP_ATI)  += ati-agp.o
 obj-$(CONFIG_AGP_AMD)  += amd-k7-agp.o
Index: linux-2.6.20-rc4-mm1/drivers/char/agp/agp.h
===
RCS file: /home/cvsroot/linux-2.6.20-rc4-mm1/drivers/char/agp/agp.h,v
retrieving revision 1.1.1.1
diff -u -p -B -r1.1.1.1 agp.h
--- linux-2.6.20-rc4-mm1/drivers/char/agp/agp.h 27 Jan 2007 22:03:38 -  
1.1.1.1
+++ linux-2.6.20-rc4-mm1/drivers/char/agp/agp.h 30 Jan 2007 04:05:33 -
@@ -298,6 +298,8 @@ extern struct aper_size_info_16 agp3_gen
 extern int agp_off;
 extern int agp_try_unsupported_boot;
 
+long compat_agp_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
+
 /* Chipset independant registers (from AGP Spec) */
 #define AGP_APBASE 0x10
 
Index: linux-2.6.20-rc4-mm1/drivers/char/agp/compat_ioctl.c
===
RCS file: linux-2.6.20-rc4-mm1/drivers/char/agp/compat_ioctl.c
diff -N linux-2.6.20-rc4-mm1/drivers/char/agp/compat_ioctl.c
--- /dev/null   1 Jan 1970 00:00:00 -
+++ linux-2.6.20-rc4-mm1/drivers/char/agp/compat_ioctl.c30 Jan 2007 
05:15:44 -
@@ -0,0 +1,282 @@
+/*
+ * AGPGART driver frontend compatibility ioctls
+ * Copyright (C) 2004 Silicon Graphics, Inc.
+ * Copyright (C) 2002-2003 Dave Jones
+ * Copyright (C) 1999 Jeff Hartmann
+ * Copyright (C) 1999 Precision Insight, Inc.
+ * Copyright (C) 1999 Xi Graphics, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
+ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include "agp.h"
+#include "compat_ioctl.h"
+
+static int compat_agpioc_info_wrap(struct agp_file_private *priv, void __user 
*arg)
+{
+   struct agp_info32 userinfo;
+   struct agp_kern_info kerninfo;
+
+   agp_copy_info(agp_bridge, );
+
+   userinfo.version.major = kerninfo.version.major;
+   userinfo.version.minor = kerninfo.version.minor;
+   userinfo.bridge_id = kerninfo.device->vendor |
+   (kerninfo.device->device << 16);
+   userinfo.agp_mode = kerninfo.mode;
+   userinfo.aper_base = (compat_long_t)kerninfo.aper_base;
+   userinfo.aper_size = kerninfo.aper_size;
+   userinfo.pg_total = userinfo.pg_system = kerninfo.max_memory;
+   userinfo.pg_used = kerninfo.current_memory;
+
+   if (copy_to_user(arg, , sizeof(userinfo)))
+   return -EFAULT;
+
+   return 0;
+}
+
+static int compat_agpioc_reserve_wrap(struct agp_file_private *priv, void 
__user *arg)
+{
+   struct agp_region32 ureserve;
+   struct agp_region kreserve;
+   struct agp_client *client;
+   struct agp_file_private *client_priv;
+
+   DBG("");
+   if (copy_from_user(, arg, sizeof(ureserve)))
+   return -EFAULT;
+
+   if ((unsigned) ureserve.seg_count >= ~0U/sizeof(struct agp_segment32))
+   return -EFAULT;
+
+   kreserve.pid 

Re: [PATCH] AGPGART compat ioctl

2007-01-29 Thread Zwane Mwaikambo
Hi Christoph,
Thanks for the input. The following has your recommendations;

drivers/char/agp/Makefile   |1
drivers/char/agp/agp.h  |2
drivers/char/agp/compat_ioctl.c |  282 
drivers/char/agp/compat_ioctl.h |  105 ++
drivers/char/agp/frontend.c |   31 ++--
5 files changed, 407 insertions(+), 14 deletions(-)

Index: linux-2.6.20-rc4-mm1/drivers/char/agp/Makefile
===
RCS file: /home/cvsroot/linux-2.6.20-rc4-mm1/drivers/char/agp/Makefile,v
retrieving revision 1.1.1.1
diff -u -p -B -r1.1.1.1 Makefile
--- linux-2.6.20-rc4-mm1/drivers/char/agp/Makefile  27 Jan 2007 22:03:38 
-  1.1.1.1
+++ linux-2.6.20-rc4-mm1/drivers/char/agp/Makefile  30 Jan 2007 04:42:21 
-
@@ -1,6 +1,7 @@
 agpgart-y := backend.o frontend.o generic.o isoch.o
 
 obj-$(CONFIG_AGP)  += agpgart.o
+obj-$(CONFIG_COMPAT)   += compat_ioctl.o
 obj-$(CONFIG_AGP_ALI)  += ali-agp.o
 obj-$(CONFIG_AGP_ATI)  += ati-agp.o
 obj-$(CONFIG_AGP_AMD)  += amd-k7-agp.o
Index: linux-2.6.20-rc4-mm1/drivers/char/agp/agp.h
===
RCS file: /home/cvsroot/linux-2.6.20-rc4-mm1/drivers/char/agp/agp.h,v
retrieving revision 1.1.1.1
diff -u -p -B -r1.1.1.1 agp.h
--- linux-2.6.20-rc4-mm1/drivers/char/agp/agp.h 27 Jan 2007 22:03:38 -  
1.1.1.1
+++ linux-2.6.20-rc4-mm1/drivers/char/agp/agp.h 30 Jan 2007 04:05:33 -
@@ -298,6 +298,8 @@ extern struct aper_size_info_16 agp3_gen
 extern int agp_off;
 extern int agp_try_unsupported_boot;
 
+long compat_agp_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
+
 /* Chipset independant registers (from AGP Spec) */
 #define AGP_APBASE 0x10
 
Index: linux-2.6.20-rc4-mm1/drivers/char/agp/compat_ioctl.c
===
RCS file: linux-2.6.20-rc4-mm1/drivers/char/agp/compat_ioctl.c
diff -N linux-2.6.20-rc4-mm1/drivers/char/agp/compat_ioctl.c
--- /dev/null   1 Jan 1970 00:00:00 -
+++ linux-2.6.20-rc4-mm1/drivers/char/agp/compat_ioctl.c30 Jan 2007 
05:15:44 -
@@ -0,0 +1,282 @@
+/*
+ * AGPGART driver frontend compatibility ioctls
+ * Copyright (C) 2004 Silicon Graphics, Inc.
+ * Copyright (C) 2002-2003 Dave Jones
+ * Copyright (C) 1999 Jeff Hartmann
+ * Copyright (C) 1999 Precision Insight, Inc.
+ * Copyright (C) 1999 Xi Graphics, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the Software),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
+ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#include linux/kernel.h
+#include linux/pci.h
+#include linux/agpgart.h
+#include asm/uaccess.h
+#include agp.h
+#include compat_ioctl.h
+
+static int compat_agpioc_info_wrap(struct agp_file_private *priv, void __user 
*arg)
+{
+   struct agp_info32 userinfo;
+   struct agp_kern_info kerninfo;
+
+   agp_copy_info(agp_bridge, kerninfo);
+
+   userinfo.version.major = kerninfo.version.major;
+   userinfo.version.minor = kerninfo.version.minor;
+   userinfo.bridge_id = kerninfo.device-vendor |
+   (kerninfo.device-device  16);
+   userinfo.agp_mode = kerninfo.mode;
+   userinfo.aper_base = (compat_long_t)kerninfo.aper_base;
+   userinfo.aper_size = kerninfo.aper_size;
+   userinfo.pg_total = userinfo.pg_system = kerninfo.max_memory;
+   userinfo.pg_used = kerninfo.current_memory;
+
+   if (copy_to_user(arg, userinfo, sizeof(userinfo)))
+   return -EFAULT;
+
+   return 0;
+}
+
+static int compat_agpioc_reserve_wrap(struct agp_file_private *priv, void 
__user *arg)
+{
+   struct agp_region32 ureserve;
+   struct agp_region kreserve;
+   struct agp_client *client;
+   struct agp_file_private *client_priv;
+
+   DBG();
+   if (copy_from_user(ureserve, arg, sizeof(ureserve)))
+   return -EFAULT;
+
+   if ((unsigned) ureserve.seg_count = ~0U/sizeof(struct 

Re: [PATCH] AGPGART compat ioctl

2007-01-28 Thread Christoph Hellwig
On Sat, Jan 27, 2007 at 07:28:07PM -0800, Zwane Mwaikambo wrote:
> --- linux-2.6.20-rc4-mm1/include/linux/agpgart.h  27 Jan 2007 22:04:06 
> -  1.1.1.1
> +++ linux-2.6.20-rc4-mm1/include/linux/agpgart.h  27 Jan 2007 22:41:23 
> -
> @@ -114,6 +114,67 @@ typedef struct _agp_unbind {
>  
>  #define AGPGART_MINOR 175
>  
> +#ifdef CONFIG_COMPAT
> +#include 

I don't think this should be in public headers.  I'd rather have all
declarations and code for compat ioctl handling in a single file,
e.g. drivers/char/agp/compat_ioctl.c

> +#ifdef CONFIG_COMPAT
> +static int compat_agpioc_info_wrap(struct agp_file_private *priv, void 
> __user *arg)

Please make sure this doesn't overflow 80 characters per line.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] AGPGART compat ioctl

2007-01-28 Thread Christoph Hellwig
On Sat, Jan 27, 2007 at 07:28:07PM -0800, Zwane Mwaikambo wrote:
 --- linux-2.6.20-rc4-mm1/include/linux/agpgart.h  27 Jan 2007 22:04:06 
 -  1.1.1.1
 +++ linux-2.6.20-rc4-mm1/include/linux/agpgart.h  27 Jan 2007 22:41:23 
 -
 @@ -114,6 +114,67 @@ typedef struct _agp_unbind {
  
  #define AGPGART_MINOR 175
  
 +#ifdef CONFIG_COMPAT
 +#include linux/compat.h

I don't think this should be in public headers.  I'd rather have all
declarations and code for compat ioctl handling in a single file,
e.g. drivers/char/agp/compat_ioctl.c

 +#ifdef CONFIG_COMPAT
 +static int compat_agpioc_info_wrap(struct agp_file_private *priv, void 
 __user *arg)

Please make sure this doesn't overflow 80 characters per line.

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/