Skip to contentSkip to conversation

Please backport c2419b4a4727f67af2fc2cd68b0d878b75e781bb (xen: allow enable use of VGA console on dom0) in 3.0, 2.6.39, 2.6.38 and 2.6.37

PATCH Konrad Rzeszutek Wilk 2 participants 2 messages Jul 26, 2011 – Aug 5, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

The "xen: allow enable use of VGA console on dom0" has been pulled by Linus in 3.1. I've forgotten to stick the CC: [email protected] on the patch so doing this by hand.

Please backport the upstream commit c2419b4a4727f67af2fc2cd68b0d878b75e781bb in 3.0, 2.6.39, 2.6.38 and 2.6.37 trees. The older trees do not need it.

(I did the cherry-pick c2419b4a4727f67af2fc2cd68b0d878b75e781bb on those trees and it worked out for me - but if you encounter any problems I will be happy to send a rebased patch).

Thank you!

commit c2419b4a4727f67af2fc2cd68b0d878b75e781bb

Author: Jeremy Fitzhardinge <[email protected]>
Date:   Tue May 31 10:50:10 2011 -0400

xen: allow enable use of VGA console on dom0

Get the information about the VGA console hardware from Xen, and put it into the form the bootloader normally generates, so that the rest of the kernel can deal with VGA as usual.

[ Impact: make VGA console work in dom0 ]

[v1: Rebased on 2.6.39]
[v2: Removed incorrect comments and fixed compile warnings]
arch/x86/xen/Makefile +1 -1
index 17c565d..a6575b9 100644
@@ -18,5 +18,5 @@ obj-y		:= enlighten.o setup.o multicalls.o mmu.o irq.o \
 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
arch/x86/xen/enlighten.c +8 -0
index e3c6a06..4abd2d5 100644
@@ -1241,6 +1241,14 @@ asmlinkage void __init xen_start_kernel(void)
 		if (pci_xen)
 			x86_init.pci.arch_init = pci_xen_init;
 	} 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();
 	}
arch/x86/xen/vga.c new file +67 -0

67 lines not on this page · raw message

arch/x86/xen/xen-ops.h +11 -0
index 3112f55..e14c54e 100644
@@ -88,6 +88,17 @@ static inline void xen_uninit_lock_cpu(int cpu)
 }
 #endif
 
+struct dom0_vga_console_info;
+
+#ifdef CONFIG_XEN_DOM0
+void __init xen_init_vga(const struct dom0_vga_console_info *, size_t size);
+#else
+static inline void __init 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, ...)		\
include/xen/interface/xen.h +39 -0
index b33257b..29b362e 100644
@@ -449,6 +449,45 @@ struct start_info {
 	int8_t cmd_line[MAX_GUEST_CMDLINE];
 };
 
+struct dom0_vga_console_info {
+	uint8_t video_type;
+#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? */
#1 lore raw
Quoted 6 lines · Konrad Rzeszutek Wilk

The "xen: allow enable use of VGA console on dom0" has been pulled by Linus in 3.1. I've forgotten to stick the CC: [email protected] on the patch so doing this by hand.

Please backport the upstream commit c2419b4a4727f67af2fc2cd68b0d878b75e781bb in 3.0, 2.6.39, 2.6.38 and 2.6.37 trees. The older trees do not need it.

As only 3.0 is in active support right now, I've applied it there.

greg k-h