From: jbeulich@novell.com Subject: Allow Xen console to be independently configured Patch-mainline: obsolete Index: head-2008-02-26/drivers/xen/Kconfig =================================================================== --- head-2008-02-26.orig/drivers/xen/Kconfig 2008-02-26 17:30:23.000000000 +0100 +++ head-2008-02-26/drivers/xen/Kconfig 2008-03-03 14:45:27.000000000 +0100 @@ -221,6 +221,12 @@ config XEN_KEYBOARD domain. If you've said Y to CONFIG_XEN_FRAMEBUFFER, you probably want to say Y here. +config XEN_CONSOLE + bool "Xen virtual console" + default y + help + The Xen virtual console is ... + config XEN_SCRUB_PAGES bool "Scrub memory before freeing it to Xen" default y Index: head-2008-02-26/drivers/xen/console/Makefile =================================================================== --- head-2008-02-26.orig/drivers/xen/console/Makefile 2007-06-12 13:13:44.000000000 +0200 +++ head-2008-02-26/drivers/xen/console/Makefile 2008-03-03 14:45:27.000000000 +0100 @@ -1,2 +1,3 @@ -obj-y := console.o xencons_ring.o +obj-$(CONFIG_XEN_CONSOLE) := console.o xencons_ring.o +obj-$(CONFIG_XEN_PRIVILEGED_GUEST) += dom0.o Index: head-2008-02-26/drivers/xen/console/console.c =================================================================== --- head-2008-02-26.orig/drivers/xen/console/console.c 2008-02-26 17:38:18.000000000 +0100 +++ head-2008-02-26/drivers/xen/console/console.c 2008-03-03 14:45:27.000000000 +0100 @@ -271,63 +271,6 @@ void xencons_force_flush(void) } -void __init dom0_init_screen_info(const struct dom0_vga_console_info *info, size_t size) -{ - /* 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; - } -} - - /******************** User-space console driver (/dev/console) ************/ #define DRV(_d) (_d) Index: head-2008-02-26/drivers/xen/console/dom0.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ head-2008-02-26/drivers/xen/console/dom0.c 2008-03-03 14:45:27.000000000 +0100 @@ -0,0 +1,93 @@ +/****************************************************************************** + * dom0.c + * + * Dom0 console parameter initialization. + * + * Copyright (c) 2002-2004, K A Fraser. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation; or, when distributed + * separately from the Linux kernel or incorporated into other + * software packages, subject to the following license: + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this source file (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, modify, + * merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include +#include +#include +#include +#include + +void __init dom0_init_screen_info(const struct dom0_vga_console_info *info, size_t size) +{ + /* 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; + } +} Index: head-2008-02-26/include/xen/xencons.h =================================================================== --- head-2008-02-26.orig/include/xen/xencons.h 2008-02-26 17:30:23.000000000 +0100 +++ head-2008-02-26/include/xen/xencons.h 2008-03-03 14:45:27.000000000 +0100 @@ -1,9 +1,14 @@ #ifndef __ASM_XENCONS_H__ #define __ASM_XENCONS_H__ +#ifdef CONFIG_XEN_PRIVILEGED_GUEST struct dom0_vga_console_info; void dom0_init_screen_info(const struct dom0_vga_console_info *, size_t); +#else +#define dom0_init_screen_info(info) ((void)(info)) +#endif +#ifdef CONFIG_XEN_CONSOLE void xencons_force_flush(void); void xencons_resume(void); @@ -13,5 +18,9 @@ void xencons_tx(void); int xencons_ring_init(void); int xencons_ring_send(const char *data, unsigned len); +#else +static inline void xencons_force_flush(void) {} +static inline void xencons_resume(void) {} +#endif #endif /* __ASM_XENCONS_H__ */