radeonfb: Fix 64 bits resources on 32 bits archs
PATCH 1/3 radeonfb: Fix 64 bits resources on 32 bits archs
This fixes radeonfb to not truncate 64 bits resources on 32 bits platforms. Unfortunately, there are still issues with addresses returned to userspace via struct fb_fix_screeninfo. This will have to be dealt with separately.
---
drivers/video/aty/radeon_base.c | 4 ++-- drivers/video/aty/radeonfb.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/video/aty/radeon_base.c +2 -2
@@ -1886,7 +1886,7 @@ static int __devinit radeon_set_fbinfo ( info->screen_size = rinfo->mapped_vram;/* Fill fix common fields */ strlcpy (info->fix.id, rinfo->name,sizeof (info->fix.id)); - info->fix.smem_start = rinfo->fb_base_phys; + info->fix.smem_start = (unsigned long )rinfo->fb_base_phys; info->fix.smem_len = rinfo->video_ram; info->fix.type =FB_TYPE_PACKED_PIXELS ; info->fix.visual =FB_VISUAL_PSEUDOCOLOR ;
@@ -1894,7 +1894,7 @@ static int __devinit radeon_set_fbinfo ( info->fix.ypanstep =1 ; info->fix.ywrapstep =0 ; info->fix.type_aux =0 ; - info->fix.mmio_start = rinfo->mmio_base_phys; + info->fix.mmio_start = (unsigned long )rinfo->mmio_base_phys; info->fix.mmio_len =RADEON_REGSIZE ; info->fix.accel =FB_ACCEL_ATI_RADEON ;
drivers/video/aty/radeonfb.h +2 -2
@@ -287,8 +287,8 @@ struct radeonfb_info {char name[DEVICE_NAME_SIZE ]; -unsigned long mmio_base_phys; -unsigned long fb_base_phys; +resource_size_t mmio_base_phys; +resource_size_t fb_base_phys;void __iomem *mmio_base;void __iomem *fb_base;
Quoted 4 lines · Benjamin Herrenschmidt
This fixes radeonfb to not truncate 64 bits resources on 32 bits platforms. Unfortunately, there are still issues with addresses returned to userspace via struct
fb_fix_screeninfo. This will have to be dealt with separately.
Thanks for this patch Benjamin, I use it together with what we have discussed in the "pci issue - wrong detection of pci ressources" thread. Unfortunately I now hit exactly that issue with fb_fix_screeninfo you describe.
For everyone the fb_fix_screeninfo has two "unsigned long" vars that need to strore a IO address.
This fails in my case with a 32bit powerpc system (=sizeof(long)=4) which has paddr >4Gb and actually it should affect any 32bit platform with paddr>4Gb.
You see it e.g. when you try to initialize X11, the x11 radeon driver issues a FBIOGET_FSCREENINFO ioctl and because our address is >4Gb it get's clobbered by that unsigned long in the fb_fix_screeninfo structure (the value comes from a resource_size_t variable which has the correct 64bit).
struct fb_fix_screeninfo {
char id[16]; /* identification string eg "TT Builtin" */
unsigned long smem_start; /* Start of frame buffer mem */
[...]
unsigned long mmio_start; /* Start of Memory Mapped I/O */
[...]
I tried the stupid solution to just change the fb_fix_screeninfo structure to resource_size_t, but that changes the size ioctl transports and would require awareness in the userspace applications using that ioctl. The X11 & Framebuffer driver work on 64bit systems, so I think it's just an issue of not cutting that data down to 32bit when transporting it (has anyone already checked the x11 drivers, I hope they don't use unsigned long too).
I wanted to ask if there are any known workarounds atm that would allow me to use my X11 for now?
Signature · 2 lines
Grüsse / regards, Christian Ehrhardt IBM Linux Technology Center, Open Virtualization
Quoted 3 lines · Christian Ehrhardt
You see it e.g. when you try to initialize X11, the x11 radeon driver issues a
FBIOGET_FSCREENINFOioctl [...]
FWIW, current versions of the xf86-video-ati radeon driver no longer use radeonfb for anything.
Signature · 2 lines
Earthling Michel Dänzer | http://tungstengraphics.com Libre software enthusiast | Debian, X and DRI developer
Quoted 2 lines · Christian Ehrhardt
I wanted to ask if there are any known workarounds atm that would allow me to use my X11 for now?
X is doing a mmap of /dev/mem instead of /dev/fb ?
You can normally map the fb mapping /dev/fb and then map the registers using /dev/fb at an offset beyond the framebuffer (fix->smem_len).
If X is using /dev/mem instead, then it's being stupid and needs to be fixed...
Cheers,
Ben.
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
Quoted 11 lines · Benjamin Herrenschmidt
Quoted 2 lines · Christian Ehrhardt
I wanted to ask if there are any known workarounds atm that would allow me to use my X11 for now?
X is doing a mmap of
/dev/meminstead of/dev/fb?You can normally map the fb mapping
/dev/fband then map the registers using/dev/fbat an offset beyond the framebuffer (fix->smem_len).If X is using
/dev/meminstead, then it's being stupid and needs to be fixed...
It's up to the driver, and again, the current radeon driver doesn't use radeonfb at all anymore...
Signature · 2 lines
Earthling Michel Dänzer | http://tungstengraphics.com Libre software enthusiast | Debian, X and DRI developer
Quoted 6 lines · Michel Dänzer
Quoted 3 lines
X is doing a mmap of
/dev/meminstead of/dev/fb?You can normally map the fb mapping
/dev/fband then map theregisters
Quoted 2 lines
using
/dev/fbat an offset beyond the framebuffer (fix->smem_len).
Quoted 7 lines
Quoted 1 line
If X is using
/dev/meminstead, then it's being stupid and needs tobe
Quoted 1 line
fixed...
It's up to the driver, and again, the current radeon driver doesn't use
radeonfb at all anymore...
Right. And I'm happy to go fix what remains, don't get me wrong here :-) We all know how stupid legacy code can be !
I'll try to get some patches to expose a new version of the structure sometimes in the upcoming week or two (we'll see what time permits) and then see about fixing X drivers that need fixing, though hopefully with pci-rework being upstream now, that shouldn't be many.
The main issue is directfb. I hope they'll catch up with the new ioctls.
Ben.
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Linux-fbdev-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel
From: Michel Dänzer <[email protected]>
Date: Wed, 23 Apr 2008 11:32:07 +0200
Quoted 7 lines · Benjamin Herrenschmidt
Quoted 6 lines · Christian Ehrhardt
Quoted 2 lines
I wanted to ask if there are any known workarounds atm that would allow me to use my X11 for now?
X is doing a mmap of
/dev/meminstead of/dev/fb?
Quoted 8 lines
Quoted 5 lines
You can normally map the fb mapping
/dev/fband then map the registers using/dev/fbat an offset beyond the framebuffer (fix->smem_len).If X is using
/dev/meminstead, then it's being stupid and needs to be fixed...It's up to the driver, and again, the current radeon driver doesn't use radeonfb at all anymore...
The only portable thing is for X to use the PCI sysfs mmap() stuff, which current Xorg servers using libpciaccess do.
I know because I'm typing this from a sparc64 using a Radeon with current Xorg :-)
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
Quoted 9 lines · David Miller
Quoted 1 line
It's up to the driver, and again, the current radeon driver doesn't
use
Quoted 1 line
radeonfb at all anymore...
The only portable thing is for X to use the PCI sysfs
mmap()stuff, which current Xorg servers using libpciaccess do.I know because I'm typing this from a sparc64 using a Radeon with current Xorg :-)
True :-) But I'd still like to fix the fb API for the sake of things like directfb etc...
Ben.
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
Hello.
Quoted 7 lines · Benjamin Herrenschmidt
This fixes radeonfb to not truncate 64 bits resources on 32 bits platforms. Unfortunately, there are still issues with addresses returned to userspace via struct
fb_fix_screeninfo. This will have to be dealt with separately.Signed-off-by Benjamin Herrenschmidt <[email protected]>
I'm seeing that these 3 patch series (dating back to April) still
unapplied. Have everybody forgotten about them? I'd like to see them finally applied.
Quoted 25 lines
drivers/video/aty/radeon_base.c +2
-2@@ -1886,7 +1886,7 @@ static int __devinit radeon_set_fbinfo ( info->screen_size = rinfo->mapped_vram;/* Fill fix common fields */ strlcpy (info->fix.id, rinfo->name,sizeof (info->fix.id)); - info->fix.smem_start = rinfo->fb_base_phys; + info->fix.smem_start = (unsigned long )rinfo->fb_base_phys; info->fix.smem_len = rinfo->video_ram; info->fix.type =FB_TYPE_PACKED_PIXELS ; info->fix.visual =FB_VISUAL_PSEUDOCOLOR ;@@ -1894,7 +1894,7 @@ static int __devinit radeon_set_fbinfo ( info->fix.ypanstep =1 ; info->fix.ywrapstep =0 ; info->fix.type_aux =0 ; - info->fix.mmio_start = rinfo->mmio_base_phys; + info->fix.mmio_start = (unsigned long )rinfo->mmio_base_phys; info->fix.mmio_len =RADEON_REGSIZE ; info->fix.accel =FB_ACCEL_ATI_RADEON ;Index:
linux-work/drivers/video/aty/radeonfb.h
===================================================================
drivers/video/aty/radeonfb.h struct radeonfb_info { · line 294
Quoted 10 lines
drivers/video/aty/radeonfb.h +2
-2@@ -287,8 +287,8 @@ struct radeonfb_info {char name[DEVICE_NAME_SIZE ]; -unsigned long mmio_base_phys; -unsigned long fb_base_phys; +resource_size_t mmio_base_phys; +resource_size_t fb_base_phys;void __iomem *mmio_base;void __iomem *fb_base;
WBR, Sergei
Hello.
Quoted 7 lines · Benjamin Herrenschmidt
This fixes radeonfb to not truncate 64 bits resources on 32 bits platforms. Unfortunately, there are still issues with addresses returned to userspace via struct
fb_fix_screeninfo. This will have to be dealt with separately.Signed-off-by Benjamin Herrenschmidt <[email protected]>
I'm seeing that this 3 patch series (dating back to April) still
unapplied. Have everybody forgotten about them? I'd like to see them finally applied.
Quoted 25 lines
drivers/video/aty/radeon_base.c +2
-2@@ -1886,7 +1886,7 @@ static int __devinit radeon_set_fbinfo ( info->screen_size = rinfo->mapped_vram;/* Fill fix common fields */ strlcpy (info->fix.id, rinfo->name,sizeof (info->fix.id)); - info->fix.smem_start = rinfo->fb_base_phys; + info->fix.smem_start = (unsigned long )rinfo->fb_base_phys; info->fix.smem_len = rinfo->video_ram; info->fix.type =FB_TYPE_PACKED_PIXELS ; info->fix.visual =FB_VISUAL_PSEUDOCOLOR ;@@ -1894,7 +1894,7 @@ static int __devinit radeon_set_fbinfo ( info->fix.ypanstep =1 ; info->fix.ywrapstep =0 ; info->fix.type_aux =0 ; - info->fix.mmio_start = rinfo->mmio_base_phys; + info->fix.mmio_start = (unsigned long )rinfo->mmio_base_phys; info->fix.mmio_len =RADEON_REGSIZE ; info->fix.accel =FB_ACCEL_ATI_RADEON ;Index:
linux-work/drivers/video/aty/radeonfb.h
===================================================================
drivers/video/aty/radeonfb.h struct radeonfb_info { · line 294
Quoted 10 lines
drivers/video/aty/radeonfb.h +2
-2@@ -287,8 +287,8 @@ struct radeonfb_info {char name[DEVICE_NAME_SIZE ]; -unsigned long mmio_base_phys; -unsigned long fb_base_phys; +resource_size_t mmio_base_phys; +resource_size_t fb_base_phys;void __iomem *mmio_base;void __iomem *fb_base;
WBR, Sergei