xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Sven Köhler" <sven.koehler@gmail.com>
To: xen-devel@lists.xensource.com
Subject: Re: Xen 4.1 PVOPS 3.0.0-RC1 VGA Console
Date: Sat, 04 Jun 2011 16:00:33 +0200	[thread overview]
Message-ID: <isddiq$sg1$1@dough.gmane.org> (raw)
In-Reply-To: <isda49$bqb$1@dough.gmane.org>

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

Am 04.06.2011 15:01, schrieb Sven Köhler:
> I will try to apply it to 3.0-rc1.

Didn't apply to 3.0-rc1. Mainly an issue in enlighten.c, but it was easy
to fix, I believe. Patch is attached. Not sure whether it's 100%
correct, but kernel booted fine, with working VGA. (Didn't try anything
fancy like X11, since it's a server machine.)


Regards,
  Sven

[-- Attachment #2: 3.0-xen-vga.patch --]
[-- Type: text/x-patch, Size: 6421 bytes --]

diff -Nru linux-3.0-rc1/arch//x86/xen/Makefile /usr/src/linux-3.0-rc1/arch//x86/xen/Makefile
--- linux-3.0-rc1/arch//x86/xen/Makefile	2011-05-30 02:43:36.000000000 +0200
+++ /usr/src/linux-3.0-rc1/arch//x86/xen/Makefile	2011-06-04 17:22:20.539995284 +0200
@@ -18,5 +18,6 @@
 obj-$(CONFIG_SMP)		+= smp.o
 obj-$(CONFIG_PARAVIRT_SPINLOCKS)+= spinlock.o
 obj-$(CONFIG_XEN_DEBUG_FS)	+= debugfs.o
+obj-$(CONFIG_XEN_DOM0)		+= vga.o
 
 obj-$(CONFIG_SWIOTLB_XEN)	+= pci-swiotlb-xen.o
diff -Nru linux-3.0-rc1/arch//x86/xen/enlighten.c /usr/src/linux-3.0-rc1/arch//x86/xen/enlighten.c
--- linux-3.0-rc1/arch//x86/xen/enlighten.c	2011-05-30 02:43:36.000000000 +0200
+++ /usr/src/linux-3.0-rc1/arch//x86/xen/enlighten.c	2011-06-04 17:27:33.550006942 +0200
@@ -1240,7 +1240,17 @@
 		add_preferred_console("hvc", 0, NULL);
 		if (pci_xen)
 			x86_init.pci.arch_init = pci_xen_init;
+		
+		boot_params.screen_info.orig_video_isVGA = 0;
 	} else {
+		const struct dom0_vga_console_info *info =
+			(void *)((char *)xen_start_info +
+				 xen_start_info->console.dom0.info_off);
+
+		xen_init_vga(info, xen_start_info->console.dom0.info_size);
+		xen_start_info->console.domU.mfn = 0;
+		xen_start_info->console.domU.evtchn = 0;
+
 		/* Make sure ACS will be enabled */
 		pci_request_acs();
 	}
diff -Nru linux-3.0-rc1/arch//x86/xen/vga.c /usr/src/linux-3.0-rc1/arch//x86/xen/vga.c
--- linux-3.0-rc1/arch//x86/xen/vga.c	1970-01-01 01:00:00.000000000 +0100
+++ /usr/src/linux-3.0-rc1/arch//x86/xen/vga.c	2011-06-04 17:21:25.780001079 +0200
@@ -0,0 +1,67 @@
+#include <linux/screen_info.h>
+#include <linux/init.h>
+
+#include <asm/bootparam.h>
+#include <asm/setup.h>
+
+#include <xen/interface/xen.h>
+
+#include "xen-ops.h"
+
+void __init xen_init_vga(const struct dom0_vga_console_info *info, size_t size)
+{
+	struct screen_info *screen_info = &boot_params.screen_info;
+
+	/* 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;
+	screen_info->orig_y = screen_info->orig_video_lines - 1;
+
+	switch (info->video_type) {
+	case XEN_VGATYPE_TEXT_MODE_3:
+		if (size < offsetof(struct dom0_vga_console_info, u.text_mode_3)
+		    + sizeof(info->u.text_mode_3))
+			break;
+		screen_info->orig_video_lines = info->u.text_mode_3.rows;
+		screen_info->orig_video_cols = info->u.text_mode_3.columns;
+		screen_info->orig_x = info->u.text_mode_3.cursor_x;
+		screen_info->orig_y = info->u.text_mode_3.cursor_y;
+		screen_info->orig_video_points =
+			info->u.text_mode_3.font_height;
+		break;
+
+	case XEN_VGATYPE_VESA_LFB:
+		if (size < offsetof(struct dom0_vga_console_info,
+				    u.vesa_lfb.gbl_caps))
+			break;
+		screen_info->orig_video_isVGA = VIDEO_TYPE_VLFB;
+		screen_info->lfb_width = info->u.vesa_lfb.width;
+		screen_info->lfb_height = info->u.vesa_lfb.height;
+		screen_info->lfb_depth = info->u.vesa_lfb.bits_per_pixel;
+		screen_info->lfb_base = info->u.vesa_lfb.lfb_base;
+		screen_info->lfb_size = info->u.vesa_lfb.lfb_size;
+		screen_info->lfb_linelength = info->u.vesa_lfb.bytes_per_line;
+		screen_info->red_size = info->u.vesa_lfb.red_size;
+		screen_info->red_pos = info->u.vesa_lfb.red_pos;
+		screen_info->green_size = info->u.vesa_lfb.green_size;
+		screen_info->green_pos = info->u.vesa_lfb.green_pos;
+		screen_info->blue_size = info->u.vesa_lfb.blue_size;
+		screen_info->blue_pos = info->u.vesa_lfb.blue_pos;
+		screen_info->rsvd_size = info->u.vesa_lfb.rsvd_size;
+		screen_info->rsvd_pos = info->u.vesa_lfb.rsvd_pos;
+		if (size >= offsetof(struct dom0_vga_console_info,
+				     u.vesa_lfb.gbl_caps)
+		    + sizeof(info->u.vesa_lfb.gbl_caps))
+			screen_info->capabilities = info->u.vesa_lfb.gbl_caps;
+		if (size >= offsetof(struct dom0_vga_console_info,
+				     u.vesa_lfb.mode_attrs)
+		    + sizeof(info->u.vesa_lfb.mode_attrs))
+			screen_info->vesa_attributes = info->u.vesa_lfb.mode_attrs;
+		break;
+	}
+}
diff -Nru linux-3.0-rc1/arch//x86/xen/xen-ops.h /usr/src/linux-3.0-rc1/arch//x86/xen/xen-ops.h
--- linux-3.0-rc1/arch//x86/xen/xen-ops.h	2011-05-30 02:43:36.000000000 +0200
+++ /usr/src/linux-3.0-rc1/arch//x86/xen/xen-ops.h	2011-06-04 17:21:25.780001079 +0200
@@ -88,6 +88,17 @@
 }
 #endif
 
+struct dom0_vga_console_info;
+
+#ifdef CONFIG_XEN_DOM0
+void xen_init_vga(const struct dom0_vga_console_info *, size_t size);
+#else
+static inline void xen_init_vga(const struct dom0_vga_console_info *info,
+				size_t size)
+{
+}
+#endif
+
 /* Declare an asm function, along with symbols needed to make it
    inlineable */
 #define DECL_ASM(ret, name, ...)		\
diff -Nru linux-3.0-rc1/include//xen/interface/xen.h /usr/src/linux-3.0-rc1/include//xen/interface/xen.h
--- linux-3.0-rc1/include//xen/interface/xen.h	2011-05-30 02:43:36.000000000 +0200
+++ /usr/src/linux-3.0-rc1/include//xen/interface/xen.h	2011-06-04 17:21:25.780001079 +0200
@@ -450,6 +450,45 @@
 	int8_t cmd_line[MAX_GUEST_CMDLINE];
 };
 
+struct dom0_vga_console_info {
+	uint8_t video_type; /* DOM0_VGA_CONSOLE_??? */
+#define XEN_VGATYPE_TEXT_MODE_3 0x03
+#define XEN_VGATYPE_VESA_LFB    0x23
+
+	union {
+		struct {
+			/* Font height, in pixels. */
+			uint16_t font_height;
+			/* Cursor location (column, row). */
+			uint16_t cursor_x, cursor_y;
+			/* Number of rows and columns (dimensions in characters). */
+			uint16_t rows, columns;
+		} text_mode_3;
+
+		struct {
+			/* Width and height, in pixels. */
+			uint16_t width, height;
+			/* Bytes per scan line. */
+			uint16_t bytes_per_line;
+			/* Bits per pixel. */
+			uint16_t bits_per_pixel;
+			/* LFB physical address, and size (in units of 64kB). */
+			uint32_t lfb_base;
+			uint32_t lfb_size;
+			/* RGB mask offsets and sizes, as defined by VBE 1.2+ */
+			uint8_t  red_pos, red_size;
+			uint8_t  green_pos, green_size;
+			uint8_t  blue_pos, blue_size;
+			uint8_t  rsvd_pos, rsvd_size;
+
+			/* VESA capabilities (offset 0xa, VESA command 0x4f00). */
+			uint32_t gbl_caps;
+			/* Mode attributes (offset 0x0, VESA command 0x4f01). */
+			uint16_t mode_attrs;
+		} vesa_lfb;
+	} u;
+};
+
 /* These flags are passed in the 'flags' field of start_info_t. */
 #define SIF_PRIVILEGED    (1<<0)  /* Is the domain privileged? */
 #define SIF_INITDOMAIN    (1<<1)  /* Is this the initial control domain? */

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

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

  reply	other threads:[~2011-06-04 14:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-04  4:41 Xen 4.1 PVOPS 3.0.0-RC1 VGA Console mike.a.collins
2011-06-04 10:55 ` Sven Köhler
2011-06-04 12:24   ` Pasi Kärkkäinen
2011-06-04 12:28   ` Michael A. Collins
2011-06-04 12:32     ` mike.a.collins
2011-06-04 13:01       ` Sven Köhler
2011-06-04 14:00         ` Sven Köhler [this message]
2011-06-06  8:28           ` Ian Campbell
2011-06-06 14:00       ` Konrad Rzeszutek Wilk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='isddiq$sg1$1@dough.gmane.org' \
    --to=sven.koehler@gmail.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).