arch,sysfb,efi: Support EDID on non-x86 EFI systems
Subsystems (14)
Thomas Zimmermann
maintainerv3 cover arch,sysfb,efi: Support EDID on non-x86 EFI systems
Replace screen_info and edid_info with sysfb_primary_device of type struct sysfb_display_info. Update all users. Then implement EDID support in the kernel EFI code.
Sysfb DRM drivers currently fetch the global edid_info directly, when they should get that information together with the screen_info from their device. Wrapping screen_info and edid_info in sysfb_primary_display and passing this to drivers enables this.
Replacing both with sysfb_primary_display has been motivate by the EFI stub. EFI wants to transfer EDID via config table in a single entry. Using struct sysfb_display_info this will become easily possible. Hence accept some churn in architecture code for the long-term improvements.
Patches 1 and 2 reduce the exposure of screen_info in EFI-related code.
Patch 3 adds struct sysfb_display_info.
Patch 4 replaces scren_info with sysfb_primary_display. This results in several changes throught the kernel, but is really just a refactoring.
Patch 5 updates sysfb to transfer sysfb_primary_display to the related drivers.
Patch 6 moves edid_info into sysfb_primary_display. This resolves some drivers' reference to the global edid_info, but also makes the EDID data available on non-x86 architectures.
Patches 7 and 8 add support for EDID transfers on non-x86 EFI systems.
Patch 9 cleans up the config-table allocation to be easier to understand.
v3:
- replace SCREEN_INFO table entry (Ard)
- merge libstub patch into kernel patch
v2:
- combine v1 of the series at [1] plus changes from [2] and [3].
[1] https://lore.kernel.org/dri-devel/[email protected]/
[2] https://lore.kernel.org/dri-devel/[email protected]/
[3] https://lore.kernel.org/linux-efi/[email protected]/
Thomas Zimmermann (9):
efi: earlycon: Reduce number of references to global screen_info
efi: sysfb_efi: Reduce number of references to global screen_info
sysfb: Add struct sysfb_display_info
sysfb: Replace screen_info with sysfb_primary_display
sysfb: Pass sysfb_primary_display to devices
sysfb: Move edid_info into sysfb_primary_display
efi: Refactor init_primary_display() helpers
efi: Support EDID information
efi: libstub: Simplify interfaces for primary_display
arch/arm64/kernel/image-vars.h | 2 +- arch/loongarch/kernel/efi.c | 38 ++++----- arch/loongarch/kernel/image-vars.h | 2 +- arch/riscv/kernel/image-vars.h | 2 +- arch/x86/kernel/kexec-bzimage64.c | 4 +- arch/x86/kernel/setup.c | 16 ++-- arch/x86/video/video-common.c | 4 +- drivers/firmware/efi/earlycon.c | 42 +++++----- drivers/firmware/efi/efi-init.c | 46 ++++++----- drivers/firmware/efi/efi.c | 4 +- drivers/firmware/efi/libstub/Makefile | 2 +- drivers/firmware/efi/libstub/efi-stub-entry.c | 36 +++++++-- drivers/firmware/efi/libstub/efi-stub.c | 49 +++++++---- drivers/firmware/efi/libstub/efistub.h | 7 +- .../firmware/efi/libstub/primary_display.c | 41 ++++++++++ drivers/firmware/efi/libstub/screen_info.c | 53 ------------ drivers/firmware/efi/libstub/zboot.c | 6 +- drivers/firmware/efi/sysfb_efi.c | 81 ++++++++++--------- drivers/firmware/sysfb.c | 13 +-- drivers/firmware/sysfb_simplefb.c | 2 +- drivers/gpu/drm/sysfb/efidrm.c | 14 ++-- drivers/gpu/drm/sysfb/vesadrm.c | 14 ++-- drivers/hv/vmbus_drv.c | 6 +- drivers/pci/vgaarb.c | 4 +- drivers/video/Kconfig | 8 +- drivers/video/fbdev/core/fbmon.c | 8 +- drivers/video/fbdev/efifb.c | 10 ++- drivers/video/fbdev/vesafb.c | 10 ++- drivers/video/fbdev/vga16fb.c | 8 +- drivers/video/screen_info_pci.c | 5 +- include/linux/efi.h | 9 ++- include/linux/screen_info.h | 2 - include/linux/sysfb.h | 23 ++++-- include/video/edid.h | 4 - 34 files changed, 321 insertions(+), 254 deletions(-) create mode 100644 drivers/firmware/efi/libstub/primary_display.c delete mode 100644 drivers/firmware/efi/libstub/screen_info.c
base-commit: d724c6f85e80a23ed46b7ebc6e38b527c09d64f5
Signature · 1 line
2.51.1
Thomas Zimmermann
maintainerPATCH v3 1/9 efi: earlycon: Reduce number of references to global screen_info
Replace usage of global screen_info with local pointers. This will later reduce churn when screen_info is being moved.
v2:
- fix coding style
--- drivers/firmware/efi/earlycon.c | 40 ++++++++++++++++----------------- 1 file changed, 20 insertions(+), 20 deletions(-)
drivers/firmware/efi/earlycon.c +20 -20
@@ -32,12 +32,13 @@ static void *efi_fb;*/ static int __init efi_earlycon_remap_fb (void ) { +const struct screen_info *si = &screen_info; +/* bail if there is no bootconsole or it was unregistered already */ if (!earlycon_console || !console_is_registered (earlycon_console))return 0 ; - efi_fb =memremap (fb_base, screen_info.lfb_size, - fb_wb ?MEMREMAP_WB :MEMREMAP_WC ); + efi_fb =memremap (fb_base, si->lfb_size, fb_wb ?MEMREMAP_WB :MEMREMAP_WC );return efi_fb ?0 : -ENOMEM ; }
@@ -71,12 +72,12 @@ static __ref void efi_earlycon_unmap(void *addr, unsigned long len)early_memunmap (addr, len); } -static void efi_earlycon_clear_scanline (unsigned int y) +static void efi_earlycon_clear_scanline (unsigned int y,const struct screen_info *si) {unsigned long *dst;u16 len; - len = screen_info.lfb_linelength; + len = si->lfb_linelength; dst =efi_earlycon_map (y*len, len);if (!dst)return ;
@@ -85,7 +86,7 @@ static void efi_earlycon_clear_scanline(unsigned int y)efi_earlycon_unmap (dst, len); } -static void efi_earlycon_scroll_up (void ) +static void efi_earlycon_scroll_up (const struct screen_info *si) {unsigned long *dst, *src;u16 maxlen =0 ;
@@ -99,8 +100,8 @@ static void efi_earlycon_scroll_up(void) } maxlen *=4 ; - len = screen_info.lfb_linelength; - height = screen_info.lfb_height; + len = si->lfb_linelength; + height = si->lfb_height;for (i =0 ; i < height - font->height; i++) { dst =efi_earlycon_map (i*len, len);
@@ -120,7 +121,8 @@ static void efi_earlycon_scroll_up(void) } } -static void efi_earlycon_write_char (u32 *dst,unsigned char c,unsigned int h) +static void efi_earlycon_write_char (u32 *dst,unsigned char c,unsigned int h, +const struct screen_info *si) {const u32 color_black =0x00000000 ;const u32 color_white =0x00ffffff ;
@@ -145,13 +147,12 @@ static void efi_earlycon_write_char(u32 *dst, unsigned char c, unsigned int h)static void efi_earlycon_write (struct console *con,const char *str,unsigned int num) { -struct screen_info *si; +const struct screen_info *si = &screen_info;u32 cur_efi_x = efi_x;unsigned int len;const char *s;void *dst; - si = &screen_info; len = si->lfb_linelength;while (num) {
@@ -174,7 +175,7 @@ efi_earlycon_write(struct console *con, const char *str, unsigned int num) x = efi_x;while (n-- >0 ) { -efi_earlycon_write_char (dst + x*4 , *s, h); +efi_earlycon_write_char (dst + x *4 , *s, h, si); x += font->width; s++; }
@@ -207,10 +208,10 @@ efi_earlycon_write(struct console *con, const char *str, unsigned int num) cur_line_y = (cur_line_y +1 ) % max_line_y; efi_y -= font->height; -efi_earlycon_scroll_up (); +efi_earlycon_scroll_up (si);for (i =0 ; i < font->height; i++) -efi_earlycon_clear_scanline (efi_y + i); +efi_earlycon_clear_scanline (efi_y + i, si); } } }
@@ -226,22 +227,21 @@ void __init efi_earlycon_reprobe(void)static int __init efi_earlycon_setup (struct earlycon_device *device,const char *opt) { -struct screen_info *si; +const struct screen_info *si = &screen_info;u16 xres, yres;u32 i; fb_wb = opt && !strcmp (opt,"ram" ); -if (screen_info.orig_video_isVGA !=VIDEO_TYPE_EFI ) { +if (si->orig_video_isVGA !=VIDEO_TYPE_EFI ) { fb_probed = true;return -ENODEV ; } - fb_base = screen_info.lfb_base; -if (screen_info.capabilities &VIDEO_CAPABILITY_64BIT_BASE ) - fb_base |= (u64 )screen_info.ext_lfb_base <<32 ; + fb_base = si->lfb_base; +if (si->capabilities &VIDEO_CAPABILITY_64BIT_BASE ) + fb_base |= (u64 )si->ext_lfb_base <<32 ; - si = &screen_info; xres = si->lfb_width; yres = si->lfb_height;
@@ -266,7 +266,7 @@ static int __init efi_earlycon_setup(struct earlycon_device *device, efi_y -= font->height;for (i =0 ; i < (yres - efi_y) / font->height; i++) -efi_earlycon_scroll_up (); +efi_earlycon_scroll_up (si); device->con->write = efi_earlycon_write; earlycon_console = device->con;
Signature · 1 line
2.51.1
Thomas Zimmermann
maintainerPATCH v3 2/9 efi: sysfb_efi: Reduce number of references to global screen_info
In reply to Thomas ZimmermannReplace usage of global screen_info with local pointers. This will later reduce churn when screen_info is being moved.
--- drivers/firmware/efi/sysfb_efi.c | 81 ++++++++++++++++--------------- drivers/firmware/sysfb.c | 4 +- drivers/firmware/sysfb_simplefb.c | 2 +- include/linux/sysfb.h | 9 ++-- 4 files changed, 51 insertions(+), 45 deletions(-)
drivers/firmware/efi/sysfb_efi.c +43 -38
@@ -92,7 +92,7 @@ void efifb_setup_from_dmi(struct screen_info *si, const char *opt) })#ifdef CONFIG_EFI -static int __init efifb_set_system (const struct dmi_system_id *id) +static int __init efifb_set_system (struct screen_info *si,const struct dmi_system_id *id) {struct efifb_dmi_info *info = id->driver_data;
@@ -101,14 +101,14 @@ static int __init efifb_set_system(const struct dmi_system_id *id)return 0 ;/* Trust the bootloader over the DMI tables */ -if (screen_info.lfb_base ==0 ) { +if (si->lfb_base ==0 ) {#if defined(CONFIG_PCI )struct pci_dev *dev =NULL ;int found_bar =0 ;#endif if (info->base) { - screen_info.lfb_base =choose_value (info->base, - screen_info.lfb_base,OVERRIDE_BASE , + si->lfb_base =choose_value (info->base, + si->lfb_base,OVERRIDE_BASE , info->flags);#if defined(CONFIG_PCI )
@@ -135,49 +135,53 @@ static int __init efifb_set_system(const struct dmi_system_id *id) start =pci_resource_start (dev, i); end =pci_resource_end (dev, i); -if (screen_info.lfb_base >= start && - screen_info.lfb_base < end) { +if (si->lfb_base >= start && si->lfb_base < end) { found_bar =1 ;break ; } } }if (!found_bar) - screen_info.lfb_base =0 ; + si->lfb_base =0 ;#endif } } -if (screen_info.lfb_base) { - screen_info.lfb_linelength =choose_value (info->stride, - screen_info.lfb_linelength,OVERRIDE_STRIDE , +if (si->lfb_base) { + si->lfb_linelength =choose_value (info->stride, + si->lfb_linelength,OVERRIDE_STRIDE , info->flags); - screen_info.lfb_width =choose_value (info->width, - screen_info.lfb_width,OVERRIDE_WIDTH , + si->lfb_width =choose_value (info->width, + si->lfb_width,OVERRIDE_WIDTH , info->flags); - screen_info.lfb_height =choose_value (info->height, - screen_info.lfb_height,OVERRIDE_HEIGHT , + si->lfb_height =choose_value (info->height, + si->lfb_height,OVERRIDE_HEIGHT , info->flags); -if (screen_info.orig_video_isVGA ==0 ) - screen_info.orig_video_isVGA =VIDEO_TYPE_EFI ; +if (si->orig_video_isVGA ==0 ) + si->orig_video_isVGA =VIDEO_TYPE_EFI ; }else { - screen_info.lfb_linelength =0 ; - screen_info.lfb_width =0 ; - screen_info.lfb_height =0 ; - screen_info.orig_video_isVGA =0 ; + si->lfb_linelength =0 ; + si->lfb_width =0 ; + si->lfb_height =0 ; + si->orig_video_isVGA =0 ;return 0 ; }printk (KERN_INFO "efifb: dmi detected %s - framebuffer at 0x%08x " "(%dx%d, stride %d)\n" , id->ident, - screen_info.lfb_base, screen_info.lfb_width, - screen_info.lfb_height, screen_info.lfb_linelength); + si->lfb_base, si->lfb_width, + si->lfb_height, si->lfb_linelength);return 1 ; } +static int __init efifb_set_system_callback (const struct dmi_system_id *id) +{ +return efifb_set_system (&screen_info, id); +} +#define EFIFB_DMI_SYSTEM_ID (vendor, name, enumid) \ { \ - efifb_set_system, \ + efifb_set_system_callback, \ name, \ { \ DMI_MATCH(DMI_BIOS_VENDOR, vendor), \
@@ -284,12 +288,13 @@ static const struct dmi_system_id efifb_dmi_swap_width_height[] __initconst = { {}, }; -static bool efifb_overlaps_pci_range (const struct of_pci_range *range) +static bool efifb_overlaps_pci_range (const struct screen_info *si, +const struct of_pci_range *range) { -u64 fb_base = screen_info.lfb_base; +u64 fb_base = si->lfb_base; -if (screen_info.capabilities &VIDEO_CAPABILITY_64BIT_BASE ) - fb_base |= (u64 )(unsigned long )screen_info.ext_lfb_base <<32 ; +if (si->capabilities &VIDEO_CAPABILITY_64BIT_BASE ) + fb_base |= (u64 )(unsigned long )si->ext_lfb_base <<32 ;return fb_base >= range->cpu_addr && fb_base < (range->cpu_addr + range->size);
@@ -311,7 +316,7 @@ static struct device_node *find_pci_overlap_node(void) }for_each_of_pci_range (&parser, &range) -if (efifb_overlaps_pci_range (&range)) +if (efifb_overlaps_pci_range (&screen_info, &range))return np; }return NULL ;
@@ -349,25 +354,25 @@ static const struct fwnode_operations efifb_fwnode_ops = {static struct fwnode_handle efifb_fwnode; -__init void sysfb_apply_efi_quirks (void ) +__init void sysfb_apply_efi_quirks (struct screen_info *si) { -if (screen_info.orig_video_isVGA !=VIDEO_TYPE_EFI || - !(screen_info.capabilities &VIDEO_CAPABILITY_SKIP_QUIRKS )) +if (si->orig_video_isVGA !=VIDEO_TYPE_EFI || + !(si->capabilities &VIDEO_CAPABILITY_SKIP_QUIRKS ))dmi_check_system (efifb_dmi_system_table); -if (screen_info.orig_video_isVGA ==VIDEO_TYPE_EFI && +if (si->orig_video_isVGA ==VIDEO_TYPE_EFI &&dmi_check_system (efifb_dmi_swap_width_height)) { -u16 temp = screen_info.lfb_width; +u16 temp = si->lfb_width; - screen_info.lfb_width = screen_info.lfb_height; - screen_info.lfb_height = temp; - screen_info.lfb_linelength =4 * screen_info.lfb_width; + si->lfb_width = si->lfb_height; + si->lfb_height = temp; + si->lfb_linelength =4 * si->lfb_width; } } -__init void sysfb_set_efifb_fwnode (struct platform_device *pd) +__init void sysfb_set_efifb_fwnode (const struct screen_info *si,struct platform_device *pd) { -if (screen_info.orig_video_isVGA ==VIDEO_TYPE_EFI &&IS_ENABLED (CONFIG_PCI )) { +if (si->orig_video_isVGA ==VIDEO_TYPE_EFI &&IS_ENABLED (CONFIG_PCI )) {fwnode_init (&efifb_fwnode, &efifb_fwnode_ops); pd->dev.fwnode = &efifb_fwnode; }
drivers/firmware/sysfb.c +2 -2
@@ -155,7 +155,7 @@ static __init int sysfb_init(void)if (disabled) goto unlock_mutex; -sysfb_apply_efi_quirks (); +sysfb_apply_efi_quirks (si); parent =sysfb_parent_dev (si);if (IS_ERR (parent)) {
@@ -200,7 +200,7 @@ static __init int sysfb_init(void) pd->dev.parent = parent; -sysfb_set_efifb_fwnode (pd); +sysfb_set_efifb_fwnode (si, pd); ret =platform_device_add_data (pd, si,sizeof (*si));if (ret)
drivers/firmware/sysfb_simplefb.c +1 -1
@@ -117,7 +117,7 @@ __init struct platform_device *sysfb_create_simplefb(const struct screen_info *s pd->dev.parent = parent; -sysfb_set_efifb_fwnode (pd); +sysfb_set_efifb_fwnode (si, pd); ret =platform_device_add_resources (pd, &res,1 );if (ret)
include/linux/sysfb.h +5 -4
@@ -82,16 +82,17 @@ static inline bool sysfb_handles_screen_info(void)#ifdef CONFIG_EFI extern struct efifb_dmi_info efifb_dmi_list[]; -void sysfb_apply_efi_quirks (void ); -void sysfb_set_efifb_fwnode (struct platform_device *pd); +void sysfb_apply_efi_quirks (struct screen_info *si); +void sysfb_set_efifb_fwnode (const struct screen_info *si,struct platform_device *pd);#else /* CONFIG_EFI */ -static inline void sysfb_apply_efi_quirks (void ) +static inline void sysfb_apply_efi_quirks (struct screen_info *si) { } -static inline void sysfb_set_efifb_fwnode (struct platform_device *pd) +static inline void sysfb_set_efifb_fwnode (const struct screen_info *si, +struct platform_device *pd) { }
Signature · 1 line
2.51.1
Thomas Zimmermann
maintainerPATCH v3 3/9 sysfb: Add struct sysfb_display_info
In reply to Thomas ZimmermannAdd struct sysfb_display_info to wrap display-related state. For now it contains only the screen's video mode. Later EDID will be added as well.
This struct will be helpful for passing display state to sysfb drivers or from the EFI stub library.
--- include/linux/sysfb.h | 5 +++++ 1 file changed, 5 insertions(+)
include/linux/sysfb.h +5 -0
@@ -8,6 +8,7 @@*/ #include <linux/err.h> +#include <linux/screen_info.h> #include <linux/types.h> #include <linux/platform_data/simplefb.h>
@@ -60,6 +61,10 @@ struct efifb_dmi_info {int flags; }; +struct sysfb_display_info { +struct screen_info screen; +}; +#ifdef CONFIG_SYSFB void sysfb_disable (struct device *dev);
Signature · 1 line
2.51.1
Re: [PATCH v3 3/9] sysfb: Add struct sysfb_display_info
Quoted 40 lines · Thomas Zimmermann
Add struct
sysfb_display_infoto wrap display-related state. For now it contains only the screen's video mode. Later EDID will be added as well.This struct will be helpful for passing display state to sysfb drivers or from the EFI stub library.
Signed-off-by Thomas Zimmermann <[email protected]>Acked-by Arnd Bergmann <[email protected]>Acked-by Ard Biesheuvel <[email protected]>--- include/linux/sysfb.h | 5 +++++ 1 file changed, 5 insertions(+)include/linux/sysfb.h +5
-0@@ -8,6 +8,7 @@*/ #include <linux/err.h> +#include <linux/screen_info.h> #include <linux/types.h> #include <linux/platform_data/simplefb.h> @@ -60,6 +61,10 @@ struct efifb_dmi_info {int flags; }; +struct sysfb_display_info { +struct screen_info screen; +}; +#ifdef CONFIG_SYSFB void sysfb_disable (struct device *dev);Signature · 1 line
2.51.1
Thomas Zimmermann
maintainerPATCH v3 4/9 sysfb: Replace screen_info with sysfb_primary_display
In reply to Thomas ZimmermannReplace the global screen_info with sysfb_primary_display of type struct sysfb_display_info. Adapt all users of screen_info.
Instances of screen_info are defined for x86, loongarch and EFI, with only one instance compiled into a specific build. Replace all of them with sysfb_primary_display.
All existing users of screen_info are updated by pointing them to sysfb_primary_display.screen instead. This introduces some churn to the code, but has no impact on functionality.
Boot parameters and EFI config tables are unchanged. They transfer screen_info as before. The logic in EFI's alloc_screen_info() changes slightly, as it now returns the screen field of sysfb_primary_display.
v2:
- update comment
- rename init_screen_info() to init_primary_display()
--- arch/arm64/kernel/image-vars.h | 2 +- arch/loongarch/kernel/efi.c | 15 +++++++------ arch/loongarch/kernel/image-vars.h | 2 +- arch/riscv/kernel/image-vars.h | 2 +- arch/x86/kernel/kexec-bzimage64.c | 4 +++- arch/x86/kernel/setup.c | 10 +++++---- arch/x86/video/video-common.c | 4 ++-- drivers/firmware/efi/earlycon.c | 8 +++---- drivers/firmware/efi/efi-init.c | 22 +++++++++---------- drivers/firmware/efi/libstub/efi-stub-entry.c | 18 ++++++++++----- drivers/firmware/efi/sysfb_efi.c | 4 ++-- drivers/firmware/sysfb.c | 6 ++--- drivers/hv/vmbus_drv.c | 6 ++--- drivers/pci/vgaarb.c | 4 ++-- drivers/video/screen_info_pci.c | 5 +++-- include/linux/screen_info.h | 2 -- include/linux/sysfb.h | 5 +++-- 17 files changed, 66 insertions(+), 53 deletions(-)
arch/arm64/kernel/image-vars.h +1 -1
@@ -38,7 +38,7 @@ PROVIDE(__efistub__end = _end);PROVIDE (__efistub___inittext_end = __inittext_end);PROVIDE (__efistub__edata = _edata);#if defined(CONFIG_EFI_EARLYCON ) || defined(CONFIG_SYSFB ) -PROVIDE (__efistub_screen_info = screen_info); +PROVIDE (__efistub_sysfb_primary_display = sysfb_primary_display);#endif PROVIDE (__efistub__ctype = _ctype);
arch/loongarch/kernel/efi.c +8 -7
@@ -18,7 +18,7 @@#include <linux/kobject.h> #include <linux/memblock.h> #include <linux/reboot.h> -#include <linux/screen_info.h> +#include <linux/sysfb.h> #include <linux/uaccess.h> #include <asm/early_ioremap.h>
@@ -75,11 +75,11 @@ bool efi_poweroff_required(void)unsigned long __initdata screen_info_table =EFI_INVALID_TABLE_ADDR ;#if defined(CONFIG_SYSFB ) || defined(CONFIG_EFI_EARLYCON ) -struct screen_info screen_info __section(".data"); -EXPORT_SYMBOL_GPL (screen_info); +struct sysfb_display_info sysfb_primary_display __section(".data"); +EXPORT_SYMBOL_GPL (sysfb_primary_display);#endif -static void __init init_screen_info (void ) +static void __init init_primary_display (void ) {struct screen_info *si;
@@ -91,11 +91,12 @@ static void __init init_screen_info(void)pr_err ("Could not map screen_info config table\n" );return ; } - screen_info = *si; + sysfb_primary_display.screen = *si;memset (si,0 ,sizeof (*si));early_memunmap (si,sizeof (*si)); -memblock_reserve (__screen_info_lfb_base (&screen_info), screen_info.lfb_size); +memblock_reserve (__screen_info_lfb_base (&sysfb_primary_display.screen), + sysfb_primary_display.screen.lfb_size); }void __init efi_init (void )
@@ -127,7 +128,7 @@ void __init efi_init(void)set_bit (EFI_CONFIG_TABLES , &efi.flags);if (IS_ENABLED (CONFIG_EFI_EARLYCON ) ||IS_ENABLED (CONFIG_SYSFB )) -init_screen_info (); +init_primary_display ();if (boot_memmap ==EFI_INVALID_TABLE_ADDR )return ;
arch/loongarch/kernel/image-vars.h +1 -1
@@ -12,7 +12,7 @@ __efistub_kernel_entry = kernel_entry; __efistub_kernel_asize = kernel_asize; __efistub_kernel_fsize = kernel_fsize;#if defined(CONFIG_EFI_EARLYCON ) || defined(CONFIG_SYSFB ) -__efistub_screen_info = screen_info; +__efistub_sysfb_primary_display = sysfb_primary_display;#endif #endif
arch/riscv/kernel/image-vars.h +1 -1
@@ -29,7 +29,7 @@ __efistub__end = _end; __efistub__edata = _edata; __efistub___init_text_end = __init_text_end;#if defined(CONFIG_EFI_EARLYCON ) || defined(CONFIG_SYSFB ) -__efistub_screen_info = screen_info; +__efistub_sysfb_primary_display = sysfb_primary_display;#endif #endif
arch/x86/kernel/kexec-bzimage64.c +3 -1
@@ -20,6 +20,7 @@#include <linux/of_fdt.h> #include <linux/efi.h> #include <linux/random.h> +#include <linux/sysfb.h> #include <asm/bootparam.h> #include <asm/setup.h>
@@ -303,7 +304,8 @@ setup_boot_parameters(struct kimage *image, struct boot_params *params, params->hdr.hardware_subarch = boot_params.hdr.hardware_subarch;/* Copying screen_info will do? */ -memcpy (¶ms->screen_info, &screen_info,sizeof (struct screen_info )); +memcpy (¶ms->screen_info, &sysfb_primary_display.screen, +sizeof (sysfb_primary_display.screen));/* Fill in memsize later */ params->screen_info.ext_mem_k =0 ;
arch/x86/kernel/setup.c +6 -4
@@ -22,6 +22,7 @@#include <linux/random.h> #include <linux/root_dev.h> #include <linux/static_call.h> +#include <linux/sysfb.h> #include <linux/swiotlb.h> #include <linux/tboot.h> #include <linux/usb/xhci-dbgp.h>
@@ -211,8 +212,9 @@ arch_initcall(init_x86_sysctl);/* * Setup options */ -struct screen_info screen_info; -EXPORT_SYMBOL (screen_info); + +struct sysfb_display_info sysfb_primary_display; +EXPORT_SYMBOL (sysfb_primary_display);#if defined(CONFIG_FIRMWARE_EDID )struct edid_info edid_info;EXPORT_SYMBOL_GPL (edid_info);
@@ -526,7 +528,7 @@ static void __init parse_setup_data(void)static void __init parse_boot_params (void ) {ROOT_DEV =old_decode_dev (boot_params.hdr.root_dev); - screen_info = boot_params.screen_info; + sysfb_primary_display.screen = boot_params.screen_info;#if defined(CONFIG_FIRMWARE_EDID ) edid_info = boot_params.edid_info;#endif
@@ -1254,7 +1256,7 @@ void __init setup_arch(char **cmdline_p)#ifdef CONFIG_VT #if defined(CONFIG_VGA_CONSOLE )if (!efi_enabled (EFI_BOOT ) || (efi_mem_type (0xa0000 ) !=EFI_CONVENTIONAL_MEMORY )) -vgacon_register_screen (&screen_info); +vgacon_register_screen (&sysfb_primary_display.screen);#endif #endif x86_init.oem.banner ();
arch/x86/video/video-common.c +2 -2
@@ -9,7 +9,7 @@#include <linux/module.h> #include <linux/pci.h> -#include <linux/screen_info.h> +#include <linux/sysfb.h> #include <linux/vgaarb.h> #include <asm/video.h>
@@ -29,7 +29,7 @@ EXPORT_SYMBOL(pgprot_framebuffer);bool video_is_primary_device (struct device *dev) {#ifdef CONFIG_SCREEN_INFO -struct screen_info *si = &screen_info; +struct screen_info *si = &sysfb_primary_display.screen;struct resource res[SCREEN_INFO_MAX_RESOURCES ];ssize_t i, numres;#endif
drivers/firmware/efi/earlycon.c +4 -4
@@ -9,7 +9,7 @@#include <linux/io.h> #include <linux/kernel.h> #include <linux/serial_core.h> -#include <linux/screen_info.h> +#include <linux/sysfb.h> #include <linux/string.h> #include <asm/early_ioremap.h>
@@ -32,7 +32,7 @@ static void *efi_fb;*/ static int __init efi_earlycon_remap_fb (void ) { -const struct screen_info *si = &screen_info; +const struct screen_info *si = &sysfb_primary_display.screen;/* bail if there is no bootconsole or it was unregistered already */ if (!earlycon_console || !console_is_registered (earlycon_console))
@@ -147,7 +147,7 @@ static void efi_earlycon_write_char(u32 *dst, unsigned char c, unsigned int h,static void efi_earlycon_write (struct console *con,const char *str,unsigned int num) { -const struct screen_info *si = &screen_info; +const struct screen_info *si = &sysfb_primary_display.screen;u32 cur_efi_x = efi_x;unsigned int len;const char *s;
@@ -227,7 +227,7 @@ void __init efi_earlycon_reprobe(void)static int __init efi_earlycon_setup (struct earlycon_device *device,const char *opt) { -const struct screen_info *si = &screen_info; +const struct screen_info *si = &sysfb_primary_display.screen;u16 xres, yres;u32 i;
drivers/firmware/efi/efi-init.c +11 -11
@@ -19,7 +19,7 @@#include <linux/of_address.h> #include <linux/of_fdt.h> #include <linux/platform_device.h> -#include <linux/screen_info.h> +#include <linux/sysfb.h> #include <asm/efi.h>
@@ -57,15 +57,15 @@ static phys_addr_t __init efi_to_phys(unsigned long addr)extern __weak const efi_config_table_type_t efi_arch_tables[];/* -* x86 defines its own screen_info and uses it even without EFI, -* everything else can get it from here. +* x86 defines its own instance of sysfb_primary_display and uses +* it even without EFI, everything else can get them from here. */ #if !defined(CONFIG_X86 ) && (defined(CONFIG_SYSFB ) || defined(CONFIG_EFI_EARLYCON )) -struct screen_info screen_info __section(".data"); -EXPORT_SYMBOL_GPL (screen_info); +struct sysfb_display_info sysfb_primary_display __section(".data"); +EXPORT_SYMBOL_GPL (sysfb_primary_display);#endif -static void __init init_screen_info (void ) +static void __init init_primary_display (void ) {struct screen_info *si;
@@ -75,13 +75,13 @@ static void __init init_screen_info(void)pr_err ("Could not map screen_info config table\n" );return ; } - screen_info = *si; + sysfb_primary_display.screen = *si;memset (si,0 ,sizeof (*si));early_memunmap (si,sizeof (*si)); -if (memblock_is_map_memory (screen_info.lfb_base)) -memblock_mark_nomap (screen_info.lfb_base, - screen_info.lfb_size); +if (memblock_is_map_memory (sysfb_primary_display.screen.lfb_base)) +memblock_mark_nomap (sysfb_primary_display.screen.lfb_base, + sysfb_primary_display.screen.lfb_size);if (IS_ENABLED (CONFIG_EFI_EARLYCON ))efi_earlycon_reprobe ();
@@ -274,5 +274,5 @@ void __init efi_init(void)if (IS_ENABLED (CONFIG_X86 ) ||IS_ENABLED (CONFIG_SYSFB ) ||IS_ENABLED (CONFIG_EFI_EARLYCON )) -init_screen_info (); +init_primary_display (); }
drivers/firmware/efi/libstub/efi-stub-entry.c +13 -5
@@ -1,13 +1,18 @@// SPDX-License-Identifier: GPL-2.0-only #include <linux/efi.h> -#include <linux/screen_info.h> +#include <linux/sysfb.h> #include <asm/efi.h> #include "efistub.h" -static unsigned long screen_info_offset; +static unsigned long kernel_image_offset; + +static void *kernel_image_addr (void *addr) +{ +return addr + kernel_image_offset; +}struct screen_info *alloc_screen_info (void ) {
@@ -16,8 +21,11 @@ struct screen_info *alloc_screen_info(void)if (IS_ENABLED (CONFIG_X86 ) ||IS_ENABLED (CONFIG_EFI_EARLYCON ) || -IS_ENABLED (CONFIG_SYSFB )) -return (void *)&screen_info + screen_info_offset; +IS_ENABLED (CONFIG_SYSFB )) { +struct sysfb_display_info *dpy =kernel_image_addr (&sysfb_primary_display); + +return &dpy->screen; + }return NULL ; }
@@ -73,7 +81,7 @@ efi_status_t __efiapi efi_pe_entry(efi_handle_t handle,return status; } - screen_info_offset = image_addr - (unsigned long )image->image_base; + kernel_image_offset = image_addr - (unsigned long )image->image_base; status =efi_stub_common (handle, image, image_addr, cmdline_ptr);
drivers/firmware/efi/sysfb_efi.c +2 -2
@@ -176,7 +176,7 @@ static int __init efifb_set_system(struct screen_info *si, const struct dmi_syststatic int __init efifb_set_system_callback (const struct dmi_system_id *id) { -return efifb_set_system (&screen_info, id); +return efifb_set_system (&sysfb_primary_display.screen, id); }#define EFIFB_DMI_SYSTEM_ID (vendor, name, enumid) \
@@ -316,7 +316,7 @@ static struct device_node *find_pci_overlap_node(void) }for_each_of_pci_range (&parser, &range) -if (efifb_overlaps_pci_range (&screen_info, &range)) +if (efifb_overlaps_pci_range (&sysfb_primary_display.screen, &range))return np; }return NULL ;
drivers/firmware/sysfb.c +3 -3
@@ -66,7 +66,7 @@ static bool sysfb_unregister(void)*/ void sysfb_disable (struct device *dev) { -struct screen_info *si = &screen_info; +struct screen_info *si = &sysfb_primary_display.screen;struct device *parent;mutex_lock (&disable_lock);
@@ -92,7 +92,7 @@ EXPORT_SYMBOL_GPL(sysfb_disable);*/ bool sysfb_handles_screen_info (void ) { -const struct screen_info *si = &screen_info; +const struct screen_info *si = &sysfb_primary_display.screen;return !!screen_info_video_type (si); }
@@ -141,7 +141,7 @@ static struct device *sysfb_parent_dev(const struct screen_info *si)static __init int sysfb_init (void ) { -struct screen_info *si = &screen_info; +struct screen_info *si = &sysfb_primary_display.screen;struct device *parent;unsigned int type;struct simplefb_platform_data mode;
drivers/hv/vmbus_drv.c +3 -3
@@ -29,7 +29,7 @@#include <linux/delay.h> #include <linux/panic_notifier.h> #include <linux/ptrace.h> -#include <linux/screen_info.h> +#include <linux/sysfb.h> #include <linux/efi.h> #include <linux/random.h> #include <linux/kernel.h>
@@ -2340,8 +2340,8 @@ static void __maybe_unused vmbus_reserve_fb(void)if (efi_enabled (EFI_BOOT )) {/* Gen2 VM: get FB base from EFI framebuffer */ if (IS_ENABLED (CONFIG_SYSFB )) { - start = screen_info.lfb_base; - size =max_t (__u32, screen_info.lfb_size,0x800000 ); + start = sysfb_primary_display.screen.lfb_base; + size =max_t (__u32, sysfb_primary_display.screen.lfb_size,0x800000 ); } }else {/* Gen1 VM: get FB base from PCI */
drivers/pci/vgaarb.c +2 -2
@@ -26,7 +26,7 @@#include <linux/poll.h> #include <linux/miscdevice.h> #include <linux/slab.h> -#include <linux/screen_info.h> +#include <linux/sysfb.h> #include <linux/vt.h> #include <linux/console.h> #include <linux/acpi.h>
@@ -557,7 +557,7 @@ EXPORT_SYMBOL(vga_put);static bool vga_is_firmware_default (struct pci_dev *pdev) {#if definedCONFIG_X86 -return pdev ==screen_info_pci_dev (&screen_info); +return pdev ==screen_info_pci_dev (&sysfb_primary_display.screen);#else return false;#endif
drivers/video/screen_info_pci.c +3 -2
@@ -4,6 +4,7 @@#include <linux/printk.h> #include <linux/screen_info.h> #include <linux/string.h> +#include <linux/sysfb.h> static struct pci_dev *screen_info_lfb_pdev;static size_t screen_info_lfb_bar;
@@ -26,7 +27,7 @@ static bool __screen_info_relocation_is_valid(const struct screen_info *si, struvoid screen_info_apply_fixups (void ) { -struct screen_info *si = &screen_info; +struct screen_info *si = &sysfb_primary_display.screen;if (screen_info_lfb_pdev) {struct resource *pr = &screen_info_lfb_pdev->resource[screen_info_lfb_bar];
@@ -75,7 +76,7 @@ static void screen_info_fixup_lfb(struct pci_dev *pdev) .flags = IORESOURCE_MEM, };const struct resource *pr; -const struct screen_info *si = &screen_info; +const struct screen_info *si = &sysfb_primary_display.screen;if (screen_info_lfb_pdev)return ;// already found
include/linux/screen_info.h +0 -2
@@ -151,6 +151,4 @@ static inline struct pci_dev *screen_info_pci_dev(const struct screen_info *si) }#endif -extern struct screen_info screen_info; -#endif /* _SCREEN_INFO_H */
include/linux/sysfb.h +3 -2
@@ -8,11 +8,10 @@*/ #include <linux/err.h> +#include <linux/platform_data/simplefb.h> #include <linux/screen_info.h> #include <linux/types.h> -#include <linux/platform_data/simplefb.h> -struct device ;struct platform_device ;struct screen_info ;
@@ -65,6 +64,8 @@ struct sysfb_display_info {struct screen_info screen; }; +extern struct sysfb_display_info sysfb_primary_display; +#ifdef CONFIG_SYSFB void sysfb_disable (struct device *dev);
Signature · 1 line
2.51.1
Re: [PATCH v3 4/9] sysfb: Replace screen_info with sysfb_primary_display
Quoted 536 lines · Thomas Zimmermann
Replace the global
screen_infowithsysfb_primary_displayof type structsysfb_display_info. Adapt all users ofscreen_info.Instances of
screen_infoare defined for x86, loongarch and EFI, with only one instance compiled into a specific build. Replace all of them withsysfb_primary_display.All existing users of
screen_infoare updated by pointing them to sysfb_primary_display.screen instead. This introduces some churn to the code, but has no impact on functionality.Boot parameters and EFI config tables are unchanged. They transfer
screen_infoas before. The logic in EFI'salloc_screen_info()changes slightly, as it now returns the screen field ofsysfb_primary_display.v2:
- update comment
- renameinit_screen_info()toinit_primary_display()Signed-off-by Thomas Zimmermann <[email protected]>Acked-by Arnd Bergmann <[email protected]>Acked-by Ard Biesheuvel <[email protected]>--- arch/arm64/kernel/image-vars.h | 2 +- arch/loongarch/kernel/efi.c | 15 +++++++------ arch/loongarch/kernel/image-vars.h | 2 +- arch/riscv/kernel/image-vars.h | 2 +- arch/x86/kernel/kexec-bzimage64.c | 4 +++- arch/x86/kernel/setup.c | 10 +++++---- arch/x86/video/video-common.c | 4 ++-- drivers/firmware/efi/earlycon.c | 8 +++---- drivers/firmware/efi/efi-init.c | 22 +++++++++---------- drivers/firmware/efi/libstub/efi-stub-entry.c | 18 ++++++++++----- drivers/firmware/efi/sysfb_efi.c | 4 ++-- drivers/firmware/sysfb.c | 6 ++--- drivers/hv/vmbus_drv.c | 6 ++--- drivers/pci/vgaarb.c | 4 ++-- drivers/video/screen_info_pci.c | 5 +++-- include/linux/screen_info.h | 2 -- include/linux/sysfb.h | 5 +++-- 17 files changed, 66 insertions(+), 53 deletions(-)arch/arm64/kernel/image-vars.h +1
-1@@ -38,7 +38,7 @@ PROVIDE(__efistub__end = _end);PROVIDE (__efistub___inittext_end = __inittext_end);PROVIDE (__efistub__edata = _edata);#if defined(CONFIG_EFI_EARLYCON ) || defined(CONFIG_SYSFB ) -PROVIDE (__efistub_screen_info = screen_info); +PROVIDE (__efistub_sysfb_primary_display = sysfb_primary_display);#endif PROVIDE (__efistub__ctype = _ctype);arch/loongarch/kernel/efi.c +8
-7@@ -18,7 +18,7 @@#include <linux/kobject.h> #include <linux/memblock.h> #include <linux/reboot.h> -#include <linux/screen_info.h> +#include <linux/sysfb.h> #include <linux/uaccess.h> #include <asm/early_ioremap.h> @@ -75,11 +75,11 @@ bool efi_poweroff_required(void)unsigned long __initdata screen_info_table =EFI_INVALID_TABLE_ADDR ;#if defined(CONFIG_SYSFB ) || defined(CONFIG_EFI_EARLYCON ) -struct screen_info screen_info __section(".data"); -EXPORT_SYMBOL_GPL (screen_info); +struct sysfb_display_info sysfb_primary_display __section(".data"); +EXPORT_SYMBOL_GPL (sysfb_primary_display);#endif -static void __init init_screen_info (void ) +static void __init init_primary_display (void ) {struct screen_info *si;@@ -91,11 +91,12 @@ static void __init init_screen_info(void)pr_err ("Could not map screen_info config table\n" );return ; } - screen_info = *si; + sysfb_primary_display.screen = *si;memset (si,0 ,sizeof (*si));early_memunmap (si,sizeof (*si)); -memblock_reserve (__screen_info_lfb_base (&screen_info), screen_info.lfb_size); +memblock_reserve (__screen_info_lfb_base (&sysfb_primary_display.screen), + sysfb_primary_display.screen.lfb_size); }void __init efi_init (void )@@ -127,7 +128,7 @@ void __init efi_init(void)set_bit (EFI_CONFIG_TABLES , &efi.flags);if (IS_ENABLED (CONFIG_EFI_EARLYCON ) ||IS_ENABLED (CONFIG_SYSFB )) -init_screen_info (); +init_primary_display ();if (boot_memmap ==EFI_INVALID_TABLE_ADDR )return ;arch/loongarch/kernel/image-vars.h +1
-1@@ -12,7 +12,7 @@ __efistub_kernel_entry = kernel_entry; __efistub_kernel_asize = kernel_asize; __efistub_kernel_fsize = kernel_fsize;#if defined(CONFIG_EFI_EARLYCON ) || defined(CONFIG_SYSFB ) -__efistub_screen_info = screen_info; +__efistub_sysfb_primary_display = sysfb_primary_display;#endif #endif arch/riscv/kernel/image-vars.h +1
-1@@ -29,7 +29,7 @@ __efistub__end = _end; __efistub__edata = _edata; __efistub___init_text_end = __init_text_end;#if defined(CONFIG_EFI_EARLYCON ) || defined(CONFIG_SYSFB ) -__efistub_screen_info = screen_info; +__efistub_sysfb_primary_display = sysfb_primary_display;#endif #endif arch/x86/kernel/kexec-bzimage64.c +3
-1@@ -20,6 +20,7 @@#include <linux/of_fdt.h> #include <linux/efi.h> #include <linux/random.h> +#include <linux/sysfb.h> #include <asm/bootparam.h> #include <asm/setup.h> @@ -303,7 +304,8 @@ setup_boot_parameters(struct kimage *image, struct boot_params *params, params->hdr.hardware_subarch = boot_params.hdr.hardware_subarch;/* Copying screen_info will do? */ -memcpy (¶ms->screen_info, &screen_info,sizeof (struct screen_info )); +memcpy (¶ms->screen_info, &sysfb_primary_display.screen, +sizeof (sysfb_primary_display.screen));/* Fill in memsize later */ params->screen_info.ext_mem_k =0 ;arch/x86/kernel/setup.c +6
-4@@ -22,6 +22,7 @@#include <linux/random.h> #include <linux/root_dev.h> #include <linux/static_call.h> +#include <linux/sysfb.h> #include <linux/swiotlb.h> #include <linux/tboot.h> #include <linux/usb/xhci-dbgp.h> @@ -211,8 +212,9 @@ arch_initcall(init_x86_sysctl);/* * Setup options */ -struct screen_info screen_info; -EXPORT_SYMBOL (screen_info); + +struct sysfb_display_info sysfb_primary_display; +EXPORT_SYMBOL (sysfb_primary_display);#if defined(CONFIG_FIRMWARE_EDID )struct edid_info edid_info;EXPORT_SYMBOL_GPL (edid_info);@@ -526,7 +528,7 @@ static void __init parse_setup_data(void)static void __init parse_boot_params (void ) {ROOT_DEV =old_decode_dev (boot_params.hdr.root_dev); - screen_info = boot_params.screen_info; + sysfb_primary_display.screen = boot_params.screen_info;#if defined(CONFIG_FIRMWARE_EDID ) edid_info = boot_params.edid_info;#endif @@ -1254,7 +1256,7 @@ void __init setup_arch(char **cmdline_p)#ifdef CONFIG_VT #if defined(CONFIG_VGA_CONSOLE )if (!efi_enabled (EFI_BOOT ) || (efi_mem_type (0xa0000 ) !=EFI_CONVENTIONAL_MEMORY )) -vgacon_register_screen (&screen_info); +vgacon_register_screen (&sysfb_primary_display.screen);#endif #endif x86_init.oem.banner ();arch/x86/video/video-common.c +2
-2@@ -9,7 +9,7 @@#include <linux/module.h> #include <linux/pci.h> -#include <linux/screen_info.h> +#include <linux/sysfb.h> #include <linux/vgaarb.h> #include <asm/video.h> @@ -29,7 +29,7 @@ EXPORT_SYMBOL(pgprot_framebuffer);bool video_is_primary_device (struct device *dev) {#ifdef CONFIG_SCREEN_INFO -struct screen_info *si = &screen_info; +struct screen_info *si = &sysfb_primary_display.screen;struct resource res[SCREEN_INFO_MAX_RESOURCES ];ssize_t i, numres;#endif drivers/firmware/efi/earlycon.c +4
-4@@ -9,7 +9,7 @@#include <linux/io.h> #include <linux/kernel.h> #include <linux/serial_core.h> -#include <linux/screen_info.h> +#include <linux/sysfb.h> #include <linux/string.h> #include <asm/early_ioremap.h> @@ -32,7 +32,7 @@ static void *efi_fb;*/ static int __init efi_earlycon_remap_fb (void ) { -const struct screen_info *si = &screen_info; +const struct screen_info *si = &sysfb_primary_display.screen;/* bail if there is no bootconsole or it was unregistered already */ if (!earlycon_console || !console_is_registered (earlycon_console))@@ -147,7 +147,7 @@ static void efi_earlycon_write_char(u32 *dst, unsigned char c, unsigned int h,static void efi_earlycon_write (struct console *con,const char *str,unsigned int num) { -const struct screen_info *si = &screen_info; +const struct screen_info *si = &sysfb_primary_display.screen;u32 cur_efi_x = efi_x;unsigned int len;const char *s;@@ -227,7 +227,7 @@ void __init efi_earlycon_reprobe(void)static int __init efi_earlycon_setup (struct earlycon_device *device,const char *opt) { -const struct screen_info *si = &screen_info; +const struct screen_info *si = &sysfb_primary_display.screen;u16 xres, yres;u32 i;drivers/firmware/efi/efi-init.c +11
-11@@ -19,7 +19,7 @@#include <linux/of_address.h> #include <linux/of_fdt.h> #include <linux/platform_device.h> -#include <linux/screen_info.h> +#include <linux/sysfb.h> #include <asm/efi.h> @@ -57,15 +57,15 @@ static phys_addr_t __init efi_to_phys(unsigned long addr)extern __weak const efi_config_table_type_t efi_arch_tables[];/* -* x86 defines its own screen_info and uses it even without EFI, -* everything else can get it from here. +* x86 defines its own instance of sysfb_primary_display and uses +* it even without EFI, everything else can get them from here. */ #if !defined(CONFIG_X86 ) && (defined(CONFIG_SYSFB ) || defined(CONFIG_EFI_EARLYCON )) -struct screen_info screen_info __section(".data"); -EXPORT_SYMBOL_GPL (screen_info); +struct sysfb_display_info sysfb_primary_display __section(".data"); +EXPORT_SYMBOL_GPL (sysfb_primary_display);#endif -static void __init init_screen_info (void ) +static void __init init_primary_display (void ) {struct screen_info *si;@@ -75,13 +75,13 @@ static void __init init_screen_info(void)pr_err ("Could not map screen_info config table\n" );return ; } - screen_info = *si; + sysfb_primary_display.screen = *si;memset (si,0 ,sizeof (*si));early_memunmap (si,sizeof (*si)); -if (memblock_is_map_memory (screen_info.lfb_base)) -memblock_mark_nomap (screen_info.lfb_base, - screen_info.lfb_size); +if (memblock_is_map_memory (sysfb_primary_display.screen.lfb_base)) +memblock_mark_nomap (sysfb_primary_display.screen.lfb_base, + sysfb_primary_display.screen.lfb_size);if (IS_ENABLED (CONFIG_EFI_EARLYCON ))efi_earlycon_reprobe ();@@ -274,5 +274,5 @@ void __init efi_init(void)if (IS_ENABLED (CONFIG_X86 ) ||IS_ENABLED (CONFIG_SYSFB ) ||IS_ENABLED (CONFIG_EFI_EARLYCON )) -init_screen_info (); +init_primary_display (); }drivers/firmware/efi/libstub/efi-stub-entry.c +13
-5@@ -1,13 +1,18 @@// SPDX-License-Identifier: GPL-2.0-only #include <linux/efi.h> -#include <linux/screen_info.h> +#include <linux/sysfb.h> #include <asm/efi.h> #include "efistub.h" -static unsigned long screen_info_offset; +static unsigned long kernel_image_offset; + +static void *kernel_image_addr (void *addr) +{ +return addr + kernel_image_offset; +}struct screen_info *alloc_screen_info (void ) {@@ -16,8 +21,11 @@ struct screen_info *alloc_screen_info(void)if (IS_ENABLED (CONFIG_X86 ) ||IS_ENABLED (CONFIG_EFI_EARLYCON ) || -IS_ENABLED (CONFIG_SYSFB )) -return (void *)&screen_info + screen_info_offset; +IS_ENABLED (CONFIG_SYSFB )) { +struct sysfb_display_info *dpy =kernel_image_addr (&sysfb_primary_display); + +return &dpy->screen; + }return NULL ; }@@ -73,7 +81,7 @@ efi_status_t __efiapi efi_pe_entry(efi_handle_t handle,return status; } - screen_info_offset = image_addr - (unsigned long )image->image_base; + kernel_image_offset = image_addr - (unsigned long )image->image_base; status =efi_stub_common (handle, image, image_addr, cmdline_ptr);drivers/firmware/efi/sysfb_efi.c +2
-2@@ -176,7 +176,7 @@ static int __init efifb_set_system(struct screen_info *si, const struct dmi_syststatic int __init efifb_set_system_callback (const struct dmi_system_id *id) { -return efifb_set_system (&screen_info, id); +return efifb_set_system (&sysfb_primary_display.screen, id); }#define EFIFB_DMI_SYSTEM_ID (vendor, name, enumid) \@@ -316,7 +316,7 @@ static struct device_node *find_pci_overlap_node(void) }for_each_of_pci_range (&parser, &range) -if (efifb_overlaps_pci_range (&screen_info, &range)) +if (efifb_overlaps_pci_range (&sysfb_primary_display.screen, &range))return np; }return NULL ;drivers/firmware/sysfb.c +3
-3@@ -66,7 +66,7 @@ static bool sysfb_unregister(void)*/ void sysfb_disable (struct device *dev) { -struct screen_info *si = &screen_info; +struct screen_info *si = &sysfb_primary_display.screen;struct device *parent;mutex_lock (&disable_lock);@@ -92,7 +92,7 @@ EXPORT_SYMBOL_GPL(sysfb_disable);*/ bool sysfb_handles_screen_info (void ) { -const struct screen_info *si = &screen_info; +const struct screen_info *si = &sysfb_primary_display.screen;return !!screen_info_video_type (si); }@@ -141,7 +141,7 @@ static struct device *sysfb_parent_dev(const struct screen_info *si)static __init int sysfb_init (void ) { -struct screen_info *si = &screen_info; +struct screen_info *si = &sysfb_primary_display.screen;struct device *parent;unsigned int type;struct simplefb_platform_data mode;drivers/hv/vmbus_drv.c +3
-3@@ -29,7 +29,7 @@#include <linux/delay.h> #include <linux/panic_notifier.h> #include <linux/ptrace.h> -#include <linux/screen_info.h> +#include <linux/sysfb.h> #include <linux/efi.h> #include <linux/random.h> #include <linux/kernel.h> @@ -2340,8 +2340,8 @@ static void __maybe_unused vmbus_reserve_fb(void)if (efi_enabled (EFI_BOOT )) {/* Gen2 VM: get FB base from EFI framebuffer */ if (IS_ENABLED (CONFIG_SYSFB )) { - start = screen_info.lfb_base; - size =max_t (__u32, screen_info.lfb_size,0x800000 ); + start = sysfb_primary_display.screen.lfb_base; + size =max_t (__u32, sysfb_primary_display.screen.lfb_size,0x800000 ); } }else {/* Gen1 VM: get FB base from PCI */ drivers/pci/vgaarb.c +2
-2@@ -26,7 +26,7 @@#include <linux/poll.h> #include <linux/miscdevice.h> #include <linux/slab.h> -#include <linux/screen_info.h> +#include <linux/sysfb.h> #include <linux/vt.h> #include <linux/console.h> #include <linux/acpi.h> @@ -557,7 +557,7 @@ EXPORT_SYMBOL(vga_put);static bool vga_is_firmware_default (struct pci_dev *pdev) {#if definedCONFIG_X86 -return pdev ==screen_info_pci_dev (&screen_info); +return pdev ==screen_info_pci_dev (&sysfb_primary_display.screen);#else return false;#endif drivers/video/screen_info_pci.c +3
-2@@ -4,6 +4,7 @@#include <linux/printk.h> #include <linux/screen_info.h> #include <linux/string.h> +#include <linux/sysfb.h> static struct pci_dev *screen_info_lfb_pdev;static size_t screen_info_lfb_bar;@@ -26,7 +27,7 @@ static bool __screen_info_relocation_is_valid(const struct screen_info *si, struvoid screen_info_apply_fixups (void ) { -struct screen_info *si = &screen_info; +struct screen_info *si = &sysfb_primary_display.screen;if (screen_info_lfb_pdev) {struct resource *pr = &screen_info_lfb_pdev->resource[screen_info_lfb_bar];@@ -75,7 +76,7 @@ static void screen_info_fixup_lfb(struct pci_dev *pdev) .flags = IORESOURCE_MEM, };const struct resource *pr; -const struct screen_info *si = &screen_info; +const struct screen_info *si = &sysfb_primary_display.screen;if (screen_info_lfb_pdev)return ;// already found include/linux/screen_info.h +0
-2@@ -151,6 +151,4 @@ static inline struct pci_dev *screen_info_pci_dev(const struct screen_info *si) }#endif -extern struct screen_info screen_info; -#endif /* _SCREEN_INFO_H */ include/linux/sysfb.h +3
-2@@ -8,11 +8,10 @@*/ #include <linux/err.h> +#include <linux/platform_data/simplefb.h> #include <linux/screen_info.h> #include <linux/types.h> -#include <linux/platform_data/simplefb.h> -struct device ;struct platform_device ;struct screen_info ;@@ -65,6 +64,8 @@ struct sysfb_display_info {struct screen_info screen; }; +extern struct sysfb_display_info sysfb_primary_display; +#ifdef CONFIG_SYSFB void sysfb_disable (struct device *dev);Signature · 1 line
2.51.1
Thomas Zimmermann
maintainerPATCH v3 5/9 sysfb: Pass sysfb_primary_display to devices
In reply to Thomas ZimmermannInstead of screen_info, store a copy of sysfb_primary_display as device data. Pick it up in drivers. Later changes will add additional data to the display info, such as EDID information.
--- drivers/firmware/sysfb.c | 5 +++-- drivers/gpu/drm/sysfb/efidrm.c | 9 ++++++--- drivers/gpu/drm/sysfb/vesadrm.c | 9 ++++++--- drivers/video/fbdev/efifb.c | 10 ++++++---- drivers/video/fbdev/vesafb.c | 10 ++++++---- drivers/video/fbdev/vga16fb.c | 8 +++++--- 6 files changed, 32 insertions(+), 19 deletions(-)
drivers/firmware/sysfb.c +3 -2
@@ -141,7 +141,8 @@ static struct device *sysfb_parent_dev(const struct screen_info *si)static __init int sysfb_init (void ) { -struct screen_info *si = &sysfb_primary_display.screen; +struct sysfb_display_info *dpy = &sysfb_primary_display; +struct screen_info *si = &dpy->screen;struct device *parent;unsigned int type;struct simplefb_platform_data mode;
@@ -202,7 +203,7 @@ static __init int sysfb_init(void)sysfb_set_efifb_fwnode (si, pd); - ret =platform_device_add_data (pd, si,sizeof (*si)); + ret =platform_device_add_data (pd, dpy,sizeof (*dpy));if (ret) goto err;
drivers/gpu/drm/sysfb/efidrm.c +6 -3
@@ -4,7 +4,7 @@#include <linux/efi.h> #include <linux/limits.h> #include <linux/platform_device.h> -#include <linux/screen_info.h> +#include <linux/sysfb.h> #include <drm/clients/drm_client_setup.h> #include <drm/drm_atomic.h>
@@ -141,6 +141,7 @@ static const struct drm_mode_config_funcs efidrm_mode_config_funcs = {static struct efidrm_device *efidrm_device_create (struct drm_driver *drv,struct platform_device *pdev) { +const struct sysfb_display_info *dpy;const struct screen_info *si;const struct drm_format_info *format;int width, height, stride;
@@ -160,9 +161,11 @@ static struct efidrm_device *efidrm_device_create(struct drm_driver *drv,size_t nformats;int ret; - si =dev_get_platdata (&pdev->dev); -if (!si) + dpy =dev_get_platdata (&pdev->dev); +if (!dpy)return ERR_PTR (-ENODEV ); + si = &dpy->screen; +if (screen_info_video_type (si) !=VIDEO_TYPE_EFI )return ERR_PTR (-ENODEV );
drivers/gpu/drm/sysfb/vesadrm.c +6 -3
@@ -4,7 +4,7 @@#include <linux/ioport.h> #include <linux/limits.h> #include <linux/platform_device.h> -#include <linux/screen_info.h> +#include <linux/sysfb.h> #include <drm/clients/drm_client_setup.h> #include <drm/drm_atomic.h>
@@ -391,6 +391,7 @@ static const struct drm_mode_config_funcs vesadrm_mode_config_funcs = {static struct vesadrm_device *vesadrm_device_create (struct drm_driver *drv,struct platform_device *pdev) { +const struct sysfb_display_info *dpy;const struct screen_info *si;const struct drm_format_info *format;int width, height, stride;
@@ -410,9 +411,11 @@ static struct vesadrm_device *vesadrm_device_create(struct drm_driver *drv,size_t nformats;int ret; - si =dev_get_platdata (&pdev->dev); -if (!si) + dpy =dev_get_platdata (&pdev->dev); +if (!dpy)return ERR_PTR (-ENODEV ); + si = &dpy->screen; +if (screen_info_video_type (si) !=VIDEO_TYPE_VLFB )return ERR_PTR (-ENODEV );
drivers/video/fbdev/efifb.c +6 -4
@@ -15,7 +15,7 @@#include <linux/fb.h> #include <linux/platform_device.h> #include <linux/printk.h> -#include <linux/screen_info.h> +#include <linux/sysfb.h> #include <video/vga.h> #include <asm/efi.h> #include <drm/drm_utils.h> /* For drm_get_panel_orientation_quirk */
@@ -345,6 +345,7 @@ ATTRIBUTE_GROUPS(efifb);static int efifb_probe (struct platform_device *dev) { +struct sysfb_display_info *dpy;struct screen_info *si;struct fb_info *info;struct efifb_par *par;
@@ -360,10 +361,11 @@ static int efifb_probe(struct platform_device *dev)* driver. We get a copy of the attached screen_info, so that we can * modify its values without affecting later drivers. */ - si =dev_get_platdata (&dev->dev); -if (!si) + dpy =dev_get_platdata (&dev->dev); +if (!dpy)return -ENODEV ; - si =devm_kmemdup (&dev->dev, si,sizeof (*si),GFP_KERNEL ); + + si =devm_kmemdup (&dev->dev, &dpy->screen,sizeof (*si),GFP_KERNEL );if (!si)return -ENOMEM ;
drivers/video/fbdev/vesafb.c +6 -4
@@ -20,7 +20,7 @@#include <linux/ioport.h> #include <linux/init.h> #include <linux/platform_device.h> -#include <linux/screen_info.h> +#include <linux/sysfb.h> #include <linux/io.h> #include <video/vga.h>
@@ -243,6 +243,7 @@ static int vesafb_setup(char *options)static int vesafb_probe (struct platform_device *dev) { +struct sysfb_display_info *dpy;struct screen_info *si;struct fb_info *info;struct vesafb_par *par;
@@ -257,10 +258,11 @@ static int vesafb_probe(struct platform_device *dev)* driver. We get a copy of the attached screen_info, so that we can * modify its values without affecting later drivers. */ - si =dev_get_platdata (&dev->dev); -if (!si) + dpy =dev_get_platdata (&dev->dev); +if (!dpy)return -ENODEV ; - si =devm_kmemdup (&dev->dev, si,sizeof (*si),GFP_KERNEL ); + + si =devm_kmemdup (&dev->dev, &dpy->screen,sizeof (*si),GFP_KERNEL );if (!si)return -ENOMEM ;
drivers/video/fbdev/vga16fb.c +5 -3
@@ -21,7 +21,7 @@#include <linux/ioport.h> #include <linux/init.h> #include <linux/platform_device.h> -#include <linux/screen_info.h> +#include <linux/sysfb.h> #include <asm/io.h> #include <video/vga.h>
@@ -1305,15 +1305,17 @@ static const struct fb_ops vga16fb_ops = {static int vga16fb_probe (struct platform_device *dev) { +struct sysfb_display_info *dpy;struct screen_info *si;struct fb_info *info;struct vga16fb_par *par;int i;int ret =0 ; - si =dev_get_platdata (&dev->dev); -if (!si) + dpy =dev_get_platdata (&dev->dev); +if (!dpy)return -ENODEV ; + si = &dpy->screen; ret =check_mode_supported (si);if (ret)
Signature · 1 line
2.51.1
Re: [PATCH v3 5/9] sysfb: Pass sysfb_primary_display to devices
Quoted 217 lines · Thomas Zimmermann
Instead of
screen_info, store a copy ofsysfb_primary_displayas device data. Pick it up in drivers. Later changes will add additional data to the display info, such as EDID information.Signed-off-by Thomas Zimmermann <[email protected]>Acked-by Arnd Bergmann <[email protected]>Acked-by Ard Biesheuvel <[email protected]>--- drivers/firmware/sysfb.c | 5 +++-- drivers/gpu/drm/sysfb/efidrm.c | 9 ++++++--- drivers/gpu/drm/sysfb/vesadrm.c | 9 ++++++--- drivers/video/fbdev/efifb.c | 10 ++++++---- drivers/video/fbdev/vesafb.c | 10 ++++++---- drivers/video/fbdev/vga16fb.c | 8 +++++--- 6 files changed, 32 insertions(+), 19 deletions(-)drivers/firmware/sysfb.c +3
-2@@ -141,7 +141,8 @@ static struct device *sysfb_parent_dev(const struct screen_info *si)static __init int sysfb_init (void ) { -struct screen_info *si = &sysfb_primary_display.screen; +struct sysfb_display_info *dpy = &sysfb_primary_display; +struct screen_info *si = &dpy->screen;struct device *parent;unsigned int type;struct simplefb_platform_data mode;@@ -202,7 +203,7 @@ static __init int sysfb_init(void)sysfb_set_efifb_fwnode (si, pd); - ret =platform_device_add_data (pd, si,sizeof (*si)); + ret =platform_device_add_data (pd, dpy,sizeof (*dpy));if (ret) goto err;drivers/gpu/drm/sysfb/efidrm.c +6
-3@@ -4,7 +4,7 @@#include <linux/efi.h> #include <linux/limits.h> #include <linux/platform_device.h> -#include <linux/screen_info.h> +#include <linux/sysfb.h> #include <drm/clients/drm_client_setup.h> #include <drm/drm_atomic.h> @@ -141,6 +141,7 @@ static const struct drm_mode_config_funcs efidrm_mode_config_funcs = {static struct efidrm_device *efidrm_device_create (struct drm_driver *drv,struct platform_device *pdev) { +const struct sysfb_display_info *dpy;const struct screen_info *si;const struct drm_format_info *format;int width, height, stride;@@ -160,9 +161,11 @@ static struct efidrm_device *efidrm_device_create(struct drm_driver *drv,size_t nformats;int ret; - si =dev_get_platdata (&pdev->dev); -if (!si) + dpy =dev_get_platdata (&pdev->dev); +if (!dpy)return ERR_PTR (-ENODEV ); + si = &dpy->screen; +if (screen_info_video_type (si) !=VIDEO_TYPE_EFI )return ERR_PTR (-ENODEV );drivers/gpu/drm/sysfb/vesadrm.c +6
-3@@ -4,7 +4,7 @@#include <linux/ioport.h> #include <linux/limits.h> #include <linux/platform_device.h> -#include <linux/screen_info.h> +#include <linux/sysfb.h> #include <drm/clients/drm_client_setup.h> #include <drm/drm_atomic.h> @@ -391,6 +391,7 @@ static const struct drm_mode_config_funcs vesadrm_mode_config_funcs = {static struct vesadrm_device *vesadrm_device_create (struct drm_driver *drv,struct platform_device *pdev) { +const struct sysfb_display_info *dpy;const struct screen_info *si;const struct drm_format_info *format;int width, height, stride;@@ -410,9 +411,11 @@ static struct vesadrm_device *vesadrm_device_create(struct drm_driver *drv,size_t nformats;int ret; - si =dev_get_platdata (&pdev->dev); -if (!si) + dpy =dev_get_platdata (&pdev->dev); +if (!dpy)return ERR_PTR (-ENODEV ); + si = &dpy->screen; +if (screen_info_video_type (si) !=VIDEO_TYPE_VLFB )return ERR_PTR (-ENODEV );drivers/video/fbdev/efifb.c +6
-4@@ -15,7 +15,7 @@#include <linux/fb.h> #include <linux/platform_device.h> #include <linux/printk.h> -#include <linux/screen_info.h> +#include <linux/sysfb.h> #include <video/vga.h> #include <asm/efi.h> #include <drm/drm_utils.h> /* For drm_get_panel_orientation_quirk */ @@ -345,6 +345,7 @@ ATTRIBUTE_GROUPS(efifb);static int efifb_probe (struct platform_device *dev) { +struct sysfb_display_info *dpy;struct screen_info *si;struct fb_info *info;struct efifb_par *par;@@ -360,10 +361,11 @@ static int efifb_probe(struct platform_device *dev)* driver. We get a copy of the attached screen_info, so that we can * modify its values without affecting later drivers. */ - si =dev_get_platdata (&dev->dev); -if (!si) + dpy =dev_get_platdata (&dev->dev); +if (!dpy)return -ENODEV ; - si =devm_kmemdup (&dev->dev, si,sizeof (*si),GFP_KERNEL ); + + si =devm_kmemdup (&dev->dev, &dpy->screen,sizeof (*si),GFP_KERNEL );if (!si)return -ENOMEM ;drivers/video/fbdev/vesafb.c +6
-4@@ -20,7 +20,7 @@#include <linux/ioport.h> #include <linux/init.h> #include <linux/platform_device.h> -#include <linux/screen_info.h> +#include <linux/sysfb.h> #include <linux/io.h> #include <video/vga.h> @@ -243,6 +243,7 @@ static int vesafb_setup(char *options)static int vesafb_probe (struct platform_device *dev) { +struct sysfb_display_info *dpy;struct screen_info *si;struct fb_info *info;struct vesafb_par *par;@@ -257,10 +258,11 @@ static int vesafb_probe(struct platform_device *dev)* driver. We get a copy of the attached screen_info, so that we can * modify its values without affecting later drivers. */ - si =dev_get_platdata (&dev->dev); -if (!si) + dpy =dev_get_platdata (&dev->dev); +if (!dpy)return -ENODEV ; - si =devm_kmemdup (&dev->dev, si,sizeof (*si),GFP_KERNEL ); + + si =devm_kmemdup (&dev->dev, &dpy->screen,sizeof (*si),GFP_KERNEL );if (!si)return -ENOMEM ;drivers/video/fbdev/vga16fb.c +5
-3@@ -21,7 +21,7 @@#include <linux/ioport.h> #include <linux/init.h> #include <linux/platform_device.h> -#include <linux/screen_info.h> +#include <linux/sysfb.h> #include <asm/io.h> #include <video/vga.h> @@ -1305,15 +1305,17 @@ static const struct fb_ops vga16fb_ops = {static int vga16fb_probe (struct platform_device *dev) { +struct sysfb_display_info *dpy;struct screen_info *si;struct fb_info *info;struct vga16fb_par *par;int i;int ret =0 ; - si =dev_get_platdata (&dev->dev); -if (!si) + dpy =dev_get_platdata (&dev->dev); +if (!dpy)return -ENODEV ; + si = &dpy->screen; ret =check_mode_supported (si);if (ret)Signature · 1 line
2.51.1
Thomas Zimmermann
maintainerPATCH v3 6/9 sysfb: Move edid_info into sysfb_primary_display
In reply to Thomas ZimmermannMove x86's edid_info into sysfb_primary_display as a new field named edid. Adapt all users.
An instance of edid_info has only been defined on x86. With the move into sysfb_primary_display, it becomes available on all architectures. Therefore remove this contraint from CONFIG_FIRMWARE_EDID.
x86 fills the EDID data from boot_params.edid_info. DRM drivers pick up the raw data and make it available to DRM clients. Replace the drivers' references to edid_info and instead use the sysfb_display_info as passed from sysfb.
v2:
- drop changes to CONFIG_FIRMWARE_EDID
--- arch/x86/kernel/setup.c | 6 +----- drivers/gpu/drm/sysfb/efidrm.c | 5 ++--- drivers/gpu/drm/sysfb/vesadrm.c | 5 ++--- drivers/video/fbdev/core/fbmon.c | 8 +++++--- include/linux/sysfb.h | 6 ++++++ include/video/edid.h | 4 ---- 6 files changed, 16 insertions(+), 18 deletions(-)
arch/x86/kernel/setup.c +1 -5
@@ -215,10 +215,6 @@ arch_initcall(init_x86_sysctl);struct sysfb_display_info sysfb_primary_display;EXPORT_SYMBOL (sysfb_primary_display); -#if defined(CONFIG_FIRMWARE_EDID ) -struct edid_info edid_info; -EXPORT_SYMBOL_GPL (edid_info); -#endif extern int root_mountflags;
@@ -530,7 +526,7 @@ static void __init parse_boot_params(void)ROOT_DEV =old_decode_dev (boot_params.hdr.root_dev); sysfb_primary_display.screen = boot_params.screen_info;#if defined(CONFIG_FIRMWARE_EDID ) - edid_info = boot_params.edid_info; + sysfb_primary_display.edid = boot_params.edid_info;#endif #ifdef CONFIG_X86_32 apm_info.bios = boot_params.apm_bios_info;
drivers/gpu/drm/sysfb/efidrm.c +2 -3
@@ -24,7 +24,6 @@#include <drm/drm_print.h> #include <drm/drm_probe_helper.h> -#include <video/edid.h> #include <video/pixel_format.h> #include "drm_sysfb_helper.h"
@@ -207,8 +206,8 @@ static struct efidrm_device *efidrm_device_create(struct drm_driver *drv, &format->format, width, height, stride);#if defined(CONFIG_FIRMWARE_EDID ) -if (drm_edid_header_is_valid (edid_info.dummy) ==8 ) - sysfb->edid = edid_info.dummy; +if (drm_edid_header_is_valid (dpy->edid.dummy) ==8 ) + sysfb->edid = dpy->edid.dummy;#endif sysfb->fb_mode =drm_sysfb_mode (width, height,0 ,0 ); sysfb->fb_format = format;
drivers/gpu/drm/sysfb/vesadrm.c +2 -3
@@ -25,7 +25,6 @@#include <drm/drm_print.h> #include <drm/drm_probe_helper.h> -#include <video/edid.h> #include <video/pixel_format.h> #include <video/vga.h>
@@ -474,8 +473,8 @@ static struct vesadrm_device *vesadrm_device_create(struct drm_driver *drv, }#if defined(CONFIG_FIRMWARE_EDID ) -if (drm_edid_header_is_valid (edid_info.dummy) ==8 ) - sysfb->edid = edid_info.dummy; +if (drm_edid_header_is_valid (dpy->edid.dummy) ==8 ) + sysfb->edid = dpy->edid.dummy;#endif sysfb->fb_mode =drm_sysfb_mode (width, height,0 ,0 ); sysfb->fb_format = format;
drivers/video/fbdev/core/fbmon.c +5 -3
@@ -32,11 +32,13 @@#include <linux/module.h> #include <linux/pci.h> #include <linux/slab.h> -#include <video/edid.h> +#include <linux/string_choices.h> +#include <linux/sysfb.h> +#include <video/of_videomode.h> #include <video/videomode.h> +#include "../edid.h" -#include <linux/string_choices.h> /* * EDID parser
@@ -1504,7 +1506,7 @@ const unsigned char *fb_firmware_edid(struct device *device) res = &dev->resource[PCI_ROM_RESOURCE ];if (res && res->flags &IORESOURCE_ROM_SHADOW ) - edid = edid_info.dummy; + edid = sysfb_primary_display.edid.dummy;return edid; }
include/linux/sysfb.h +6 -0
@@ -12,6 +12,8 @@#include <linux/screen_info.h> #include <linux/types.h> +#include <video/edid.h> +struct device ;struct platform_device ;struct screen_info ;
@@ -62,6 +64,10 @@ struct efifb_dmi_info {struct sysfb_display_info {struct screen_info screen; + +#if defined(CONFIG_FIRMWARE_EDID ) +struct edid_info edid; +#endif };extern struct sysfb_display_info sysfb_primary_display;
include/video/edid.h +0 -4
@@ -4,8 +4,4 @@#include <uapi/video/edid.h> -#if defined(CONFIG_FIRMWARE_EDID ) -extern struct edid_info edid_info; -#endif -#endif /* __linux_video_edid_h__ */
Signature · 1 line
2.51.1
Thomas Zimmermann
maintainerPATCH v3 7/9 efi: Refactor init_primary_display() helpers
In reply to Thomas ZimmermannRework the kernel's init_primary_display() helpers to allow for later support of additional config-table entries and EDID information. No functional changes.
--- arch/loongarch/kernel/efi.c | 22 +++++++++++----------- drivers/firmware/efi/efi-init.c | 19 ++++++++++--------- 2 files changed, 21 insertions(+), 20 deletions(-)
arch/loongarch/kernel/efi.c +11 -11
@@ -81,19 +81,19 @@ EXPORT_SYMBOL_GPL(sysfb_primary_display);static void __init init_primary_display (void ) { -struct screen_info *si; - -if (screen_info_table ==EFI_INVALID_TABLE_ADDR ) -return ; - - si =early_memremap (screen_info_table,sizeof (*si)); -if (!si) { -pr_err ("Could not map screen_info config table\n" ); +if (screen_info_table ==EFI_INVALID_TABLE_ADDR ) { +struct screen_info *si =early_memremap (screen_info_table,sizeof (*si)); + +if (!si) { +pr_err ("Could not map screen_info config table\n" ); +return ; + } + sysfb_primary_display.screen = *si; +memset (si,0 ,sizeof (*si)); +early_memunmap (si,sizeof (*si)); + }else {return ; } - sysfb_primary_display.screen = *si; -memset (si,0 ,sizeof (*si)); -early_memunmap (si,sizeof (*si));memblock_reserve (__screen_info_lfb_base (&sysfb_primary_display.screen), sysfb_primary_display.screen.lfb_size);
drivers/firmware/efi/efi-init.c +10 -9
@@ -67,10 +67,9 @@ EXPORT_SYMBOL_GPL(sysfb_primary_display);static void __init init_primary_display (void ) { -struct screen_info *si; -if (screen_info_table !=EFI_INVALID_TABLE_ADDR ) { - si =early_memremap (screen_info_table,sizeof (*si)); +struct screen_info *si =early_memremap (screen_info_table,sizeof (*si)); +if (!si) {pr_err ("Could not map screen_info config table\n" );return ;
@@ -78,14 +77,16 @@ static void __init init_primary_display(void) sysfb_primary_display.screen = *si;memset (si,0 ,sizeof (*si));early_memunmap (si,sizeof (*si)); + }else { +return ; + } -if (memblock_is_map_memory (sysfb_primary_display.screen.lfb_base)) -memblock_mark_nomap (sysfb_primary_display.screen.lfb_base, - sysfb_primary_display.screen.lfb_size); +if (memblock_is_map_memory (sysfb_primary_display.screen.lfb_base)) +memblock_mark_nomap (sysfb_primary_display.screen.lfb_base, + sysfb_primary_display.screen.lfb_size); -if (IS_ENABLED (CONFIG_EFI_EARLYCON )) -efi_earlycon_reprobe (); - } +if (IS_ENABLED (CONFIG_EFI_EARLYCON )) +efi_earlycon_reprobe (); }static int __init uefi_init (u64 efi_system_table)
Signature · 1 line
2.51.1
Ard Biesheuvel
maintainerRe: [PATCH v3 7/9] efi: Refactor init_primary_display() helpers
Quoted 11 lines · Thomas Zimmermann
Rework the kernel's
init_primary_display()helpers to allow for later support of additional config-table entries and EDID information. No functional changes.Signed-off-by Thomas Zimmermann <[email protected]>--- arch/loongarch/kernel/efi.c | 22 +++++++++++----------- drivers/firmware/efi/efi-init.c | 19 ++++++++++--------- 2 files changed, 21 insertions(+), 20 deletions(-)
This patch seems unnecessary now that we've replace one table with another.
I've dropped it for now - let me know if you really want to keep it.
Quoted 78 lines
arch/loongarch/kernel/efi.c +11
-11@@ -81,19 +81,19 @@ EXPORT_SYMBOL_GPL(sysfb_primary_display);static void __init init_primary_display (void ) { -struct screen_info *si; - -if (screen_info_table ==EFI_INVALID_TABLE_ADDR ) -return ; - - si =early_memremap (screen_info_table,sizeof (*si)); -if (!si) { -pr_err ("Could not map screen_info config table\n" ); +if (screen_info_table ==EFI_INVALID_TABLE_ADDR ) { +struct screen_info *si =early_memremap (screen_info_table,sizeof (*si)); + +if (!si) { +pr_err ("Could not map screen_info config table\n" ); +return ; + } + sysfb_primary_display.screen = *si; +memset (si,0 ,sizeof (*si)); +early_memunmap (si,sizeof (*si)); + }else {return ; } - sysfb_primary_display.screen = *si; -memset (si,0 ,sizeof (*si)); -early_memunmap (si,sizeof (*si));memblock_reserve (__screen_info_lfb_base (&sysfb_primary_display.screen), sysfb_primary_display.screen.lfb_size);drivers/firmware/efi/efi-init.c +10
-10@@ -67,10 +67,9 @@ EXPORT_SYMBOL_GPL(sysfb_primary_display);static void __init init_primary_display (void ) { -struct screen_info *si; -if (screen_info_table !=EFI_INVALID_TABLE_ADDR ) { - si =early_memremap (screen_info_table,sizeof (*si)); +struct screen_info *si =early_memremap (screen_info_table,sizeof (*si)); +if (!si) {pr_err ("Could not map screen_info config table\n" );return ;@@ -78,14 +77,16 @@ static void __init init_primary_display(void) sysfb_primary_display.screen = *si;memset (si,0 ,sizeof (*si));early_memunmap (si,sizeof (*si)); + }else { +return ; + } -if (memblock_is_map_memory (sysfb_primary_display.screen.lfb_base)) -memblock_mark_nomap (sysfb_primary_display.screen.lfb_base, - sysfb_primary_display.screen.lfb_size); +if (memblock_is_map_memory (sysfb_primary_display.screen.lfb_base)) +memblock_mark_nomap (sysfb_primary_display.screen.lfb_base, + sysfb_primary_display.screen.lfb_size); -if (IS_ENABLED (CONFIG_EFI_EARLYCON )) -efi_earlycon_reprobe (); - } +if (IS_ENABLED (CONFIG_EFI_EARLYCON )) +efi_earlycon_reprobe (); }static int __init uefi_init (u64 efi_system_table) --2.51.1
Thomas Zimmermann
maintainerPATCH v3 8/9 efi: Support EDID information
In reply to Thomas ZimmermannIn the EFI config table, rename LINUX_EFI_SCREEN_INFO_TABLE_GUID to LINUX_EFI_PRIMARY_DISPLAY_TABLE_GUID. Read sysfb_primary_display from the entry. In addition to the screen_info, the entry now also contains EDID information.
In libstub, replace struct screen_info with struct sysfb_display_info from the kernel's sysfb_primary_display and rename functions accordingly. Transfer it to the runtime kernel using the kernel's global state or the config-table entry LINUX_EFI_PRIMARY_DISPLAY_TABLE_GUID.
With CONFIG_FIRMWARE_EDID=y, libstub now transfers the GOP device's EDID information to the kernel. If CONFIG_FIRMWARE_EDID=n, EDID information is disabled. Make the Kconfig symbol CONFIG_FIRMWARE_EDID available with EFI. Setting the value to 'n' disables EDID support.
Also rename screen_info.c to primary_display.c and adapt the contained comment according to the changes.
v3:
- replace SCREEN_INFO table (Ard)
- merge libstub changes
--- arch/loongarch/kernel/efi.c | 17 +++--- drivers/firmware/efi/efi-init.c | 17 +++--- drivers/firmware/efi/efi.c | 4 +- drivers/firmware/efi/libstub/Makefile | 2 +- drivers/firmware/efi/libstub/efi-stub-entry.c | 11 ++-- drivers/firmware/efi/libstub/efi-stub.c | 41 +++++++++----- drivers/firmware/efi/libstub/efistub.h | 7 ++- .../firmware/efi/libstub/primary_display.c | 56 +++++++++++++++++++ drivers/firmware/efi/libstub/screen_info.c | 53 ------------------ drivers/firmware/efi/libstub/zboot.c | 4 +- drivers/video/Kconfig | 8 ++- include/linux/efi.h | 9 +-- 12 files changed, 123 insertions(+), 106 deletions(-) create mode 100644 drivers/firmware/efi/libstub/primary_display.c delete mode 100644 drivers/firmware/efi/libstub/screen_info.c
arch/loongarch/kernel/efi.c +9 -8
@@ -72,7 +72,7 @@ bool efi_poweroff_required(void) (acpi_gbl_reduced_hardware || acpi_no_s5); } -unsigned long __initdata screen_info_table =EFI_INVALID_TABLE_ADDR ; +unsigned long __initdata primary_display_table =EFI_INVALID_TABLE_ADDR ;#if defined(CONFIG_SYSFB ) || defined(CONFIG_EFI_EARLYCON ) struct sysfb_display_info sysfb_primary_display __section(".data");
@@ -81,16 +81,17 @@ EXPORT_SYMBOL_GPL(sysfb_primary_display);static void __init init_primary_display (void ) { -if (screen_info_table ==EFI_INVALID_TABLE_ADDR ) { -struct screen_info *si =early_memremap (screen_info_table,sizeof (*si)); +if (primary_display_table !=EFI_INVALID_TABLE_ADDR ) { +struct sysfb_display_info *dpy = +early_memremap (primary_display_table,sizeof (*dpy)); -if (!si) { -pr_err ("Could not map screen_info config table\n" ); +if (!dpy) { +pr_err ("Could not map primary_display config table\n" );return ; } - sysfb_primary_display.screen = *si; -memset (si,0 ,sizeof (*si)); -early_memunmap (si,sizeof (*si)); + sysfb_primary_display = *dpy; +memset (dpy,0 ,sizeof (*dpy)); +early_memunmap (dpy,sizeof (*dpy)); }else {return ; }
drivers/firmware/efi/efi-init.c +9 -8
@@ -23,7 +23,7 @@#include <asm/efi.h> -unsigned long __initdata screen_info_table =EFI_INVALID_TABLE_ADDR ; +unsigned long __initdata primary_display_table =EFI_INVALID_TABLE_ADDR ;static int __init is_memory (efi_memory_desc_t *md) {
@@ -67,16 +67,17 @@ EXPORT_SYMBOL_GPL(sysfb_primary_display);static void __init init_primary_display (void ) { -if (screen_info_table !=EFI_INVALID_TABLE_ADDR ) { -struct screen_info *si =early_memremap (screen_info_table,sizeof (*si)); +if (primary_display_table !=EFI_INVALID_TABLE_ADDR ) { +struct sysfb_display_info *dpy = +early_memremap (primary_display_table,sizeof (*dpy)); -if (!si) { -pr_err ("Could not map screen_info config table\n" ); +if (!dpy) { +pr_err ("Could not map primary_display config table\n" );return ; } - sysfb_primary_display.screen = *si; -memset (si,0 ,sizeof (*si)); -early_memunmap (si,sizeof (*si)); + sysfb_primary_display = *dpy; +memset (dpy,0 ,sizeof (*dpy)); +early_memunmap (dpy,sizeof (*dpy)); }else {return ; }
drivers/firmware/efi/efi.c +2 -2
@@ -63,7 +63,7 @@ static unsigned long __initdata mem_reserve = EFI_INVALID_TABLE_ADDR;static unsigned long __initdata rt_prop =EFI_INVALID_TABLE_ADDR ;static unsigned long __initdata initrd =EFI_INVALID_TABLE_ADDR ; -extern unsigned long screen_info_table; +extern unsigned long primary_display_table;struct mm_struct efi_mm = { .mm_mt =MTREE_INIT_EXT (mm_mt,MM_MT_FLAGS , efi_mm.mmap_lock),
@@ -641,7 +641,7 @@ static const efi_config_table_type_t common_tables[] __initconst = { {LINUX_EFI_UNACCEPTED_MEM_TABLE_GUID, &efi.unaccepted, "Unaccepted" }, #endif #ifdef CONFIG_EFI_GENERIC_STUB - {LINUX_EFI_SCREEN_INFO_TABLE_GUID, &screen_info_table }, + {LINUX_EFI_PRIMARY_DISPLAY_TABLE_GUID, &primary_display_table }, #endif {}, };
drivers/firmware/efi/libstub/Makefile +1 -1
@@ -80,7 +80,7 @@ $(obj)/lib-%.o: $(srctree)/lib/%.c FORCE $(call if_changed_rule,cc_o_c) lib-$(CONFIG_EFI_GENERIC_STUB) += efi-stub.o string.o intrinsics.o systable.o \ - screen_info.o efi-stub-entry.o + primary_display.o efi-stub-entry.o lib-$(CONFIG_ARM) += arm32-stub.o lib-$(CONFIG_ARM64) += kaslr.o arm64.o arm64-stub.o smbios.o
drivers/firmware/efi/libstub/efi-stub-entry.c +4 -7
@@ -14,18 +14,15 @@ static void *kernel_image_addr(void *addr)return addr + kernel_image_offset; } -struct screen_info *alloc_screen_info (void ) +struct sysfb_display_info *alloc_primary_display (void ) {if (IS_ENABLED (CONFIG_ARM )) -return __alloc_screen_info (); +return __alloc_primary_display ();if (IS_ENABLED (CONFIG_X86 ) ||IS_ENABLED (CONFIG_EFI_EARLYCON ) || -IS_ENABLED (CONFIG_SYSFB )) { -struct sysfb_display_info *dpy =kernel_image_addr (&sysfb_primary_display); - -return &dpy->screen; - } +IS_ENABLED (CONFIG_SYSFB )) +return kernel_image_addr (&sysfb_primary_display);return NULL ; }
drivers/firmware/efi/libstub/efi-stub.c +26 -15
77 lines not on this page · raw message
drivers/firmware/efi/libstub/efistub.h +4 -3
@@ -36,6 +36,7 @@struct edid_info ;struct screen_info ; +struct sysfb_display_info ;extern bool efi_no5lvl;extern bool efi_nochunk;
@@ -1175,9 +1176,9 @@ efi_enable_reset_attack_mitigation(void) { }void efi_retrieve_eventlog (void ); -struct screen_info *alloc_screen_info (void ); -struct screen_info *__alloc_screen_info (void ); -void free_screen_info (struct screen_info *si); +struct sysfb_display_info *alloc_primary_display (void ); +struct sysfb_display_info *__alloc_primary_display (void ); +void free_primary_display (struct sysfb_display_info *dpy);void efi_cache_sync_image (unsigned long image_base,unsigned long alloc_size);
drivers/firmware/efi/libstub/primary_display.c new file +56 -0
56 lines not on this page · raw message
drivers/firmware/efi/libstub/screen_info.c deleted +0 -53
53 lines not on this page · raw message
drivers/firmware/efi/libstub/zboot.c +2 -2
@@ -26,9 +26,9 @@ void __weak efi_cache_sync_image(unsigned long image_base,// executable code loaded into memory to be safe for execution. } -struct screen_info *alloc_screen_info (void ) +struct sysfb_display_info *alloc_primary_display (void ) { -return __alloc_screen_info (); +return __alloc_primary_display (); } asmlinkage efi_status_t __efiapi
drivers/video/Kconfig +5 -3
@@ -63,11 +63,13 @@ endif # HAS_IOMEM config FIRMWARE_EDID bool "Enable firmware EDID" - depends on X86 + depends on EFI || X86 help This enables access to the EDID transferred from the firmware. - On x86, this is from the VESA BIOS. DRM display drivers will - be able to export the information to userspace. + On EFI systems, the EDID comes from the same device as the + primary GOP. On x86 with BIOS, it comes from the VESA BIOS. + DRM display drivers will be able to export the information + to userspace. Also enable this if DDC/I2C transfers do not work for your driver and if you are using nvidiafb, i810fb or savagefb.
include/linux/efi.h +5 -4
@@ -406,11 +406,12 @@ void efi_native_runtime_setup(void);#define EFI_CC_FINAL_EVENTS_TABLE_GUID EFI_GUID(0xdd4a4648, 0x2de7, 0x4665, 0x96, 0x4d, 0x21, 0xd9, 0xef, 0x5f, 0xb4, 0x46)/* -* This GUID is used to pass to the kernel proper the struct screen_info -* structure that was populated by the stub based on the GOP protocol instance -* associated with ConOut +* This GUIDs are used to pass to the kernel proper the primary +* display that has been populated by the stub based on the GOP +* instance associated with ConOut. */ -#define LINUX_EFI_SCREEN_INFO_TABLE_GUID EFI_GUID(0xe03fc20a, 0x85dc, 0x406e, 0xb9, 0x0e, 0x4a, 0xb5, 0x02, 0x37, 0x1d, 0x95) +#define LINUX_EFI_PRIMARY_DISPLAY_TABLE_GUID EFI_GUID(0xe03fc20a, 0x85dc, 0x406e, 0xb9, 0x0e, 0x4a, 0xb5, 0x02, 0x37, 0x1d, 0x95) +#define LINUX_EFI_ARM_CPU_STATE_TABLE_GUID EFI_GUID(0xef79e4aa, 0x3c3d, 0x4989, 0xb9, 0x02, 0x07, 0xa9, 0x43, 0xe5, 0x50, 0xd2)#define LINUX_EFI_LOADER_ENTRY_GUID EFI_GUID(0x4a67b082, 0x0a4c, 0x41cf, 0xb6, 0xc7, 0x44, 0x0b, 0x29, 0xbb, 0x8c, 0x4f)#define LINUX_EFI_RANDOM_SEED_TABLE_GUID EFI_GUID(0x1ce1e5bc, 0x7ceb, 0x42f2, 0x81, 0xe5, 0x8a, 0xad, 0xf1, 0x80, 0xf5, 0x7b)
Signature · 1 line
2.51.1
Thomas Zimmermann
maintainerPATCH v3 9/9 efi: libstub: Simplify interfaces for primary_display
In reply to Thomas ZimmermannRename alloc_primary_display() and __alloc_primary_display(), clarify free semantics to make interfaces easier to understand.
Rename alloc_primary_display() to lookup_primary_display() as it does not necessarily allocate. Then rename __alloc_primary_display() to the new alloc_primary_display(). The helper belongs to free_primary_display), so it should be named without underscores.
The lookup helper does not necessarily allocate, so the output parameter needs_free to indicate when free should be called. Pass an argument through the calls to track this state. Put the free handling into release_primary_display() for simplificy.
Also move the comment fro primary_display.c to efi-stub-entry.c, where it now describes lookup_primary_display().
--- drivers/firmware/efi/libstub/efi-stub-entry.c | 23 +++++++++++++++++-- drivers/firmware/efi/libstub/efi-stub.c | 22 ++++++++++++------ drivers/firmware/efi/libstub/efistub.h | 2 +- .../firmware/efi/libstub/primary_display.c | 17 +------------- drivers/firmware/efi/libstub/zboot.c | 6 +++-- 5 files changed, 42 insertions(+), 28 deletions(-)
drivers/firmware/efi/libstub/efi-stub-entry.c +21 -2
@@ -14,10 +14,29 @@ static void *kernel_image_addr(void *addr)return addr + kernel_image_offset; } -struct sysfb_display_info *alloc_primary_display (void ) +/* +* There are two ways of populating the core kernel's sysfb_primary_display +* via the stub: +* +* - using a configuration table, which relies on the EFI init code to +* locate the table and copy the contents; or +* +* - by linking directly to the core kernel's copy of the global symbol. +* +* The latter is preferred because it makes the EFIFB earlycon available very +* early, but it only works if the EFI stub is part of the core kernel image +* itself. The zboot decompressor can only use the configuration table +* approach. +*/ + +struct sysfb_display_info *lookup_primary_display (bool *needs_free) { + *needs_free = true; +if (IS_ENABLED (CONFIG_ARM )) -return __alloc_primary_display (); +return alloc_primary_display (); + + *needs_free = false; if (IS_ENABLED(CONFIG_X86) || IS_ENABLED(CONFIG_EFI_EARLYCON) ||
drivers/firmware/efi/libstub/efi-stub.c +15 -7
@@ -51,14 +51,14 @@ static bool flat_va_mapping = (EFI_RT_VIRTUAL_OFFSET != 0);void __weak free_primary_display (struct sysfb_display_info *dpy) { } -static struct sysfb_display_info *setup_primary_display (void ) +static struct sysfb_display_info *setup_primary_display (bool *dpy_needs_free) {struct sysfb_display_info *dpy;struct screen_info *screen =NULL ;struct edid_info *edid =NULL ;efi_status_t status; - dpy =alloc_primary_display (); + dpy =lookup_primary_display (dpy_needs_free);if (!dpy)return NULL ; screen = &dpy->screen;
@@ -68,15 +68,22 @@ static struct sysfb_display_info *setup_primary_display(void) status =efi_setup_graphics (screen, edid);if (status !=EFI_SUCCESS ) - goto err_free_primary_display; + goto err___free_primary_display;return dpy; -err_free_primary_display: -free_primary_display (dpy); +err___free_primary_display: +if (*dpy_needs_free) +free_primary_display (dpy);return NULL ; } +static void release_primary_display (struct sysfb_display_info *dpy,bool dpy_needs_free) +{ +if (dpy && dpy_needs_free) +free_primary_display (dpy); +} +static void install_memreserve_table (void ) {struct linux_efi_memreserve *rsv;
@@ -156,13 +163,14 @@ efi_status_t efi_stub_common(efi_handle_t handle, char *cmdline_ptr) {struct sysfb_display_info *dpy; +bool dpy_needs_free;efi_status_t status; status =check_platform_features ();if (status !=EFI_SUCCESS )return status; - dpy =setup_primary_display (); + dpy =setup_primary_display (&dpy_needs_free);efi_retrieve_eventlog ();
@@ -182,7 +190,7 @@ efi_status_t efi_stub_common(efi_handle_t handle, status =efi_boot_kernel (handle, image, image_addr, cmdline_ptr); -free_primary_display (dpy); +release_primary_display (dpy, dpy_needs_free);return status; }
drivers/firmware/efi/libstub/efistub.h +1 -1
@@ -1176,8 +1176,8 @@ efi_enable_reset_attack_mitigation(void) { }void efi_retrieve_eventlog (void ); +struct sysfb_display_info *lookup_primary_display (bool *needs_free);struct sysfb_display_info *alloc_primary_display (void ); -struct sysfb_display_info *__alloc_primary_display (void );void free_primary_display (struct sysfb_display_info *dpy); void efi_cache_sync_image(unsigned long image_base,
drivers/firmware/efi/libstub/primary_display.c +1 -16
@@ -7,24 +7,9 @@#include "efistub.h" -/* -* There are two ways of populating the core kernel's sysfb_primary_display -* via the stub: -* -* - using a configuration table, which relies on the EFI init code to -* locate the table and copy the contents; or -* -* - by linking directly to the core kernel's copy of the global symbol. -* -* The latter is preferred because it makes the EFIFB earlycon available very -* early, but it only works if the EFI stub is part of the core kernel image -* itself. The zboot decompressor can only use the configuration table -* approach. -*/ -static efi_guid_t primary_display_guid =LINUX_EFI_PRIMARY_DISPLAY_TABLE_GUID ; -struct sysfb_display_info *__alloc_primary_display (void ) +struct sysfb_display_info *alloc_primary_display (void ) {struct sysfb_display_info *dpy;efi_status_t status;
drivers/firmware/efi/libstub/zboot.c +4 -2
@@ -26,9 +26,11 @@ void __weak efi_cache_sync_image(unsigned long image_base,// executable code loaded into memory to be safe for execution. } -struct sysfb_display_info *alloc_primary_display (void ) +struct sysfb_display_info *lookup_primary_display (bool *needs_free) { -return __alloc_primary_display (); + *needs_free = true; + +return alloc_primary_display (); } asmlinkage efi_status_t __efiapi
Signature · 1 line
2.51.1
Ard Biesheuvel
maintainerRe: [PATCH v3 9/9] efi: libstub: Simplify interfaces for primary_display
Hi Thomas
Quoted 11 lines · Thomas Zimmermann
Rename
alloc_primary_display()and__alloc_primary_display(), clarify free semantics to make interfaces easier to understand.Rename
alloc_primary_display()tolookup_primary_display()as it does not necessarily allocate. Then rename__alloc_primary_display()to the newalloc_primary_display(). The helper belongs tofree_primary_display), so it should be named without underscores.The lookup helper does not necessarily allocate, so the output parameter
needs_freeto indicate when free should be called.
I don't understand why we need this. Whether or not the helper allocates is a compile time decision, and in builds where it doesn't, the free helper doesn't do anything.
I'm all for making things simpler, but I don't think this patch achieves that tbh.
I've queued up this series now up until this patch - once we converge on the simplification, I'm happy to apply it on top.
Thanks,
Quoted 189 lines
Pass
an argument through the calls to track this state. Put the free handling intorelease_primary_display()for simplificy.Also move the comment fro
primary_display.ctoefi-stub-entry.c, where it now describeslookup_primary_display().Signed-off-by Thomas Zimmermann <[email protected]>--- drivers/firmware/efi/libstub/efi-stub-entry.c | 23 +++++++++++++++++-- drivers/firmware/efi/libstub/efi-stub.c | 22 ++++++++++++------ drivers/firmware/efi/libstub/efistub.h | 2 +- .../firmware/efi/libstub/primary_display.c | 17 +------------- drivers/firmware/efi/libstub/zboot.c | 6 +++-- 5 files changed, 42 insertions(+), 28 deletions(-)drivers/firmware/efi/libstub/efi-stub-entry.c +21
-2@@ -14,10 +14,29 @@ static void *kernel_image_addr(void *addr)return addr + kernel_image_offset; } -struct sysfb_display_info *alloc_primary_display (void ) +/* +* There are two ways of populating the core kernel's sysfb_primary_display +* via the stub: +* +* - using a configuration table, which relies on the EFI init code to +* locate the table and copy the contents; or +* +* - by linking directly to the core kernel's copy of the global symbol. +* +* The latter is preferred because it makes the EFIFB earlycon available very +* early, but it only works if the EFI stub is part of the core kernel image +* itself. The zboot decompressor can only use the configuration table +* approach. +*/ + +struct sysfb_display_info *lookup_primary_display (bool *needs_free) { + *needs_free = true; +if (IS_ENABLED (CONFIG_ARM )) -return __alloc_primary_display (); +return alloc_primary_display (); + + *needs_free = false; if (IS_ENABLED(CONFIG_X86) || IS_ENABLED(CONFIG_EFI_EARLYCON) ||drivers/firmware/efi/libstub/efi-stub.c +15
-7@@ -51,14 +51,14 @@ static bool flat_va_mapping = (EFI_RT_VIRTUAL_OFFSET != 0);void __weak free_primary_display (struct sysfb_display_info *dpy) { } -static struct sysfb_display_info *setup_primary_display (void ) +static struct sysfb_display_info *setup_primary_display (bool *dpy_needs_free) {struct sysfb_display_info *dpy;struct screen_info *screen =NULL ;struct edid_info *edid =NULL ;efi_status_t status; - dpy =alloc_primary_display (); + dpy =lookup_primary_display (dpy_needs_free);if (!dpy)return NULL ; screen = &dpy->screen;@@ -68,15 +68,22 @@ static struct sysfb_display_info *setup_primary_display(void) status =efi_setup_graphics (screen, edid);if (status !=EFI_SUCCESS ) - goto err_free_primary_display; + goto err___free_primary_display;return dpy; -err_free_primary_display: -free_primary_display (dpy); +err___free_primary_display: +if (*dpy_needs_free) +free_primary_display (dpy);return NULL ; } +static void release_primary_display (struct sysfb_display_info *dpy,bool dpy_needs_free) +{ +if (dpy && dpy_needs_free) +free_primary_display (dpy); +} +static void install_memreserve_table (void ) {struct linux_efi_memreserve *rsv;@@ -156,13 +163,14 @@ efi_status_t efi_stub_common(efi_handle_t handle, char *cmdline_ptr) {struct sysfb_display_info *dpy; +bool dpy_needs_free;efi_status_t status; status =check_platform_features ();if (status !=EFI_SUCCESS )return status; - dpy =setup_primary_display (); + dpy =setup_primary_display (&dpy_needs_free);efi_retrieve_eventlog ();@@ -182,7 +190,7 @@ efi_status_t efi_stub_common(efi_handle_t handle, status =efi_boot_kernel (handle, image, image_addr, cmdline_ptr); -free_primary_display (dpy); +release_primary_display (dpy, dpy_needs_free);return status; }drivers/firmware/efi/libstub/efistub.h +1
-1@@ -1176,8 +1176,8 @@ efi_enable_reset_attack_mitigation(void) { }void efi_retrieve_eventlog (void ); +struct sysfb_display_info *lookup_primary_display (bool *needs_free);struct sysfb_display_info *alloc_primary_display (void ); -struct sysfb_display_info *__alloc_primary_display (void );void free_primary_display (struct sysfb_display_info *dpy); void efi_cache_sync_image(unsigned long image_base,drivers/firmware/efi/libstub/primary_display.c +1
-16@@ -7,24 +7,9 @@#include "efistub.h" -/* -* There are two ways of populating the core kernel's sysfb_primary_display -* via the stub: -* -* - using a configuration table, which relies on the EFI init code to -* locate the table and copy the contents; or -* -* - by linking directly to the core kernel's copy of the global symbol. -* -* The latter is preferred because it makes the EFIFB earlycon available very -* early, but it only works if the EFI stub is part of the core kernel image -* itself. The zboot decompressor can only use the configuration table -* approach. -*/ -static efi_guid_t primary_display_guid =LINUX_EFI_PRIMARY_DISPLAY_TABLE_GUID ; -struct sysfb_display_info *__alloc_primary_display (void ) +struct sysfb_display_info *alloc_primary_display (void ) {struct sysfb_display_info *dpy;efi_status_t status;drivers/firmware/efi/libstub/zboot.c +4
-3@@ -26,9 +26,11 @@ void __weak efi_cache_sync_image(unsigned long image_base,// executable code loaded into memory to be safe for execution. } -struct sysfb_display_info *alloc_primary_display (void ) +struct sysfb_display_info *lookup_primary_display (bool *needs_free) { -return __alloc_primary_display (); + *needs_free = true; + +return alloc_primary_display (); } asmlinkage efi_status_t __efiapi --2.51.1
Thomas Zimmermann
maintainerRe: [PATCH v3 9/9] efi: libstub: Simplify interfaces for primary_display
Hi
Am 16.12.25 um 14:23 schrieb Ard Biesheuvel:
Quoted 17 lines
Hi Thomas
Quoted 10 lines · Thomas Zimmermann
Rename
alloc_primary_display()and__alloc_primary_display(), clarify free semantics to make interfaces easier to understand.Rename
alloc_primary_display()tolookup_primary_display()as it does not necessarily allocate. Then rename__alloc_primary_display()to the newalloc_primary_display(). The helper belongs tofree_primary_display), so it should be named without underscores.The lookup helper does not necessarily allocate, so the output parameter
needs_freeto indicate when free should be called.I don't understand why we need this. Whether or not the helper allocates is a compile time decision, and in builds where it doesn't, the free helper doesn't do anything.
Quoted 5 lines
I'm all for making things simpler, but I don't think this patch achieves that tbh.
I've queued up this series now up until this patch - once we converge on the simplification, I'm happy to apply it on top.
If you don't want this patch, just leave it out then. Coming from another subsystem, I found the current logic and naming confusing THB.
Best regards
Thomas
Quoted 194 lines
Thanks,
Quoted 189 lines
Pass
an argument through the calls to track this state. Put the free handling intorelease_primary_display()for simplificy.Also move the comment fro
primary_display.ctoefi-stub-entry.c, where it now describeslookup_primary_display().Signed-off-by Thomas Zimmermann <[email protected]>--- drivers/firmware/efi/libstub/efi-stub-entry.c | 23 +++++++++++++++++-- drivers/firmware/efi/libstub/efi-stub.c | 22 ++++++++++++------ drivers/firmware/efi/libstub/efistub.h | 2 +- .../firmware/efi/libstub/primary_display.c | 17 +------------- drivers/firmware/efi/libstub/zboot.c | 6 +++-- 5 files changed, 42 insertions(+), 28 deletions(-)drivers/firmware/efi/libstub/efi-stub-entry.c +21
-2@@ -14,10 +14,29 @@ static void *kernel_image_addr(void *addr)return addr + kernel_image_offset; } -struct sysfb_display_info *alloc_primary_display (void ) +/* +* There are two ways of populating the core kernel's sysfb_primary_display +* via the stub: +* +* - using a configuration table, which relies on the EFI init code to +* locate the table and copy the contents; or +* +* - by linking directly to the core kernel's copy of the global symbol. +* +* The latter is preferred because it makes the EFIFB earlycon available very +* early, but it only works if the EFI stub is part of the core kernel image +* itself. The zboot decompressor can only use the configuration table +* approach. +*/ + +struct sysfb_display_info *lookup_primary_display (bool *needs_free) { + *needs_free = true; +if (IS_ENABLED (CONFIG_ARM )) -return __alloc_primary_display (); +return alloc_primary_display (); + + *needs_free = false; if (IS_ENABLED(CONFIG_X86) || IS_ENABLED(CONFIG_EFI_EARLYCON) ||drivers/firmware/efi/libstub/efi-stub.c +15
-7@@ -51,14 +51,14 @@ static bool flat_va_mapping = (EFI_RT_VIRTUAL_OFFSET != 0);void __weak free_primary_display (struct sysfb_display_info *dpy) { } -static struct sysfb_display_info *setup_primary_display (void ) +static struct sysfb_display_info *setup_primary_display (bool *dpy_needs_free) {struct sysfb_display_info *dpy;struct screen_info *screen =NULL ;struct edid_info *edid =NULL ;efi_status_t status; - dpy =alloc_primary_display (); + dpy =lookup_primary_display (dpy_needs_free);if (!dpy)return NULL ; screen = &dpy->screen;@@ -68,15 +68,22 @@ static struct sysfb_display_info *setup_primary_display(void) status =efi_setup_graphics (screen, edid);if (status !=EFI_SUCCESS ) - goto err_free_primary_display; + goto err___free_primary_display;return dpy; -err_free_primary_display: -free_primary_display (dpy); +err___free_primary_display: +if (*dpy_needs_free) +free_primary_display (dpy);return NULL ; } +static void release_primary_display (struct sysfb_display_info *dpy,bool dpy_needs_free) +{ +if (dpy && dpy_needs_free) +free_primary_display (dpy); +} +static void install_memreserve_table (void ) {struct linux_efi_memreserve *rsv;@@ -156,13 +163,14 @@ efi_status_t efi_stub_common(efi_handle_t handle, char *cmdline_ptr) {struct sysfb_display_info *dpy; +bool dpy_needs_free;efi_status_t status; status =check_platform_features ();if (status !=EFI_SUCCESS )return status; - dpy =setup_primary_display (); + dpy =setup_primary_display (&dpy_needs_free);efi_retrieve_eventlog ();@@ -182,7 +190,7 @@ efi_status_t efi_stub_common(efi_handle_t handle, status =efi_boot_kernel (handle, image, image_addr, cmdline_ptr); -free_primary_display (dpy); +release_primary_display (dpy, dpy_needs_free);return status; }drivers/firmware/efi/libstub/efistub.h +1
-1@@ -1176,8 +1176,8 @@ efi_enable_reset_attack_mitigation(void) { }void efi_retrieve_eventlog (void ); +struct sysfb_display_info *lookup_primary_display (bool *needs_free);struct sysfb_display_info *alloc_primary_display (void ); -struct sysfb_display_info *__alloc_primary_display (void );void free_primary_display (struct sysfb_display_info *dpy); void efi_cache_sync_image(unsigned long image_base,drivers/firmware/efi/libstub/primary_display.c +1
-16@@ -7,24 +7,9 @@#include "efistub.h" -/* -* There are two ways of populating the core kernel's sysfb_primary_display -* via the stub: -* -* - using a configuration table, which relies on the EFI init code to -* locate the table and copy the contents; or -* -* - by linking directly to the core kernel's copy of the global symbol. -* -* The latter is preferred because it makes the EFIFB earlycon available very -* early, but it only works if the EFI stub is part of the core kernel image -* itself. The zboot decompressor can only use the configuration table -* approach. -*/ -static efi_guid_t primary_display_guid =LINUX_EFI_PRIMARY_DISPLAY_TABLE_GUID ; -struct sysfb_display_info *__alloc_primary_display (void ) +struct sysfb_display_info *alloc_primary_display (void ) {struct sysfb_display_info *dpy;efi_status_t status;drivers/firmware/efi/libstub/zboot.c +4
-3@@ -26,9 +26,11 @@ void __weak efi_cache_sync_image(unsigned long image_base,// executable code loaded into memory to be safe for execution. } -struct sysfb_display_info *alloc_primary_display (void ) +struct sysfb_display_info *lookup_primary_display (bool *needs_free) { -return __alloc_primary_display (); + *needs_free = true; + +return alloc_primary_display (); } asmlinkage efi_status_t __efiapi --2.51.1
Signature · 6 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)
Hi Thomas,
I am attempting to test this patch series but encountered merge conflicts when applying it to various trees. Could you please clarify the specific base commit (or branch/tag) this series was generated against?
When testing on the next branch on commits 7a2ff00 and e41ef37, I hit a conflict on PATCH v3 4/9:
patching file drivers/pci/vgaarb.c
Hunk #2 FAILED at 557.
1 out of 2 hunks FAILED -- rejects in file drivers/pci/vgaarb.c
When testing against 3a86608 (Linux 6.18-rc1), the following conflicts occurred:
patching file drivers/gpu/drm/sysfb/efidrm.c
Hunk #1 FAILED at 24.
1 out of 2 hunks FAILED -- rejects in file drivers/gpu/drm/sysfb/efidrm.c patching file drivers/gpu/drm/sysfb/vesadrm.c
Hunk #1 FAILED at 25.
1 out of 2 hunks FAILED -- rejects in file drivers/gpu/drm/sysfb/vesadrm.c
Please let me know the correct base, and I will retest.
Thanks,
Richard Lyu
Quoted 96 lines · Thomas Zimmermann
Replace
screen_infoandedid_infowithsysfb_primary_deviceof type structsysfb_display_info. Update all users. Then implement EDID support in the kernel EFI code.Sysfb DRM drivers currently fetch the global
edid_infodirectly, when they should get that information together with thescreen_infofrom their device. Wrappingscreen_infoandedid_infoinsysfb_primary_displayand passing this to drivers enables this.Replacing both with
sysfb_primary_displayhas been motivate by the EFI stub. EFI wants to transfer EDID via config table in a single entry. Using structsysfb_display_infothis will become easily possible. Hence accept some churn in architecture code for the long-term improvements.Patches 1 and 2 reduce the exposure of
screen_infoin EFI-related code.Patch 3 adds struct
sysfb_display_info.Patch 4 replaces
scren_infowithsysfb_primary_display. This results in several changes throught the kernel, but is really just a refactoring.Patch 5 updates sysfb to transfer
sysfb_primary_displayto the related drivers.Patch 6 moves
edid_infointosysfb_primary_display. This resolves some drivers' reference to the globaledid_info, but also makes the EDID data available on non-x86 architectures.Patches 7 and 8 add support for EDID transfers on non-x86 EFI systems.
Patch 9 cleans up the config-table allocation to be easier to understand.
v3:
- replaceSCREEN_INFOtable entry (Ard)
- merge libstub patch into kernel patch
v2:
- combine v1 of the series at [1] plus changes from [2] and [3].[1] https://lore.kernel.org/dri-devel/[email protected]/
[2] https://lore.kernel.org/dri-devel/[email protected]/
[3] https://lore.kernel.org/linux-efi/[email protected]/Thomas Zimmermann (9):
efi: earlycon: Reduce number of references to globalscreen_info
efi:sysfb_efi: Reduce number of references to globalscreen_info
sysfb: Add structsysfb_display_info
sysfb: Replacescreen_infowithsysfb_primary_display
sysfb: Passsysfb_primary_displayto devices
sysfb: Moveedid_infointosysfb_primary_display
efi: Refactorinit_primary_display()helpers
efi: Support EDID information
efi: libstub: Simplify interfaces forprimary_displayarch/arm64/kernel/image-vars.h | 2 +- arch/loongarch/kernel/efi.c | 38 ++++----- arch/loongarch/kernel/image-vars.h | 2 +- arch/riscv/kernel/image-vars.h | 2 +- arch/x86/kernel/kexec-bzimage64.c | 4 +- arch/x86/kernel/setup.c | 16 ++-- arch/x86/video/video-common.c | 4 +- drivers/firmware/efi/earlycon.c | 42 +++++----- drivers/firmware/efi/efi-init.c | 46 ++++++----- drivers/firmware/efi/efi.c | 4 +- drivers/firmware/efi/libstub/Makefile | 2 +- drivers/firmware/efi/libstub/efi-stub-entry.c | 36 +++++++-- drivers/firmware/efi/libstub/efi-stub.c | 49 +++++++---- drivers/firmware/efi/libstub/efistub.h | 7 +- .../firmware/efi/libstub/primary_display.c | 41 ++++++++++ drivers/firmware/efi/libstub/screen_info.c | 53 ------------ drivers/firmware/efi/libstub/zboot.c | 6 +- drivers/firmware/efi/sysfb_efi.c | 81 ++++++++++--------- drivers/firmware/sysfb.c | 13 +-- drivers/firmware/sysfb_simplefb.c | 2 +- drivers/gpu/drm/sysfb/efidrm.c | 14 ++-- drivers/gpu/drm/sysfb/vesadrm.c | 14 ++-- drivers/hv/vmbus_drv.c | 6 +- drivers/pci/vgaarb.c | 4 +- drivers/video/Kconfig | 8 +- drivers/video/fbdev/core/fbmon.c | 8 +- drivers/video/fbdev/efifb.c | 10 ++- drivers/video/fbdev/vesafb.c | 10 ++- drivers/video/fbdev/vga16fb.c | 8 +- drivers/video/screen_info_pci.c | 5 +- include/linux/efi.h | 9 ++- include/linux/screen_info.h | 2 - include/linux/sysfb.h | 23 ++++-- include/video/edid.h | 4 - 34 files changed, 321 insertions(+), 254 deletions(-) create mode 100644 drivers/firmware/efi/libstub/primary_display.c delete mode 100644 drivers/firmware/efi/libstub/screen_info.cbase-commit:
d724c6f85e80a23ed46b7ebc6e38b527c09d64f5Signature · 1 line
2.51.1
Thomas Zimmermann
maintainerHi
Am 27.11.25 um 03:20 schrieb Richard Lyu:
Quoted 4 lines
Hi Thomas,
I am attempting to test this patch series but encountered merge conflicts when applying it to various trees. Could you please clarify the specific base commit (or branch/tag) this series was generated against?
Thanks for testing.
Quoted 14 lines
When testing on the next branch on commits 7a2ff00 and e41ef37, I hit a conflict on PATCH v3 4/9:
patching filedrivers/pci/vgaarb.c
Hunk #2 FAILED at 557.
1 out of 2 hunks FAILED -- rejects in filedrivers/pci/vgaarb.cWhen testing against 3a86608 (Linux 6.18-rc1), the following conflicts occurred:
patching filedrivers/gpu/drm/sysfb/efidrm.c
Hunk #1 FAILED at 24.
1 out of 2 hunks FAILED -- rejects in filedrivers/gpu/drm/sysfb/efidrm.cpatching filedrivers/gpu/drm/sysfb/vesadrm.c
Hunk #1 FAILED at 25.
1 out of 2 hunks FAILED -- rejects in filedrivers/gpu/drm/sysfb/vesadrm.c
Quoted 1 line
Please let me know the correct base, and I will retest.
It's in the cover letter: d724c6f85e80a23ed46b7ebc6e38b527c09d64f5 The commit is in linux-next. The idea is that the EFI tree can pick up the changes easily in the next cycle. linux-next seemed like the best choice. Best regards Thomas
Quoted 101 lines
Thanks,
Richard LyuQuoted 96 lines · Thomas Zimmermann
Replace
screen_infoandedid_infowithsysfb_primary_deviceof type structsysfb_display_info. Update all users. Then implement EDID support in the kernel EFI code.Sysfb DRM drivers currently fetch the global
edid_infodirectly, when they should get that information together with thescreen_infofrom their device. Wrappingscreen_infoandedid_infoinsysfb_primary_displayand passing this to drivers enables this.Replacing both with
sysfb_primary_displayhas been motivate by the EFI stub. EFI wants to transfer EDID via config table in a single entry. Using structsysfb_display_infothis will become easily possible. Hence accept some churn in architecture code for the long-term improvements.Patches 1 and 2 reduce the exposure of
screen_infoin EFI-related code.Patch 3 adds struct
sysfb_display_info.Patch 4 replaces
scren_infowithsysfb_primary_display. This results in several changes throught the kernel, but is really just a refactoring.Patch 5 updates sysfb to transfer
sysfb_primary_displayto the related drivers.Patch 6 moves
edid_infointosysfb_primary_display. This resolves some drivers' reference to the globaledid_info, but also makes the EDID data available on non-x86 architectures.Patches 7 and 8 add support for EDID transfers on non-x86 EFI systems.
Patch 9 cleans up the config-table allocation to be easier to understand.
v3:
- replaceSCREEN_INFOtable entry (Ard)
- merge libstub patch into kernel patch
v2:
- combine v1 of the series at [1] plus changes from [2] and [3].[1] https://lore.kernel.org/dri-devel/[email protected]/
[2] https://lore.kernel.org/dri-devel/[email protected]/
[3] https://lore.kernel.org/linux-efi/[email protected]/Thomas Zimmermann (9):
efi: earlycon: Reduce number of references to globalscreen_info
efi:sysfb_efi: Reduce number of references to globalscreen_info
sysfb: Add structsysfb_display_info
sysfb: Replacescreen_infowithsysfb_primary_display
sysfb: Passsysfb_primary_displayto devices
sysfb: Moveedid_infointosysfb_primary_display
efi: Refactorinit_primary_display()helpers
efi: Support EDID information
efi: libstub: Simplify interfaces forprimary_displayarch/arm64/kernel/image-vars.h | 2 +- arch/loongarch/kernel/efi.c | 38 ++++----- arch/loongarch/kernel/image-vars.h | 2 +- arch/riscv/kernel/image-vars.h | 2 +- arch/x86/kernel/kexec-bzimage64.c | 4 +- arch/x86/kernel/setup.c | 16 ++-- arch/x86/video/video-common.c | 4 +- drivers/firmware/efi/earlycon.c | 42 +++++----- drivers/firmware/efi/efi-init.c | 46 ++++++----- drivers/firmware/efi/efi.c | 4 +- drivers/firmware/efi/libstub/Makefile | 2 +- drivers/firmware/efi/libstub/efi-stub-entry.c | 36 +++++++-- drivers/firmware/efi/libstub/efi-stub.c | 49 +++++++---- drivers/firmware/efi/libstub/efistub.h | 7 +- .../firmware/efi/libstub/primary_display.c | 41 ++++++++++ drivers/firmware/efi/libstub/screen_info.c | 53 ------------ drivers/firmware/efi/libstub/zboot.c | 6 +- drivers/firmware/efi/sysfb_efi.c | 81 ++++++++++--------- drivers/firmware/sysfb.c | 13 +-- drivers/firmware/sysfb_simplefb.c | 2 +- drivers/gpu/drm/sysfb/efidrm.c | 14 ++-- drivers/gpu/drm/sysfb/vesadrm.c | 14 ++-- drivers/hv/vmbus_drv.c | 6 +- drivers/pci/vgaarb.c | 4 +- drivers/video/Kconfig | 8 +- drivers/video/fbdev/core/fbmon.c | 8 +- drivers/video/fbdev/efifb.c | 10 ++- drivers/video/fbdev/vesafb.c | 10 ++- drivers/video/fbdev/vga16fb.c | 8 +- drivers/video/screen_info_pci.c | 5 +- include/linux/efi.h | 9 ++- include/linux/screen_info.h | 2 - include/linux/sysfb.h | 23 ++++-- include/video/edid.h | 4 - 34 files changed, 321 insertions(+), 254 deletions(-)create mode 100644
drivers/firmware/efi/libstub/primary_display.cdelete mode 100644drivers/firmware/efi/libstub/screen_info.cbase-commit:
d724c6f85e80a23ed46b7ebc6e38b527c09d64f5Signature · 1 line
2.51.1
Signature · 6 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)
Ard Biesheuvel
maintainerQuoted 25 lines · Thomas Zimmermann
Hi
Am 27.11.25 um 03:20 schrieb Richard Lyu:
Quoted 4 lines
Hi Thomas,
I am attempting to test this patch series but encountered merge conflicts when applying it to various trees. Could you please clarify the specific base commit (or branch/tag) this series was generated against?
Thanks for testing.
Quoted 14 lines
When testing on the next branch on commits 7a2ff00 and e41ef37, I hit a conflict on PATCH v3 4/9:
patching filedrivers/pci/vgaarb.c
Hunk #2 FAILED at 557.
1 out of 2 hunks FAILED -- rejects in filedrivers/pci/vgaarb.cWhen testing against 3a86608 (Linux 6.18-rc1), the following conflicts occurred:
patching filedrivers/gpu/drm/sysfb/efidrm.c
Hunk #1 FAILED at 24.
1 out of 2 hunks FAILED -- rejects in filedrivers/gpu/drm/sysfb/efidrm.cpatching filedrivers/gpu/drm/sysfb/vesadrm.c
Hunk #1 FAILED at 25.
1 out of 2 hunks FAILED -- rejects in filedrivers/gpu/drm/sysfb/vesadrm.c
Quoted 6 lines
Quoted 1 line
Please let me know the correct base, and I will retest.
It's in the cover letter:
d724c6f85e80a23ed46b7ebc6e38b527c09d64f5The commit is in linux-next. The idea is that the EFI tree can pick up the changes easily in the next cycle. linux-next seemed like the best choice. Best regards Thomas
Thanks. I will queue this up as soon as -rc1 is released.
This series was applied to riscv/linux.git (fixes) by Ard Biesheuvel <[email protected]>:
Hello:
This series was applied to riscv/linux.git (fixes) by Ard Biesheuvel <[email protected]>:
Quoted 10 lines · On Wed, 26 Nov 2025 17:03:17 +0100 you wrote:
Replace
screen_infoandedid_infowithsysfb_primary_deviceof type structsysfb_display_info. Update all users. Then implement EDID support in the kernel EFI code.Sysfb DRM drivers currently fetch the global
edid_infodirectly, when they should get that information together with thescreen_infofrom their device. Wrappingscreen_infoandedid_infoinsysfb_primary_displayand passing this to drivers enables this.[...]
Here is the summary with links:
- [v3,1/9] efi: earlycon: Reduce number of references to global screen_info
https://git.kernel.org/riscv/c/b868070fbc02 - [v3,2/9] efi: sysfb_efi: Reduce number of references to global screen_info (no matching commit) - [v3,3/9] sysfb: Add struct sysfb_display_info https://git.kernel.org/riscv/c/b945922619b7 - [v3,4/9] sysfb: Replace screen_info with sysfb_primary_display (no matching commit) - [v3,5/9] sysfb: Pass sysfb_primary_display to devices https://git.kernel.org/riscv/c/08e583ad6857 - [v3,6/9] sysfb: Move edid_info into sysfb_primary_display https://git.kernel.org/riscv/c/4fcae6358871
- [v3,7/9] efi: Refactor init_primary_display() helpers (no matching commit)
- [v3,8/9] efi: Support EDID information
(no matching commit)
- [v3,9/9] efi: libstub: Simplify interfaces for primary_display (no matching commit)
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html