Skip to contentSkip to conversation

copy_from_user in drivers/video/fbmem.c

DISCUSSION Adrian Cox 4 participants 13 messages Jun 16, 2000 – Jun 20, 2000

lore
Share & tools
lore

Adrian Cox

author
#0 lore raw

I've just ported the chips driver in 2.2 to the 69030 (now Asiliant, was Intel, was C&T). I've found that writing to the frame buffer device fails, because the underlying method in fbmem.c uses copy_from_user(), and on PowerPC copy_from_user() cannot copy into uncached space.

Which do people think is wrong:
Is copy_from_user() on PPC wrong, because it can't write to uncached space.
Is fbmem.c wrong, because it tries to use copy_from_user() to memory mapped IO?

- Adrian Cox, AG Electronics

ps. On the 7400 this is fairly academic, as writing sequentially to a cache line allocates it without the need for dcbz.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#1 lore raw
Quoted 10 lines · Adrian Cox

I've just ported the chips driver in 2.2 to the 69030 (now Asiliant, was Intel, was C&T). I've found that writing to the frame buffer device fails, because the underlying method in fbmem.c uses copy_from_user(), and on PowerPC copy_from_user() cannot copy into uncached space.

Which do people think is wrong:
Is copy_from_user() on PPC wrong, because it can't write to uncached space.
Is fbmem.c wrong, because it tries to use copy_from_user() to memory mapped IO?

Congratulations! You found a bug in fbmem.c! Fbmem.c should not use direct memory accesses to access the frame buffer, but must use fb_writel() and friends instead.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#2 lore raw
Quoted 10 lines
Quoted 6 lines

Which do people think is wrong:
Is copy_from_user() on PPC wrong, because it can't write to uncached space.
Is fbmem.c wrong, because it tries to use copy_from_user() to memory mapped IO?

Congratulations! You found a bug in fbmem.c! Fbmem.c should not use direct memory accesses to access the frame buffer, but must use fb_writel() and friends instead.

Let me guess, fb_write and fb_read. I have seen problems also with using memset on a mmap framebuffer on the PPC. Geert I like to suggest we move fb_write, fb_read, and fb_memset to fb.h so userland apps can use them. Also I have though about having generic functions for register access based on what is in atyfb.c for userland to use as well. Something like.

static inline u32 ld_le32(unsigned int regindex, struct fb_info *info); etc.

Actually this problem is more general. We really should have a generic access MMIO region function. I believe some sound cards can be mmapped as well.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#3 lore raw

CTFB 0.30 now availiable (CT65554...CT69000)

In reply to Geert Uytterhoeven

The driver works now quite well with my hw.

Check the ctfb_README for limits and features.

What about a merge with the old chipsfb.o?

Dounload dir: www.visuelle.maschinen.de/ctfb/

Thomas

(I am not a member of LinuxPPC-Dev <[email protected]> mailing list, please reply thru Linux Frame Buffer Device Development <[email protected]> or directly)

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

author
#4 lore raw

Re: CTFB 0.30 now availiable (CT65554...CT69000)

Quoted 6 lines · Thomas Hhenleitner

The driver works now quite well with my hw.

Check the ctfb_README for limits and features.

What about a merge with the old chipsfb.o?

I'm working on my 69030 driver as a separate driver currently, because of the requirement to use memory mapped IO and avoid all fixed IO addresses, which makes it incompatible with the 65550. I did look at your driver, but I decided to base mine on the existing chipsfb.c because I needed PowerPC support, and because the coding style of your driver was quite different to existing frame buffer drivers.

My priorities are:
1) Not assume any BIOS setup, as BIOS setup only occurs on x86 hosts, and only on the primary display.
2) Avoid use of the big-endian region in the chip, while still supporting big-endian hosts. This is necessary to support the twin-pipeline mode of the 69030 in future.
3) Support multiple displays. This requires use of memory mapping.

- Adrian Cox, AG Electronics

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#7 lore raw

Re: [linux-fbdev] CTFB 0.30 now availiable (CT65554...CT69000)

Quoted 3 lines · James Simmons
Quoted 1 line

Dounload dir: www.visuelle.maschinen.de/ctfb/

Check your server. I couldn't contact it.

s/visuelle.maschinen/visuelle-maschinen/ (from looking at the email address)

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#8 lore raw

Re: [linux-fbdev] CTFB 0.30 now availiable (CT65554...CT69000)

Quoted 7 lines · James Simmons
Quoted 3 lines
Quoted 1 line

Dounload dir: www.visuelle.maschinen.de/ctfb/

Check your server. I couldn't contact it.

s/visuelle.maschinen/visuelle-maschinen/ (from looking at the email address)

Yep. Its worked :-)

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#9 lore raw

Re: [linux-fbdev] CTFB 0.30 now availiable (CT65554...CT69000)

In reply to Geert Uytterhoeven

Am Mon, 19 Jun 2000 schrieb Geert Uytterhoeven:

Quoted 7 lines · James Simmons
Quoted 3 lines
Quoted 1 line

Dounload dir: www.visuelle.maschinen.de/ctfb/

Check your server. I couldn't contact it.

s/visuelle.maschinen/visuelle-maschinen/ (from looking at the email address)

Pleas try again. May be the server was down. Adrian Cox could get it. I just did

wget http://www.visuelle-maschinen.de/ctfb/ctfb0.30.tgz
wget http://www.visuelle-maschinen.de/ctfb/ctfb_addons0.30.tgz

successfully. If you still have trouble I'll send it to you directly.

Thomas

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#5 lore raw

Re: CTFB 0.30 now availiable (CT65554...CT69000)

In reply to Adrian Cox

Am Mon, 19 Jun 2000 schrieb Adrian Cox:

Quoted 23 lines
Quoted 6 lines · Thomas Hhenleitner

The driver works now quite well with my hw.

Check the ctfb_README for limits and features.

What about a merge with the old chipsfb.o?

I'm working on my 69030 driver as a separate driver currently, because of the requirement to use memory mapped IO and avoid all fixed IO addresses, which makes it incompatible with the 65550. I did look at your driver, but I decided to base mine on the existing chipsfb.c because I needed PowerPC support, and because the coding style of your driver was quite different to existing frame buffer drivers.

My priorities are:
1) Not assume any BIOS setup, as BIOS setup only occurs on x86 hosts, and only on the primary display.
2) Avoid use of the big-endian region in the chip, while still supporting big-endian hosts. This is necessary to support the twin-pipeline mode of the 69030 in future.
3) Support multiple displays. This requires use of memory mapping.

Quoted 1 line

- Adrian Cox, AG Electronics

Where can I get the source of your driver to have a look at it?
Is the CT69030 availiable? The last I heard about it was, that it was cacelled.

Thomas

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#10 lore raw

Re: [linux-fbdev] CTFB 0.30 now availiable (CT65554...CT69000)

In reply to Thomas H?henleitner
Quoted 8 lines

Pleas try again. May be the server was down. Adrian Cox could get it. I just did

wget http://www.visuelle-maschinen.de/ctfb/ctfb0.30.tgz
wget http://www.visuelle-maschinen.de/ctfb/ctfb_addons0.30.tgz

successfully. If you still have trouble I'll send it to you directly.

I got it now thanks to Geert. You have alot of files for ctfb.

Q: Why did they deprecate a.out support in linux?
A: Because a nasty coff is bad for your elf.

James Simmons  [[email protected]]               ____/|
fbdev/console/gfx developer                             \ o.O|

http://www.linux-fbdev.org =(_)=
http://linuxgfx.sourceforge.net U
http://linuxconsole.sourceforge.net

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#11 lore raw

name space pollution Was Re: [linux-fbdev] CTFB 0.30 now availiable (CT65554...CT69000)

Am Mon, 19 Jun 2000 schrieb James Simmons:

Quoted 2 lines

I got it now thanks to Geert. You have alot of files for ctfb.

It's a matter of taste. A file overview is in ctfb_README. And no big deal to merge them into one monolitc block if it should go into the kernel sources.

By the way I have here a question:

If we have several submodules as parts of a framebuffer we have some symbols within the namespace of this framebuffer. When we compile it as a separate module for modprobe there is no problem. But when we compile it as part of the kernel these frambuffer specific symbols are polluting the kernel namespace. Is there an elegant way to make the framebuffer specific symbols invisible for the kernel after we have our xxxfb.o?

Thomas

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#12 lore raw

Re: name space pollution Was Re: [linux-fbdev] CTFB 0.30 now availiable (CT65554...CT69000)

Quoted 7 lines

If we have several submodules as parts of a framebuffer we have some symbols within the namespace of this framebuffer. When we compile it as a separate module for modprobe there is no problem. But when we compile it as part of the kernel these frambuffer specific symbols are polluting the kernel namespace. Is there an elegant way to make the framebuffer specific symbols invisible for the kernel after we have our xxxfb.o?

Hum? I don't know. Anyone? I usually don't think about namespace pollution. I just makes sure I bizarre names so they don't conflict with anything else.

Q: Why did they deprecate a.out support in linux?
A: Because a nasty coff is bad for your elf.

James Simmons  [[email protected]]               ____/|
fbdev/console/gfx developer                             \ o.O|

http://www.linux-fbdev.org =(_)=
http://linuxgfx.sourceforge.net U
http://linuxconsole.sourceforge.net

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/