Skip to contentSkip to conversation

x86/platform: adjust CONFIG_VIDEO usage

PATCH In review Jan Beulich 2 participants 2 messages Jan 13

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/platform: adjust CONFIG_VIDEO usage

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.

---
I'm not quite certain whether to have Fixes: 11b4ff64841e ("x86/platform:
protect XENPF_get_dom0_console if CONFIG_VIDEO not set") here. Opinions?

xen/arch/x86/platform_hypercall.c +9 -12
@@ -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;
xen/include/xen/vga.h +2 -1
@@ -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);
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Jan Beulich

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.

Quoted 3 lines

---
I'm not quite certain whether to have Fixes: 11b4ff64841e ("x86/platform:
protect XENPF_get_dom0_console if CONFIG_VIDEO not set") here. Opinions?

That's up to you.  I doubt you're going to backport it, so it really doesn't matter does it?

~Andrew