PATCH: console.c: use ioremap instead of __va to map video memory
Hi,
on ia64 you need to map video are as uncached memory. With this patch the vga console is now working on ia64.
Tested on ia64 only.
Tristan.
# HG changeset patch
# User [email protected]
# Node ID ef77d9331c6790e90d9bfb544fce0d8aa07df04d
# Parent 0771620083f2a53354b8ed4146938a9349a825f5
Use ioremap instead of __va to map VGA memory area (to be uncached).
xen/drivers/char/console.c +6 -5
@@ -65,11 +65,12 @@#define COLUMNS 80#define LINES 25#define ATTRIBUTE 7 +#define VIDEO_SIZE (COLUMNS * LINES * 2)/* Clear the screen and initialize VIDEO, XPOS and YPOS. */ static void cls (void ) { -memset (video,0 ,COLUMNS *LINES *2 ); +memset (video,0 ,VIDEO_SIZE ); xpos = ypos =0 ;outw (10 +(1 <<(5 +8 )),0x3d4 );/* cursor off */ }
@@ -107,9 +108,9 @@* * These checks are basically to detect headless server boxes. */ -return (detect_video (__va (0xA0000 )) || -detect_video (__va (0xB0000 )) || -detect_video (__va (0xB8000 ))); +return (detect_video (ioremap (0xA0000 ,VIDEO_SIZE )) || +detect_video (ioremap (0xB0000 ,VIDEO_SIZE )) || +detect_video (ioremap (0xB8000 ,VIDEO_SIZE ))); }/* This is actually code from vgaHWRestore in an old version of XFree86 :-) */
@@ -143,7 +144,7 @@return ; } - video =__va (0xB8000 ); + video =ioremap (0xB8000 ,VIDEO_SIZE ); tmp =inb (0x3da );outb (0x00 ,0x3c0 );
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 6 lines · Tristan Gingold
Hi,
on ia64 you need to map video are as uncached memory. With this patch the vga console is now working on ia64.
Tested on ia64 only.
It should work fine on x86 (though I haven't tested!) since ioremap is just defined to __va().
The comment in asm-x86/io.h says "we don't need a real ioremap on Xen/x86", but I think we do need it for the IOMMU work on x86-64, since the hypervisor will need to map the IOMMU's internal register area for things like cache flushing. Is there a fundamental objection to a real ioremap for x86?
Cheers,
Muli
Signature · 2 lines
Muli Ben-Yehuda http://www.mulix.org | http://mulix.livejournal.com/
Quoted 5 lines · Muli Ben-Yehuda
The comment in
asm-x86/io.hsays "we don't need a real ioremap on Xen/x86", but I think we do need it for the IOMMU work on x86-64, since the hypervisor will need to map the IOMMU's internal register area for things like cache flushing. Is there a fundamental objection to a real ioremap for x86?
No, it got removed as it wasn't used, but it can easily be added back. It's particularly easy since we probably don't need iounmap().
-- Keir
Quoted 2 lines · Keir Fraser
No, it got removed as it wasn't used, but it can easily be added back. It's particularly easy since we probably don't need
iounmap().
Excellent, thanks for the info.
Cheers,
Muli
Signature · 2 lines
Muli Ben-Yehuda http://www.mulix.org | http://mulix.livejournal.com/
Quoted 11 lines · Keir Fraser
Quoted 5 lines · Muli Ben-Yehuda
The comment in
asm-x86/io.hsays "we don't need a real ioremap on Xen/x86", but I think we do need it for the IOMMU work on x86-64, since the hypervisor will need to map the IOMMU's internal register area for things like cache flushing. Is there a fundamental objection to a real ioremap for x86?No, it got removed as it wasn't used, but it can easily be added back. It's particularly easy since we probably don't need
iounmap().
Hmm, looking at the hg logs, it looks like ioremap() was added for x86-64 with the current __va() implementation. Can you please point me at the old version?
Thanks,
Muli
Signature · 2 lines
Muli Ben-Yehuda http://www.mulix.org | http://mulix.livejournal.com/
Quoted 6 lines · Muli Ben-Yehuda
Quoted 2 lines
No, it got removed as it wasn't used, but it can easily be added back. It's particularly easy since we probably don't need
iounmap().Hmm, looking at the hg logs, it looks like
ioremap()was added for x86-64 with the current__va()implementation. Can you please point me at the old version?
If you want the old ioremap(), see for example changeset 1452, and look for xen/arch/i386/ioremap.c. That implementation would still work even for x86/64 -- the bit that directly changes page tables should actually call map_pages_to_xen().
-- Keir