Switch to using IS_ENABLED() in both places, thus in particular making
sure XENPF_get_dom0_console handling doesn't take the "default" path: The
behavior better wouldn't differ between VIDEO=y and there not being VGA vs
VIDEO=n. For this to work, fill_console_start_info() needs to be
unconditionally declared; extend that to vga_console_info as well.

Signed-off-by: Jan Beulich <[email protected]>
---
I'm not quite certain whether to have Fixes: 11b4ff64841e ("x86/platform:
protect XENPF_get_dom0_console if CONFIG_VIDEO not set") here. Opinions?

--- a/xen/arch/x86/platform_hypercall.c
+++ b/xen/arch/x86/platform_hypercall.c
@@ -415,10 +415,9 @@ ret_t do_platform_op(
         }
         case XEN_FW_VBEDDC_INFO:
             ret = -ESRCH;
-#ifdef CONFIG_VIDEO
-            if ( op->u.firmware_info.index != 0 )
-                break;
-            if ( *(u32 *)bootsym(boot_edid_info) == 0x13131313 )
+            if ( !IS_ENABLED(CONFIG_VIDEO) ||
+                 op->u.firmware_info.index != 0 ||
+                 *(uint32_t *)bootsym(boot_edid_info) == 0x13131313 )
                 break;
 
             op->u.firmware_info.u.vbeddc_info.capabilities =
@@ -434,7 +433,6 @@ ret_t do_platform_op(
                  copy_to_compat(op->u.firmware_info.u.vbeddc_info.edid,
                                 bootsym(boot_edid_info), 128) )
                 ret = -EFAULT;
-#endif
             break;
         case XEN_FW_EFI_INFO:
             ret = efi_get_info(op->u.firmware_info.index,
@@ -905,20 +903,19 @@ ret_t do_platform_op(
         break;
     }
 
-#ifdef CONFIG_VIDEO
     case XENPF_get_dom0_console:
         BUILD_BUG_ON(sizeof(op->u.dom0_console) > sizeof(op->u.pad));
-        ret = sizeof(op->u.dom0_console);
-        if ( !fill_console_start_info(&op->u.dom0_console) )
-        {
-            ret = -ENODEV;
+
+        ret = -ENODEV;
+        if ( !IS_ENABLED(CONFIG_VIDEO) ||
+             !fill_console_start_info(&op->u.dom0_console) )
             break;
-        }
+
+        ret = sizeof(op->u.dom0_console);
 
         if ( copy_field_to_guest(u_xenpf_op, op, u.dom0_console) )
             ret = -EFAULT;
         break;
-#endif
 
     default:
         ret = -ENOSYS;
--- a/xen/include/xen/vga.h
+++ b/xen/include/xen/vga.h
@@ -11,9 +11,10 @@
 
 #include <xen/video.h>
 
-#ifdef CONFIG_VGA
 extern struct xen_vga_console_info vga_console_info;
 int fill_console_start_info(struct dom0_vga_console_info *ci);
+
+#ifdef CONFIG_VGA
 void vesa_init(void);
 void vesa_early_init(void);
 void vesa_endboot(bool keep);

Reply via email to