Skip to contentSkip to conversation

x86: add a user configurable Kconfig option for the VGA

PATCH Superseded Derek Straka 4 participants 7 messages Sep 13, 2016 – Sep 20, 2016

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: add a user configurable Kconfig option for the VGA

Allows for the conditional inclusion of VGA driver on the x86 platform rather than having it always enabled.

The default configuration for the CONFIG_VGA option remains 'y' on x86, so the behavior out of the box remains unchanged. The addition of the option allows advanced users to enable/disable the inclusion of the VGA driver.

---
 xen/arch/x86/Kconfig        | 1 -
 xen/arch/x86/efi/efi-boot.h | 7 +++++++
 xen/arch/x86/setup.c        | 5 +++++
 xen/drivers/video/Kconfig   | 3 ++-
 xen/include/asm-x86/setup.h | 5 +++++
 xen/include/xen/console.h   | 8 ++++++++
 6 files changed, 27 insertions(+), 2 deletions(-)
xen/arch/x86/Kconfig +0 -1
index 265fd79..9e10591 100644
@@ -20,7 +20,6 @@ config X86
 	select HAS_PCI
 	select HAS_PDX
 	select NUMA
-	select VGA
 
 config ARCH_DEFCONFIG
 	string
xen/arch/x86/efi/efi-boot.h +7 -0
index 10985721..911fdfd 100644
@@ -476,6 +476,7 @@ static void __init efi_arch_edd(void)
         boot_edd_info_nr = EDD_INFO_MAX;
 }
 
+#ifdef CONFIG_VGA
 static void __init efi_arch_console_init(UINTN cols, UINTN rows)
 {
     vga_console_info.video_type = XEN_VGATYPE_TEXT_MODE_3;
@@ -550,6 +551,12 @@ static void __init efi_arch_video_init(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop,
             (gop->Mode->FrameBufferSize + 0xffff) >> 16;
     }
 }
+#else
+static inline void __init efi_arch_video_init(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop,
+                                       UINTN info_size,
+                                       EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *mode_info) {}
+static inline void __init efi_arch_console_init(UINTN cols, UINTN rows) {}
+#endif
 
 static void __init efi_arch_memory_setup(void)
 {
xen/arch/x86/setup.c +5 -0
index 8ae897a..6358336 100644
@@ -433,10 +433,12 @@ struct boot_video_info {
     u16 vesapm_off;         /* 0x26 */
     u16 vesa_attrib;        /* 0x28 */
 };
+
 extern struct boot_video_info boot_vid_info;
 
 static void __init parse_video_info(void)
 {
+#ifdef CONFIG_VGA
     struct boot_video_info *bvi = &bootsym(boot_vid_info);
 
     /* The EFI loader fills vga_console_info directly. */
@@ -472,6 +474,7 @@ static void __init parse_video_info(void)
         vga_console_info.u.vesa_lfb.gbl_caps = bvi->capabilities;
         vga_console_info.u.vesa_lfb.mode_attrs = bvi->vesa_attrib;
     }
+#endif
 }
 
 static void __init kexec_reserve_area(struct e820map *e820)
@@ -672,6 +675,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
 
     printk("Command line: %s\n", cmdline);
 
+#ifdef CONFIG_VGA
     printk("Video information:\n");
 
     /* Print VGA display mode information. */
@@ -694,6 +698,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
         printk(" No VGA detected\n");
         break;
     }
+#endif
 
     /* Print VBE/DDC EDID information. */
     if ( bootsym(boot_edid_caps) != 0x1313 )
xen/drivers/video/Kconfig +2 -1
index 0ffbbd9..0f208fe 100644
@@ -3,7 +3,8 @@ config VIDEO
 	bool
 
 config VGA
-	bool
+	bool "VGA"
+	default y if X86
 	select VIDEO
 
 config HAS_ARM_HDLCD
xen/include/asm-x86/setup.h +5 -0
index c65b79c..02e9b12 100644
@@ -28,8 +28,13 @@ void arch_init_memory(void);
 void subarch_init_memory(void);
 
 void init_IRQ(void);
+#ifdef CONFIG_VGA
 void vesa_init(void);
 void vesa_mtrr_init(void);
+#else
+static inline void vesa_init(void) {}
+static inline void vesa_mtrr_init(void) {}
+#endif
 
 int construct_dom0(
     struct domain *d,
xen/include/xen/console.h +8 -0
index ea06fd8..2e7c22c 100644
@@ -19,7 +19,15 @@ void console_init_postirq(void);
 void console_endboot(void);
 int console_has(const char *device);
 
+#ifdef CONFIG_VGA
 int fill_console_start_info(struct dom0_vga_console_info *);
+#else
+#include <xen/string.h>
+static inline int fill_console_start_info(struct dom0_vga_console_info *ci) {
+    (void) memset(ci, 0, sizeof(*ci));
+    return 1;
+}
+#endif
 
 unsigned long console_lock_recursive_irqsave(void);
 void console_unlock_recursive_irqrestore(unsigned long flags);
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 13 lines · Derek Straka
xen/arch/x86/efi/efi-boot.h +1 -0
index 10985721..911fdfd 100644
@@ -476,6 +476,7 @@ static void __init efi_arch_edd(void)
         boot_edd_info_nr = EDD_INFO_MAX;
 }
 
+#ifdef CONFIG_VGA
 static void __init efi_arch_console_init(UINTN cols, UINTN rows)
 {
     vga_console_info.video_type = XEN_VGATYPE_TEXT_MODE_3;

xen/arch/x86/efi/efi-boot.h static void __init efi_arch_video_init(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop, · line 559

Quoted 9 lines
xen/arch/x86/efi/efi-boot.h +6 -0
@@ -550,6 +551,12 @@ static void __init efi_arch_video_init(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop,
             (gop->Mode->FrameBufferSize + 0xffff) >> 16;
     }
 }
+#else
+static inline void __init efi_arch_video_init(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop,
+                                       UINTN info_size,
+                                       EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *mode_info) {}
+static inline void __init efi_arch_console_init(UINTN cols, UINTN rows) {}
+#endif

I'd technically intent these parameters to match the others.

xen/arch/x86/setup.c struct boot_video_info { · line 438

Quoted 11 lines
xen/arch/x86/setup.c +1 -0
index 8ae897a..6358336 100644
@@ -433,10 +433,12 @@ struct boot_video_info {
     u16 vesapm_off;         /* 0x26 */
     u16 vesa_attrib;        /* 0x28 */
 };
+
 extern struct boot_video_info boot_vid_info;
 

Extra white space. But honestly it makes it easier to read.

Quoted 11 lines
xen/arch/x86/setup.c +1 -0
 static void __init kexec_reserve_area(struct e820map *e820)
@@ -672,6 +675,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
 
     printk("Command line: %s\n", cmdline);
 
+#ifdef CONFIG_VGA
     printk("Video information:\n");
 
     /* Print VGA display mode information. */

xen/arch/x86/setup.c void __init noreturn __start_xen(unsigned long mbi_p) · line 701

Quoted 4 lines
xen/arch/x86/setup.c +1 -0
@@ -694,6 +698,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
         printk(" No VGA detected\n");
         break;
     }
+#endif

Not sure if the else case should be something like:

	printk("Video information: None\n");

I'll leave it up to others to concur or disagree but if people disagree then:

Signature · 1 line
Doug Goldstein

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#2 lore raw
In reply to Derek Straka
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 13.09.16 at 21:40, <[email protected]> wrote:

Allows for the conditional inclusion of VGA driver on the x86 platform rather than having it always enabled.

So I guess with all three of these patches an overview mail is missing. What are you trying to accomplish? Solely reducing the binary size of Xen doesn't seem like a very important goal to me, and eliminating these drivers from the build doesn't appear to help make Xen more stable of secure.

xen/arch/x86/setup.c void __init noreturn __start_xen(unsigned long mbi_p) · line 679

Quoted 6 lines
xen/arch/x86/setup.c +1 -0
@@ -672,6 +675,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
 
     printk("Command line: %s\n", cmdline);
 
+#ifdef CONFIG_VGA
     printk("Video information:\n");

Some of the other conditionals you add may be affected too, but here it is most prominent at the first glance - considering that we also have CONFIG_VIDEO, wouldn't it rather be that one to be used in a place like this one?

xen/include/xen/console.h void console_init_postirq(void); · line 28

Quoted 13 lines
xen/include/xen/console.h +5 -0
@@ -19,7 +19,15 @@ void console_init_postirq(void);
 void console_endboot(void);
 int console_has(const char *device);
 
+#ifdef CONFIG_VGA
 int fill_console_start_info(struct dom0_vga_console_info *);
+#else
+#include <xen/string.h>
+static inline int fill_console_start_info(struct dom0_vga_console_info *ci) 
 {
+    (void) memset(ci, 0, sizeof(*ci));

What is this cast to void goo for?

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#6 lore raw
In reply to Derek Straka

Hello Derek,

xen/drivers/video/Kconfig config VIDEO · line 7

Quoted 11 lines · Derek Straka
xen/drivers/video/Kconfig +2 -1
index 0ffbbd9..0f208fe 100644
@@ -3,7 +3,8 @@ config VIDEO
 	bool
 
 config VGA
-	bool
+	bool "VGA"
+	default y if X86

Same remark as for the NS16550 change. This option cannot be enabled on ARM and will break compilation of randconfig.

Regards,

xen/drivers/video/Kconfig config VIDEO · line 10

Quoted 3 lines
xen/drivers/video/Kconfig +0 -0
 	select VIDEO
 
 config HAS_ARM_HDLCD

Regards,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#3 lore raw
In reply to Jan Beulich
Quoted 10 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 13.09.16 at 21:40, <[email protected]> wrote:

Allows for the conditional inclusion of VGA driver on the x86 platform rather than having it always enabled.

So I guess with all three of these patches an overview mail is missing. What are you trying to accomplish? Solely reducing the binary size of Xen doesn't seem like a very important goal to me, and eliminating these drivers from the build doesn't appear to help make Xen more stable of secure.

I agree with your assessment on the stability and security standpoint. Our customer has asked us to remove
unused drivers based on functionality of a set of boards. Each of the boards has a subset of the available hardware functionality brought out to accessible headers. I decided to try to make these items optional via the Kconfig mechanisms already
in place in Xen and contribute the modifications upstream. I appreciate all of the feedback on the patches, but if they won't
get accepted upstream because they aren't useful, I don't want to continue to waste people's time reviewing these changes.

-Derek

Quoted 25 lines

xen/arch/x86/setup.c void __init noreturn __start_xen(unsigned long mbi_p) · line 679

Quoted 7 lines
xen/arch/x86/setup.c +1 -0
@@ -672,6 +675,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
 
     printk("Command line: %s\n", cmdline);
 
+#ifdef CONFIG_VGA
     printk("Video information:\n");

Some of the other conditionals you add may be affected too, but here it is most prominent at the first glance - considering that we also have CONFIG_VIDEO, wouldn't it rather be that one to be used in a place like this one?

xen/include/xen/console.h void console_init_postirq(void); · line 26

Quoted 11 lines
xen/include/xen/console.h +4 -0
@@ -19,7 +19,15 @@ void console_init_postirq(void);
 void console_endboot(void);
 int console_has(const char *device);
 
+#ifdef CONFIG_VGA
 int fill_console_start_info(struct dom0_vga_console_info *);
+#else
+#include <xen/string.h>
+static inline int fill_console_start_info(struct dom0_vga_console_info

*ci)

Quoted 7 lines

xen/include/xen/console.h void console_init_postirq(void); · line 28

Quoted 2 lines
xen/include/xen/console.h +1 -0
 {
+    (void) memset(ci, 0, sizeof(*ci));

What is this cast to void goo for?

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#4 lore raw
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 20.09.16 at 14:35, <[email protected]> wrote:
Quoted 10 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 13.09.16 at 21:40, <[email protected]> wrote:

Allows for the conditional inclusion of VGA driver on the x86 platform rather than having it always enabled.

So I guess with all three of these patches an overview mail is missing. What are you trying to accomplish? Solely reducing the binary size of Xen doesn't seem like a very important goal to me, and eliminating these drivers from the build doesn't appear to help make Xen more stable of secure.

Quoted 5 lines

I agree with your assessment on the stability and security standpoint. Our customer has asked us to remove
unused drivers based on functionality of a set of boards. Each of the boards has a subset of the available hardware functionality brought out to accessible headers.

Well, does that mean that's just to reduce the size of the hypervisor? If so, I'm honestly not sure we want to set a precedent here, since if we do, people could come and suggest to make all sorts of code build conditionally, and I don't think our plans with Kconfig so far were going in that direction (but others may disagree with me here).

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#5 lore raw
Quoted 20 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 20.09.16 at 14:35, <[email protected]> wrote:
Quoted 4 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 13.09.16 at 21:40, <[email protected]> wrote:

Allows for the conditional inclusion of VGA driver on the x86 platform rather than having it always enabled.

Quoted 7 lines
Quoted 6 lines

So I guess with all three of these patches an overview mail is missing. What are you trying to accomplish? Solely reducing the binary size of Xen doesn't seem like a very important goal to me, and eliminating these drivers from the build doesn't appear to help make Xen more stable of secure.

I agree with your assessment on the stability and security standpoint.

Our

Quoted 4 lines

customer has asked us to remove
unused drivers based on functionality of a set of boards. Each of the boards has a subset of the available hardware functionality brought out to accessible headers.

Quoted 7 lines

Well, does that mean that's just to reduce the size of the hypervisor? If so, I'm honestly not sure we want to set a precedent here, since if we do, people could come and suggest to make all sorts of code build conditionally, and I don't think our plans with Kconfig so far were going in that direction (but others may disagree with me here).

For the most part: yes. At the end of the day, my customer wants to

reduce the size of hypervisor. I disagree a bit that these specific changes
would set a poor precedent of for configuration. The reason I proposed it in the first place was the mechanisms for conditional compilation were already implicitly available via HAS_*. I thought adding the ability for the user to explicitly define the configuration option would be a permissible extension of the capability already present. That said, I do see your point about limiting the scope of conditional code to avoid an eventual mess. Thanks.

-Derek

Quoted 2 lines

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel