* v4l & compat_ioctl
@ 2008-03-28 11:04 Jiri Slaby
2008-03-28 11:25 ` Andi Kleen
0 siblings, 1 reply; 10+ messages in thread
From: Jiri Slaby @ 2008-03-28 11:04 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Linux and Kernel Video,
Linux Kernel Mailing List
Hi,
wouldn't make sense to add v4l ioctls to ioctl_start (fs/compat_ioctl.c) table
to allow i386 stuff such as skype to run video on x86_64? The ioctl structures
seem to be pretty aliasable, so even no special handler wouldn't be neded...
Otherwise people are getting crap like this:
ioctl32(skype:29183): Unknown cmd fd(13) cmd(80685600){t:'V';sz:104}
arg(f6571054) on /dev/video0
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: v4l & compat_ioctl
2008-03-28 11:04 v4l & compat_ioctl Jiri Slaby
@ 2008-03-28 11:25 ` Andi Kleen
2008-03-28 11:31 ` Jiri Slaby
0 siblings, 1 reply; 10+ messages in thread
From: Andi Kleen @ 2008-03-28 11:25 UTC (permalink / raw)
To: Jiri Slaby
Cc: Mauro Carvalho Chehab, Linux and Kernel Video,
Linux Kernel Mailing List
Jiri Slaby <jirislaby@gmail.com> writes:
> wouldn't make sense to add v4l ioctls to ioctl_start
> (fs/compat_ioctl.c) table to allow i386 stuff such as skype to run
> video on x86_64?
Don't make it a question.
In general any ioctl in any driver runnable on any 64bit
architecture that has a 32bit compat layer should have compat
support. Not having it is a bug.
However the new standard way to do this is to not
add new stuff into compat_ioctl.c, but define ->compat_ioctl
entry points in the low level drivers (and ideally converted
them to ->unlocked_ioctl too while you're at it)
-Andi
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: v4l & compat_ioctl
2008-03-28 11:25 ` Andi Kleen
@ 2008-03-28 11:31 ` Jiri Slaby
2008-03-28 11:38 ` Andi Kleen
0 siblings, 1 reply; 10+ messages in thread
From: Jiri Slaby @ 2008-03-28 11:31 UTC (permalink / raw)
To: Andi Kleen
Cc: Mauro Carvalho Chehab, Linux and Kernel Video,
Linux Kernel Mailing List
On 03/28/2008 12:25 PM, Andi Kleen wrote:
> However the new standard way to do this is to not
> add new stuff into compat_ioctl.c, but define ->compat_ioctl
> entry points in the low level drivers (and ideally converted
> them to ->unlocked_ioctl too while you're at it)
Andi, the problem here is, that v4l has only open in fops which in turn changes
fops to the driver's one, so this would mean change all the drivers in v4l...
I second the converting to unlocked_ioctl and compat_ioctl in longer term (for
new drivers as a merging rule), but wouldn't be feasible to add them to compat
ioctl for now?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: v4l & compat_ioctl
2008-03-28 11:31 ` Jiri Slaby
@ 2008-03-28 11:38 ` Andi Kleen
2008-03-28 12:22 ` Jiri Slaby
0 siblings, 1 reply; 10+ messages in thread
From: Andi Kleen @ 2008-03-28 11:38 UTC (permalink / raw)
To: Jiri Slaby
Cc: Andi Kleen, Mauro Carvalho Chehab, Linux and Kernel Video,
Linux Kernel Mailing List
On Fri, Mar 28, 2008 at 12:31:33PM +0100, Jiri Slaby wrote:
> On 03/28/2008 12:25 PM, Andi Kleen wrote:
> >However the new standard way to do this is to not
> >add new stuff into compat_ioctl.c, but define ->compat_ioctl
> >entry points in the low level drivers (and ideally converted
> >them to ->unlocked_ioctl too while you're at it)
>
> Andi, the problem here is, that v4l has only open in fops which in turn
> changes fops to the driver's one, so this would mean change all the drivers
> in v4l...
And? Are there that many? It's a simple mechanical operation.
> I second the converting to unlocked_ioctl and compat_ioctl in longer term
> (for new drivers as a merging rule), but wouldn't be feasible to add them
> to compat ioctl for now?
The problem with compat_ioctl is that it doesn't handle overlapping ioctl
ranges and that the compat code cannot be made modular (although if they
are compatible that is no big problem)
BTW i haven't audited them, but if there is u64 or similar in there anywhere
be careful about alignment.
-Andi
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: v4l & compat_ioctl
2008-03-28 11:38 ` Andi Kleen
@ 2008-03-28 12:22 ` Jiri Slaby
2008-03-28 13:35 ` Andi Kleen
0 siblings, 1 reply; 10+ messages in thread
From: Jiri Slaby @ 2008-03-28 12:22 UTC (permalink / raw)
To: Andi Kleen
Cc: Mauro Carvalho Chehab, Linux and Kernel Video,
Linux Kernel Mailing List
On 03/28/2008 12:38 PM, Andi Kleen wrote:
> BTW i haven't audited them, but if there is u64 or similar in there anywhere
> be careful about alignment.
Well, not good, some ioctls have different numbers on 32 and 64 bit:
struct v4l2_ext_controls {
__u32 ctrl_class;
__u32 count;
__u32 error_idx;
__u32 reserved[2];
struct v4l2_ext_control *controls;
};
#define VIDIOC_G_EXT_CTRLS _IOWR ('V', 71, struct v4l2_ext_controls)
as an example.
And alignment is a problem here (v4l2_std_id is u64):
struct v4l2_standard {
__u32 index;
v4l2_std_id id;
__u8 name[24];
struct v4l2_fract frameperiod; /* Frames, not fields */
__u32 framelines;
__u32 reserved[4];
};
which results in different ioctl numbers too.
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: v4l & compat_ioctl
2008-03-28 12:22 ` Jiri Slaby
@ 2008-03-28 13:35 ` Andi Kleen
2008-03-28 17:24 ` Mauro Carvalho Chehab
0 siblings, 1 reply; 10+ messages in thread
From: Andi Kleen @ 2008-03-28 13:35 UTC (permalink / raw)
To: Jiri Slaby
Cc: Andi Kleen, Mauro Carvalho Chehab, Linux and Kernel Video,
Linux Kernel Mailing List
On Fri, Mar 28, 2008 at 01:22:48PM +0100, Jiri Slaby wrote:
> On 03/28/2008 12:38 PM, Andi Kleen wrote:
> >BTW i haven't audited them, but if there is u64 or similar in there
> >anywhere
> >be careful about alignment.
>
> Well, not good, some ioctls have different numbers on 32 and 64 bit:
Then you need compat handlers to translate the numbers.
> struct v4l2_ext_controls {
> __u32 ctrl_class;
> __u32 count;
> __u32 error_idx;
> __u32 reserved[2];
> struct v4l2_ext_control *controls;
Definitely conversion needed for the pointer too.
> };
> #define VIDIOC_G_EXT_CTRLS _IOWR ('V', 71, struct v4l2_ext_controls)
> as an example.
>
> And alignment is a problem here (v4l2_std_id is u64):
Yes needs conversion for the structure too.
> struct v4l2_standard {
> __u32 index;
> v4l2_std_id id;
> __u8 name[24];
> struct v4l2_fract frameperiod; /* Frames, not fields */
> __u32 framelines;
> __u32 reserved[4];
> };
> which results in different ioctl numbers too.
-andi
>
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: v4l & compat_ioctl
2008-03-28 13:35 ` Andi Kleen
@ 2008-03-28 17:24 ` Mauro Carvalho Chehab
2008-03-28 17:26 ` Jiri Slaby
0 siblings, 1 reply; 10+ messages in thread
From: Mauro Carvalho Chehab @ 2008-03-28 17:24 UTC (permalink / raw)
To: Jiri Slaby; +Cc: Andi Kleen, Linux and Kernel Video, Linux Kernel Mailing List
On Fri, 28 Mar 2008 14:35:37 +0100
Andi Kleen <andi@firstfloor.org> wrote:
> On Fri, Mar 28, 2008 at 01:22:48PM +0100, Jiri Slaby wrote:
> > On 03/28/2008 12:38 PM, Andi Kleen wrote:
> > >BTW i haven't audited them, but if there is u64 or similar in there
> > >anywhere
> > >be careful about alignment.
> >
> > Well, not good, some ioctls have different numbers on 32 and 64 bit:
>
> Then you need compat handlers to translate the numbers.
V4L has its 32 bits compat module already, defined on
drivers/media/video/compat_ioctl32.c.
Also, the drivers should have this:
.compat_ioctl = v4l_compat_ioctl32,
on their fops tables:
$ ls -C `grep -l compat_ioctl32 *.c|grep -v mod`
arv.c meye.c radio-rtrack2.c stk-webcam.c
bttv-driver.c miropcm20-radio.c radio-sf16fmi.c stradis.c
bw-qcam.c ov511.c radio-sf16fmr2.c stv680.c
compat_ioctl32.c pms.c radio-si470x.c usbvideo.c
cpia2_v4l.c pwc-if.c radio-terratec.c usbvision-video.c
cpia.c radio-aimslab.c radio-trust.c vicam.c
c-qcam.c radio-aztech.c radio-typhoon.c w9966.c
cx23885-video.c radio-cadet.c radio-zoltrix.c w9968cf.c
cx88-video.c radio-gemtek.c saa5249.c zc0301_core.c
dsbr100.c radio-gemtek-pci.c saa7134-video.c zoran_driver.c
em28xx-video.c radio-maestro.c se401.c
et61x251_core.c radio-maxiradio.c sn9c102_core.c
It seems that the problem you're suffering is specific to some driver.
Cheers,
Mauro
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2008-03-28 18:07 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-28 11:04 v4l & compat_ioctl Jiri Slaby
2008-03-28 11:25 ` Andi Kleen
2008-03-28 11:31 ` Jiri Slaby
2008-03-28 11:38 ` Andi Kleen
2008-03-28 12:22 ` Jiri Slaby
2008-03-28 13:35 ` Andi Kleen
2008-03-28 17:24 ` Mauro Carvalho Chehab
2008-03-28 17:26 ` Jiri Slaby
2008-03-28 17:47 ` Mauro Carvalho Chehab
2008-03-28 18:07 ` Jiri Slaby
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox