All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: beginnings of allowing more than the basic 80x25 VGA screen resolution
@ 2005-07-04  8:35 Jan Beulich
  0 siblings, 0 replies; 11+ messages in thread
From: Jan Beulich @ 2005-07-04  8:35 UTC (permalink / raw)
  To: Keir.Fraser; +Cc: xen-devel

>> As far as I know, not only the VGA driver does not do any mode
>> switching, even the VESA one doesn't (because the protected mode
>> interface doesn't cover the mode switching functions as far as I
>> remember). Only the video board specific frame buffer drivers are
able
>> to switch modes, and the bad thing (for me personally) is that even
in
>> 2.6.12 there still is no (64-bit) support for the i915 chipset. So
I
>> continue to be required to live with the video mode that XEN 'sets'
>> prior to loading dom0, and short of it supporting a VESA console my
>> first minimal attempt was to at least increase (and propagate) the
size
>> to the maximum possible without significant changes.
>
>That's a pain. Maybe we can find a simple example somewhere of setting

>video mode via protect-mode VBE calls. I see that this functionality
is 
>missing from the kernel drivers -- it's all done in a monstrous 
>real-mode assembly file. Any video card we care about these days
should 
>support VBE 2.0/3.0 I think, and those interfaces don;t require you to

>be runnign in real mode.

At least for VBE 2.0 such code can't exist; the protected mode
interface only covers
- setting the memory window
- setting the display start
- setting the primary palette
and I don't think 3.0 significantly extended that interface. The
assumption here is that any program wishing to use this is going to set
up its video mode once and for all in real mode, and then only require
some limited support in setting certain output-related things.

Jan

^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: beginnings of allowing more than the basic 80x25 VGA screen resolution
@ 2005-07-04  8:00 Jan Beulich
  0 siblings, 0 replies; 11+ messages in thread
From: Jan Beulich @ 2005-07-04  8:00 UTC (permalink / raw)
  To: Keir.Fraser; +Cc: xen-devel

>We could certainly add a way to propagate the mode option through to 
>the vga driver, but is the Linux vga driver really unable to switch 
>modes without bios help? Is there support for a protected-mode
vesa/vbe 
>driver instead?

As far as I know, not only the VGA driver does not do any mode
switching, even the VESA one doesn't (because the protected mode
interface doesn't cover the mode switching functions as far as I
remember). Only the video board specific frame buffer drivers are able
to switch modes, and the bad thing (for me personally) is that even in
2.6.12 there still is no (64-bit) support for the i915 chipset. So I
continue to be required to live with the video mode that XEN 'sets'
prior to loading dom0, and short of it supporting a VESA console my
first minimal attempt was to at least increase (and propagate) the size
to the maximum possible without significant changes.

Jan

^ permalink raw reply	[flat|nested] 11+ messages in thread
[parent not found: <s2c890b4.055@lucius.provo.novell.com>]
* Re: beginnings of allowing more than the basic 80x25 VGA screen resolution
@ 2005-07-04  7:28 Jan Beulich
  0 siblings, 0 replies; 11+ messages in thread
From: Jan Beulich @ 2005-07-04  7:28 UTC (permalink / raw)
  To: Keir.Fraser; +Cc: xen-devel

>I'll happily take a patch that increases range of text modes supported

>by Xen. But why bother to propagate this info to XenLinux? You can set

>a vga-mode parameter on XenLinux's command line. To make this easier,

>we could have Xen automatically add a suitable mode parameter to 
>XenLinux command line, based on what was passed to Xen, if one wasn;t

>specified by the administrator.

Hmm, interesting. I would have hoped such thing would exist, but I
can't see how it could work, since the code affected by
CONFIG_VIDEO_SELECT (which is what in non-guest Linux deals with the
vga= option) doesn't even exist in XenLinux. Further more, since XEN is
a multiboot image, it would require infrastructure to switch back to
real mode for issuing the necessary INT10-s in the guest kernel, which I
think is neither very desirable nor existing.

So I must be missing something, but I'd need a pointer at where I would
have to look for the alternative code.

Jan

^ permalink raw reply	[flat|nested] 11+ messages in thread
* beginnings of allowing more than the basic 80x25 VGA screen resolution
@ 2005-07-01 15:48 Jan Beulich
  2005-07-01 15:52 ` Jon Smirl
  2005-07-01 16:02 ` Keir Fraser
  0 siblings, 2 replies; 11+ messages in thread
From: Jan Beulich @ 2005-07-01 15:48 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 363 bytes --]

With stack traces (during kernel crashes) being usually quite long, extending the capacity of the screen to at least 80x30 (20%) may already be considered helpful. I'm certain the patches won't be accepted as-is (namely the change to the start_info structure), but I need to get an understanding at what the expectations are to then try to adjust them.

Jan


[-- Attachment #2: xen-vga-plus.patch --]
[-- Type: application/octet-stream, Size: 7871 bytes --]

diff -Nprux .list unstable/xen/arch/x86/domain_build.c nxen-core/xen/arch/x86/domain_build.c
--- unstable/xen/arch/x86/domain_build.c	2005-07-01 08:24:22.243480408 -0700
+++ nxen-core/xen/arch/x86/domain_build.c	2005-07-01 08:32:20.931708736 -0700
@@ -12,6 +12,7 @@
 #include <xen/smp.h>
 #include <xen/delay.h>
 #include <xen/event.h>
+#include <xen/console.h>
 #include <xen/elf.h>
 #include <xen/kernel.h>
 #include <asm/regs.h>
@@ -541,6 +542,8 @@ int construct_dom0(struct domain *d,
     /* Set up start info area. */
     si = (start_info_t *)vstartinfo_start;
     memset(si, 0, PAGE_SIZE);
+    si->size         = sizeof(start_info_t);
+    si->boot_offset  = offsetof(start_info_t, pt_base);
     si->nr_pages     = nr_pages;
 
     if ( opt_dom0_translate )
@@ -554,6 +557,7 @@ int construct_dom0(struct domain *d,
         si->shared_info  = virt_to_phys(d->shared_info);
 
     si->flags        = SIF_PRIVILEGED | SIF_INITDOMAIN;
+    fill_console_start_info(si);
     si->pt_base      = vpt_start;
     si->nr_pt_frames = nr_pt_pages;
     si->mfn_list     = vphysmap_start;
diff -Nprux .list unstable/xen/drivers/char/console.c nxen-core/xen/drivers/char/console.c
--- unstable/xen/drivers/char/console.c	2005-07-01 08:24:47.353663080 -0700
+++ nxen-core/xen/drivers/char/console.c	2005-07-01 08:32:43.349300744 -0700
@@ -63,7 +63,7 @@ spinlock_t console_lock = SPIN_LOCK_UNLO
 
 /* VGA text (mode 3) definitions. */
 #define COLUMNS     80
-#define LINES       25
+#define LINES       vgacon_enabled
 #define ATTRIBUTE    7
 
 /* Clear the screen and initialize VIDEO, XPOS and YPOS.  */
@@ -166,6 +166,27 @@ static void init_vga(void)
         outb(i, 0x3c0); 
         outb(regs[j++], 0x3c0);
     }
+
+    switch ( vgacon_enabled )
+    {
+    case 30:
+    /*case 34:*/
+    /*case 60:*/
+        /* Set 480 scan lines. */
+        outw(0x0c11, 0x3d4);		/* Vertical sync end (also unlocks CR0-7) */
+        outw(0x0b06, 0x3d4);		/* Vertical total */
+        outw(0x3e07, 0x3d4);		/* Vertical overflow */
+        outw(0xea10, 0x3d4);		/* Vertical sync start */
+        outw(0x8c11, 0x3d4);		/* Vertical sync end (also locks CR0-7) */
+        outw(0xdf12, 0x3d4);		/* Vertical display end */
+        outw(0xe715, 0x3d4);		/* Vertical blank start */
+        outw(0x0416, 0x3d4);		/* Vertical blank end */
+        outb((inb(0x3cc) & 0x0d) | 0xe2, 0x3c2);		/* Misc output register */
+        break;
+    default:
+        vgacon_enabled = 25;
+        break;
+    }
     
     tmp = inb(0x3da);
     outb(0x20, 0x3c0);
@@ -207,6 +228,31 @@ static void putchar_console(int c)
     }
 }
 
+int fill_console_start_info(start_info_t *si)
+{
+    if (!vgacon_enabled)
+        return 0;
+    si->video_type   = 1;
+    si->video_width  = COLUMNS;
+    si->video_height = LINES;
+    si->txt_mode     = 3;
+    switch (LINES)
+    {
+    default:
+        si->txt_points = 16;
+        break;
+    case 28:
+    case 34:
+        si->txt_points = 14;
+        break;
+    case 43:
+    case 50:
+    case 60:
+        si->txt_points = 8;
+        break;
+    }
+    return 1;
+}
 
 /*
  * ********************************************************
@@ -453,7 +499,9 @@ void init_console(void)
         if ( strncmp(p, "com", 3) == 0 )
             sercon_handle = serial_parse_handle(p);
         else if ( strncmp(p, "vga", 3) == 0 )
-            vgacon_enabled = 1;
+            vgacon_enabled = p[3] < '1' || p[3] > '9'
+                             ? 25
+                             : simple_strtol(p + 3, NULL, 10);
     }
 
     init_vga();
diff -Nprux .list unstable/xen/include/public/xen.h nxen-core/xen/include/public/xen.h
--- unstable/xen/include/public/xen.h	2005-07-01 08:25:48.455374208 -0700
+++ nxen-core/xen/include/public/xen.h	2005-07-01 08:33:29.878227272 -0700
@@ -433,30 +433,51 @@ typedef struct shared_info_st
 
 #define MAX_GUEST_CMDLINE 1024
 typedef struct {
+    u32      size;            /*  0: structure size */
+    u32      boot_offset;     /*  4: offset of boot-only info */
     /* THE FOLLOWING ARE FILLED IN BOTH ON INITIAL BOOT AND ON RESUME.        */
-    memory_t nr_pages;        /*  0: Total pages allocated to this domain.    */
+    memory_t nr_pages;        /*  8: Total pages allocated to this domain.    */
     _MEMORY_PADDING(A);
-    memory_t shared_info;     /*  8: MACHINE address of shared info struct.   */
+    memory_t shared_info;     /* 16: MACHINE address of shared info struct.   */
     _MEMORY_PADDING(B);
-    u32      flags;           /* 16: SIF_xxx flags.                           */
-    u16      domain_controller_evtchn; /* 20 */
-    u16      __pad;
+    u32      flags;           /* 24: SIF_xxx flags.                           */
+    u16      domain_controller_evtchn; /* 28 */
+    u16      video_width;     /* 30 */
+    u16      video_height;    /* 32 */
+    u8       video_type;      /* 34 */
+    u8       txt_points;      /* 35 */
+    u16      txt_mode;        /* 36 */
+    u16      txt_x;           /* 38 */
+    u16      txt_y;           /* 40 */
+    u16      lfb__pad;        /* 42 */
+    u32      lfb_base;        /* 44 */
+    u32      lfb_size;        /* 48 */
+    u16      lfb_linelen;     /* 52 */
+    u16      lfb_depth;       /* 54 */
+    u8       red_pos;         /* 56 */
+    u8       red_size;        /* 57 */
+    u8       green_pos;       /* 58 */
+    u8       green_size;      /* 59 */
+    u8       blue_pos;        /* 60 */
+    u8       blue_size;       /* 61 */
+    u8       rsvd_pos;        /* 62 */
+    u8       rsvd_size;       /* 63 */
     /* THE FOLLOWING ARE ONLY FILLED IN ON INITIAL BOOT (NOT RESUME).         */
-    memory_t pt_base;         /* 24: VIRTUAL address of page directory.       */
+    memory_t pt_base;         /* 64: VIRTUAL address of page directory.       */
     _MEMORY_PADDING(C);
-    memory_t nr_pt_frames;    /* 32: Number of bootstrap p.t. frames.         */
+    memory_t nr_pt_frames;    /* 72: Number of bootstrap p.t. frames.         */
     _MEMORY_PADDING(D);
-    memory_t mfn_list;        /* 40: VIRTUAL address of page-frame list.      */
+    memory_t mfn_list;        /* 80: VIRTUAL address of page-frame list.      */
     _MEMORY_PADDING(E);
-    memory_t mod_start;       /* 48: VIRTUAL address of pre-loaded module.    */
+    memory_t mod_start;       /* 88: VIRTUAL address of pre-loaded module.    */
     _MEMORY_PADDING(F);
-    memory_t mod_len;         /* 56: Size (bytes) of pre-loaded module.       */
+    memory_t mod_len;         /* 96: Size (bytes) of pre-loaded module.       */
     _MEMORY_PADDING(G);
-    s8 cmd_line[MAX_GUEST_CMDLINE]; /* 64 */
-    memory_t store_page;      /* 1088: VIRTUAL address of store page.         */
+    s8 cmd_line[MAX_GUEST_CMDLINE]; /* 104 */
+    memory_t store_page;      /* 1128: VIRTUAL address of store page.         */
     _MEMORY_PADDING(H);
-    u16      store_evtchn;    /* 1096: Event channel for store communication. */
-} PACKED start_info_t; /* 1098 bytes */
+    u16      store_evtchn;    /* 1136: Event channel for store communication. */
+} PACKED start_info_t; /* 1138 bytes */
 
 /* These flags are passed in the 'flags' field of start_info_t. */
 #define SIF_PRIVILEGED    (1<<0)  /* Is the domain privileged? */
diff -Nprux .list unstable/xen/include/xen/console.h nxen-core/xen/include/xen/console.h
--- unstable/xen/include/xen/console.h	2005-07-01 08:25:51.866855584 -0700
+++ nxen-core/xen/include/xen/console.h	2005-07-01 08:33:32.814780848 -0700
@@ -8,6 +8,7 @@
 #define __CONSOLE_H__
 
 #include <xen/spinlock.h>
+#include <public/xen.h>
 
 extern spinlock_t console_lock;
 
@@ -17,6 +18,7 @@ long read_console_ring(char **, u32 *, i
 
 void init_console(void);
 void console_endboot(int disable_vga);
+int fill_console_start_info(start_info_t *);
 
 void console_force_unlock(void);
 void console_force_lock(void);

[-- Attachment #3: xenlinux-vga-plus.patch --]
[-- Type: application/octet-stream, Size: 5609 bytes --]

--- 2.6.11-xen/arch/xen/i386/kernel/setup.c	2005-07-01 09:13:57.212216416 -0700
+++ nxen-guest/arch/xen/i386/kernel/setup.c	2005-07-01 09:15:13.351641464 -0700
@@ -1412,6 +1412,14 @@ void __init setup_arch(char **cmdline_p)
 	HYPERVISOR_vm_assist(VMASST_CMD_enable,
 			     VMASST_TYPE_writable_pagetables);
 
+	if (xen_start_info.size != sizeof(start_info_t)
+	    || xen_start_info.boot_offset != offsetof(start_info_t, pt_base))
+		panic("Mismatched start_info layouts (%zu/%u, %zu/%u)",
+		      sizeof(start_info_t),
+		      xen_start_info.size,
+		      offsetof(start_info_t, pt_base),
+		      xen_start_info.boot_offset);
+
 	memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data));
 	early_cpu_init();
 
@@ -1432,7 +1440,32 @@ void __init setup_arch(char **cmdline_p)
 	*/
 	ROOT_DEV = MKDEV(UNNAMED_MAJOR,0);
  	drive_info = DRIVE_INFO;
- 	screen_info = SCREEN_INFO;
+
+#ifdef CONFIG_XEN_PHYSDEV_ACCESS
+	screen_info.orig_video_mode   = xen_start_info.txt_mode; 
+	screen_info.orig_video_isVGA  = xen_start_info.video_type;
+	screen_info.orig_video_lines  = xen_start_info.video_height;
+	screen_info.orig_video_cols   = xen_start_info.video_width;
+	screen_info.orig_video_points = xen_start_info.txt_points;
+	/* This is drawn from a dump from vgacon:startup in standard Linux. */
+	screen_info.orig_video_ega_bx = 3;
+
+	screen_info.lfb_width         = xen_start_info.video_width;
+	screen_info.lfb_height        = xen_start_info.video_height;
+	screen_info.lfb_depth         = xen_start_info.lfb_depth;
+	screen_info.lfb_base          = xen_start_info.lfb_base;
+	screen_info.lfb_size          = xen_start_info.lfb_size;
+	screen_info.lfb_linelength    = xen_start_info.lfb_linelen;
+	screen_info.red_size          = xen_start_info.red_size;
+	screen_info.red_pos           = xen_start_info.red_pos;
+	screen_info.green_size        = xen_start_info.green_size;
+	screen_info.green_pos         = xen_start_info.green_pos;
+	screen_info.blue_size         = xen_start_info.blue_size;
+	screen_info.blue_pos          = xen_start_info.blue_pos;
+	screen_info.rsvd_size         = xen_start_info.rsvd_size;
+	screen_info.rsvd_pos          = xen_start_info.rsvd_pos;
+#endif
+
 	edid_info = EDID_INFO;
 	apm_info.bios = APM_BIOS_INFO;
 	ist_info = IST_INFO;
@@ -1446,16 +1454,6 @@ void __init setup_arch(char **cmdline_p)
 	aux_device_present = AUX_DEVICE_INFO;
 	bootloader_type = LOADER_TYPE;
 
-#ifdef CONFIG_XEN_PHYSDEV_ACCESS
-	/* This is drawn from a dump from vgacon:startup in standard Linux. */
-	screen_info.orig_video_mode = 3; 
-	screen_info.orig_video_isVGA = 1;
-	screen_info.orig_video_lines = 25;
-	screen_info.orig_video_cols = 80;
-	screen_info.orig_video_ega_bx = 3;
-	screen_info.orig_video_points = 16;
-#endif
-
 #ifdef CONFIG_BLK_DEV_RAM
 	rd_image_start = RAMDISK_FLAGS & RAMDISK_IMAGE_START_MASK;
 	rd_prompt = ((RAMDISK_FLAGS & RAMDISK_PROMPT_FLAG) != 0);
--- 2.6.11-xen/arch/xen/x86_64/kernel/setup.c	2005-07-01 09:14:30.399171232 -0700
+++ nxen-guest/arch/xen/x86_64/kernel/setup.c	2005-07-01 09:15:40.113573032 -0700
@@ -607,6 +607,14 @@ void __init setup_arch(char **cmdline_p)
 	int i, j;
 	physdev_op_t op;
 
+	if (xen_start_info.size != sizeof(start_info_t)
+	    || xen_start_info.boot_offset != offsetof(start_info_t, pt_base))
+		panic("Mismatched start_info layouts (%zu/%u, %zu/%u)",
+		      sizeof(start_info_t),
+		      xen_start_info.size,
+		      offsetof(start_info_t, pt_base),
+		      xen_start_info.boot_offset);
+
 #if 0
  	ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV);
 #else
@@ -615,8 +623,30 @@ void __init setup_arch(char **cmdline_p)
  	drive_info = DRIVE_INFO;
 
 #ifdef CONFIG_XEN_PHYSDEV_ACCESS
- 	screen_info = SCREEN_INFO;
+	screen_info.orig_video_mode   = xen_start_info.txt_mode; 
+	screen_info.orig_video_isVGA  = xen_start_info.video_type;
+	screen_info.orig_video_lines  = xen_start_info.video_height;
+	screen_info.orig_video_cols   = xen_start_info.video_width;
+	screen_info.orig_video_points = xen_start_info.txt_points;
+	/* This is drawn from a dump from vgacon:startup in standard Linux. */
+	screen_info.orig_video_ega_bx = 3;
+
+	screen_info.lfb_width         = xen_start_info.video_width;
+	screen_info.lfb_height        = xen_start_info.video_height;
+	screen_info.lfb_depth         = xen_start_info.lfb_depth;
+	screen_info.lfb_base          = xen_start_info.lfb_base;
+	screen_info.lfb_size          = xen_start_info.lfb_size;
+	screen_info.lfb_linelength    = xen_start_info.lfb_linelen;
+	screen_info.red_size          = xen_start_info.red_size;
+	screen_info.red_pos           = xen_start_info.red_pos;
+	screen_info.green_size        = xen_start_info.green_size;
+	screen_info.green_pos         = xen_start_info.green_pos;
+	screen_info.blue_size         = xen_start_info.blue_size;
+	screen_info.blue_pos          = xen_start_info.blue_pos;
+	screen_info.rsvd_size         = xen_start_info.rsvd_size;
+	screen_info.rsvd_pos          = xen_start_info.rsvd_pos;
 #endif
+
 	edid_info = EDID_INFO;
 	aux_device_present = AUX_DEVICE_INFO;
 	saved_video_mode = SAVED_VIDEO_MODE;
@@ -629,15 +659,6 @@ void __init setup_arch(char **cmdline_p)
 #endif
 /*        register_console(&xen_console); */
 
-#ifdef CONFIG_XEN_PHYSDEV_ACCESS
-	/* This is drawn from a dump from vgacon:startup in standard Linux. */
-	screen_info.orig_video_mode = 3; 
-	screen_info.orig_video_isVGA = 1;
-	screen_info.orig_video_lines = 25;
-	screen_info.orig_video_cols = 80;
-	screen_info.orig_video_ega_bx = 3;
-	screen_info.orig_video_points = 16;
-#endif       
         ARCH_SETUP
         print_memory_map(machine_specific_memory_setup());
 

[-- Attachment #4: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2005-07-07  7:59 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <s2c898b4.073@lucius.provo.novell.com>
2005-07-04  8:14 ` beginnings of allowing more than the basic 80x25 VGA screen resolution Keir Fraser
2005-07-04  8:51   ` Gerd Knorr
2005-07-06 21:37     ` Matthias Huber
2005-07-07  7:59       ` Gerd Knorr
2005-07-04  8:35 Jan Beulich
  -- strict thread matches above, loose matches on Subject: below --
2005-07-04  8:00 Jan Beulich
     [not found] <s2c890b4.055@lucius.provo.novell.com>
2005-07-04  7:50 ` Keir Fraser
2005-07-04  7:28 Jan Beulich
2005-07-01 15:48 Jan Beulich
2005-07-01 15:52 ` Jon Smirl
2005-07-01 16:02 ` Keir Fraser

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.