Skip to contentSkip to conversation

efi: Downgrade "EFI_MEMMAP is not enabled" message

PATCH In review Takashi Iwai 2 participants 10 messages Mar 1, 2019 – Mar 26, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 efi: Downgrade "EFI_MEMMAP is not enabled" message

Since 38ac0287b7f4 ("fbdev/efifb: Honour UEFI memory map attributes when mapping the FB"), efifb_probe() checks its memory range via efi_mem_desc_lookup(), and this leads to a spurious error message "EFI_MEMMAP is not enabled" at every boot on KVM. This is quite annoying since the error message appears even if you set "quiet" boot option.

Actually there are only a few places that call efi_mem_desc_lookup() function, and the other callers do give the explicit error messages when the function returns an error in anyway. That is, the error message in the function is more or less moot.

So let's downgrade the error message for stop annoying users.

Fixes 38ac0287b7f4 ("fbdev/efifb: Honour UEFI memory map attributes when mapping the FB")

Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1127339

---
 drivers/firmware/efi/efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/efi/efi.c +1 -1
index 55b77c576c42..50ac33097458 100644
@@ -409,7 +409,7 @@ int efi_mem_desc_lookup(u64 phys_addr, efi_memory_desc_t *out_md)
 	efi_memory_desc_t *md;
 
 	if (!efi_enabled(EFI_MEMMAP)) {
-		pr_err_once("EFI_MEMMAP is not enabled.\n");
+		pr_debug("EFI_MEMMAP is not enabled.\n");
 		return -EINVAL;
 	}
 
Signature · 1 line
2.16.4
#1 lore raw
Quoted 27 lines · Takashi Iwai

Since 38ac0287b7f4 ("fbdev/efifb: Honour UEFI memory map attributes when mapping the FB"), efifb_probe() checks its memory range via efi_mem_desc_lookup(), and this leads to a spurious error message "EFI_MEMMAP is not enabled" at every boot on KVM. This is quite annoying since the error message appears even if you set "quiet" boot option.

Actually there are only a few places that call efi_mem_desc_lookup() function, and the other callers do give the explicit error messages when the function returns an error in anyway. That is, the error message in the function is more or less moot.

So let's downgrade the error message for stop annoying users.

Fixes 38ac0287b7f4 ("fbdev/efifb: Honour UEFI memory map attributes when mapping the FB")

Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1127339

---
 drivers/firmware/efi/efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/efi/efi.c +0 -0
index 55b77c576c42..50ac33097458 100644

drivers/firmware/efi/efi.c int efi_mem_desc_lookup(u64 phys_addr, efi_memory_desc_t *out_md) · line 415

Quoted 8 lines
drivers/firmware/efi/efi.c +1 -1
@@ -409,7 +409,7 @@ int efi_mem_desc_lookup(u64 phys_addr, efi_memory_desc_t *out_md)
        efi_memory_desc_t *md;
 
        if (!efi_enabled(EFI_MEMMAP)) {
-               pr_err_once("EFI_MEMMAP is not enabled.\n");
+               pr_debug("EFI_MEMMAP is not enabled.\n");
                return -EINVAL;
        }
 

efifb_probe() only calls efi_mem_desc_lookup() if screen_info.orig_video_isVGA == VIDEO_TYPE_EFI, which only gets assigned on a EFI boot.

So even though I don't object to the patch as is, I would like to understand where this error message is coming from, given that it means that you are running on a UEFI system without the EFI memory map.

Is this system booting via GRUB in EFI mode?

#2 lore raw
Quoted 42 lines · Ard Biesheuvel
Quoted 27 lines · Takashi Iwai

Since 38ac0287b7f4 ("fbdev/efifb: Honour UEFI memory map attributes when mapping the FB"), efifb_probe() checks its memory range via efi_mem_desc_lookup(), and this leads to a spurious error message "EFI_MEMMAP is not enabled" at every boot on KVM. This is quite annoying since the error message appears even if you set "quiet" boot option.

Actually there are only a few places that call efi_mem_desc_lookup() function, and the other callers do give the explicit error messages when the function returns an error in anyway. That is, the error message in the function is more or less moot.

So let's downgrade the error message for stop annoying users.

Fixes 38ac0287b7f4 ("fbdev/efifb: Honour UEFI memory map attributes when mapping the FB")

Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1127339

---
 drivers/firmware/efi/efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/efi/efi.c +0 -0
index 55b77c576c42..50ac33097458 100644

drivers/firmware/efi/efi.c int efi_mem_desc_lookup(u64 phys_addr, efi_memory_desc_t *out_md) · line 415

Quoted 8 lines
drivers/firmware/efi/efi.c +1 -1
@@ -409,7 +409,7 @@ int efi_mem_desc_lookup(u64 phys_addr, efi_memory_desc_t *out_md)
        efi_memory_desc_t *md;
 
        if (!efi_enabled(EFI_MEMMAP)) {
-               pr_err_once("EFI_MEMMAP is not enabled.\n");
+               pr_debug("EFI_MEMMAP is not enabled.\n");
                return -EINVAL;
        }
 

efifb_probe() only calls efi_mem_desc_lookup() if screen_info.orig_video_isVGA == VIDEO_TYPE_EFI, which only gets assigned on a EFI boot.

Quoted 6 lines

So even though I don't object to the patch as is, I would like to understand where this error message is coming from, given that it means that you are running on a UEFI system without the EFI memory map.

Is this system booting via GRUB in EFI mode?

No, it's booted in legacy boot mode. But the primary fb is efifb, and that's why the message appears.

thanks,

Takashi

#3 lore raw
Quoted 50 lines · Takashi Iwai
Quoted 47 lines · Ard Biesheuvel
Quoted 27 lines · Takashi Iwai

Since 38ac0287b7f4 ("fbdev/efifb: Honour UEFI memory map attributes when mapping the FB"), efifb_probe() checks its memory range via efi_mem_desc_lookup(), and this leads to a spurious error message "EFI_MEMMAP is not enabled" at every boot on KVM. This is quite annoying since the error message appears even if you set "quiet" boot option.

Actually there are only a few places that call efi_mem_desc_lookup() function, and the other callers do give the explicit error messages when the function returns an error in anyway. That is, the error message in the function is more or less moot.

So let's downgrade the error message for stop annoying users.

Fixes 38ac0287b7f4 ("fbdev/efifb: Honour UEFI memory map attributes when mapping the FB")

Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1127339

---
 drivers/firmware/efi/efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/efi/efi.c +0 -0
index 55b77c576c42..50ac33097458 100644

drivers/firmware/efi/efi.c int efi_mem_desc_lookup(u64 phys_addr, efi_memory_desc_t *out_md) · line 415

Quoted 8 lines
drivers/firmware/efi/efi.c +1 -1
@@ -409,7 +409,7 @@ int efi_mem_desc_lookup(u64 phys_addr, efi_memory_desc_t *out_md)
        efi_memory_desc_t *md;
 
        if (!efi_enabled(EFI_MEMMAP)) {
-               pr_err_once("EFI_MEMMAP is not enabled.\n");
+               pr_debug("EFI_MEMMAP is not enabled.\n");
                return -EINVAL;
        }
 

efifb_probe() only calls efi_mem_desc_lookup() if screen_info.orig_video_isVGA == VIDEO_TYPE_EFI, which only gets assigned on a EFI boot.

So even though I don't object to the patch as is, I would like to understand where this error message is coming from, given that it means that you are running on a UEFI system without the EFI memory map.

Quoted 5 lines
Quoted 1 line

Is this system booting via GRUB in EFI mode?

No, it's booted in legacy boot mode. But the primary fb is efifb, and that's why the message appears.

So how are we ending up with

screen_info.orig_video_isVGA == VIDEO_TYPE_EFI

??

#4 lore raw
Quoted 58 lines · Ard Biesheuvel
Quoted 50 lines · Takashi Iwai
Quoted 47 lines · Ard Biesheuvel
Quoted 27 lines · Takashi Iwai

Since 38ac0287b7f4 ("fbdev/efifb: Honour UEFI memory map attributes when mapping the FB"), efifb_probe() checks its memory range via efi_mem_desc_lookup(), and this leads to a spurious error message "EFI_MEMMAP is not enabled" at every boot on KVM. This is quite annoying since the error message appears even if you set "quiet" boot option.

Actually there are only a few places that call efi_mem_desc_lookup() function, and the other callers do give the explicit error messages when the function returns an error in anyway. That is, the error message in the function is more or less moot.

So let's downgrade the error message for stop annoying users.

Fixes 38ac0287b7f4 ("fbdev/efifb: Honour UEFI memory map attributes when mapping the FB")

Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1127339

---
 drivers/firmware/efi/efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/efi/efi.c +0 -0
index 55b77c576c42..50ac33097458 100644

drivers/firmware/efi/efi.c int efi_mem_desc_lookup(u64 phys_addr, efi_memory_desc_t *out_md) · line 415

Quoted 8 lines
drivers/firmware/efi/efi.c +1 -1
@@ -409,7 +409,7 @@ int efi_mem_desc_lookup(u64 phys_addr, efi_memory_desc_t *out_md)
        efi_memory_desc_t *md;
 
        if (!efi_enabled(EFI_MEMMAP)) {
-               pr_err_once("EFI_MEMMAP is not enabled.\n");
+               pr_debug("EFI_MEMMAP is not enabled.\n");
                return -EINVAL;
        }
 

efifb_probe() only calls efi_mem_desc_lookup() if screen_info.orig_video_isVGA == VIDEO_TYPE_EFI, which only gets assigned on a EFI boot.

So even though I don't object to the patch as is, I would like to understand where this error message is coming from, given that it means that you are running on a UEFI system without the EFI memory map.

Quoted 5 lines
Quoted 1 line

Is this system booting via GRUB in EFI mode?

No, it's booted in legacy boot mode. But the primary fb is efifb, and that's why the message appears.

Quoted 5 lines

So how are we ending up with

screen_info.orig_video_isVGA == VIDEO_TYPE_EFI

??

Ah, sorry, my description was too ambiguous.

Actually our GRUB2 default setup boots the Linux kernel with linuxefi. What I meant was that I invoked qemu-kvm without any -bios option, so it's no EFI BIOS.

thanks,

Takashi

#5 lore raw
Quoted 65 lines · Takashi Iwai
Quoted 62 lines · Ard Biesheuvel
Quoted 50 lines · Takashi Iwai
Quoted 47 lines · Ard Biesheuvel
Quoted 27 lines · Takashi Iwai

Since 38ac0287b7f4 ("fbdev/efifb: Honour UEFI memory map attributes when mapping the FB"), efifb_probe() checks its memory range via efi_mem_desc_lookup(), and this leads to a spurious error message "EFI_MEMMAP is not enabled" at every boot on KVM. This is quite annoying since the error message appears even if you set "quiet" boot option.

Actually there are only a few places that call efi_mem_desc_lookup() function, and the other callers do give the explicit error messages when the function returns an error in anyway. That is, the error message in the function is more or less moot.

So let's downgrade the error message for stop annoying users.

Fixes 38ac0287b7f4 ("fbdev/efifb: Honour UEFI memory map attributes when mapping the FB")

Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1127339

---
 drivers/firmware/efi/efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/efi/efi.c +0 -0
index 55b77c576c42..50ac33097458 100644

drivers/firmware/efi/efi.c int efi_mem_desc_lookup(u64 phys_addr, efi_memory_desc_t *out_md) · line 415

Quoted 8 lines
drivers/firmware/efi/efi.c +1 -1
@@ -409,7 +409,7 @@ int efi_mem_desc_lookup(u64 phys_addr, efi_memory_desc_t *out_md)
        efi_memory_desc_t *md;
 
        if (!efi_enabled(EFI_MEMMAP)) {
-               pr_err_once("EFI_MEMMAP is not enabled.\n");
+               pr_debug("EFI_MEMMAP is not enabled.\n");
                return -EINVAL;
        }
 

efifb_probe() only calls efi_mem_desc_lookup() if screen_info.orig_video_isVGA == VIDEO_TYPE_EFI, which only gets assigned on a EFI boot.

So even though I don't object to the patch as is, I would like to understand where this error message is coming from, given that it means that you are running on a UEFI system without the EFI memory map.

Quoted 5 lines
Quoted 1 line

Is this system booting via GRUB in EFI mode?

No, it's booted in legacy boot mode. But the primary fb is efifb, and that's why the message appears.

So how are we ending up with

screen_info.orig_video_isVGA == VIDEO_TYPE_EFI

Quoted 8 lines
Quoted 1 line

??

Ah, sorry, my description was too ambiguous.

Actually our GRUB2 default setup boots the Linux kernel with linuxefi. What I meant was that I invoked qemu-kvm without any -bios option, so it's no EFI BIOS.

Some from the link here

https://openqa.opensuse.org/tests/864184/file/journal_check-full_journal.log

I got

Feb 27 13:13:41 linux-e2c3 kernel: efifb: probing for efifb
Feb 27 13:13:41 linux-e2c3 kernel: efi: EFI_MEMMAP is not enabled.
Feb 27 13:13:41 linux-e2c3 kernel: fbcon: Taking over console
Feb 27 13:13:41 linux-e2c3 kernel: efifb: No BGRT, not showing boot graphics
Feb 27 13:13:41 linux-e2c3 kernel: efifb: framebuffer at 0xfc000000,
using 1408k, total 1408k
Feb 27 13:13:41 linux-e2c3 kernel: efifb: mode is 800x600x24,
linelength=2400, pages=1
Feb 27 13:13:41 linux-e2c3 kernel: efifb: scrolling: redraw
Feb 27 13:13:41 linux-e2c3 kernel: efifb: Truecolor: size=0:8:8:8,
shift=0:16:8:0
Feb 27 13:13:41 linux-e2c3 kernel: Console: switching to colour frame
buffer device 100x37
Feb 27 13:13:41 linux-e2c3 kernel: fb0: EFI VGA frame buffer device

So if we are doing legacy, there is something else that is taking, GRUB perhaps, that is taking the framebuffer parameters and putting them in screen_info and marking them as VIDEO_TYPE_EFI.

If this is a reasonable thing to do, it implies that the efifb driver may run on otherwise non-EFI systems, and if this is the case, I'd rather fix it like this:

drivers/video/fbdev/efifb.c +2 -1
index ba906876cc45..9e529cc2b4ff 100644
@@ -464,7 +464,8 @@ static int efifb_probe(struct platform_device *dev)
        info->apertures->ranges[0].base = efifb_fix.smem_start;
        info->apertures->ranges[0].size = size_remap;
 
-       if (!efi_mem_desc_lookup(efifb_fix.smem_start, &md)) {
+       if (efi_enabled(EFI_BOOT) &&
+           !efi_mem_desc_lookup(efifb_fix.smem_start, &md)) {
                if ((efifb_fix.smem_start + efifb_fix.smem_len) >
                    (md.phys_addr + (md.num_pages << EFI_PAGE_SHIFT))) {
                        pr_err("efifb: video memory @ 0x%lx spans

multiple EFI memory regions\n",

Could you please confirm whether this works around the issue as well?

#6 lore raw
Quoted 121 lines · Ard Biesheuvel
Quoted 65 lines · Takashi Iwai
Quoted 62 lines · Ard Biesheuvel
Quoted 50 lines · Takashi Iwai
Quoted 47 lines · Ard Biesheuvel
Quoted 27 lines · Takashi Iwai

Since 38ac0287b7f4 ("fbdev/efifb: Honour UEFI memory map attributes when mapping the FB"), efifb_probe() checks its memory range via efi_mem_desc_lookup(), and this leads to a spurious error message "EFI_MEMMAP is not enabled" at every boot on KVM. This is quite annoying since the error message appears even if you set "quiet" boot option.

Actually there are only a few places that call efi_mem_desc_lookup() function, and the other callers do give the explicit error messages when the function returns an error in anyway. That is, the error message in the function is more or less moot.

So let's downgrade the error message for stop annoying users.

Fixes 38ac0287b7f4 ("fbdev/efifb: Honour UEFI memory map attributes when mapping the FB")

Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1127339

---
 drivers/firmware/efi/efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/efi/efi.c +0 -0
index 55b77c576c42..50ac33097458 100644

drivers/firmware/efi/efi.c int efi_mem_desc_lookup(u64 phys_addr, efi_memory_desc_t *out_md) · line 415

Quoted 8 lines
drivers/firmware/efi/efi.c +1 -1
@@ -409,7 +409,7 @@ int efi_mem_desc_lookup(u64 phys_addr, efi_memory_desc_t *out_md)
        efi_memory_desc_t *md;
 
        if (!efi_enabled(EFI_MEMMAP)) {
-               pr_err_once("EFI_MEMMAP is not enabled.\n");
+               pr_debug("EFI_MEMMAP is not enabled.\n");
                return -EINVAL;
        }
 

efifb_probe() only calls efi_mem_desc_lookup() if screen_info.orig_video_isVGA == VIDEO_TYPE_EFI, which only gets assigned on a EFI boot.

So even though I don't object to the patch as is, I would like to understand where this error message is coming from, given that it means that you are running on a UEFI system without the EFI memory map.

Quoted 5 lines
Quoted 1 line

Is this system booting via GRUB in EFI mode?

No, it's booted in legacy boot mode. But the primary fb is efifb, and that's why the message appears.

So how are we ending up with

screen_info.orig_video_isVGA == VIDEO_TYPE_EFI

Quoted 8 lines
Quoted 1 line

??

Ah, sorry, my description was too ambiguous.

Actually our GRUB2 default setup boots the Linux kernel with linuxefi. What I meant was that I invoked qemu-kvm without any -bios option, so it's no EFI BIOS.

Some from the link here

https://openqa.opensuse.org/tests/864184/file/journal_check-full_journal.log

I got

Feb 27 13:13:41 linux-e2c3 kernel: efifb: probing for efifb
Feb 27 13:13:41 linux-e2c3 kernel: efi: EFI_MEMMAP is not enabled.
Feb 27 13:13:41 linux-e2c3 kernel: fbcon: Taking over console
Feb 27 13:13:41 linux-e2c3 kernel: efifb: No BGRT, not showing boot graphics
Feb 27 13:13:41 linux-e2c3 kernel: efifb: framebuffer at 0xfc000000,
using 1408k, total 1408k
Feb 27 13:13:41 linux-e2c3 kernel: efifb: mode is 800x600x24,
linelength=2400, pages=1
Feb 27 13:13:41 linux-e2c3 kernel: efifb: scrolling: redraw
Feb 27 13:13:41 linux-e2c3 kernel: efifb: Truecolor: size=0:8:8:8,
shift=0:16:8:0
Feb 27 13:13:41 linux-e2c3 kernel: Console: switching to colour frame
buffer device 100x37
Feb 27 13:13:41 linux-e2c3 kernel: fb0: EFI VGA frame buffer device

So if we are doing legacy, there is something else that is taking, GRUB perhaps, that is taking the framebuffer parameters and putting them in screen_info and marking them as VIDEO_TYPE_EFI.

If this is a reasonable thing to do, it implies that the efifb driver may run on otherwise non-EFI systems, and if this is the case, I'd rather fix it like this:

drivers/video/fbdev/efifb.c +2 -1
index ba906876cc45..9e529cc2b4ff 100644
@@ -464,7 +464,8 @@ static int efifb_probe(struct platform_device *dev)
        info->apertures->ranges[0].base = efifb_fix.smem_start;
        info->apertures->ranges[0].size = size_remap;
 
-       if (!efi_mem_desc_lookup(efifb_fix.smem_start, &md)) {
+       if (efi_enabled(EFI_BOOT) &&
+           !efi_mem_desc_lookup(efifb_fix.smem_start, &md)) {
                if ((efifb_fix.smem_start + efifb_fix.smem_len) >
                    (md.phys_addr + (md.num_pages << EFI_PAGE_SHIFT))) {
                        pr_err("efifb: video memory @ 0x%lx spans

multiple EFI memory regions\n",

Quoted 1 line

Could you please confirm whether this works around the issue as well?

Yeah, that makes sense, and I confirmed that your patch worked. Both EFI_BOOT and EFI_MEMMAP are 0 on the default boot.

Reported-and-tested-by Takashi Iwai <[email protected]>

Thanks!

Takashi

#7 lore raw
Quoted 124 lines · Takashi Iwai
Quoted 121 lines · Ard Biesheuvel
Quoted 65 lines · Takashi Iwai
Quoted 62 lines · Ard Biesheuvel
Quoted 50 lines · Takashi Iwai
Quoted 47 lines · Ard Biesheuvel
Quoted 27 lines · Takashi Iwai

Since 38ac0287b7f4 ("fbdev/efifb: Honour UEFI memory map attributes when mapping the FB"), efifb_probe() checks its memory range via efi_mem_desc_lookup(), and this leads to a spurious error message "EFI_MEMMAP is not enabled" at every boot on KVM. This is quite annoying since the error message appears even if you set "quiet" boot option.

Actually there are only a few places that call efi_mem_desc_lookup() function, and the other callers do give the explicit error messages when the function returns an error in anyway. That is, the error message in the function is more or less moot.

So let's downgrade the error message for stop annoying users.

Fixes 38ac0287b7f4 ("fbdev/efifb: Honour UEFI memory map attributes when mapping the FB")

Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1127339

---
 drivers/firmware/efi/efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/efi/efi.c +0 -0
index 55b77c576c42..50ac33097458 100644

drivers/firmware/efi/efi.c int efi_mem_desc_lookup(u64 phys_addr, efi_memory_desc_t *out_md) · line 415

Quoted 8 lines
drivers/firmware/efi/efi.c +1 -1
@@ -409,7 +409,7 @@ int efi_mem_desc_lookup(u64 phys_addr, efi_memory_desc_t *out_md)
        efi_memory_desc_t *md;
 
        if (!efi_enabled(EFI_MEMMAP)) {
-               pr_err_once("EFI_MEMMAP is not enabled.\n");
+               pr_debug("EFI_MEMMAP is not enabled.\n");
                return -EINVAL;
        }
 

efifb_probe() only calls efi_mem_desc_lookup() if screen_info.orig_video_isVGA == VIDEO_TYPE_EFI, which only gets assigned on a EFI boot.

So even though I don't object to the patch as is, I would like to understand where this error message is coming from, given that it means that you are running on a UEFI system without the EFI memory map.

Quoted 5 lines
Quoted 1 line

Is this system booting via GRUB in EFI mode?

No, it's booted in legacy boot mode. But the primary fb is efifb, and that's why the message appears.

So how are we ending up with

screen_info.orig_video_isVGA == VIDEO_TYPE_EFI

Quoted 8 lines
Quoted 1 line

??

Ah, sorry, my description was too ambiguous.

Actually our GRUB2 default setup boots the Linux kernel with linuxefi. What I meant was that I invoked qemu-kvm without any -bios option, so it's no EFI BIOS.

Some from the link here

https://openqa.opensuse.org/tests/864184/file/journal_check-full_journal.log

I got

Feb 27 13:13:41 linux-e2c3 kernel: efifb: probing for efifb
Feb 27 13:13:41 linux-e2c3 kernel: efi: EFI_MEMMAP is not enabled.
Feb 27 13:13:41 linux-e2c3 kernel: fbcon: Taking over console
Feb 27 13:13:41 linux-e2c3 kernel: efifb: No BGRT, not showing boot graphics
Feb 27 13:13:41 linux-e2c3 kernel: efifb: framebuffer at 0xfc000000,
using 1408k, total 1408k
Feb 27 13:13:41 linux-e2c3 kernel: efifb: mode is 800x600x24,
linelength=2400, pages=1
Feb 27 13:13:41 linux-e2c3 kernel: efifb: scrolling: redraw
Feb 27 13:13:41 linux-e2c3 kernel: efifb: Truecolor: size=0:8:8:8,
shift=0:16:8:0
Feb 27 13:13:41 linux-e2c3 kernel: Console: switching to colour frame
buffer device 100x37
Feb 27 13:13:41 linux-e2c3 kernel: fb0: EFI VGA frame buffer device

So if we are doing legacy, there is something else that is taking, GRUB perhaps, that is taking the framebuffer parameters and putting them in screen_info and marking them as VIDEO_TYPE_EFI.

If this is a reasonable thing to do, it implies that the efifb driver may run on otherwise non-EFI systems, and if this is the case, I'd rather fix it like this:

drivers/video/fbdev/efifb.c +2 -1
index ba906876cc45..9e529cc2b4ff 100644
@@ -464,7 +464,8 @@ static int efifb_probe(struct platform_device *dev)
        info->apertures->ranges[0].base = efifb_fix.smem_start;
        info->apertures->ranges[0].size = size_remap;
 
-       if (!efi_mem_desc_lookup(efifb_fix.smem_start, &md)) {
+       if (efi_enabled(EFI_BOOT) &&
+           !efi_mem_desc_lookup(efifb_fix.smem_start, &md)) {
                if ((efifb_fix.smem_start + efifb_fix.smem_len) >
                    (md.phys_addr + (md.num_pages << EFI_PAGE_SHIFT))) {
                        pr_err("efifb: video memory @ 0x%lx spans

multiple EFI memory regions\n",

Quoted 6 lines
Quoted 1 line

Could you please confirm whether this works around the issue as well?

Yeah, that makes sense, and I confirmed that your patch worked. Both EFI_BOOT and EFI_MEMMAP are 0 on the default boot.

Reported-and-tested-by Takashi Iwai <[email protected]>

Ard, what is the status of this fix?

thanks,

Takashi

#8 lore raw
Quoted 127 lines · Takashi Iwai
Quoted 124 lines · Takashi Iwai
Quoted 121 lines · Ard Biesheuvel
Quoted 65 lines · Takashi Iwai
Quoted 62 lines · Ard Biesheuvel
Quoted 50 lines · Takashi Iwai
Quoted 47 lines · Ard Biesheuvel
Quoted 27 lines · Takashi Iwai

Since 38ac0287b7f4 ("fbdev/efifb: Honour UEFI memory map attributes when mapping the FB"), efifb_probe() checks its memory range via efi_mem_desc_lookup(), and this leads to a spurious error message "EFI_MEMMAP is not enabled" at every boot on KVM. This is quite annoying since the error message appears even if you set "quiet" boot option.

Actually there are only a few places that call efi_mem_desc_lookup() function, and the other callers do give the explicit error messages when the function returns an error in anyway. That is, the error message in the function is more or less moot.

So let's downgrade the error message for stop annoying users.

Fixes 38ac0287b7f4 ("fbdev/efifb: Honour UEFI memory map attributes when mapping the FB")

Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1127339

---
 drivers/firmware/efi/efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/efi/efi.c +0 -0
index 55b77c576c42..50ac33097458 100644

drivers/firmware/efi/efi.c int efi_mem_desc_lookup(u64 phys_addr, efi_memory_desc_t *out_md) · line 415

Quoted 8 lines
drivers/firmware/efi/efi.c +1 -1
@@ -409,7 +409,7 @@ int efi_mem_desc_lookup(u64 phys_addr, efi_memory_desc_t *out_md)
        efi_memory_desc_t *md;
 
        if (!efi_enabled(EFI_MEMMAP)) {
-               pr_err_once("EFI_MEMMAP is not enabled.\n");
+               pr_debug("EFI_MEMMAP is not enabled.\n");
                return -EINVAL;
        }
 

efifb_probe() only calls efi_mem_desc_lookup() if screen_info.orig_video_isVGA == VIDEO_TYPE_EFI, which only gets assigned on a EFI boot.

So even though I don't object to the patch as is, I would like to understand where this error message is coming from, given that it means that you are running on a UEFI system without the EFI memory map.

Quoted 5 lines
Quoted 1 line

Is this system booting via GRUB in EFI mode?

No, it's booted in legacy boot mode. But the primary fb is efifb, and that's why the message appears.

So how are we ending up with

screen_info.orig_video_isVGA == VIDEO_TYPE_EFI

Quoted 8 lines
Quoted 1 line

??

Ah, sorry, my description was too ambiguous.

Actually our GRUB2 default setup boots the Linux kernel with linuxefi. What I meant was that I invoked qemu-kvm without any -bios option, so it's no EFI BIOS.

Some from the link here

https://openqa.opensuse.org/tests/864184/file/journal_check-full_journal.log

I got

Feb 27 13:13:41 linux-e2c3 kernel: efifb: probing for efifb
Feb 27 13:13:41 linux-e2c3 kernel: efi: EFI_MEMMAP is not enabled.
Feb 27 13:13:41 linux-e2c3 kernel: fbcon: Taking over console
Feb 27 13:13:41 linux-e2c3 kernel: efifb: No BGRT, not showing boot graphics
Feb 27 13:13:41 linux-e2c3 kernel: efifb: framebuffer at 0xfc000000,
using 1408k, total 1408k
Feb 27 13:13:41 linux-e2c3 kernel: efifb: mode is 800x600x24,
linelength=2400, pages=1
Feb 27 13:13:41 linux-e2c3 kernel: efifb: scrolling: redraw
Feb 27 13:13:41 linux-e2c3 kernel: efifb: Truecolor: size=0:8:8:8,
shift=0:16:8:0
Feb 27 13:13:41 linux-e2c3 kernel: Console: switching to colour frame
buffer device 100x37
Feb 27 13:13:41 linux-e2c3 kernel: fb0: EFI VGA frame buffer device

So if we are doing legacy, there is something else that is taking, GRUB perhaps, that is taking the framebuffer parameters and putting them in screen_info and marking them as VIDEO_TYPE_EFI.

If this is a reasonable thing to do, it implies that the efifb driver may run on otherwise non-EFI systems, and if this is the case, I'd rather fix it like this:

drivers/video/fbdev/efifb.c +2 -1
index ba906876cc45..9e529cc2b4ff 100644
@@ -464,7 +464,8 @@ static int efifb_probe(struct platform_device *dev)
        info->apertures->ranges[0].base = efifb_fix.smem_start;
        info->apertures->ranges[0].size = size_remap;
 
-       if (!efi_mem_desc_lookup(efifb_fix.smem_start, &md)) {
+       if (efi_enabled(EFI_BOOT) &&
+           !efi_mem_desc_lookup(efifb_fix.smem_start, &md)) {
                if ((efifb_fix.smem_start + efifb_fix.smem_len) >
                    (md.phys_addr + (md.num_pages << EFI_PAGE_SHIFT))) {
                        pr_err("efifb: video memory @ 0x%lx spans

multiple EFI memory regions\n",

Quoted 9 lines
Quoted 6 lines
Quoted 1 line

Could you please confirm whether this works around the issue as well?

Yeah, that makes sense, and I confirmed that your patch worked. Both EFI_BOOT and EFI_MEMMAP are 0 on the default boot.

Reported-and-tested-by Takashi Iwai <[email protected]>

Ard, what is the status of this fix?

I will get it queued for v5.2

#9 lore raw
Quoted 134 lines · Ard Biesheuvel
Quoted 132 lines · Takashi Iwai
Quoted 129 lines · Takashi Iwai
Quoted 121 lines · Ard Biesheuvel
Quoted 65 lines · Takashi Iwai
Quoted 62 lines · Ard Biesheuvel
Quoted 50 lines · Takashi Iwai
Quoted 47 lines · Ard Biesheuvel
Quoted 27 lines · Takashi Iwai

Since 38ac0287b7f4 ("fbdev/efifb: Honour UEFI memory map attributes when mapping the FB"), efifb_probe() checks its memory range via efi_mem_desc_lookup(), and this leads to a spurious error message "EFI_MEMMAP is not enabled" at every boot on KVM. This is quite annoying since the error message appears even if you set "quiet" boot option.

Actually there are only a few places that call efi_mem_desc_lookup() function, and the other callers do give the explicit error messages when the function returns an error in anyway. That is, the error message in the function is more or less moot.

So let's downgrade the error message for stop annoying users.

Fixes 38ac0287b7f4 ("fbdev/efifb: Honour UEFI memory map attributes when mapping the FB")

Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1127339

---
 drivers/firmware/efi/efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/efi/efi.c +0 -0
index 55b77c576c42..50ac33097458 100644

drivers/firmware/efi/efi.c int efi_mem_desc_lookup(u64 phys_addr, efi_memory_desc_t *out_md) · line 415

Quoted 8 lines
drivers/firmware/efi/efi.c +1 -1
@@ -409,7 +409,7 @@ int efi_mem_desc_lookup(u64 phys_addr, efi_memory_desc_t *out_md)
        efi_memory_desc_t *md;
 
        if (!efi_enabled(EFI_MEMMAP)) {
-               pr_err_once("EFI_MEMMAP is not enabled.\n");
+               pr_debug("EFI_MEMMAP is not enabled.\n");
                return -EINVAL;
        }
 

efifb_probe() only calls efi_mem_desc_lookup() if screen_info.orig_video_isVGA == VIDEO_TYPE_EFI, which only gets assigned on a EFI boot.

So even though I don't object to the patch as is, I would like to understand where this error message is coming from, given that it means that you are running on a UEFI system without the EFI memory map.

Quoted 5 lines
Quoted 1 line

Is this system booting via GRUB in EFI mode?

No, it's booted in legacy boot mode. But the primary fb is efifb, and that's why the message appears.

So how are we ending up with

screen_info.orig_video_isVGA == VIDEO_TYPE_EFI

Quoted 8 lines
Quoted 1 line

??

Ah, sorry, my description was too ambiguous.

Actually our GRUB2 default setup boots the Linux kernel with linuxefi. What I meant was that I invoked qemu-kvm without any -bios option, so it's no EFI BIOS.

Some from the link here

https://openqa.opensuse.org/tests/864184/file/journal_check-full_journal.log

I got

Feb 27 13:13:41 linux-e2c3 kernel: efifb: probing for efifb
Feb 27 13:13:41 linux-e2c3 kernel: efi: EFI_MEMMAP is not enabled.
Feb 27 13:13:41 linux-e2c3 kernel: fbcon: Taking over console
Feb 27 13:13:41 linux-e2c3 kernel: efifb: No BGRT, not showing boot graphics
Feb 27 13:13:41 linux-e2c3 kernel: efifb: framebuffer at 0xfc000000,
using 1408k, total 1408k
Feb 27 13:13:41 linux-e2c3 kernel: efifb: mode is 800x600x24,
linelength=2400, pages=1
Feb 27 13:13:41 linux-e2c3 kernel: efifb: scrolling: redraw
Feb 27 13:13:41 linux-e2c3 kernel: efifb: Truecolor: size=0:8:8:8,
shift=0:16:8:0
Feb 27 13:13:41 linux-e2c3 kernel: Console: switching to colour frame
buffer device 100x37
Feb 27 13:13:41 linux-e2c3 kernel: fb0: EFI VGA frame buffer device

So if we are doing legacy, there is something else that is taking, GRUB perhaps, that is taking the framebuffer parameters and putting them in screen_info and marking them as VIDEO_TYPE_EFI.

If this is a reasonable thing to do, it implies that the efifb driver may run on otherwise non-EFI systems, and if this is the case, I'd rather fix it like this:

drivers/video/fbdev/efifb.c +2 -1
index ba906876cc45..9e529cc2b4ff 100644
@@ -464,7 +464,8 @@ static int efifb_probe(struct platform_device *dev)
        info->apertures->ranges[0].base = efifb_fix.smem_start;
        info->apertures->ranges[0].size = size_remap;
 
-       if (!efi_mem_desc_lookup(efifb_fix.smem_start, &md)) {
+       if (efi_enabled(EFI_BOOT) &&
+           !efi_mem_desc_lookup(efifb_fix.smem_start, &md)) {
                if ((efifb_fix.smem_start + efifb_fix.smem_len) >
                    (md.phys_addr + (md.num_pages << EFI_PAGE_SHIFT))) {
                        pr_err("efifb: video memory @ 0x%lx spans

multiple EFI memory regions\n",

Quoted 1 line

Could you please confirm whether this works around the issue as well?

Yeah, that makes sense, and I confirmed that your patch worked. Both EFI_BOOT and EFI_MEMMAP are 0 on the default boot.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Reported-and-tested-by Takashi Iwai <[email protected]>

Ard, what is the status of this fix?

I will get it queued for v5.2

OK great, just let me know if you submitted the patch. Then I'm going to merge to (open)SUSE kernels for addressing the reported issue.

Thanks!

Takashi