Correct Video Corruption for EFI Plus Bochs/Cirrus
v2 cover Correct Video Corruption for EFI Plus Bochs/Cirrus
Disable building video_bochs and video_cirrus for EFI x86 platforms (i386_efi and x86_64_efi). For x86 EFI platforms efi_gop or efi_uga should provide the video support. Currently, in EFI platforms there is a risk that both the legacy device is present and the EFI video interface - which can cause unexpected video corruption when a mix of the two interfaces are used. This can happen when all_video is loaded for simplicity in a GRUB config.
There is some additional analysis from the Qemu team in this thread:
https://gitlab.com/qemu-project/qemu/-/issues/2562
This is an issue on some major distros such as Debian on EFI when running under Qemu and potentially other scenarios.
There is some discussion on the Debian side in this thread:
https://salsa.debian.org/kernel-team/linux/-/merge_requests/1453
This relates to this discussion from grub-devel also:
https://lists.gnu.org/archive/html/grub-devel/2025-09/msg00244.html
Following this change, for x86_64_efi the following modules would be loaded by "all_video": "efi_gop" "efi_uga"
Link to v1 thread:
https://lists.gnu.org/archive/html/grub-devel/2025-09/msg00254.html
Changes v1 => v2:
Also remove video_cirrus when building for i386 EFI or x86-64 EFI
Andrew Hamilton (1):
build: Disable building video_bochs/cirrus for EFI x86 platforms
grub-core/Makefile.core.def | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
Signature · 7 lines
2.47.3 _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
PATCH v2 1/1 build: Disable building video_bochs/cirrus for EFI x86
Disable building video_bochs and video_cirrus for EFI x86 platforms (i386_efi and x86_64_efi). For x86 EFI platforms efi_gop or efi_uga should provide the video support. Currently, in EFI platforms there is a risk that both the legacy device is present and the EFI video interface - which can cause unexpected video corruption when a mix of the two interfaces are used. This can happen when all_video is loaded for simplicity in a GRUB config.
--- grub-core/Makefile.core.def | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
grub-core/Makefile.core.def +10 -2
@@ -2163,13 +2163,21 @@ module = { module = { name = video_cirrus; x86 = video/cirrus.c; - enable = x86; + enable = i386_pc; + enable = i386_qemu; + enable = i386_coreboot; + enable = i386_multiboot; + enable = i386_ieee1275; }; module = { name = video_bochs; x86 = video/bochs.c; - enable = x86; + enable = i386_pc; + enable = i386_qemu; + enable = i386_coreboot; + enable = i386_multiboot; + enable = i386_ieee1275; }; module = {
Signature · 7 lines
2.47.3 _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
---- On Tue, 30 Sep 2025 06:23:39 +0400 Andrew Hamilton <[email protected]> wrote ---
Quoted 1 line
Disable building
video_bochsandvideo_cirrusfor EFI x86 platforms (i386_efi
I tested this patch, and it indeed solves the bug. (But I tested on x86_64 only.)
Signature · 8 lines
Askar Safin https://types.pl/@safinaskar _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
Andrew Hamilton <[email protected]>:
Quoted 1 line
Disable building
video_bochsandvideo_cirrusfor EFI x86 platforms (i386_efi
Why this patch is not yet applied?
Signature · 6 lines
Askar Safin _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
Daniel - can you take a look at this one to see if we can get it pulled in to help those affected by this issue?
Thanks
Andrew
Quoted 9 lines · Askar Safin
Andrew Hamilton <[email protected]>:
Quoted 1 line
Disable building
video_bochsandvideo_cirrusfor EFI x86 platforms(
i386_efiWhy this patch is not yet applied?
--
Askar Safin
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Quoted 2 lines · Andrew Hamilton
Daniel - can you take a look at this one to see if we can get it pulled in to help those affected by this issue?
I am not entirely sure it [1] is correct. I have pinged and CC-ed Vladimir...
Daniel
[1] https://lore.kernel.org/grub-devel/[email protected]/
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Quoted 5 lines · Daniel Kiper via Grub-devel
Quoted 2 lines · Andrew Hamilton
Daniel - can you take a look at this one to see if we can get it pulled in to help those affected by this issue?
I am not entirely sure it [1] is correct.
Well. Underlying problem is that there are two drivers active for one piece of hardware. The driver which comes with the EFI firmware, and the grub driver. Which is /never/ a good idea. In this specific case the effect is very visible, with other hardware the problems can be more obscure or with luck not present.
The by far easiest way to handle this properly to allow only the efi_* drivers on all EFI platforms. The patch does just that (limited to video drivers).
Alternatively you can check for conflicts. Check which physical device backs efi_gop, block that from being used by grub drivers. Same for all other device types.
The latter would handle the corner case that there is hardware which is
(a) supported by grub, and (b) not supported by the firmware, and (c) essential to boot the system. Not sure how relevant that is in practice, most EFI firmware I've seen recently is pretty complete when it comes to hardware support. NIC drivers are missing sometimes, iPXE to the rescue ;)
Note that the same conflict exists for filesystem drivers too, usually both EFI and grub FAT drivers are active. Luckily write access to the ESP is very rare, so this isn't much of a problem in practice.
take care,
Gerd
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Quoted 28 lines · Gerd Hoffmann
Quoted 5 lines · Daniel Kiper via Grub-devel
Quoted 2 lines · Andrew Hamilton
Daniel - can you take a look at this one to see if we can get it pulled in to help those affected by this issue?
I am not entirely sure it [1] is correct.
Well. Underlying problem is that there are two drivers active for one piece of hardware. The driver which comes with the EFI firmware, and the grub driver. Which is /never/ a good idea. In this specific case the effect is very visible, with other hardware the problems can be more obscure or with luck not present.
The by far easiest way to handle this properly to allow only the efi_* drivers on all EFI platforms. The patch does just that (limited to video drivers).
Alternatively you can check for conflicts. Check which physical device backs
efi_gop, block that from being used by grub drivers. Same for all other device types.The latter would handle the corner case that there is hardware which is
(a) supported by grub, and (b) not supported by the firmware, and (c) essential to boot the system. Not sure how relevant that is in practice, most EFI firmware I've seen recently is pretty complete when it comes to hardware support. NIC drivers are missing sometimes, iPXE to the rescue ;)
Quoted 3 lines
Note that the same conflict exists for filesystem drivers too, usually both EFI and grub FAT drivers are active. Luckily write access to the ESP is very rare, so this isn't much of a problem in practice.
I am not saying it is not a problem. I rather saying that I do not like the solution. Or even we... I discussed the issue with Vladimir and he agrees with me.
Anyway, why cannot you use GRUB_VIDEO_BACKEND config variable? If it is not acceptable please propose a solution without disabling drivers currently build and provided by the GRUB. We are OK with not loading some drivers but we are against disabling them at build.
Daniel
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Fixing this problem is needed for Debian to enable CONFIG_DRM_SIMPLEDRM for its kernels (this is already done by many other distros).
(see this thread:
https://salsa.debian.org/kernel-team/linux/-/merge_requests/1453#note_603600
)
So I'm asking will GRUB merge at least a partial solution to this problem in reasonable time?
Quoted 1 line · Daniel Kiper
Anyway, why cannot you use
GRUB_VIDEO_BACKENDconfig variable?
I want GRUB to work by default. :)
Quoted 2 lines
If it is not acceptable please propose a solution without disabling drivers currently build and provided by the GRUB. We are OK with not
Then make "all_video" depend on "efi_*" only on efi-x86_64.
Signature · 6 lines
Askar Safin _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
Quoted 8 lines · Askar Safin
Fixing this problem is needed for Debian to enable
CONFIG_DRM_SIMPLEDRMfor its kernels (this is already done by many other distros).
(see this thread:
https://salsa.debian.org/kernel-team/linux/-/merge_requests/1453#note_603600
)
So I'm asking will GRUB merge at least a partial solution to this problem in reasonable time?
Propose an acceptable solution and we will take it...
Quoted 9 lines · Daniel Kiper
Quoted 1 line
Anyway, why cannot you use
GRUB_VIDEO_BACKENDconfig variable?I want GRUB to work by default. :)
Quoted 2 lines
If it is not acceptable please propose a solution without disabling drivers currently build and provided by the GRUB. We are OK with not
Then make "
all_video" depend on "efi_*" only on efi-x86_64.
I think it is much easier and sensible to tweak GRUB shell scripts to make it work.
Daniel
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Quoted 17 lines · Daniel Kiper
Quoted 8 lines · Askar Safin
Fixing this problem is needed for Debian to enable
CONFIG_DRM_SIMPLEDRMfor its kernels (this is already done by many other distros).
(see this thread:
https://salsa.debian.org/kernel-team/linux/-/merge_requests/1453#note_603600
)
So I'm asking will GRUB merge at least a partial solution to this problem in reasonable time?Propose an acceptable solution and we will take it...
Quoted 5 lines · Daniel Kiper
Quoted 1 line
Anyway, why cannot you use
GRUB_VIDEO_BACKENDconfig variable?I want GRUB to work by default. :)
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
If it is not acceptable please propose a solution without disabling drivers currently build and provided by the GRUB. We are OK with not
Then make "
all_video" depend on "efi_*" only on efi-x86_64.I think it is much easier and sensible to tweak GRUB shell scripts to make it work.
To be precise, I am OK with a patch doing it properly. And it would be nice to have a flag to enable original behavior just in case.
Daniel
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel