* Re: [PATCH v2 4/9] vgacon, arch/*: remove unused screen_info definitions
From: Philippe Mathieu-Daudé @ 2023-07-19 13:34 UTC (permalink / raw)
To: Arnd Bergmann, linux-fbdev, Thomas Zimmermann, Helge Deller,
Javier Martinez Canillas
Cc: Arnd Bergmann, David S. Miller, K. Y. Srinivasan, Ard Biesheuvel,
Borislav Petkov, Brian Cain, Catalin Marinas, Christophe Leroy,
Daniel Vetter, Dave Hansen, David Airlie, Deepak Rawat,
Dexuan Cui, Dinh Nguyen, Greg Kroah-Hartman, Guo Ren,
Haiyang Zhang, Huacai Chen, Ingo Molnar,
John Paul Adrian Glaubitz, Khalid Aziz, Linus Walleij,
Matt Turner, Max Filippov, Michael Ellerman, Nicholas Piggin,
Palmer Dabbelt, Russell King, Thomas Bogendoerfer,
Thomas Gleixner, WANG Xuerui, Wei Liu, Will Deacon, x86,
linux-alpha, linux-kernel, linux-arm-kernel, linux-efi,
linux-csky, linux-hexagon, linux-ia64, loongarch, linux-mips,
linuxppc-dev, linux-riscv, linux-sh, sparclinux, linux-hyperv,
dri-devel, Palmer Dabbelt
In-Reply-To: <20230719123944.3438363-5-arnd@kernel.org>
On 19/7/23 14:39, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> A number of architectures either kept the screen_info definition for
> historical purposes as it used to be required by the generic VT code, or
> they copied it from another architecture in order to build the VGA console
> driver in an allmodconfig build. The mips definition is used by some
> platforms, but the initialization on jazz is not needed.
>
> Now that vgacon no longer builds on these architectures, remove the
> stale definitions and initializations.
>
> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
> Acked-by: Dinh Nguyen <dinguyen@kernel.org>
> Acked-by: Max Filippov <jcmvbkbc@gmail.com>
> Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
> Acked-by: Guo Ren <guoren@kernel.org>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> arch/csky/kernel/setup.c | 12 ------------
> arch/hexagon/kernel/Makefile | 2 --
> arch/hexagon/kernel/screen_info.c | 3 ---
> arch/mips/jazz/setup.c | 9 ---------
> arch/nios2/kernel/setup.c | 5 -----
> arch/sh/kernel/setup.c | 5 -----
> arch/sparc/kernel/setup_32.c | 13 -------------
> arch/sparc/kernel/setup_64.c | 13 -------------
> arch/xtensa/kernel/setup.c | 12 ------------
> 9 files changed, 74 deletions(-)
> delete mode 100644 arch/hexagon/kernel/screen_info.c
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply
* Re: [PATCH v2 9/9] efi: move screen_info into efi init code
From: Ard Biesheuvel @ 2023-07-19 13:19 UTC (permalink / raw)
To: Arnd Bergmann
Cc: linux-fbdev, Thomas Zimmermann, Helge Deller,
Javier Martinez Canillas, Arnd Bergmann, David S. Miller,
K. Y. Srinivasan, Borislav Petkov, Brian Cain, Catalin Marinas,
Christophe Leroy, Daniel Vetter, Dave Hansen, David Airlie,
Deepak Rawat, Dexuan Cui, Dinh Nguyen, Greg Kroah-Hartman,
Guo Ren, Haiyang Zhang, Huacai Chen, Ingo Molnar,
John Paul Adrian Glaubitz, Khalid Aziz, Linus Walleij,
Matt Turner, Max Filippov, Michael Ellerman, Nicholas Piggin,
Palmer Dabbelt, Russell King, Thomas Bogendoerfer,
Thomas Gleixner, WANG Xuerui, Wei Liu, Will Deacon, x86,
linux-alpha, linux-kernel, linux-arm-kernel, linux-efi,
linux-csky, linux-hexagon, linux-ia64, loongarch, linux-mips,
linuxppc-dev, linux-riscv, linux-sh, sparclinux, linux-hyperv,
dri-devel
In-Reply-To: <20230719123944.3438363-10-arnd@kernel.org>
On Wed, 19 Jul 2023 at 14:41, Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> After the vga console no longer relies on global screen_info, there are
> only two remaining use cases:
>
> - on the x86 architecture, it is used for multiple boot methods
> (bzImage, EFI, Xen, kexec) to commicate the initial VGA or framebuffer
> settings to a number of device drivers.
>
> - on other architectures, it is only used as part of the EFI stub,
> and only for the three sysfb framebuffers (simpledrm, simplefb, efifb).
>
> Remove the duplicate data structure definitions by moving it into the
> efi-init.c file that sets it up initially for the EFI case, leaving x86
> as an exception that retains its own definition for non-EFI boots.
>
> The added #ifdefs here are optional, I added them to further limit the
> reach of screen_info to configurations that have at least one of the
> users enabled.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
> ---
> arch/arm/kernel/setup.c | 4 ----
> arch/arm64/kernel/efi.c | 4 ----
> arch/arm64/kernel/image-vars.h | 2 ++
> arch/ia64/kernel/setup.c | 4 ----
> arch/loongarch/kernel/efi.c | 3 ++-
> arch/loongarch/kernel/image-vars.h | 2 ++
> arch/loongarch/kernel/setup.c | 5 -----
> arch/riscv/kernel/image-vars.h | 2 ++
> arch/riscv/kernel/setup.c | 5 -----
> drivers/firmware/efi/efi-init.c | 14 +++++++++++++-
> drivers/firmware/efi/libstub/efi-stub-entry.c | 8 +++++++-
> 11 files changed, 28 insertions(+), 25 deletions(-)
>
> diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
> index 86c2751f56dcf..135b7eff03f72 100644
> --- a/arch/arm/kernel/setup.c
> +++ b/arch/arm/kernel/setup.c
> @@ -939,10 +939,6 @@ static struct screen_info vgacon_screen_info = {
> };
> #endif
>
> -#if defined(CONFIG_EFI)
> -struct screen_info screen_info;
> -#endif
> -
> static int __init customize_machine(void)
> {
> /*
> diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
> index 3afbe503b066f..ff2d5169d7f1f 100644
> --- a/arch/arm64/kernel/efi.c
> +++ b/arch/arm64/kernel/efi.c
> @@ -71,10 +71,6 @@ static __init pteval_t create_mapping_protection(efi_memory_desc_t *md)
> return pgprot_val(PAGE_KERNEL_EXEC);
> }
>
> -/* we will fill this structure from the stub, so don't put it in .bss */
> -struct screen_info screen_info __section(".data");
> -EXPORT_SYMBOL(screen_info);
> -
> int __init efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md)
> {
> pteval_t prot_val = create_mapping_protection(md);
> diff --git a/arch/arm64/kernel/image-vars.h b/arch/arm64/kernel/image-vars.h
> index 35f3c79595137..5e4dc72ab1bda 100644
> --- a/arch/arm64/kernel/image-vars.h
> +++ b/arch/arm64/kernel/image-vars.h
> @@ -27,7 +27,9 @@ PROVIDE(__efistub__text = _text);
> 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);
> +#endif
> PROVIDE(__efistub__ctype = _ctype);
>
> PROVIDE(__pi___memcpy = __pi_memcpy);
> diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
> index 82feae1323f40..e91a91b5e9142 100644
> --- a/arch/ia64/kernel/setup.c
> +++ b/arch/ia64/kernel/setup.c
> @@ -86,10 +86,6 @@ EXPORT_SYMBOL(local_per_cpu_offset);
> #endif
> unsigned long ia64_cycles_per_usec;
> struct ia64_boot_param *ia64_boot_param;
> -#if defined(CONFIG_EFI)
> -/* No longer used on ia64, but needed for linking */
> -struct screen_info screen_info;
> -#endif
> #ifdef CONFIG_VGA_CONSOLE
> unsigned long vga_console_iobase;
> unsigned long vga_console_membase;
> diff --git a/arch/loongarch/kernel/efi.c b/arch/loongarch/kernel/efi.c
> index 9fc10cea21e10..df7db34024e61 100644
> --- a/arch/loongarch/kernel/efi.c
> +++ b/arch/loongarch/kernel/efi.c
> @@ -115,7 +115,8 @@ void __init efi_init(void)
>
> set_bit(EFI_CONFIG_TABLES, &efi.flags);
>
> - init_screen_info();
> + if (IS_ENABLED(CONFIG_EFI_EARLYCON) || IS_ENABLED(CONFIG_SYSFB))
> + init_screen_info();
>
> if (boot_memmap == EFI_INVALID_TABLE_ADDR)
> return;
> diff --git a/arch/loongarch/kernel/image-vars.h b/arch/loongarch/kernel/image-vars.h
> index e561989d02de9..5087416b9678d 100644
> --- a/arch/loongarch/kernel/image-vars.h
> +++ b/arch/loongarch/kernel/image-vars.h
> @@ -12,7 +12,9 @@ __efistub_kernel_entry = kernel_entry;
> __efistub_kernel_asize = kernel_asize;
> __efistub_kernel_fsize = kernel_fsize;
> __efistub_kernel_offset = kernel_offset;
> +#if defined(CONFIG_EFI_EARLYCON) || defined(CONFIG_SYSFB)
> __efistub_screen_info = screen_info;
> +#endif
>
> #endif
>
> diff --git a/arch/loongarch/kernel/setup.c b/arch/loongarch/kernel/setup.c
> index 77e7a3722caa6..4570c3149b849 100644
> --- a/arch/loongarch/kernel/setup.c
> +++ b/arch/loongarch/kernel/setup.c
> @@ -16,7 +16,6 @@
> #include <linux/dmi.h>
> #include <linux/efi.h>
> #include <linux/export.h>
> -#include <linux/screen_info.h>
> #include <linux/memblock.h>
> #include <linux/initrd.h>
> #include <linux/ioport.h>
> @@ -57,10 +56,6 @@
> #define SMBIOS_CORE_PACKAGE_OFFSET 0x23
> #define LOONGSON_EFI_ENABLE (1 << 3)
>
> -#ifdef CONFIG_EFI
> -struct screen_info screen_info __section(".data");
> -#endif
> -
> unsigned long fw_arg0, fw_arg1, fw_arg2;
> DEFINE_PER_CPU(unsigned long, kernelsp);
> struct cpuinfo_loongarch cpu_data[NR_CPUS] __read_mostly;
> diff --git a/arch/riscv/kernel/image-vars.h b/arch/riscv/kernel/image-vars.h
> index 15616155008cc..89d92f9644d5e 100644
> --- a/arch/riscv/kernel/image-vars.h
> +++ b/arch/riscv/kernel/image-vars.h
> @@ -27,7 +27,9 @@ __efistub__start = _start;
> __efistub__start_kernel = _start_kernel;
> __efistub__end = _end;
> __efistub__edata = _edata;
> +#if defined(CONFIG_EFI_EARLYCON) || defined(CONFIG_SYSFB)
> __efistub_screen_info = screen_info;
> +#endif
>
> #endif
>
> diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
> index a3dbe13f45fb3..aea585dc8e8f3 100644
> --- a/arch/riscv/kernel/setup.c
> +++ b/arch/riscv/kernel/setup.c
> @@ -15,7 +15,6 @@
> #include <linux/memblock.h>
> #include <linux/sched.h>
> #include <linux/console.h>
> -#include <linux/screen_info.h>
> #include <linux/of_fdt.h>
> #include <linux/sched/task.h>
> #include <linux/smp.h>
> @@ -39,10 +38,6 @@
>
> #include "head.h"
>
> -#if defined(CONFIG_EFI)
> -struct screen_info screen_info __section(".data");
> -#endif
> -
> /*
> * The lucky hart to first increment this variable will boot the other cores.
> * This is used before the kernel initializes the BSS so it can't be in the
> diff --git a/drivers/firmware/efi/efi-init.c b/drivers/firmware/efi/efi-init.c
> index ef0820f1a9246..d4987d0130801 100644
> --- a/drivers/firmware/efi/efi-init.c
> +++ b/drivers/firmware/efi/efi-init.c
> @@ -55,6 +55,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.
> + */
> +#if !defined(CONFIG_X86) && (defined(CONFIG_SYSFB) || defined(CONFIG_EFI_EARLYCON))
> +struct screen_info screen_info __section(".data");
> +EXPORT_SYMBOL_GPL(screen_info);
> +#endif
> +
> static void __init init_screen_info(void)
> {
> struct screen_info *si;
> @@ -240,5 +249,8 @@ void __init efi_init(void)
> memblock_reserve(data.phys_map & PAGE_MASK,
> PAGE_ALIGN(data.size + (data.phys_map & ~PAGE_MASK)));
>
> - init_screen_info();
> + if (IS_ENABLED(CONFIG_X86) ||
> + IS_ENABLED(CONFIG_SYSFB) ||
> + IS_ENABLED(CONFIG_EFI_EARLYCON))
> + init_screen_info();
> }
> diff --git a/drivers/firmware/efi/libstub/efi-stub-entry.c b/drivers/firmware/efi/libstub/efi-stub-entry.c
> index 2f1902e5d4075..a6c0498351905 100644
> --- a/drivers/firmware/efi/libstub/efi-stub-entry.c
> +++ b/drivers/firmware/efi/libstub/efi-stub-entry.c
> @@ -13,7 +13,13 @@ struct screen_info *alloc_screen_info(void)
> {
> if (IS_ENABLED(CONFIG_ARM))
> return __alloc_screen_info();
> - return (void *)&screen_info + screen_info_offset;
> +
> + if (IS_ENABLED(CONFIG_X86) ||
> + IS_ENABLED(CONFIG_EFI_EARLYCON) ||
> + IS_ENABLED(CONFIG_SYSFB))
> + return (void *)&screen_info + screen_info_offset;
> +
> + return NULL;
> }
>
> /*
> --
> 2.39.2
>
^ permalink raw reply
* [PATCH v2 9/9] efi: move screen_info into efi init code
From: Arnd Bergmann @ 2023-07-19 12:39 UTC (permalink / raw)
To: linux-fbdev, Thomas Zimmermann, Helge Deller,
Javier Martinez Canillas
Cc: Arnd Bergmann, David S. Miller, K. Y. Srinivasan, Ard Biesheuvel,
Borislav Petkov, Brian Cain, Catalin Marinas, Christophe Leroy,
Daniel Vetter, Dave Hansen, David Airlie, Deepak Rawat,
Dexuan Cui, Dinh Nguyen, Greg Kroah-Hartman, Guo Ren,
Haiyang Zhang, Huacai Chen, Ingo Molnar,
John Paul Adrian Glaubitz, Khalid Aziz, Linus Walleij,
Matt Turner, Max Filippov, Michael Ellerman, Nicholas Piggin,
Palmer Dabbelt, Russell King, Thomas Bogendoerfer,
Thomas Gleixner, WANG Xuerui, Wei Liu, Will Deacon, x86,
linux-alpha, linux-kernel, linux-arm-kernel, linux-efi,
linux-csky, linux-hexagon, linux-ia64, loongarch, linux-mips,
linuxppc-dev, linux-riscv, linux-sh, sparclinux, linux-hyperv,
dri-devel
In-Reply-To: <20230719123944.3438363-1-arnd@kernel.org>
From: Arnd Bergmann <arnd@arndb.de>
After the vga console no longer relies on global screen_info, there are
only two remaining use cases:
- on the x86 architecture, it is used for multiple boot methods
(bzImage, EFI, Xen, kexec) to commicate the initial VGA or framebuffer
settings to a number of device drivers.
- on other architectures, it is only used as part of the EFI stub,
and only for the three sysfb framebuffers (simpledrm, simplefb, efifb).
Remove the duplicate data structure definitions by moving it into the
efi-init.c file that sets it up initially for the EFI case, leaving x86
as an exception that retains its own definition for non-EFI boots.
The added #ifdefs here are optional, I added them to further limit the
reach of screen_info to configurations that have at least one of the
users enabled.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/arm/kernel/setup.c | 4 ----
arch/arm64/kernel/efi.c | 4 ----
arch/arm64/kernel/image-vars.h | 2 ++
arch/ia64/kernel/setup.c | 4 ----
arch/loongarch/kernel/efi.c | 3 ++-
arch/loongarch/kernel/image-vars.h | 2 ++
arch/loongarch/kernel/setup.c | 5 -----
arch/riscv/kernel/image-vars.h | 2 ++
arch/riscv/kernel/setup.c | 5 -----
drivers/firmware/efi/efi-init.c | 14 +++++++++++++-
drivers/firmware/efi/libstub/efi-stub-entry.c | 8 +++++++-
11 files changed, 28 insertions(+), 25 deletions(-)
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 86c2751f56dcf..135b7eff03f72 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -939,10 +939,6 @@ static struct screen_info vgacon_screen_info = {
};
#endif
-#if defined(CONFIG_EFI)
-struct screen_info screen_info;
-#endif
-
static int __init customize_machine(void)
{
/*
diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
index 3afbe503b066f..ff2d5169d7f1f 100644
--- a/arch/arm64/kernel/efi.c
+++ b/arch/arm64/kernel/efi.c
@@ -71,10 +71,6 @@ static __init pteval_t create_mapping_protection(efi_memory_desc_t *md)
return pgprot_val(PAGE_KERNEL_EXEC);
}
-/* we will fill this structure from the stub, so don't put it in .bss */
-struct screen_info screen_info __section(".data");
-EXPORT_SYMBOL(screen_info);
-
int __init efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md)
{
pteval_t prot_val = create_mapping_protection(md);
diff --git a/arch/arm64/kernel/image-vars.h b/arch/arm64/kernel/image-vars.h
index 35f3c79595137..5e4dc72ab1bda 100644
--- a/arch/arm64/kernel/image-vars.h
+++ b/arch/arm64/kernel/image-vars.h
@@ -27,7 +27,9 @@ PROVIDE(__efistub__text = _text);
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);
+#endif
PROVIDE(__efistub__ctype = _ctype);
PROVIDE(__pi___memcpy = __pi_memcpy);
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index 82feae1323f40..e91a91b5e9142 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -86,10 +86,6 @@ EXPORT_SYMBOL(local_per_cpu_offset);
#endif
unsigned long ia64_cycles_per_usec;
struct ia64_boot_param *ia64_boot_param;
-#if defined(CONFIG_EFI)
-/* No longer used on ia64, but needed for linking */
-struct screen_info screen_info;
-#endif
#ifdef CONFIG_VGA_CONSOLE
unsigned long vga_console_iobase;
unsigned long vga_console_membase;
diff --git a/arch/loongarch/kernel/efi.c b/arch/loongarch/kernel/efi.c
index 9fc10cea21e10..df7db34024e61 100644
--- a/arch/loongarch/kernel/efi.c
+++ b/arch/loongarch/kernel/efi.c
@@ -115,7 +115,8 @@ void __init efi_init(void)
set_bit(EFI_CONFIG_TABLES, &efi.flags);
- init_screen_info();
+ if (IS_ENABLED(CONFIG_EFI_EARLYCON) || IS_ENABLED(CONFIG_SYSFB))
+ init_screen_info();
if (boot_memmap == EFI_INVALID_TABLE_ADDR)
return;
diff --git a/arch/loongarch/kernel/image-vars.h b/arch/loongarch/kernel/image-vars.h
index e561989d02de9..5087416b9678d 100644
--- a/arch/loongarch/kernel/image-vars.h
+++ b/arch/loongarch/kernel/image-vars.h
@@ -12,7 +12,9 @@ __efistub_kernel_entry = kernel_entry;
__efistub_kernel_asize = kernel_asize;
__efistub_kernel_fsize = kernel_fsize;
__efistub_kernel_offset = kernel_offset;
+#if defined(CONFIG_EFI_EARLYCON) || defined(CONFIG_SYSFB)
__efistub_screen_info = screen_info;
+#endif
#endif
diff --git a/arch/loongarch/kernel/setup.c b/arch/loongarch/kernel/setup.c
index 77e7a3722caa6..4570c3149b849 100644
--- a/arch/loongarch/kernel/setup.c
+++ b/arch/loongarch/kernel/setup.c
@@ -16,7 +16,6 @@
#include <linux/dmi.h>
#include <linux/efi.h>
#include <linux/export.h>
-#include <linux/screen_info.h>
#include <linux/memblock.h>
#include <linux/initrd.h>
#include <linux/ioport.h>
@@ -57,10 +56,6 @@
#define SMBIOS_CORE_PACKAGE_OFFSET 0x23
#define LOONGSON_EFI_ENABLE (1 << 3)
-#ifdef CONFIG_EFI
-struct screen_info screen_info __section(".data");
-#endif
-
unsigned long fw_arg0, fw_arg1, fw_arg2;
DEFINE_PER_CPU(unsigned long, kernelsp);
struct cpuinfo_loongarch cpu_data[NR_CPUS] __read_mostly;
diff --git a/arch/riscv/kernel/image-vars.h b/arch/riscv/kernel/image-vars.h
index 15616155008cc..89d92f9644d5e 100644
--- a/arch/riscv/kernel/image-vars.h
+++ b/arch/riscv/kernel/image-vars.h
@@ -27,7 +27,9 @@ __efistub__start = _start;
__efistub__start_kernel = _start_kernel;
__efistub__end = _end;
__efistub__edata = _edata;
+#if defined(CONFIG_EFI_EARLYCON) || defined(CONFIG_SYSFB)
__efistub_screen_info = screen_info;
+#endif
#endif
diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
index a3dbe13f45fb3..aea585dc8e8f3 100644
--- a/arch/riscv/kernel/setup.c
+++ b/arch/riscv/kernel/setup.c
@@ -15,7 +15,6 @@
#include <linux/memblock.h>
#include <linux/sched.h>
#include <linux/console.h>
-#include <linux/screen_info.h>
#include <linux/of_fdt.h>
#include <linux/sched/task.h>
#include <linux/smp.h>
@@ -39,10 +38,6 @@
#include "head.h"
-#if defined(CONFIG_EFI)
-struct screen_info screen_info __section(".data");
-#endif
-
/*
* The lucky hart to first increment this variable will boot the other cores.
* This is used before the kernel initializes the BSS so it can't be in the
diff --git a/drivers/firmware/efi/efi-init.c b/drivers/firmware/efi/efi-init.c
index ef0820f1a9246..d4987d0130801 100644
--- a/drivers/firmware/efi/efi-init.c
+++ b/drivers/firmware/efi/efi-init.c
@@ -55,6 +55,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.
+ */
+#if !defined(CONFIG_X86) && (defined(CONFIG_SYSFB) || defined(CONFIG_EFI_EARLYCON))
+struct screen_info screen_info __section(".data");
+EXPORT_SYMBOL_GPL(screen_info);
+#endif
+
static void __init init_screen_info(void)
{
struct screen_info *si;
@@ -240,5 +249,8 @@ void __init efi_init(void)
memblock_reserve(data.phys_map & PAGE_MASK,
PAGE_ALIGN(data.size + (data.phys_map & ~PAGE_MASK)));
- init_screen_info();
+ if (IS_ENABLED(CONFIG_X86) ||
+ IS_ENABLED(CONFIG_SYSFB) ||
+ IS_ENABLED(CONFIG_EFI_EARLYCON))
+ init_screen_info();
}
diff --git a/drivers/firmware/efi/libstub/efi-stub-entry.c b/drivers/firmware/efi/libstub/efi-stub-entry.c
index 2f1902e5d4075..a6c0498351905 100644
--- a/drivers/firmware/efi/libstub/efi-stub-entry.c
+++ b/drivers/firmware/efi/libstub/efi-stub-entry.c
@@ -13,7 +13,13 @@ struct screen_info *alloc_screen_info(void)
{
if (IS_ENABLED(CONFIG_ARM))
return __alloc_screen_info();
- return (void *)&screen_info + screen_info_offset;
+
+ if (IS_ENABLED(CONFIG_X86) ||
+ IS_ENABLED(CONFIG_EFI_EARLYCON) ||
+ IS_ENABLED(CONFIG_SYSFB))
+ return (void *)&screen_info + screen_info_offset;
+
+ return NULL;
}
/*
--
2.39.2
^ permalink raw reply related
* [PATCH v2 8/9] hyperv: avoid dependency on screen_info
From: Arnd Bergmann @ 2023-07-19 12:39 UTC (permalink / raw)
To: linux-fbdev, Thomas Zimmermann, Helge Deller,
Javier Martinez Canillas
Cc: Arnd Bergmann, David S. Miller, K. Y. Srinivasan, Ard Biesheuvel,
Borislav Petkov, Brian Cain, Catalin Marinas, Christophe Leroy,
Daniel Vetter, Dave Hansen, David Airlie, Deepak Rawat,
Dexuan Cui, Dinh Nguyen, Greg Kroah-Hartman, Guo Ren,
Haiyang Zhang, Huacai Chen, Ingo Molnar,
John Paul Adrian Glaubitz, Khalid Aziz, Linus Walleij,
Matt Turner, Max Filippov, Michael Ellerman, Nicholas Piggin,
Palmer Dabbelt, Russell King, Thomas Bogendoerfer,
Thomas Gleixner, WANG Xuerui, Wei Liu, Will Deacon, x86,
linux-alpha, linux-kernel, linux-arm-kernel, linux-efi,
linux-csky, linux-hexagon, linux-ia64, loongarch, linux-mips,
linuxppc-dev, linux-riscv, linux-sh, sparclinux, linux-hyperv,
dri-devel
In-Reply-To: <20230719123944.3438363-1-arnd@kernel.org>
From: Arnd Bergmann <arnd@arndb.de>
The two hyperv framebuffer drivers (hyperv_fb or hyperv_drm_drv) access the
global screen_info in order to take over from the sysfb framebuffer, which
in turn could be handled by simplefb, simpledrm or efifb. Similarly, the
vmbus_drv code marks the original EFI framebuffer as reserved, but this
is not required if there is no sysfb.
As a preparation for making screen_info itself more local to the sysfb
helper code, add a compile-time conditional in all three files that relate
to hyperv fb and just skip this code if there is no sysfb that needs to
be unregistered.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/gpu/drm/hyperv/hyperv_drm_drv.c | 7 ++++---
drivers/hv/vmbus_drv.c | 6 ++++--
drivers/video/fbdev/hyperv_fb.c | 8 ++++----
3 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
index 8026118c6e033..9a44a00effc24 100644
--- a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
+++ b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
@@ -73,9 +73,10 @@ static int hyperv_setup_vram(struct hyperv_drm_device *hv,
struct drm_device *dev = &hv->dev;
int ret;
- drm_aperture_remove_conflicting_framebuffers(screen_info.lfb_base,
- screen_info.lfb_size,
- &hyperv_driver);
+ if (IS_ENABLED(CONFIG_SYSFB))
+ drm_aperture_remove_conflicting_framebuffers(screen_info.lfb_base,
+ screen_info.lfb_size,
+ &hyperv_driver);
hv->fb_size = (unsigned long)hv->mmio_megabytes * 1024 * 1024;
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 67f95a29aeca5..5bc059e8a9f5f 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -2100,8 +2100,10 @@ static void __maybe_unused vmbus_reserve_fb(void)
if (efi_enabled(EFI_BOOT)) {
/* Gen2 VM: get FB base from EFI framebuffer */
- start = screen_info.lfb_base;
- size = max_t(__u32, screen_info.lfb_size, 0x800000);
+ if (IS_ENABLED(CONFIG_SYSFB)) {
+ start = screen_info.lfb_base;
+ size = max_t(__u32, screen_info.lfb_size, 0x800000);
+ }
} else {
/* Gen1 VM: get FB base from PCI */
pdev = pci_get_device(PCI_VENDOR_ID_MICROSOFT,
diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c
index b331452aab4fb..7e0d1c4235549 100644
--- a/drivers/video/fbdev/hyperv_fb.c
+++ b/drivers/video/fbdev/hyperv_fb.c
@@ -1030,7 +1030,7 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info)
goto getmem_done;
}
pr_info("Unable to allocate enough contiguous physical memory on Gen 1 VM. Using MMIO instead.\n");
- } else {
+ } else if (IS_ENABLED(CONFIG_SYSFB)) {
base = screen_info.lfb_base;
size = screen_info.lfb_size;
}
@@ -1076,13 +1076,13 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info)
getmem_done:
aperture_remove_conflicting_devices(base, size, KBUILD_MODNAME);
- if (gen2vm) {
+ if (!gen2vm) {
+ pci_dev_put(pdev);
+ } else if (IS_ENABLED(CONFIG_SYSFB)) {
/* framebuffer is reallocated, clear screen_info to avoid misuse from kexec */
screen_info.lfb_size = 0;
screen_info.lfb_base = 0;
screen_info.orig_video_isVGA = 0;
- } else {
- pci_dev_put(pdev);
}
return 0;
--
2.39.2
^ permalink raw reply related
* [PATCH v2 7/9] vga16fb: drop powerpc support
From: Arnd Bergmann @ 2023-07-19 12:39 UTC (permalink / raw)
To: linux-fbdev, Thomas Zimmermann, Helge Deller,
Javier Martinez Canillas
Cc: Arnd Bergmann, David S. Miller, K. Y. Srinivasan, Ard Biesheuvel,
Borislav Petkov, Brian Cain, Catalin Marinas, Christophe Leroy,
Daniel Vetter, Dave Hansen, David Airlie, Deepak Rawat,
Dexuan Cui, Dinh Nguyen, Greg Kroah-Hartman, Guo Ren,
Haiyang Zhang, Huacai Chen, Ingo Molnar,
John Paul Adrian Glaubitz, Khalid Aziz, Linus Walleij,
Matt Turner, Max Filippov, Michael Ellerman, Nicholas Piggin,
Palmer Dabbelt, Russell King, Thomas Bogendoerfer,
Thomas Gleixner, WANG Xuerui, Wei Liu, Will Deacon, x86,
linux-alpha, linux-kernel, linux-arm-kernel, linux-efi,
linux-csky, linux-hexagon, linux-ia64, loongarch, linux-mips,
linuxppc-dev, linux-riscv, linux-sh, sparclinux, linux-hyperv,
dri-devel
In-Reply-To: <20230719123944.3438363-1-arnd@kernel.org>
From: Arnd Bergmann <arnd@arndb.de>
I noticed that commit 0db5b61e0dc07 ("fbdev/vga16fb: Create
EGA/VGA devices in sysfb code") broke vga16fb on non-x86 platforms,
because the sysfb code never creates a vga-framebuffer device when
screen_info.orig_video_isVGA is set to '1' instead of VIDEO_TYPE_VGAC.
However, it turns out that the only architecture that has allowed
building vga16fb in the past 20 years is powerpc, and this only worked
on two 32-bit platforms and never on 64-bit powerpc. The last machine
that actually used this was removed in linux-3.10, so this is all dead
code and can be removed.
The big-endian support in vga16fb.c could also be removed, but I'd just
leave this in place.
Fixes: 933ee7119fb14 ("powerpc: remove PReP platform")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/powerpc/kernel/setup-common.c | 16 ----------------
drivers/video/fbdev/Kconfig | 2 +-
drivers/video/fbdev/vga16fb.c | 9 +--------
3 files changed, 2 insertions(+), 25 deletions(-)
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index d2a446216444f..81a6313927228 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -22,7 +22,6 @@
#include <linux/seq_file.h>
#include <linux/ioport.h>
#include <linux/console.h>
-#include <linux/screen_info.h>
#include <linux/root_dev.h>
#include <linux/cpu.h>
#include <linux/unistd.h>
@@ -98,21 +97,6 @@ int boot_cpu_hwid = -1;
int dcache_bsize;
int icache_bsize;
-/*
- * This still seems to be needed... -- paulus
- */
-struct screen_info screen_info = {
- .orig_x = 0,
- .orig_y = 25,
- .orig_video_cols = 80,
- .orig_video_lines = 25,
- .orig_video_isVGA = 1,
- .orig_video_points = 16
-};
-#if defined(CONFIG_FB_VGA16_MODULE)
-EXPORT_SYMBOL(screen_info);
-#endif
-
/* Variables required to store legacy IO irq routing */
int of_i8042_kbd_irq;
EXPORT_SYMBOL_GPL(of_i8042_kbd_irq);
diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index 9169ee532baf7..ebc3cdfdfca07 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -368,7 +368,7 @@ config FB_IMSTT
config FB_VGA16
tristate "VGA 16-color graphics support"
- depends on FB && (X86 || PPC)
+ depends on FB && X86
select APERTURE_HELPERS
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
diff --git a/drivers/video/fbdev/vga16fb.c b/drivers/video/fbdev/vga16fb.c
index 34d00347ad58a..8e28f9dd19044 100644
--- a/drivers/video/fbdev/vga16fb.c
+++ b/drivers/video/fbdev/vga16fb.c
@@ -185,8 +185,6 @@ static inline void setindex(int index)
/* Check if the video mode is supported by the driver */
static inline int check_mode_supported(const struct screen_info *si)
{
- /* non-x86 architectures treat orig_video_isVGA as a boolean flag */
-#if defined(CONFIG_X86)
/* only EGA and VGA in 16 color graphic mode are supported */
if (si->orig_video_isVGA != VIDEO_TYPE_EGAC &&
si->orig_video_isVGA != VIDEO_TYPE_VGAC)
@@ -197,7 +195,7 @@ static inline int check_mode_supported(const struct screen_info *si)
si->orig_video_mode != 0x10 && /* 640x350/4 (EGA) */
si->orig_video_mode != 0x12) /* 640x480/4 (VGA) */
return -ENODEV;
-#endif
+
return 0;
}
@@ -1338,12 +1336,7 @@ static int vga16fb_probe(struct platform_device *dev)
printk(KERN_INFO "vga16fb: mapped to 0x%p\n", info->screen_base);
par = info->par;
-#if defined(CONFIG_X86)
par->isVGA = si->orig_video_isVGA == VIDEO_TYPE_VGAC;
-#else
- /* non-x86 architectures treat orig_video_isVGA as a boolean flag */
- par->isVGA = si->orig_video_isVGA;
-#endif
par->palette_blanked = 0;
par->vesa_blanked = 0;
--
2.39.2
^ permalink raw reply related
* [PATCH v2 6/9] vgacon: clean up global screen_info instances
From: Arnd Bergmann @ 2023-07-19 12:39 UTC (permalink / raw)
To: linux-fbdev, Thomas Zimmermann, Helge Deller,
Javier Martinez Canillas
Cc: Arnd Bergmann, David S. Miller, K. Y. Srinivasan, Ard Biesheuvel,
Borislav Petkov, Brian Cain, Catalin Marinas, Christophe Leroy,
Daniel Vetter, Dave Hansen, David Airlie, Deepak Rawat,
Dexuan Cui, Dinh Nguyen, Greg Kroah-Hartman, Guo Ren,
Haiyang Zhang, Huacai Chen, Ingo Molnar,
John Paul Adrian Glaubitz, Khalid Aziz, Linus Walleij,
Matt Turner, Max Filippov, Michael Ellerman, Nicholas Piggin,
Palmer Dabbelt, Russell King, Thomas Bogendoerfer,
Thomas Gleixner, WANG Xuerui, Wei Liu, Will Deacon, x86,
linux-alpha, linux-kernel, linux-arm-kernel, linux-efi,
linux-csky, linux-hexagon, linux-ia64, loongarch, linux-mips,
linuxppc-dev, linux-riscv, linux-sh, sparclinux, linux-hyperv,
dri-devel
In-Reply-To: <20230719123944.3438363-1-arnd@kernel.org>
From: Arnd Bergmann <arnd@arndb.de>
To prepare for completely separating the VGA console screen_info from
the one used in EFI/sysfb, rename the vgacon instances and make them
local as much as possible.
ia64 and arm both have confurations with vgacon and efi, but the contents
never overlaps because ia64 has no EFI framebuffer, and arm only has
vga console on legacy platforms without EFI. Renaming these is required
before the EFI screen_info can be moved into drivers/firmware.
The ia64 vga console is actually registered in two places from
setup_arch(), but one of them is wrong, so drop the one in pcdp.c and
the fix the one in setup.c to use the correct conditional.
x86 has to keep them together, as the boot protocol is used to switch
between VGA text console and framebuffer through the screen_info data.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/alpha/kernel/proto.h | 2 ++
arch/alpha/kernel/setup.c | 6 ++--
arch/alpha/kernel/sys_sio.c | 6 ++--
arch/arm/include/asm/setup.h | 5 ++++
arch/arm/kernel/atags_parse.c | 18 ++++++------
arch/arm/kernel/efi.c | 6 ----
arch/arm/kernel/setup.c | 10 +++++--
arch/ia64/kernel/setup.c | 49 +++++++++++++++----------------
arch/mips/kernel/setup.c | 11 -------
arch/mips/mti-malta/malta-setup.c | 4 ++-
arch/mips/sibyte/swarm/setup.c | 24 ++++++++-------
arch/mips/sni/setup.c | 16 +++++-----
drivers/firmware/pcdp.c | 1 -
13 files changed, 78 insertions(+), 80 deletions(-)
diff --git a/arch/alpha/kernel/proto.h b/arch/alpha/kernel/proto.h
index 5816a31c1b386..2c89c1c557129 100644
--- a/arch/alpha/kernel/proto.h
+++ b/arch/alpha/kernel/proto.h
@@ -1,5 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0 */
#include <linux/interrupt.h>
+#include <linux/screen_info.h>
#include <linux/io.h>
/* Prototypes of functions used across modules here in this directory. */
@@ -113,6 +114,7 @@ extern int boot_cpuid;
#ifdef CONFIG_VERBOSE_MCHECK
extern unsigned long alpha_verbose_mcheck;
#endif
+extern struct screen_info vgacon_screen_info;
/* srmcons.c */
#if defined(CONFIG_ALPHA_GENERIC) || defined(CONFIG_ALPHA_SRM)
diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c
index d73b685fe9852..7b35af2ed2787 100644
--- a/arch/alpha/kernel/setup.c
+++ b/arch/alpha/kernel/setup.c
@@ -138,7 +138,7 @@ static char __initdata command_line[COMMAND_LINE_SIZE];
* code think we're on a VGA color display.
*/
-struct screen_info screen_info = {
+struct screen_info vgacon_screen_info = {
.orig_x = 0,
.orig_y = 25,
.orig_video_cols = 80,
@@ -146,8 +146,6 @@ struct screen_info screen_info = {
.orig_video_isVGA = 1,
.orig_video_points = 16
};
-
-EXPORT_SYMBOL(screen_info);
#endif
/*
@@ -655,7 +653,7 @@ setup_arch(char **cmdline_p)
#ifdef CONFIG_VT
#if defined(CONFIG_VGA_CONSOLE)
- vgacon_register_screen(&screen_info);
+ vgacon_register_screen(&vgacon_screen_info);
#endif
#endif
diff --git a/arch/alpha/kernel/sys_sio.c b/arch/alpha/kernel/sys_sio.c
index 7de8a5d2d2066..086488ed83a7f 100644
--- a/arch/alpha/kernel/sys_sio.c
+++ b/arch/alpha/kernel/sys_sio.c
@@ -60,9 +60,9 @@ alphabook1_init_arch(void)
#ifdef CONFIG_VGA_CONSOLE
/* The AlphaBook1 has LCD video fixed at 800x600,
37 rows and 100 cols. */
- screen_info.orig_y = 37;
- screen_info.orig_video_cols = 100;
- screen_info.orig_video_lines = 37;
+ vgacon_screen_info.orig_y = 37;
+ vgacon_screen_info.orig_video_cols = 100;
+ vgacon_screen_info.orig_video_lines = 37;
#endif
lca_init_arch();
diff --git a/arch/arm/include/asm/setup.h b/arch/arm/include/asm/setup.h
index 546af8b1e3f65..cc106f946c691 100644
--- a/arch/arm/include/asm/setup.h
+++ b/arch/arm/include/asm/setup.h
@@ -11,6 +11,7 @@
#ifndef __ASMARM_SETUP_H
#define __ASMARM_SETUP_H
+#include <linux/screen_info.h>
#include <uapi/asm/setup.h>
@@ -35,4 +36,8 @@ void early_mm_init(const struct machine_desc *);
void adjust_lowmem_bounds(void);
void setup_dma_zone(const struct machine_desc *desc);
+#ifdef CONFIG_VGA_CONSOLE
+extern struct screen_info vgacon_screen_info;
+#endif
+
#endif
diff --git a/arch/arm/kernel/atags_parse.c b/arch/arm/kernel/atags_parse.c
index 4c815da3b77b0..4ec591bde3dfa 100644
--- a/arch/arm/kernel/atags_parse.c
+++ b/arch/arm/kernel/atags_parse.c
@@ -72,15 +72,15 @@ __tagtable(ATAG_MEM, parse_tag_mem32);
#if defined(CONFIG_ARCH_FOOTBRIDGE) && defined(CONFIG_VGA_CONSOLE)
static int __init parse_tag_videotext(const struct tag *tag)
{
- screen_info.orig_x = tag->u.videotext.x;
- screen_info.orig_y = tag->u.videotext.y;
- screen_info.orig_video_page = tag->u.videotext.video_page;
- screen_info.orig_video_mode = tag->u.videotext.video_mode;
- screen_info.orig_video_cols = tag->u.videotext.video_cols;
- screen_info.orig_video_ega_bx = tag->u.videotext.video_ega_bx;
- screen_info.orig_video_lines = tag->u.videotext.video_lines;
- screen_info.orig_video_isVGA = tag->u.videotext.video_isvga;
- screen_info.orig_video_points = tag->u.videotext.video_points;
+ vgacon_screen_info.orig_x = tag->u.videotext.x;
+ vgacon_screen_info.orig_y = tag->u.videotext.y;
+ vgacon_screen_info.orig_video_page = tag->u.videotext.video_page;
+ vgacon_screen_info.orig_video_mode = tag->u.videotext.video_mode;
+ vgacon_screen_info.orig_video_cols = tag->u.videotext.video_cols;
+ vgacon_screen_info.orig_video_ega_bx = tag->u.videotext.video_ega_bx;
+ vgacon_screen_info.orig_video_lines = tag->u.videotext.video_lines;
+ vgacon_screen_info.orig_video_isVGA = tag->u.videotext.video_isvga;
+ vgacon_screen_info.orig_video_points = tag->u.videotext.video_points;
return 0;
}
diff --git a/arch/arm/kernel/efi.c b/arch/arm/kernel/efi.c
index e94655ef16bb3..6f9ec7d28a710 100644
--- a/arch/arm/kernel/efi.c
+++ b/arch/arm/kernel/efi.c
@@ -123,12 +123,6 @@ void __init arm_efi_init(void)
{
efi_init();
- if (screen_info.orig_video_isVGA == VIDEO_TYPE_EFI) {
- /* dummycon on ARM needs non-zero values for columns/lines */
- screen_info.orig_video_cols = 80;
- screen_info.orig_video_lines = 25;
- }
-
/* ARM does not permit early mappings to persist across paging_init() */
efi_memmap_unmap();
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 5d8a7fb3eba45..86c2751f56dcf 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -928,8 +928,8 @@ static void __init request_standard_resources(const struct machine_desc *mdesc)
request_resource(&ioport_resource, &lp2);
}
-#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_EFI)
-struct screen_info screen_info = {
+#if defined(CONFIG_VGA_CONSOLE)
+static struct screen_info vgacon_screen_info = {
.orig_video_lines = 30,
.orig_video_cols = 80,
.orig_video_mode = 0,
@@ -939,6 +939,10 @@ struct screen_info screen_info = {
};
#endif
+#if defined(CONFIG_EFI)
+struct screen_info screen_info;
+#endif
+
static int __init customize_machine(void)
{
/*
@@ -1192,7 +1196,7 @@ void __init setup_arch(char **cmdline_p)
#ifdef CONFIG_VT
#if defined(CONFIG_VGA_CONSOLE)
- vgacon_register_screen(&screen_info);
+ vgacon_register_screen(&vgacon_screen_info);
#endif
#endif
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index 2c9283fcd3759..82feae1323f40 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -86,7 +86,8 @@ EXPORT_SYMBOL(local_per_cpu_offset);
#endif
unsigned long ia64_cycles_per_usec;
struct ia64_boot_param *ia64_boot_param;
-#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_EFI)
+#if defined(CONFIG_EFI)
+/* No longer used on ia64, but needed for linking */
struct screen_info screen_info;
#endif
#ifdef CONFIG_VGA_CONSOLE
@@ -503,8 +504,9 @@ screen_info_setup(void)
{
#ifdef CONFIG_VGA_CONSOLE
unsigned int orig_x, orig_y, num_cols, num_rows, font_height;
+ static struct screen_info si;
- memset(&screen_info, 0, sizeof(screen_info));
+ memset(&si, 0, sizeof(si));
if (!ia64_boot_param->console_info.num_rows ||
!ia64_boot_param->console_info.num_cols) {
@@ -522,14 +524,26 @@ screen_info_setup(void)
font_height = 400 / num_rows;
}
- screen_info.orig_x = orig_x;
- screen_info.orig_y = orig_y;
- screen_info.orig_video_cols = num_cols;
- screen_info.orig_video_lines = num_rows;
- screen_info.orig_video_points = font_height;
- screen_info.orig_video_mode = 3; /* XXX fake */
- screen_info.orig_video_isVGA = 1; /* XXX fake */
- screen_info.orig_video_ega_bx = 3; /* XXX fake */
+ si.orig_x = orig_x;
+ si.orig_y = orig_y;
+ si.orig_video_cols = num_cols;
+ si.orig_video_lines = num_rows;
+ si.orig_video_points = font_height;
+ si.orig_video_mode = 3; /* XXX fake */
+ si.orig_video_isVGA = 1; /* XXX fake */
+ si.orig_video_ega_bx = 3; /* XXX fake */
+
+ if (!conswitchp) {
+ /*
+ * Non-legacy systems may route legacy VGA MMIO range to system
+ * memory. vga_con probes the MMIO hole, so memory looks like
+ * a VGA device to it. The EFI memory map can tell us if it's
+ * memory so we can avoid this problem.
+ */
+ if (efi_mem_type(vga_console_membase + 0xA0000) !=
+ EFI_CONVENTIONAL_MEMORY) {
+ vgacon_register_screen(&si);
+ }
#endif
}
@@ -609,21 +623,6 @@ setup_arch (char **cmdline_p)
cpu_init(); /* initialize the bootstrap CPU */
mmu_context_init(); /* initialize context_id bitmap */
-#ifdef CONFIG_VT
- if (!conswitchp) {
-# if defined(CONFIG_VGA_CONSOLE)
- /*
- * Non-legacy systems may route legacy VGA MMIO range to system
- * memory. vga_con probes the MMIO hole, so memory looks like
- * a VGA device to it. The EFI memory map can tell us if it's
- * memory so we can avoid this problem.
- */
- if (efi_mem_type(0xA0000) != EFI_CONVENTIONAL_MEMORY)
- vgacon_register_screen(&screen_info);
-# endif
- }
-#endif
-
/* enable IA-64 Machine Check Abort Handling unless disabled */
if (!nomca)
ia64_mca_init();
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 6c3fae62a9f6b..cae181bbfee10 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -15,7 +15,6 @@
#include <linux/delay.h>
#include <linux/ioport.h>
#include <linux/export.h>
-#include <linux/screen_info.h>
#include <linux/memblock.h>
#include <linux/initrd.h>
#include <linux/root_dev.h>
@@ -54,10 +53,6 @@ struct cpuinfo_mips cpu_data[NR_CPUS] __read_mostly;
EXPORT_SYMBOL(cpu_data);
-#ifdef CONFIG_VGA_CONSOLE
-struct screen_info screen_info;
-#endif
-
/*
* Setup information
*
@@ -792,12 +787,6 @@ void __init setup_arch(char **cmdline_p)
if (IS_ENABLED(CONFIG_CPU_R4X00_BUGS64))
check_bugs64_early();
-#if defined(CONFIG_VT)
-#if defined(CONFIG_VGA_CONSOLE)
- vgacon_register_screen(&screen_info);
-#endif
-#endif
-
arch_mem_init(cmdline_p);
dmi_setup();
diff --git a/arch/mips/mti-malta/malta-setup.c b/arch/mips/mti-malta/malta-setup.c
index 21cb3ac1237b7..3a2836e9d8566 100644
--- a/arch/mips/mti-malta/malta-setup.c
+++ b/arch/mips/mti-malta/malta-setup.c
@@ -161,7 +161,7 @@ static void __init pci_clock_check(void)
#if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE)
static void __init screen_info_setup(void)
{
- screen_info = (struct screen_info) {
+ static struct screen_info si = {
.orig_x = 0,
.orig_y = 25,
.ext_mem_k = 0,
@@ -175,6 +175,8 @@ static void __init screen_info_setup(void)
.orig_video_isVGA = VIDEO_TYPE_VGAC,
.orig_video_points = 16
};
+
+ vgacon_register_screen(&si);
}
#endif
diff --git a/arch/mips/sibyte/swarm/setup.c b/arch/mips/sibyte/swarm/setup.c
index 37df504d3ecbb..74e7c242b6902 100644
--- a/arch/mips/sibyte/swarm/setup.c
+++ b/arch/mips/sibyte/swarm/setup.c
@@ -112,6 +112,19 @@ int update_persistent_clock64(struct timespec64 now)
}
}
+#ifdef CONFIG_VGA_CONSOLE
+static struct screen_info vgacon_screen_info = {
+ .orig_video_page = 52,
+ .orig_video_mode = 3,
+ .orig_video_cols = 80,
+ .flags = 12,
+ .orig_video_ega_bx = 3,
+ .orig_video_lines = 25,
+ .orig_video_isVGA = 0x22,
+ .orig_video_points = 16,
+};
+#endif
+
void __init plat_mem_setup(void)
{
#ifdef CONFIG_SIBYTE_BCM1x80
@@ -130,16 +143,7 @@ void __init plat_mem_setup(void)
swarm_rtc_type = RTC_M41T81;
#ifdef CONFIG_VGA_CONSOLE
- screen_info = (struct screen_info) {
- .orig_video_page = 52,
- .orig_video_mode = 3,
- .orig_video_cols = 80,
- .flags = 12,
- .orig_video_ega_bx = 3,
- .orig_video_lines = 25,
- .orig_video_isVGA = 0x22,
- .orig_video_points = 16,
- };
+ vgacon_register_screen(&vgacon_screen_info);
/* XXXKW for CFE, get lines/cols from environment */
#endif
}
diff --git a/arch/mips/sni/setup.c b/arch/mips/sni/setup.c
index 9984cf91be7d0..42fdb939c88d8 100644
--- a/arch/mips/sni/setup.c
+++ b/arch/mips/sni/setup.c
@@ -39,18 +39,20 @@ extern void sni_machine_power_off(void);
static void __init sni_display_setup(void)
{
#if defined(CONFIG_VGA_CONSOLE) && defined(CONFIG_FW_ARC)
- struct screen_info *si = &screen_info;
+ static struct screen_info si;
DISPLAY_STATUS *di;
di = ArcGetDisplayStatus(1);
if (di) {
- si->orig_x = di->CursorXPosition;
- si->orig_y = di->CursorYPosition;
- si->orig_video_cols = di->CursorMaxXPosition;
- si->orig_video_lines = di->CursorMaxYPosition;
- si->orig_video_isVGA = VIDEO_TYPE_VGAC;
- si->orig_video_points = 16;
+ si.orig_x = di->CursorXPosition;
+ si.orig_y = di->CursorYPosition;
+ si.orig_video_cols = di->CursorMaxXPosition;
+ si.orig_video_lines = di->CursorMaxYPosition;
+ si.orig_video_isVGA = VIDEO_TYPE_VGAC;
+ si.orig_video_points = 16;
+
+ vgacon_register_screen(&si);
}
#endif
}
diff --git a/drivers/firmware/pcdp.c b/drivers/firmware/pcdp.c
index 667a595373b2d..876b3e9b37e25 100644
--- a/drivers/firmware/pcdp.c
+++ b/drivers/firmware/pcdp.c
@@ -72,7 +72,6 @@ setup_vga_console(struct pcdp_device *dev)
return -ENODEV;
}
- vgacon_register_screen(&screen_info);
printk(KERN_INFO "PCDP: VGA console\n");
return 0;
#else
--
2.39.2
^ permalink raw reply related
* [PATCH v2 5/9] vgacon: remove screen_info dependency
From: Arnd Bergmann @ 2023-07-19 12:39 UTC (permalink / raw)
To: linux-fbdev, Thomas Zimmermann, Helge Deller,
Javier Martinez Canillas
Cc: Arnd Bergmann, David S. Miller, K. Y. Srinivasan, Ard Biesheuvel,
Borislav Petkov, Brian Cain, Catalin Marinas, Christophe Leroy,
Daniel Vetter, Dave Hansen, David Airlie, Deepak Rawat,
Dexuan Cui, Dinh Nguyen, Greg Kroah-Hartman, Guo Ren,
Haiyang Zhang, Huacai Chen, Ingo Molnar,
John Paul Adrian Glaubitz, Khalid Aziz, Linus Walleij,
Matt Turner, Max Filippov, Michael Ellerman, Nicholas Piggin,
Palmer Dabbelt, Russell King, Thomas Bogendoerfer,
Thomas Gleixner, WANG Xuerui, Wei Liu, Will Deacon, x86,
linux-alpha, linux-kernel, linux-arm-kernel, linux-efi,
linux-csky, linux-hexagon, linux-ia64, loongarch, linux-mips,
linuxppc-dev, linux-riscv, linux-sh, sparclinux, linux-hyperv,
dri-devel
In-Reply-To: <20230719123944.3438363-1-arnd@kernel.org>
From: Arnd Bergmann <arnd@arndb.de>
The vga console driver is fairly self-contained, and only used by
architectures that explicitly initialize the screen_info settings.
Chance every instance that picks the vga console by setting conswitchp
to call a function instead, and pass a reference to the screen_info
there.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/alpha/kernel/setup.c | 2 +-
arch/arm/kernel/setup.c | 2 +-
arch/ia64/kernel/setup.c | 2 +-
arch/mips/kernel/setup.c | 2 +-
arch/x86/kernel/setup.c | 2 +-
drivers/firmware/pcdp.c | 2 +-
drivers/video/console/vgacon.c | 68 ++++++++++++++++++++--------------
include/linux/console.h | 7 ++++
8 files changed, 53 insertions(+), 34 deletions(-)
diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c
index b4d2297765c02..d73b685fe9852 100644
--- a/arch/alpha/kernel/setup.c
+++ b/arch/alpha/kernel/setup.c
@@ -655,7 +655,7 @@ setup_arch(char **cmdline_p)
#ifdef CONFIG_VT
#if defined(CONFIG_VGA_CONSOLE)
- conswitchp = &vga_con;
+ vgacon_register_screen(&screen_info);
#endif
#endif
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 40326a35a179b..5d8a7fb3eba45 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -1192,7 +1192,7 @@ void __init setup_arch(char **cmdline_p)
#ifdef CONFIG_VT
#if defined(CONFIG_VGA_CONSOLE)
- conswitchp = &vga_con;
+ vgacon_register_screen(&screen_info);
#endif
#endif
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index d2c66efdde560..2c9283fcd3759 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -619,7 +619,7 @@ setup_arch (char **cmdline_p)
* memory so we can avoid this problem.
*/
if (efi_mem_type(0xA0000) != EFI_CONVENTIONAL_MEMORY)
- conswitchp = &vga_con;
+ vgacon_register_screen(&screen_info);
# endif
}
#endif
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 1aba7dc95132c..6c3fae62a9f6b 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -794,7 +794,7 @@ void __init setup_arch(char **cmdline_p)
#if defined(CONFIG_VT)
#if defined(CONFIG_VGA_CONSOLE)
- conswitchp = &vga_con;
+ vgacon_register_screen(&screen_info);
#endif
#endif
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index fd975a4a52006..b1ea77d504615 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -1293,7 +1293,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))
- conswitchp = &vga_con;
+ vgacon_register_screen(&screen_info);
#endif
#endif
x86_init.oem.banner();
diff --git a/drivers/firmware/pcdp.c b/drivers/firmware/pcdp.c
index 715a45442d1cf..667a595373b2d 100644
--- a/drivers/firmware/pcdp.c
+++ b/drivers/firmware/pcdp.c
@@ -72,7 +72,7 @@ setup_vga_console(struct pcdp_device *dev)
return -ENODEV;
}
- conswitchp = &vga_con;
+ vgacon_register_screen(&screen_info);
printk(KERN_INFO "PCDP: VGA console\n");
return 0;
#else
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index e25ba523892e5..3d7fedf27ffc1 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -97,6 +97,8 @@ static int vga_video_font_height;
static int vga_scan_lines __read_mostly;
static unsigned int vga_rolled_over; /* last vc_origin offset before wrap */
+static struct screen_info *vga_si;
+
static bool vga_hardscroll_enabled;
static bool vga_hardscroll_user_enable = true;
@@ -161,8 +163,9 @@ static const char *vgacon_startup(void)
u16 saved1, saved2;
volatile u16 *p;
- if (screen_info.orig_video_isVGA == VIDEO_TYPE_VLFB ||
- screen_info.orig_video_isVGA == VIDEO_TYPE_EFI) {
+ if (!vga_si ||
+ vga_si->orig_video_isVGA == VIDEO_TYPE_VLFB ||
+ vga_si->orig_video_isVGA == VIDEO_TYPE_EFI) {
no_vga:
#ifdef CONFIG_DUMMY_CONSOLE
conswitchp = &dummy_con;
@@ -172,29 +175,29 @@ static const char *vgacon_startup(void)
#endif
}
- /* boot_params.screen_info reasonably initialized? */
- if ((screen_info.orig_video_lines == 0) ||
- (screen_info.orig_video_cols == 0))
+ /* vga_si reasonably initialized? */
+ if ((vga_si->orig_video_lines == 0) ||
+ (vga_si->orig_video_cols == 0))
goto no_vga;
/* VGA16 modes are not handled by VGACON */
- if ((screen_info.orig_video_mode == 0x0D) || /* 320x200/4 */
- (screen_info.orig_video_mode == 0x0E) || /* 640x200/4 */
- (screen_info.orig_video_mode == 0x10) || /* 640x350/4 */
- (screen_info.orig_video_mode == 0x12) || /* 640x480/4 */
- (screen_info.orig_video_mode == 0x6A)) /* 800x600/4 (VESA) */
+ if ((vga_si->orig_video_mode == 0x0D) || /* 320x200/4 */
+ (vga_si->orig_video_mode == 0x0E) || /* 640x200/4 */
+ (vga_si->orig_video_mode == 0x10) || /* 640x350/4 */
+ (vga_si->orig_video_mode == 0x12) || /* 640x480/4 */
+ (vga_si->orig_video_mode == 0x6A)) /* 800x600/4 (VESA) */
goto no_vga;
- vga_video_num_lines = screen_info.orig_video_lines;
- vga_video_num_columns = screen_info.orig_video_cols;
+ vga_video_num_lines = vga_si->orig_video_lines;
+ vga_video_num_columns = vga_si->orig_video_cols;
vgastate.vgabase = NULL;
- if (screen_info.orig_video_mode == 7) {
+ if (vga_si->orig_video_mode == 7) {
/* Monochrome display */
vga_vram_base = 0xb0000;
vga_video_port_reg = VGA_CRT_IM;
vga_video_port_val = VGA_CRT_DM;
- if ((screen_info.orig_video_ega_bx & 0xff) != 0x10) {
+ if ((vga_si->orig_video_ega_bx & 0xff) != 0x10) {
static struct resource ega_console_resource =
{ .name = "ega",
.flags = IORESOURCE_IO,
@@ -231,12 +234,12 @@ static const char *vgacon_startup(void)
vga_vram_base = 0xb8000;
vga_video_port_reg = VGA_CRT_IC;
vga_video_port_val = VGA_CRT_DC;
- if ((screen_info.orig_video_ega_bx & 0xff) != 0x10) {
+ if ((vga_si->orig_video_ega_bx & 0xff) != 0x10) {
int i;
vga_vram_size = 0x8000;
- if (!screen_info.orig_video_isVGA) {
+ if (!vga_si->orig_video_isVGA) {
static struct resource ega_console_resource =
{ .name = "ega",
.flags = IORESOURCE_IO,
@@ -327,14 +330,14 @@ static const char *vgacon_startup(void)
|| vga_video_type == VIDEO_TYPE_VGAC
|| vga_video_type == VIDEO_TYPE_EGAM) {
vga_hardscroll_enabled = vga_hardscroll_user_enable;
- vga_default_font_height = screen_info.orig_video_points;
- vga_video_font_height = screen_info.orig_video_points;
+ vga_default_font_height = vga_si->orig_video_points;
+ vga_video_font_height = vga_si->orig_video_points;
/* This may be suboptimal but is a safe bet - go with it */
vga_scan_lines =
vga_video_font_height * vga_video_num_lines;
}
- vgacon_xres = screen_info.orig_video_cols * VGA_FONTWIDTH;
+ vgacon_xres = vga_si->orig_video_cols * VGA_FONTWIDTH;
vgacon_yres = vga_scan_lines;
return display_desc;
@@ -379,7 +382,7 @@ static void vgacon_init(struct vc_data *c, int init)
/* Only set the default if the user didn't deliberately override it */
if (global_cursor_default == -1)
global_cursor_default =
- !(screen_info.flags & VIDEO_FLAGS_NOCURSOR);
+ !(vga_si->flags & VIDEO_FLAGS_NOCURSOR);
}
static void vgacon_deinit(struct vc_data *c)
@@ -607,7 +610,7 @@ static int vgacon_switch(struct vc_data *c)
{
int x = c->vc_cols * VGA_FONTWIDTH;
int y = c->vc_rows * c->vc_cell_height;
- int rows = screen_info.orig_video_lines * vga_default_font_height/
+ int rows = vga_si->orig_video_lines * vga_default_font_height/
c->vc_cell_height;
/*
* We need to save screen size here as it's the only way
@@ -627,7 +630,7 @@ static int vgacon_switch(struct vc_data *c)
if ((vgacon_xres != x || vgacon_yres != y) &&
(!(vga_video_num_columns % 2) &&
- vga_video_num_columns <= screen_info.orig_video_cols &&
+ vga_video_num_columns <= vga_si->orig_video_cols &&
vga_video_num_lines <= rows))
vgacon_doresize(c, c->vc_cols, c->vc_rows);
}
@@ -1074,13 +1077,13 @@ static int vgacon_resize(struct vc_data *c, unsigned int width,
* Ho ho! Someone (svgatextmode, eh?) may have reprogrammed
* the video mode! Set the new defaults then and go away.
*/
- screen_info.orig_video_cols = width;
- screen_info.orig_video_lines = height;
+ vga_si->orig_video_cols = width;
+ vga_si->orig_video_lines = height;
vga_default_font_height = c->vc_cell_height;
return 0;
}
- if (width % 2 || width > screen_info.orig_video_cols ||
- height > (screen_info.orig_video_lines * vga_default_font_height)/
+ if (width % 2 || width > vga_si->orig_video_cols ||
+ height > (vga_si->orig_video_lines * vga_default_font_height)/
c->vc_cell_height)
return -EINVAL;
@@ -1110,8 +1113,8 @@ static void vgacon_save_screen(struct vc_data *c)
* console initialization routines.
*/
vga_bootup_console = 1;
- c->state.x = screen_info.orig_x;
- c->state.y = screen_info.orig_y;
+ c->state.x = vga_si->orig_x;
+ c->state.y = vga_si->orig_y;
}
/* We can't copy in more than the size of the video buffer,
@@ -1204,4 +1207,13 @@ const struct consw vga_con = {
};
EXPORT_SYMBOL(vga_con);
+void vgacon_register_screen(struct screen_info *si)
+{
+ if (!si || vga_si)
+ return;
+
+ conswitchp = &vga_con;
+ vga_si = si;
+}
+
MODULE_LICENSE("GPL");
diff --git a/include/linux/console.h b/include/linux/console.h
index d3195664baa5a..5f900210e689e 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -101,6 +101,13 @@ extern const struct consw dummy_con; /* dummy console buffer */
extern const struct consw vga_con; /* VGA text console */
extern const struct consw newport_con; /* SGI Newport console */
+struct screen_info;
+#ifdef CONFIG_VGA_CONSOLE
+void vgacon_register_screen(struct screen_info *si);
+#else
+static inline void vgacon_register_screen(struct screen_info *si) { }
+#endif
+
int con_is_bound(const struct consw *csw);
int do_unregister_con_driver(const struct consw *csw);
int do_take_over_console(const struct consw *sw, int first, int last, int deflt);
--
2.39.2
^ permalink raw reply related
* [PATCH v2 4/9] vgacon, arch/*: remove unused screen_info definitions
From: Arnd Bergmann @ 2023-07-19 12:39 UTC (permalink / raw)
To: linux-fbdev, Thomas Zimmermann, Helge Deller,
Javier Martinez Canillas
Cc: Arnd Bergmann, David S. Miller, K. Y. Srinivasan, Ard Biesheuvel,
Borislav Petkov, Brian Cain, Catalin Marinas, Christophe Leroy,
Daniel Vetter, Dave Hansen, David Airlie, Deepak Rawat,
Dexuan Cui, Dinh Nguyen, Greg Kroah-Hartman, Guo Ren,
Haiyang Zhang, Huacai Chen, Ingo Molnar,
John Paul Adrian Glaubitz, Khalid Aziz, Linus Walleij,
Matt Turner, Max Filippov, Michael Ellerman, Nicholas Piggin,
Palmer Dabbelt, Russell King, Thomas Bogendoerfer,
Thomas Gleixner, WANG Xuerui, Wei Liu, Will Deacon, x86,
linux-alpha, linux-kernel, linux-arm-kernel, linux-efi,
linux-csky, linux-hexagon, linux-ia64, loongarch, linux-mips,
linuxppc-dev, linux-riscv, linux-sh, sparclinux, linux-hyperv,
dri-devel, Palmer Dabbelt
In-Reply-To: <20230719123944.3438363-1-arnd@kernel.org>
From: Arnd Bergmann <arnd@arndb.de>
A number of architectures either kept the screen_info definition for
historical purposes as it used to be required by the generic VT code, or
they copied it from another architecture in order to build the VGA console
driver in an allmodconfig build. The mips definition is used by some
platforms, but the initialization on jazz is not needed.
Now that vgacon no longer builds on these architectures, remove the
stale definitions and initializations.
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Dinh Nguyen <dinguyen@kernel.org>
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
Acked-by: Guo Ren <guoren@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/csky/kernel/setup.c | 12 ------------
arch/hexagon/kernel/Makefile | 2 --
arch/hexagon/kernel/screen_info.c | 3 ---
arch/mips/jazz/setup.c | 9 ---------
arch/nios2/kernel/setup.c | 5 -----
arch/sh/kernel/setup.c | 5 -----
arch/sparc/kernel/setup_32.c | 13 -------------
arch/sparc/kernel/setup_64.c | 13 -------------
arch/xtensa/kernel/setup.c | 12 ------------
9 files changed, 74 deletions(-)
delete mode 100644 arch/hexagon/kernel/screen_info.c
diff --git a/arch/csky/kernel/setup.c b/arch/csky/kernel/setup.c
index 106fbf0b6f3b4..51012e90780d6 100644
--- a/arch/csky/kernel/setup.c
+++ b/arch/csky/kernel/setup.c
@@ -8,22 +8,10 @@
#include <linux/of_fdt.h>
#include <linux/start_kernel.h>
#include <linux/dma-map-ops.h>
-#include <linux/screen_info.h>
#include <asm/sections.h>
#include <asm/mmu_context.h>
#include <asm/pgalloc.h>
-#ifdef CONFIG_DUMMY_CONSOLE
-struct screen_info screen_info = {
- .orig_video_lines = 30,
- .orig_video_cols = 80,
- .orig_video_mode = 0,
- .orig_video_ega_bx = 0,
- .orig_video_isVGA = 1,
- .orig_video_points = 8
-};
-#endif
-
static void __init csky_memblock_init(void)
{
unsigned long lowmem_size = PFN_DOWN(LOWMEM_LIMIT - PHYS_OFFSET_OFFSET);
diff --git a/arch/hexagon/kernel/Makefile b/arch/hexagon/kernel/Makefile
index e73cb321630ec..3fdf937eb572e 100644
--- a/arch/hexagon/kernel/Makefile
+++ b/arch/hexagon/kernel/Makefile
@@ -17,5 +17,3 @@ obj-y += vm_vectors.o
obj-$(CONFIG_HAS_DMA) += dma.o
obj-$(CONFIG_STACKTRACE) += stacktrace.o
-
-obj-$(CONFIG_VGA_CONSOLE) += screen_info.o
diff --git a/arch/hexagon/kernel/screen_info.c b/arch/hexagon/kernel/screen_info.c
deleted file mode 100644
index 1e1ceb18bafe7..0000000000000
--- a/arch/hexagon/kernel/screen_info.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <linux/screen_info.h>
-
-struct screen_info screen_info;
diff --git a/arch/mips/jazz/setup.c b/arch/mips/jazz/setup.c
index ee044261eb223..23059ead773fc 100644
--- a/arch/mips/jazz/setup.c
+++ b/arch/mips/jazz/setup.c
@@ -13,7 +13,6 @@
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/console.h>
-#include <linux/screen_info.h>
#include <linux/platform_device.h>
#include <linux/serial_8250.h>
#include <linux/dma-mapping.h>
@@ -76,14 +75,6 @@ void __init plat_mem_setup(void)
_machine_restart = jazz_machine_restart;
-#ifdef CONFIG_VT
- screen_info = (struct screen_info) {
- .orig_video_cols = 160,
- .orig_video_lines = 64,
- .orig_video_points = 16,
- };
-#endif
-
add_preferred_console("ttyS", 0, "9600");
}
diff --git a/arch/nios2/kernel/setup.c b/arch/nios2/kernel/setup.c
index 8582ed9658447..da122a5fa43b2 100644
--- a/arch/nios2/kernel/setup.c
+++ b/arch/nios2/kernel/setup.c
@@ -19,7 +19,6 @@
#include <linux/memblock.h>
#include <linux/initrd.h>
#include <linux/of_fdt.h>
-#include <linux/screen_info.h>
#include <asm/mmu_context.h>
#include <asm/sections.h>
@@ -36,10 +35,6 @@ static struct pt_regs fake_regs = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0};
-#ifdef CONFIG_VT
-struct screen_info screen_info;
-#endif
-
/* Copy a short hook instruction sequence to the exception address */
static inline void copy_exception_handler(unsigned int addr)
{
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index b3da2757faaf3..3d80515298d26 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -7,7 +7,6 @@
* Copyright (C) 1999 Niibe Yutaka
* Copyright (C) 2002 - 2010 Paul Mundt
*/
-#include <linux/screen_info.h>
#include <linux/ioport.h>
#include <linux/init.h>
#include <linux/initrd.h>
@@ -69,10 +68,6 @@ EXPORT_SYMBOL(cpu_data);
struct sh_machine_vector sh_mv = { .mv_name = "generic", };
EXPORT_SYMBOL(sh_mv);
-#ifdef CONFIG_VT
-struct screen_info screen_info;
-#endif
-
extern int root_mountflags;
#define RAMDISK_IMAGE_START_MASK 0x07FF
diff --git a/arch/sparc/kernel/setup_32.c b/arch/sparc/kernel/setup_32.c
index 34ef7febf0d56..e3b72a7b46d37 100644
--- a/arch/sparc/kernel/setup_32.c
+++ b/arch/sparc/kernel/setup_32.c
@@ -17,7 +17,6 @@
#include <linux/initrd.h>
#include <asm/smp.h>
#include <linux/user.h>
-#include <linux/screen_info.h>
#include <linux/delay.h>
#include <linux/fs.h>
#include <linux/seq_file.h>
@@ -51,18 +50,6 @@
#include "kernel.h"
-struct screen_info screen_info = {
- 0, 0, /* orig-x, orig-y */
- 0, /* unused */
- 0, /* orig-video-page */
- 0, /* orig-video-mode */
- 128, /* orig-video-cols */
- 0,0,0, /* ega_ax, ega_bx, ega_cx */
- 54, /* orig-video-lines */
- 0, /* orig-video-isVGA */
- 16 /* orig-video-points */
-};
-
/* Typing sync at the prom prompt calls the function pointed to by
* romvec->pv_synchook which I set to the following function.
* This should sync all filesystems and return, for now it just
diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c
index 6546ca9d4d3f1..6a4797dec34b4 100644
--- a/arch/sparc/kernel/setup_64.c
+++ b/arch/sparc/kernel/setup_64.c
@@ -15,7 +15,6 @@
#include <linux/ptrace.h>
#include <asm/smp.h>
#include <linux/user.h>
-#include <linux/screen_info.h>
#include <linux/delay.h>
#include <linux/fs.h>
#include <linux/seq_file.h>
@@ -68,18 +67,6 @@
DEFINE_SPINLOCK(ns87303_lock);
EXPORT_SYMBOL(ns87303_lock);
-struct screen_info screen_info = {
- 0, 0, /* orig-x, orig-y */
- 0, /* unused */
- 0, /* orig-video-page */
- 0, /* orig-video-mode */
- 128, /* orig-video-cols */
- 0, 0, 0, /* unused, ega_bx, unused */
- 54, /* orig-video-lines */
- 0, /* orig-video-isVGA */
- 16 /* orig-video-points */
-};
-
static void
prom_console_write(struct console *con, const char *s, unsigned int n)
{
diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c
index aba3ff4e60d85..3f22d0537818d 100644
--- a/arch/xtensa/kernel/setup.c
+++ b/arch/xtensa/kernel/setup.c
@@ -19,7 +19,6 @@
#include <linux/init.h>
#include <linux/mm.h>
#include <linux/proc_fs.h>
-#include <linux/screen_info.h>
#include <linux/kernel.h>
#include <linux/percpu.h>
#include <linux/reboot.h>
@@ -49,17 +48,6 @@
#include <asm/timex.h>
#include <asm/traps.h>
-#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE)
-struct screen_info screen_info = {
- .orig_x = 0,
- .orig_y = 24,
- .orig_video_cols = 80,
- .orig_video_lines = 24,
- .orig_video_isVGA = 1,
- .orig_video_points = 16,
-};
-#endif
-
#ifdef CONFIG_BLK_DEV_INITRD
extern unsigned long initrd_start;
extern unsigned long initrd_end;
--
2.39.2
^ permalink raw reply related
* [PATCH v2 3/9] dummycon: limit Arm console size hack to footbridge
From: Arnd Bergmann @ 2023-07-19 12:39 UTC (permalink / raw)
To: linux-fbdev, Thomas Zimmermann, Helge Deller,
Javier Martinez Canillas
Cc: Arnd Bergmann, David S. Miller, K. Y. Srinivasan, Ard Biesheuvel,
Borislav Petkov, Brian Cain, Catalin Marinas, Christophe Leroy,
Daniel Vetter, Dave Hansen, David Airlie, Deepak Rawat,
Dexuan Cui, Dinh Nguyen, Greg Kroah-Hartman, Guo Ren,
Haiyang Zhang, Huacai Chen, Ingo Molnar,
John Paul Adrian Glaubitz, Khalid Aziz, Linus Walleij,
Matt Turner, Max Filippov, Michael Ellerman, Nicholas Piggin,
Palmer Dabbelt, Russell King, Thomas Bogendoerfer,
Thomas Gleixner, WANG Xuerui, Wei Liu, Will Deacon, x86,
linux-alpha, linux-kernel, linux-arm-kernel, linux-efi,
linux-csky, linux-hexagon, linux-ia64, loongarch, linux-mips,
linuxppc-dev, linux-riscv, linux-sh, sparclinux, linux-hyperv,
dri-devel
In-Reply-To: <20230719123944.3438363-1-arnd@kernel.org>
From: Arnd Bergmann <arnd@arndb.de>
The dummycon default console size used to be determined by architecture,
but now this is a Kconfig setting on everything except ARM. Tracing this
back in the historic git trees, this was used to match the size of VGA
console or VGA framebuffer on early machines, but nowadays that code is
no longer used, except probably on the old footbridge/netwinder since
that is the only one that supports vgacon.
On machines with a framebuffer, booting with DT so far results in always
using the hardcoded 80x30 size in dummycon, while on ATAGS the setting
can come from a bootloader specific override. Both seem to be worse
choices than the Kconfig setting, since the actual text size for fbcon
also depends on the selected font.
Make this work the same way as everywhere else and use the normal
Kconfig setting, except for the footbridge with vgacon, which keeps
using the traditional code. If vgacon is disabled, footbridge can
also ignore the setting. This means the screen_info only has to be
provided when either vgacon or EFI are enabled now.
To limit the amount of surprises on Arm, change the Kconfig default
to the previously used 80x30 setting instead of the usual 80x25.
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/arm/kernel/atags_parse.c | 2 +-
arch/arm/kernel/setup.c | 3 +--
drivers/video/console/Kconfig | 5 +++--
drivers/video/console/dummycon.c | 2 +-
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/arch/arm/kernel/atags_parse.c b/arch/arm/kernel/atags_parse.c
index 33f6eb5213a5a..4c815da3b77b0 100644
--- a/arch/arm/kernel/atags_parse.c
+++ b/arch/arm/kernel/atags_parse.c
@@ -69,7 +69,7 @@ static int __init parse_tag_mem32(const struct tag *tag)
__tagtable(ATAG_MEM, parse_tag_mem32);
-#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE)
+#if defined(CONFIG_ARCH_FOOTBRIDGE) && defined(CONFIG_VGA_CONSOLE)
static int __init parse_tag_videotext(const struct tag *tag)
{
screen_info.orig_x = tag->u.videotext.x;
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index c66b560562b30..40326a35a179b 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -928,8 +928,7 @@ static void __init request_standard_resources(const struct machine_desc *mdesc)
request_resource(&ioport_resource, &lp2);
}
-#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE) || \
- defined(CONFIG_EFI)
+#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_EFI)
struct screen_info screen_info = {
.orig_video_lines = 30,
.orig_video_cols = 80,
diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig
index 6af90db6d2da9..b575cf54174af 100644
--- a/drivers/video/console/Kconfig
+++ b/drivers/video/console/Kconfig
@@ -52,7 +52,7 @@ config DUMMY_CONSOLE
config DUMMY_CONSOLE_COLUMNS
int "Initial number of console screen columns"
- depends on DUMMY_CONSOLE && !ARM
+ depends on DUMMY_CONSOLE && !ARCH_FOOTBRIDGE
default 160 if PARISC
default 80
help
@@ -62,8 +62,9 @@ config DUMMY_CONSOLE_COLUMNS
config DUMMY_CONSOLE_ROWS
int "Initial number of console screen rows"
- depends on DUMMY_CONSOLE && !ARM
+ depends on DUMMY_CONSOLE && !ARCH_FOOTBRIDGE
default 64 if PARISC
+ default 30 if ARM
default 25
help
On PA-RISC, the default value is 64, which should fit a 1280x1024
diff --git a/drivers/video/console/dummycon.c b/drivers/video/console/dummycon.c
index f1711b2f9ff05..70549fecee12c 100644
--- a/drivers/video/console/dummycon.c
+++ b/drivers/video/console/dummycon.c
@@ -18,7 +18,7 @@
* Dummy console driver
*/
-#if defined(__arm__)
+#if defined(CONFIG_ARCH_FOOTBRIDGE) && defined(CONFIG_VGA_CONSOLE)
#define DUMMY_COLUMNS screen_info.orig_video_cols
#define DUMMY_ROWS screen_info.orig_video_lines
#else
--
2.39.2
^ permalink raw reply related
* [PATCH v2 2/9] vgacon: rework screen_info #ifdef checks
From: Arnd Bergmann @ 2023-07-19 12:39 UTC (permalink / raw)
To: linux-fbdev, Thomas Zimmermann, Helge Deller,
Javier Martinez Canillas
Cc: Arnd Bergmann, David S. Miller, K. Y. Srinivasan, Ard Biesheuvel,
Borislav Petkov, Brian Cain, Catalin Marinas, Christophe Leroy,
Daniel Vetter, Dave Hansen, David Airlie, Deepak Rawat,
Dexuan Cui, Dinh Nguyen, Greg Kroah-Hartman, Guo Ren,
Haiyang Zhang, Huacai Chen, Ingo Molnar,
John Paul Adrian Glaubitz, Khalid Aziz, Linus Walleij,
Matt Turner, Max Filippov, Michael Ellerman, Nicholas Piggin,
Palmer Dabbelt, Russell King, Thomas Bogendoerfer,
Thomas Gleixner, WANG Xuerui, Wei Liu, Will Deacon, x86,
linux-alpha, linux-kernel, linux-arm-kernel, linux-efi,
linux-csky, linux-hexagon, linux-ia64, loongarch, linux-mips,
linuxppc-dev, linux-riscv, linux-sh, sparclinux, linux-hyperv,
dri-devel
In-Reply-To: <20230719123944.3438363-1-arnd@kernel.org>
From: Arnd Bergmann <arnd@arndb.de>
On non-x86 architectures, the screen_info variable is generally only
used for the VGA console where supported, and in some cases the EFI
framebuffer or vga16fb.
Now that we have a definite list of which architectures actually use it
for what, use consistent #ifdef checks so the global variable is only
defined when it is actually used on those architectures.
Loongarch and riscv have no support for vgacon or vga16fb, but
they support EFI firmware, so only that needs to be checked, and the
initialization can be removed because that is handled by EFI.
IA64 has both vgacon and EFI, though EFI apparently never uses
a framebuffer here.
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
v2 changes:
- split out mips/jazz change
- improve ia64 #ifdef changes
---
arch/alpha/kernel/setup.c | 2 ++
arch/alpha/kernel/sys_sio.c | 2 ++
arch/ia64/kernel/setup.c | 6 ++++++
arch/loongarch/kernel/setup.c | 2 ++
arch/mips/kernel/setup.c | 2 +-
arch/mips/sibyte/swarm/setup.c | 2 +-
arch/mips/sni/setup.c | 2 +-
arch/riscv/kernel/setup.c | 11 ++---------
8 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c
index b650ff1cb022e..b4d2297765c02 100644
--- a/arch/alpha/kernel/setup.c
+++ b/arch/alpha/kernel/setup.c
@@ -131,6 +131,7 @@ static void determine_cpu_caches (unsigned int);
static char __initdata command_line[COMMAND_LINE_SIZE];
+#ifdef CONFIG_VGA_CONSOLE
/*
* The format of "screen_info" is strange, and due to early
* i386-setup code. This is just enough to make the console
@@ -147,6 +148,7 @@ struct screen_info screen_info = {
};
EXPORT_SYMBOL(screen_info);
+#endif
/*
* The direct map I/O window, if any. This should be the same
diff --git a/arch/alpha/kernel/sys_sio.c b/arch/alpha/kernel/sys_sio.c
index 7c420d8dac53d..7de8a5d2d2066 100644
--- a/arch/alpha/kernel/sys_sio.c
+++ b/arch/alpha/kernel/sys_sio.c
@@ -57,11 +57,13 @@ sio_init_irq(void)
static inline void __init
alphabook1_init_arch(void)
{
+#ifdef CONFIG_VGA_CONSOLE
/* The AlphaBook1 has LCD video fixed at 800x600,
37 rows and 100 cols. */
screen_info.orig_y = 37;
screen_info.orig_video_cols = 100;
screen_info.orig_video_lines = 37;
+#endif
lca_init_arch();
}
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index 5a55ac82c13a4..d2c66efdde560 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -86,9 +86,13 @@ EXPORT_SYMBOL(local_per_cpu_offset);
#endif
unsigned long ia64_cycles_per_usec;
struct ia64_boot_param *ia64_boot_param;
+#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_EFI)
struct screen_info screen_info;
+#endif
+#ifdef CONFIG_VGA_CONSOLE
unsigned long vga_console_iobase;
unsigned long vga_console_membase;
+#endif
static struct resource data_resource = {
.name = "Kernel data",
@@ -497,6 +501,7 @@ early_console_setup (char *cmdline)
static void __init
screen_info_setup(void)
{
+#ifdef CONFIG_VGA_CONSOLE
unsigned int orig_x, orig_y, num_cols, num_rows, font_height;
memset(&screen_info, 0, sizeof(screen_info));
@@ -525,6 +530,7 @@ screen_info_setup(void)
screen_info.orig_video_mode = 3; /* XXX fake */
screen_info.orig_video_isVGA = 1; /* XXX fake */
screen_info.orig_video_ega_bx = 3; /* XXX fake */
+#endif
}
static inline void
diff --git a/arch/loongarch/kernel/setup.c b/arch/loongarch/kernel/setup.c
index 95e6b579dfdd1..77e7a3722caa6 100644
--- a/arch/loongarch/kernel/setup.c
+++ b/arch/loongarch/kernel/setup.c
@@ -57,7 +57,9 @@
#define SMBIOS_CORE_PACKAGE_OFFSET 0x23
#define LOONGSON_EFI_ENABLE (1 << 3)
+#ifdef CONFIG_EFI
struct screen_info screen_info __section(".data");
+#endif
unsigned long fw_arg0, fw_arg1, fw_arg2;
DEFINE_PER_CPU(unsigned long, kernelsp);
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index cb871eb784a7c..1aba7dc95132c 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -54,7 +54,7 @@ struct cpuinfo_mips cpu_data[NR_CPUS] __read_mostly;
EXPORT_SYMBOL(cpu_data);
-#ifdef CONFIG_VT
+#ifdef CONFIG_VGA_CONSOLE
struct screen_info screen_info;
#endif
diff --git a/arch/mips/sibyte/swarm/setup.c b/arch/mips/sibyte/swarm/setup.c
index 76683993cdd3a..37df504d3ecbb 100644
--- a/arch/mips/sibyte/swarm/setup.c
+++ b/arch/mips/sibyte/swarm/setup.c
@@ -129,7 +129,7 @@ void __init plat_mem_setup(void)
if (m41t81_probe())
swarm_rtc_type = RTC_M41T81;
-#ifdef CONFIG_VT
+#ifdef CONFIG_VGA_CONSOLE
screen_info = (struct screen_info) {
.orig_video_page = 52,
.orig_video_mode = 3,
diff --git a/arch/mips/sni/setup.c b/arch/mips/sni/setup.c
index efad85c8c823b..9984cf91be7d0 100644
--- a/arch/mips/sni/setup.c
+++ b/arch/mips/sni/setup.c
@@ -38,7 +38,7 @@ extern void sni_machine_power_off(void);
static void __init sni_display_setup(void)
{
-#if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE) && defined(CONFIG_FW_ARC)
+#if defined(CONFIG_VGA_CONSOLE) && defined(CONFIG_FW_ARC)
struct screen_info *si = &screen_info;
DISPLAY_STATUS *di;
diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
index 971fe776e2f8b..a3dbe13f45fb3 100644
--- a/arch/riscv/kernel/setup.c
+++ b/arch/riscv/kernel/setup.c
@@ -39,15 +39,8 @@
#include "head.h"
-#if defined(CONFIG_DUMMY_CONSOLE) || defined(CONFIG_EFI)
-struct screen_info screen_info __section(".data") = {
- .orig_video_lines = 30,
- .orig_video_cols = 80,
- .orig_video_mode = 0,
- .orig_video_ega_bx = 0,
- .orig_video_isVGA = 1,
- .orig_video_points = 8
-};
+#if defined(CONFIG_EFI)
+struct screen_info screen_info __section(".data");
#endif
/*
--
2.39.2
^ permalink raw reply related
* [PATCH v2 1/9] vgacon: rework Kconfig dependencies
From: Arnd Bergmann @ 2023-07-19 12:39 UTC (permalink / raw)
To: linux-fbdev, Thomas Zimmermann, Helge Deller,
Javier Martinez Canillas
Cc: Arnd Bergmann, David S. Miller, K. Y. Srinivasan, Ard Biesheuvel,
Borislav Petkov, Brian Cain, Catalin Marinas, Christophe Leroy,
Daniel Vetter, Dave Hansen, David Airlie, Deepak Rawat,
Dexuan Cui, Dinh Nguyen, Greg Kroah-Hartman, Guo Ren,
Haiyang Zhang, Huacai Chen, Ingo Molnar,
John Paul Adrian Glaubitz, Khalid Aziz, Linus Walleij,
Matt Turner, Max Filippov, Michael Ellerman, Nicholas Piggin,
Palmer Dabbelt, Russell King, Thomas Bogendoerfer,
Thomas Gleixner, WANG Xuerui, Wei Liu, Will Deacon, x86,
linux-alpha, linux-kernel, linux-arm-kernel, linux-efi,
linux-csky, linux-hexagon, linux-ia64, loongarch, linux-mips,
linuxppc-dev, linux-riscv, linux-sh, sparclinux, linux-hyperv,
dri-devel
In-Reply-To: <20230719123944.3438363-1-arnd@kernel.org>
From: Arnd Bergmann <arnd@arndb.de>
The list of dependencies here is phrased as an opt-out, but this is missing
a lot of architectures that don't actually support VGA consoles, and some
of the entries are stale:
- powerpc used to support VGA consoles in the old arch/ppc codebase, but
the merged arch/powerpc never did
- arm lists footbridge, integrator and netwinder, but netwinder is actually
part of footbridge, and integrator does not appear to have an actual
VGA hardware, or list it in its ATAG or DT.
- mips has a few platforms (malta, sibyte, and sni) that initialize
screen_info, on everything else the console is selected but cannot
actually work.
- csky, hexgagon, loongarch, nios2, riscv and xtensa are not listed
in the opt-out table and declare a screen_info to allow building
vga_con, but this cannot work because the console is never selected.
Replace this with an opt-in table that lists only the platforms that
remain. This is effectively x86, plus a couple of historic workstation
and server machines that reused parts of the x86 system architecture.
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/video/console/Kconfig | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig
index 1b5a319971ed0..6af90db6d2da9 100644
--- a/drivers/video/console/Kconfig
+++ b/drivers/video/console/Kconfig
@@ -7,9 +7,9 @@ menu "Console display driver support"
config VGA_CONSOLE
bool "VGA text console" if EXPERT || !X86
- depends on !4xx && !PPC_8xx && !SPARC && !M68K && !PARISC && !SUPERH && \
- (!ARM || ARCH_FOOTBRIDGE || ARCH_INTEGRATOR || ARCH_NETWINDER) && \
- !ARM64 && !ARC && !MICROBLAZE && !OPENRISC && !S390 && !UML
+ depends on ALPHA || IA64 || X86 || \
+ (ARM && ARCH_FOOTBRIDGE) || \
+ (MIPS && (MIPS_MALTA || SIBYTE_BCM112X || SIBYTE_SB1250 || SIBYTE_BCM1x80 || SNI_RM))
select APERTURE_HELPERS if (DRM || FB || VFIO_PCI_CORE)
default y
help
--
2.39.2
^ permalink raw reply related
* [PATCH v2 0/9] video: screen_info cleanups
From: Arnd Bergmann @ 2023-07-19 12:39 UTC (permalink / raw)
To: linux-fbdev, Thomas Zimmermann, Helge Deller,
Javier Martinez Canillas
Cc: Arnd Bergmann, David S. Miller, K. Y. Srinivasan, Ard Biesheuvel,
Borislav Petkov, Brian Cain, Catalin Marinas, Christophe Leroy,
Daniel Vetter, Dave Hansen, David Airlie, Deepak Rawat,
Dexuan Cui, Dinh Nguyen, Greg Kroah-Hartman, Guo Ren,
Haiyang Zhang, Huacai Chen, Ingo Molnar,
John Paul Adrian Glaubitz, Khalid Aziz, Linus Walleij,
Matt Turner, Max Filippov, Michael Ellerman, Nicholas Piggin,
Palmer Dabbelt, Russell King, Thomas Bogendoerfer,
Thomas Gleixner, WANG Xuerui, Wei Liu, Will Deacon, x86,
linux-alpha, linux-kernel, linux-arm-kernel, linux-efi,
linux-csky, linux-hexagon, linux-ia64, loongarch, linux-mips,
linuxppc-dev, linux-riscv, linux-sh, sparclinux, linux-hyperv,
dri-devel
From: Arnd Bergmann <arnd@arndb.de>
I refreshed the first four patches that I sent before with very minor
updates, and then added some more to further disaggregate the use
of screen_info:
- I found that powerpc wasn't using vga16fb any more
- vgacon can be almost entirely separated from the global
screen_info, except on x86
- similarly, the EFI framebuffer initialization can be
kept separate, except on x86.
I did extensive build testing on arm/arm64/x86 and the normal built bot
testing for the other architectures.
Which tree should this get merged through?
Link: https://lore.kernel.org/lkml/20230707095415.1449376-1-arnd@kernel.org/
Arnd Bergmann (9):
vgacon: rework Kconfig dependencies
vgacon: rework screen_info #ifdef checks
dummycon: limit Arm console size hack to footbridge
vgacon, arch/*: remove unused screen_info definitions
vgacon: remove screen_info dependency
vgacon: clean up global screen_info instances
vga16fb: drop powerpc support
hyperv: avoid dependency on screen_info
efi: move screen_info into efi init code
arch/alpha/kernel/proto.h | 2 +
arch/alpha/kernel/setup.c | 8 +--
arch/alpha/kernel/sys_sio.c | 8 ++-
arch/arm/include/asm/setup.h | 5 ++
arch/arm/kernel/atags_parse.c | 20 +++---
arch/arm/kernel/efi.c | 6 --
arch/arm/kernel/setup.c | 7 +-
arch/arm64/kernel/efi.c | 4 --
arch/arm64/kernel/image-vars.h | 2 +
arch/csky/kernel/setup.c | 12 ----
arch/hexagon/kernel/Makefile | 2 -
arch/hexagon/kernel/screen_info.c | 3 -
arch/ia64/kernel/setup.c | 51 +++++++-------
arch/loongarch/kernel/efi.c | 3 +-
arch/loongarch/kernel/image-vars.h | 2 +
arch/loongarch/kernel/setup.c | 3 -
arch/mips/jazz/setup.c | 9 ---
arch/mips/kernel/setup.c | 11 ---
arch/mips/mti-malta/malta-setup.c | 4 +-
arch/mips/sibyte/swarm/setup.c | 26 ++++---
arch/mips/sni/setup.c | 18 ++---
arch/nios2/kernel/setup.c | 5 --
arch/powerpc/kernel/setup-common.c | 16 -----
arch/riscv/kernel/setup.c | 12 ----
arch/sh/kernel/setup.c | 5 --
arch/sparc/kernel/setup_32.c | 13 ----
arch/sparc/kernel/setup_64.c | 13 ----
arch/x86/kernel/setup.c | 2 +-
arch/xtensa/kernel/setup.c | 12 ----
drivers/firmware/efi/efi-init.c | 14 +++-
drivers/firmware/efi/libstub/efi-stub-entry.c | 8 ++-
drivers/firmware/pcdp.c | 1 -
drivers/gpu/drm/hyperv/hyperv_drm_drv.c | 7 +-
drivers/hv/vmbus_drv.c | 6 +-
drivers/video/console/Kconfig | 11 +--
drivers/video/console/dummycon.c | 2 +-
drivers/video/console/vgacon.c | 68 +++++++++++--------
drivers/video/fbdev/Kconfig | 2 +-
drivers/video/fbdev/hyperv_fb.c | 8 +--
drivers/video/fbdev/vga16fb.c | 9 +--
include/linux/console.h | 7 ++
41 files changed, 178 insertions(+), 249 deletions(-)
delete mode 100644 arch/hexagon/kernel/screen_info.c
--
2.39.2
Cc: "David S. Miller" <davem@davemloft.net>
Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Cain <bcain@quicinc.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Deepak Rawat <drawat.floss@gmail.com>
Cc: Dexuan Cui <decui@microsoft.com>
Cc: Dinh Nguyen <dinguyen@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Guo Ren <guoren@kernel.org>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Helge Deller <deller@gmx.de>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Javier Martinez Canillas <javierm@redhat.com>
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Cc: Khalid Aziz <khalid@gonehiking.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: WANG Xuerui <kernel@xen0n.name>
Cc: Wei Liu <wei.liu@kernel.org>
Cc: Will Deacon <will@kernel.org>
Cc: x86@kernel.org
Cc: linux-alpha@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-efi@vger.kernel.org
Cc: linux-csky@vger.kernel.org
Cc: linux-hexagon@vger.kernel.org
Cc: linux-ia64@vger.kernel.org
Cc: loongarch@lists.linux.dev
Cc: linux-mips@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-riscv@lists.infradead.org
Cc: linux-sh@vger.kernel.org
Cc: sparclinux@vger.kernel.org
Cc: linux-hyperv@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: linux-fbdev@vger.kernel.org
^ permalink raw reply
* Re: [PATCH 07/12] arch/x86: Declare edid_info in <asm/screen_info.h>
From: Arnd Bergmann @ 2023-07-18 14:47 UTC (permalink / raw)
To: Thomas Zimmermann, Helge Deller, Daniel Vetter, Dave Airlie
Cc: linux-hyperv, linux-efi, linux-ia64, linux-sh, Peter Zijlstra,
Dave Hansen, linux-fbdev, dri-devel, linux-mips, H. Peter Anvin,
sparclinux, linux-riscv, Ard Biesheuvel, Linux-Arch,
linux-hexagon, linux-staging, linux-csky@vger.kernel.org,
Ingo Molnar, Sami Tolvanen, Kees Cook, Paul E. McKenney,
Frederic Weisbecker, Nicholas Piggin, Borislav Petkov, loongarch,
Thomas Gleixner, linux-arm-kernel, x86, linux-kernel,
Juerg Haefliger, linux-alpha, Andrew Morton, linuxppc-dev
In-Reply-To: <150c0fa2-bff2-0644-d6e5-c4dab7f79048@suse.de>
On Wed, Jul 5, 2023, at 10:18, Thomas Zimmermann wrote:
> Am 30.06.23 um 13:53 schrieb Arnd Bergmann:
>> On Fri, Jun 30, 2023, at 09:46, Thomas Zimmermann wrote:
>>> Am 29.06.23 um 15:21 schrieb Arnd Bergmann:
>>
>> I definitely get it for the screen_info, which needs the complexity.
>> For ARCHARCH_HAS_EDID_INFO I would hope that it's never selected by
>> anything other than x86, so I would still go with just a dependency
>> on x86 for simplicity, but I don't mind having the extra symbol if that
>> keeps it more consistent with how the screen_info is handled.
>
> Well, I'd like to add edid_info to platforms with EFI. What would be
> arm/arm64 and loongarch, I guess. See below for the future plans.
To be clear: I don't mind using a 'struct edid_info' being passed
around between subsystems, that is clearly an improvement over
'struct screen_info'. It's the global variable that seems like
an artifact of linux-2.4 days, and I think we can do better than that.
>>>> I suppose you could use FIRMWARE_EDID on EFI or OF systems without
>>>> the need for a global edid_info structure, but that would not
>>>> share any code with the current fb_firmware_edid() function.
>>>
>>> The current code is build on top of screen_info and edid_info. I'd
>>> preferably not replace that, if possible.
>>
>> One way I could imagine this looking in the end would be
>> something like
>>
>> struct screen_info *fb_screen_info(struct device *dev)
>> {
>> struct screen_info *si = NULL;
>>
>> if (IS_ENABLED(CONFIG_EFI))
>> si = efi_get_screen_info(dev);
>>
>> if (IS_ENABLED(CONFIG_ARCH_HAS_SCREEN_INFO) && !si)
>> si = screen_info;
>>
>> return si;
>> }
>>
>> corresponding to fb_firmware_edid(). With this, any driver
>> that wants to access screen_info would call this function
>> instead of using the global pointer, plus either NULL pointer
>> check or a CONFIG_ARCH_HAS_SCREEN_INFO dependency.
>>
>> This way we could completely eliminate the global screen_info
>> on arm64, riscv, and loongarch but still use the efi and
>> hyperv framebuffer/drm drivers.
>
> If possible, I'd like to remove global screen_info and edid_info
> entirely from fbdev and the various consoles.
ok
> We currently use screen_info to set up the generic framebuffer device in
> drivers/firmware/sysfb.c. I'd like to use edid_info here as well, so
> that the generic graphics drivers can get EDID information.
>
> For the few fbdev drivers and consoles that require the global
> screen_info/edid_info, I'd rather provide lookup functions in sysfb
> (e.g., sysfb_get_screen_info(), sysfb_get_edid_info()). The global
> screen_info/edid_info state would then become an internal artifact of
> the sysfb code.
>
> Hopefully that explains some of the decisions made in this patchset.
I spent some more time looking at the screen_info side, after my
first set of patches to refine the #ifdefs, and I think we don't
even need to make screen_info available to non-x86 drivers at all:
- All the vgacon users except for x86 can just register a static
screen_info (or simplified into a simpler structure) with the
driver itself. This even includes ia64, which does not support
EFI framebuffers.
- The VESA, vga16, SIS, Intel and HyperV framebuffer drivers only
need access to screen_info on x86. HyperV is the only driver that
can currently access the data from EFI firmware on arm64, but
that is only used for 'gen 1' guests, which I'm pretty sure
only exist on x86.
- All the other references to screen_info are specific to EFI
firmware, so we can move the global definition from arm,
arm64, loongarch, riscv and ia64 into the EFI firmware
code itself. It is still accessed by efifb and efi-earlycon
at this point.
I have uploaded version 2 of my series to
https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/log/?h=screen-info-v2
and will send it out after I get the green light from build
bots.
Arnd
^ permalink raw reply
* Re: [PATCH v6 01/21] x86/head_64: Store boot_params pointer in callee save register
From: Borislav Petkov @ 2023-07-18 11:39 UTC (permalink / raw)
To: Ard Biesheuvel
Cc: linux-efi, linux-kernel, Evgeniy Baskov, Andy Lutomirski,
Dave Hansen, Ingo Molnar, Peter Zijlstra, Thomas Gleixner,
Alexey Khoroshilov, Peter Jones, Gerd Hoffmann, Dave Young,
Mario Limonciello, Kees Cook, Tom Lendacky, Kirill A . Shutemov,
Linus Torvalds, Joerg Roedel
In-Reply-To: <20230711091453.2543622-2-ardb@kernel.org>
On Tue, Jul 11, 2023 at 11:14:33AM +0200, Ard Biesheuvel wrote:
> Instead of pushing/popping %RSI to/from the stack every time a function
> is called from startup_64(), store it in callee preserved register R15
> and grab it from there when its value is actually needed.
>
> Secondary boot does not and should not care about the value of %RSI at
> entry, and all the C handlers except the primary boot C entrypoint all
> ignore the function arguments entirely. Avoid inadvertent surprises by
> zeroing R15 on the secondary boot path explicitly.
>
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> ---
> arch/x86/kernel/head_64.S | 23 +++++---------------
> 1 file changed, 5 insertions(+), 18 deletions(-)
LGTM.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply
* Re: [RFC PATCH v2] x86/boot: add .sbat section to the bzImage
From: Daniel P. Berrangé @ 2023-07-17 18:16 UTC (permalink / raw)
To: James Bottomley
Cc: Ard Biesheuvel, Emanuele Giuseppe Esposito, x86, Thomas Gleixner,
bluca, lennart, Ingo Molnar, Borislav Petkov, Dave Hansen,
H. Peter Anvin, Andrew Morton, Masahiro Yamada,
Alexander Potapenko, Nick Desaulniers, Vitaly Kuznetsov,
linux-kernel, linux-efi
In-Reply-To: <0aa647f719103e8620d7209cbde40f04a7334749.camel@HansenPartnership.com>
On Mon, Jul 17, 2023 at 01:15:19PM -0400, James Bottomley wrote:
> On Mon, 2023-07-17 at 17:56 +0100, Daniel P. Berrangé wrote:
> > On Mon, Jul 17, 2023 at 12:08:26PM -0400, James Bottomley wrote:
> > > On Thu, 2023-07-13 at 15:52 +0200, Ard Biesheuvel wrote:
> > > > (add linux-efi@ cc)
> > >
> > > Thanks for that, since this is really EFI related rather than x86.
> >
> > snip
> >
> > > The problem, as I see it, is if the distros give the kernel an
> > > .sbat section, that means any vanilla kernel that's built by a user
> > > and signed by their key now won't work (even if their key is in
> > > MoK) because it won't have an sbat section ... and the sbat
> > > mechanism is component specific, not key specific, so the signer
> > > has no choice but to adopt it.
> >
> > AFAICT, that problem only exists for binaries directly invoked
> > from shim. So that would be a problem for the boot loader (grub),
> > or a kernel image being booted directly without a bootloader
> > present.
>
> Well, currently, yes; that's the in_protocol check in
> shim.c:verify_sbat_section(). However, I was assuming based on this
> thread, that that was being tightened up (either because people are
> moving away from grub or because the shim verifier protocol would
> enforce it) as you imply below.
>
> > For kernel binaries invoked indirectly by the boot loader, the
> > use of SBAT is currently optional. ie missing SBAT record would
> > be treated as success.
> >
> > This was a pragmatic way to introduce SBAT support as it only
> > impacted grub at that time.
> >
> > Once a distro starts adding SBAT to their kenrels too though, we
> > can forsee that they would like to enforce SBAT for the whole
> > boot chain, to prevent rollback to previously signed binaries
> > that lacked SBAT info.
> >
> > This policy could be enforced per key though. eg require SBAT
> > for anything verified against the vendor key that's compiled into
> > shim, but not require SBAT for binaries verified with the MoK
> > entries.
>
> That might work, but it's not currently in the shim code base. It also
> wouldn't work for SUSE I suspect: they actually put all of their distro
> keys into MokList (so the machine owner has to approve any SUSE key
> update), so how can shim tell the difference between my key and their
> key?
Interesting, I didn't know that about SUSE's usage pattern. That
would pretty much require that the SBAT enforcement is configured
per MokList entry, to retain sufficient flexibility for users.
> > The user specific MoK entries don't have such a compelling use
> > case for SBAT, since if they need to revoke old binaries, the
> > end users always have the easy fallback option of just rotating
> > their signing keys and switching out the enrolled key in MoK.
> >
> > The choice of whether to mandate SBAT for binaries signed with
> > a MoK entry, could be set by the end user themselves at the time
> > their enroll their signing cert in the MoK DB.
>
> Well, I agree with this, since it was my original point. However, a
> key observation still seems to be that none of this exception proposal
> is actually coded anywhere, so if shim does tighten up sbat
> verification, everyone currently gets caught by it (and if it doesn't
> then the kernel doesn't need an sbat section).
>
> I really think if this exception proposal is what everyone is planning,
> then you can simply leave the upstream kernel alone, since it won't
> require sbat information unless incorporated into a distro.
I don't know what shim maintainers are planning, this was just an
idea I came up with when thinking through how to enforce SBAT without
making it a pain for users.
> So the direction forward seems to be to get this exception proposal
> coded up and agreed and then we can decide based on that whether the
> upstream kernel needs to care.
Agreed, I think it needs some feedback from the shim maintainers about
a vision for future SBAT enforcement. I'll raise this idea and see
what they say. If we eliminate the need for upstream linux to care
about SBTA that probably makes life easier for everyone.
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply
* Re: [RFC PATCH v2] x86/boot: add .sbat section to the bzImage
From: James Bottomley @ 2023-07-17 17:15 UTC (permalink / raw)
To: Daniel P. Berrangé
Cc: Ard Biesheuvel, Emanuele Giuseppe Esposito, x86, Thomas Gleixner,
bluca, lennart, Ingo Molnar, Borislav Petkov, Dave Hansen,
H. Peter Anvin, Andrew Morton, Masahiro Yamada,
Alexander Potapenko, Nick Desaulniers, Vitaly Kuznetsov,
linux-kernel, linux-efi
In-Reply-To: <ZLVyvAXwtemx1I6p@redhat.com>
On Mon, 2023-07-17 at 17:56 +0100, Daniel P. Berrangé wrote:
> On Mon, Jul 17, 2023 at 12:08:26PM -0400, James Bottomley wrote:
> > On Thu, 2023-07-13 at 15:52 +0200, Ard Biesheuvel wrote:
> > > (add linux-efi@ cc)
> >
> > Thanks for that, since this is really EFI related rather than x86.
>
> snip
>
> > The problem, as I see it, is if the distros give the kernel an
> > .sbat section, that means any vanilla kernel that's built by a user
> > and signed by their key now won't work (even if their key is in
> > MoK) because it won't have an sbat section ... and the sbat
> > mechanism is component specific, not key specific, so the signer
> > has no choice but to adopt it.
>
> AFAICT, that problem only exists for binaries directly invoked
> from shim. So that would be a problem for the boot loader (grub),
> or a kernel image being booted directly without a bootloader
> present.
Well, currently, yes; that's the in_protocol check in
shim.c:verify_sbat_section(). However, I was assuming based on this
thread, that that was being tightened up (either because people are
moving away from grub or because the shim verifier protocol would
enforce it) as you imply below.
> For kernel binaries invoked indirectly by the boot loader, the
> use of SBAT is currently optional. ie missing SBAT record would
> be treated as success.
>
> This was a pragmatic way to introduce SBAT support as it only
> impacted grub at that time.
>
> Once a distro starts adding SBAT to their kenrels too though, we
> can forsee that they would like to enforce SBAT for the whole
> boot chain, to prevent rollback to previously signed binaries
> that lacked SBAT info.
>
> This policy could be enforced per key though. eg require SBAT
> for anything verified against the vendor key that's compiled into
> shim, but not require SBAT for binaries verified with the MoK
> entries.
That might work, but it's not currently in the shim code base. It also
wouldn't work for SUSE I suspect: they actually put all of their distro
keys into MokList (so the machine owner has to approve any SUSE key
update), so how can shim tell the difference between my key and their
key?
> The user specific MoK entries don't have such a compelling use
> case for SBAT, since if they need to revoke old binaries, the
> end users always have the easy fallback option of just rotating
> their signing keys and switching out the enrolled key in MoK.
>
> The choice of whether to mandate SBAT for binaries signed with
> a MoK entry, could be set by the end user themselves at the time
> their enroll their signing cert in the MoK DB.
Well, I agree with this, since it was my original point. However, a
key observation still seems to be that none of this exception proposal
is actually coded anywhere, so if shim does tighten up sbat
verification, everyone currently gets caught by it (and if it doesn't
then the kernel doesn't need an sbat section).
I really think if this exception proposal is what everyone is planning,
then you can simply leave the upstream kernel alone, since it won't
require sbat information unless incorporated into a distro.
So the direction forward seems to be to get this exception proposal
coded up and agreed and then we can decide based on that whether the
upstream kernel needs to care.
James
^ permalink raw reply
* Re: [RFC PATCH v2] x86/boot: add .sbat section to the bzImage
From: Daniel P. Berrangé @ 2023-07-17 16:56 UTC (permalink / raw)
To: James Bottomley
Cc: Ard Biesheuvel, Emanuele Giuseppe Esposito, x86, Thomas Gleixner,
bluca, lennart, Ingo Molnar, Borislav Petkov, Dave Hansen,
H. Peter Anvin, Andrew Morton, Masahiro Yamada,
Alexander Potapenko, Nick Desaulniers, Vitaly Kuznetsov,
linux-kernel, linux-efi
In-Reply-To: <ba2354dc63fd741d2d351b18d4312d0771c0935d.camel@HansenPartnership.com>
On Mon, Jul 17, 2023 at 12:08:26PM -0400, James Bottomley wrote:
> On Thu, 2023-07-13 at 15:52 +0200, Ard Biesheuvel wrote:
> > (add linux-efi@ cc)
>
> Thanks for that, since this is really EFI related rather than x86.
snip
> The problem, as I see it, is if the distros give the kernel an .sbat
> section, that means any vanilla kernel that's built by a user and
> signed by their key now won't work (even if their key is in MoK)
> because it won't have an sbat section ... and the sbat mechanism is
> component specific, not key specific, so the signer has no choice but
> to adopt it.
AFAICT, that problem only exists for binaries directly invoked
from shim. So that would be a problem for the boot loader (grub),
or a kernel image being booted directly without a bootloader
present.
For kernel binaries invoked indirectly by the boot loader, the
use of SBAT is currently optional. ie missing SBAT record would
be treated as success.
This was a pragmatic way to introduce SBAT support as it only
impacted grub at that time.
Once a distro starts adding SBAT to their kenrels too though, we
can forsee that they would like to enforce SBAT for the whole
boot chain, to prevent rollback to previously signed binaries
that lacked SBAT info.
This policy could be enforced per key though. eg require SBAT
for anything verified against the vendor key that's compiled into
shim, but not require SBAT for binaries verified with the MoK
entries.
The user specific MoK entries don't have such a compelling use
case for SBAT, since if they need to revoke old binaries, the
end users always have the easy fallback option of just rotating
their signing keys and switching out the enrolled key in MoK.
The choice of whether to mandate SBAT for binaries signed with
a MoK entry, could be set by the end user themselves at the time
their enroll their signing cert in the MoK DB.
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply
* Re: [RFC PATCH v2] x86/boot: add .sbat section to the bzImage
From: James Bottomley @ 2023-07-17 16:08 UTC (permalink / raw)
To: Ard Biesheuvel, Emanuele Giuseppe Esposito
Cc: x86, Thomas Gleixner, bluca, lennart, Ingo Molnar,
Borislav Petkov, Dave Hansen, H. Peter Anvin, Andrew Morton,
Masahiro Yamada, Alexander Potapenko, Nick Desaulniers,
Vitaly Kuznetsov, Daniel P . Berrangé, linux-kernel,
linux-efi
In-Reply-To: <ZLABozIRVGmwuIBf@gambale.home>
On Thu, 2023-07-13 at 15:52 +0200, Ard Biesheuvel wrote:
> (add linux-efi@ cc)
Thanks for that, since this is really EFI related rather than x86.
> On Thu, Jul 13, 2023 at 03:33:38PM +0200, Ard Biesheuvel wrote:
> > Hello Emanuele,
> >
> > Please cc the linux-efi@ mailing list and myself on EFI related
> > patches.
> >
> > First of all, I think the tone of the discussion is way out of hand
> > on both sides of the debate. Please keep it civil and courteous.
> >
> > On Tue, Jul 11, 2023 at 11:44:49AM -0400, Emanuele Giuseppe
> > Esposito wrote:
> > > *Important*: this is just an RFC, as I am not expert in this area
> > > and I don't know what's the best way to achieve this.
> > >
> > > v2:
> > > * add standard "sbat,1,SBAT Version,..." header string
> > >
> > > The aim of this patch is to add a .sbat section to the linux
> > > binary
> > > (https://github.com/rhboot/shim/blob/main/SBAT.md).
> > > We mainly need SBAT in UKIs (Unified Kernel Images), as we might
> > > want to revoke authorizations to specific signed PEs that were
> > > initially considered as trusted. The reason might be for example
> > > a security issue related to a specific linux release.
> > >
> > > A .sbat is simply a section containing a string with the
> > > component name and a version number. This version number is
> > > compared with the value in OVMF_VARS, and if it's less than the
> > > variable, the binary is not trusted, even if it is correctly
> > > signed.
> > >
> >
> > Most people will not known what OVMF_VARS is or a PE.
> >
> > Also, 'version number' is a bit vague, better to stick with
> > existing terminology that makes this more self explanatory: the
> > component that authenticates the kernel image keeps a revocation
> > counter, and refuses to load authentic images whose revocation
> > index is lower than the revocation counter. This approach removes
> > the need for revoking individual image hashes or having to rotate
> > the signing keys when a vulnerability is discovered.
> >
> > The argument that we need this in the upstream kernel seems to be
> > predicated on the assumption that there is one universal signing
> > authority and revocation domain, but this is not necessarily true.
> > Even if the distros appear to have decided that it is a reasonable
> > choice to deploy the MicroSoft signed shim and the associated
> > components on other systems than Windows-crippled x86 PCs, this is
> > not universally true, and UEFI secure boot can be (and is) deployed
> > in sane ways as well.
Well, yes, but just because sanity exists, doesn't mean we can ignore
the current insanity in the Laptop/desktop x86 space.
The problem, as I see it, is if the distros give the kernel an .sbat
section, that means any vanilla kernel that's built by a user and
signed by their key now won't work (even if their key is in MoK)
because it won't have an sbat section ... and the sbat mechanism is
component specific, not key specific, so the signer has no choice but
to adopt it.
There are two ways out of this: give the kernel an sbat section that's
always current, which is what the proposed patch does (but rather falls
down on the who keeps it current and how part) or actually add sbat
addition to the signing tools, so people who sign their own kernels can
simply go on doing that and no-one else need worry.
I rather incline to the latter, but as a maintainer of a secure boot
signing tool I would say that. I could easily add tools that tell
someone what the current SBAT level is on the machine they're using, or
in any given boot component, which will make it very easy to add the
correct one. If it becomes the responsibility of the signer, they're
the ones who decide whether what they've signed revokes everything else
(which they'd never realistically do if they want to keep booting
distro kernels in addition to their own).
James
^ permalink raw reply
* Re: [PATCH v2] x86/kexec: Add EFI config table identity mapping for kexec kernel
From: Tao Liu @ 2023-07-17 15:11 UTC (permalink / raw)
To: Ard Biesheuvel
Cc: Borislav Petkov, tglx, mingo, dave.hansen, x86, hpa, linux-kernel,
bhe, dyoung, kexec, linux-efi
In-Reply-To: <CAMj1kXGEFr+E3pKLrJJq=FXv9ZhDg0zSEw7sewumPZkwtd3P5Q@mail.gmail.com>
On Mon, Jul 17, 2023 at 10:57 PM Ard Biesheuvel <ardb@kernel.org> wrote:
>
> On Mon, 17 Jul 2023 at 15:53, Tao Liu <ltao@redhat.com> wrote:
> >
> > Hi Borislav,
> >
> > On Thu, Jul 13, 2023 at 6:05 PM Borislav Petkov <bp@alien8.de> wrote:
> > >
> > > On Thu, Jun 01, 2023 at 03:20:44PM +0800, Tao Liu wrote:
> > > > arch/x86/kernel/machine_kexec_64.c | 35 ++++++++++++++++++++++++++----
> > > > 1 file changed, 31 insertions(+), 4 deletions(-)
> > >
> > > Ok, pls try this totally untested thing.
> > >
> > > Thx.
> > >
> > > ---
> > > diff --git a/arch/x86/boot/compressed/sev.c b/arch/x86/boot/compressed/sev.c
> > > index 09dc8c187b3c..fefe27b2af85 100644
> > > --- a/arch/x86/boot/compressed/sev.c
> > > +++ b/arch/x86/boot/compressed/sev.c
> > > @@ -404,13 +404,20 @@ void sev_enable(struct boot_params *bp)
> > > if (bp)
> > > bp->cc_blob_address = 0;
> > >
> > > + /* Check for the SME/SEV support leaf */
> > > + eax = 0x80000000;
> > > + ecx = 0;
> > > + native_cpuid(&eax, &ebx, &ecx, &edx);
> > > + if (eax < 0x8000001f)
> > > + return;
> > > +
> > > /*
> > > * Setup/preliminary detection of SNP. This will be sanity-checked
> > > * against CPUID/MSR values later.
> > > */
> > > snp = snp_init(bp);
> > >
> > > - /* Check for the SME/SEV support leaf */
> > > + /* Recheck the SME/SEV support leaf */
> > > eax = 0x80000000;
> > > ecx = 0;
> > > native_cpuid(&eax, &ebx, &ecx, &edx);
> > >
> > Thanks a lot for the patch above! Sorry for the late response. I have
> > compiled and tested it locally against 6.5.0-rc1, though it can pass
> > the early stage of kexec kernel bootup,
>
> OK, so that proves that the cc_blob table access is the culprit here.
> That still means that kexec on SEV is likely to explode in the exact
> same way should anyone attempt that.
>
>
> > however the kernel will panic
> > occasionally later. The test machine is the one with Intel Atom
> > x6425RE cpu which encountered the page fault issue of missing efi
> > config table.
> >
>
> Agree with Boris that this seems entirely unrelated.
Agree, I will have a retest based on Boris's suggestions.
>
> > ...snip...
> > [ 21.360763] nvme0n1: p1 p2 p3
> > [ 21.364207] igc 0000:03:00.0: PTM enabled, 4ns granularity
> > [ 21.421097] pps pps1: new PPS source ptp1
> > [ 21.425396] igc 0000:03:00.0 (unnamed net_device) (uninitialized): PHC added
> > [ 21.457005] igc 0000:03:00.0: 4.000 Gb/s available PCIe bandwidth
> > (5.0 GT/s PCIe x1 link)
> > [ 21.465210] igc 0000:03:00.0 eth1: MAC: ...snip...
> > [ 21.473424] igc 0000:03:00.0 enp3s0: renamed from eth1
> > [ 21.479446] BUG: kernel NULL pointer dereference, address: 0000000000000008
> > [ 21.486405] #PF: supervisor read access in kernel mode
> > [ 21.491519] mmc1: Failed to initialize a non-removable card
> > [ 21.491538] #PF: error_code(0x0000) - not-present page
> > [ 21.502229] PGD 0 P4D 0
> > [ 21.504773] Oops: 0000 [#1] PREEMPT SMP NOPTI
> > [ 21.509133] CPU: 3 PID: 402 Comm: systemd-udevd Not tainted 6.5.0-rc1+ #1
> > [ 21.515905] Hardware name: ...snip...
>
>
> Why are you snipping the hardware name?
Sorry for the inconvenience here... The machine is borrowed from our
partner, which may not be officially released to the market. I haven't
discussed the legal issue with them. In addition, I think the stack
trace is more useful, so I snipped the hardware name. Sorry about
that...
>
^ permalink raw reply
* Re: [PATCH v2] x86/kexec: Add EFI config table identity mapping for kexec kernel
From: Tao Liu @ 2023-07-17 15:02 UTC (permalink / raw)
To: Ard Biesheuvel
Cc: Borislav Petkov, Michael Roth, Joerg Roedel, Baoquan He,
thomas.lendacky, tglx, mingo, dave.hansen, x86, hpa, linux-kernel,
dyoung, kexec, linux-efi
In-Reply-To: <CAMj1kXFBtd6DRzwNbuY5_zc4DThjQWs9itN=qYkED-+6nkoGcw@mail.gmail.com>
Hi Ard,
Thanks for your explanation!
On Thu, Jul 13, 2023 at 6:18 PM Ard Biesheuvel <ardb@kernel.org> wrote:
>
> On Fri, 7 Jul 2023 at 19:12, Borislav Petkov <bp@alien8.de> wrote:
> >
> > On Fri, Jul 07, 2023 at 10:25:15AM -0500, Michael Roth wrote:
> > > ...
> > > It would be unfortunate if we finally abandoned this path because of the
> > > issue being hit here though. I think the patch posted here is the proper
> > > resolution to the issue being hit, and I'm hoping at this point we've
> > > identified all the similar cases where EFI/setup_data-related structures
> > > were missing explicit mappings. But if we still think it's too much of a
> > > liability to access the EFI config table outside of SEV-enabled guests,
> > > then I can work on re-implementing things based on the above logic.
> >
> > Replying here to Tom's note too...
> >
> > So, I like the idea of rechecking CPUID. Yes, let's do the sev_status
> > check. As a result, we either fail the guest - no problem - or we boot
> > and we recheck. Thus, we don't run AMD code on !AMD machines, if the HV
> > is not a lying bastard.
> >
> > Now, if we've gotten a valid setup_data SETUP_EFI entry with a valid
> > pointer to an EFI config table, then that should happen in the generic
> > path - initialize_identity_maps(), for example - like you've done in
> > b57feed2cc26 - not in the kexec code because kexec *happens* to need it.
> >
> > We want to access the EFI config table? Sure, by all means, but make
> > that generic for all code.
> >
>
> OK, so in summary, what seems to be happening here is that the SEV
> init code in the decompressor looks for the cc blob table before the
> on-demand mapping code is up, which normally ensures that any RAM
> address is accessible even if it hasn't been mapped explicitly.
>
Yes it is exactly the case.
> This is why the fix happens to work: the code only maps the array of
> (guid, phys_addr) tuples that describes the list of configuration
> tables that have been provided by the firmware. The actual
> configuration tables themselves could be anywhere in physical memory,
> and without prior knowledge of a particular GUID value, there is no
> way to know the size of the table, and so they cannot be mapped
Should we loop map each element of the config table one at a time? We
read a GUID value, then we map it with phys_addr, phys_addr +
sizeof(struct), then we read-map the next one, in this way we may not
need to know the size of the table?
> upfront like this. However, the cc blob table does not exist on this
> machine, and so whether the EFI config tables themselves are mapped or
> not is irrelevant.
Currently we don't need all the data of the config table, only part of
it. So only (guid, phys_addr) tuple arrays are mapped into. Won't it
be better if we map config table on demand if we need further data
later?
>
> But it does mean the fix is incomplete, and certainly does not belong
> in generic kexec code. If anything, we should be fixing the
> decompressor code to defer the cc blob table check until after the
> demand mapping code is up.
Yes, if we can defer the cc blob access, the issue can be resolved. I
don't know if it is doable from AMD's view...
>
> If this is problematic, we might instead disable SEV for kexec, and
> rely on the fact that SEV firmware enters with a complete 1:1 map (as
We still need sev support for kexec. If we disable sev during kexec, I
suppose kdump may be broken on a sev guest, maybe?
Thanks,
Tao Liu
> we seem to be doing currently). If kexec for SEV is needed at some
> point, we can re-enable it by having it provide a mapping for the
> config table array and the cc blob table explicitly.
>
^ permalink raw reply
* Re: [PATCH v2] x86/kexec: Add EFI config table identity mapping for kexec kernel
From: Ard Biesheuvel @ 2023-07-17 14:56 UTC (permalink / raw)
To: Tao Liu
Cc: Borislav Petkov, tglx, mingo, dave.hansen, x86, hpa, linux-kernel,
bhe, dyoung, kexec, linux-efi
In-Reply-To: <CAO7dBbVMNKTSDi5eP4BseEUexsk0Mo0GWJpyHfOcp+tHs6cSUw@mail.gmail.com>
On Mon, 17 Jul 2023 at 15:53, Tao Liu <ltao@redhat.com> wrote:
>
> Hi Borislav,
>
> On Thu, Jul 13, 2023 at 6:05 PM Borislav Petkov <bp@alien8.de> wrote:
> >
> > On Thu, Jun 01, 2023 at 03:20:44PM +0800, Tao Liu wrote:
> > > arch/x86/kernel/machine_kexec_64.c | 35 ++++++++++++++++++++++++++----
> > > 1 file changed, 31 insertions(+), 4 deletions(-)
> >
> > Ok, pls try this totally untested thing.
> >
> > Thx.
> >
> > ---
> > diff --git a/arch/x86/boot/compressed/sev.c b/arch/x86/boot/compressed/sev.c
> > index 09dc8c187b3c..fefe27b2af85 100644
> > --- a/arch/x86/boot/compressed/sev.c
> > +++ b/arch/x86/boot/compressed/sev.c
> > @@ -404,13 +404,20 @@ void sev_enable(struct boot_params *bp)
> > if (bp)
> > bp->cc_blob_address = 0;
> >
> > + /* Check for the SME/SEV support leaf */
> > + eax = 0x80000000;
> > + ecx = 0;
> > + native_cpuid(&eax, &ebx, &ecx, &edx);
> > + if (eax < 0x8000001f)
> > + return;
> > +
> > /*
> > * Setup/preliminary detection of SNP. This will be sanity-checked
> > * against CPUID/MSR values later.
> > */
> > snp = snp_init(bp);
> >
> > - /* Check for the SME/SEV support leaf */
> > + /* Recheck the SME/SEV support leaf */
> > eax = 0x80000000;
> > ecx = 0;
> > native_cpuid(&eax, &ebx, &ecx, &edx);
> >
> Thanks a lot for the patch above! Sorry for the late response. I have
> compiled and tested it locally against 6.5.0-rc1, though it can pass
> the early stage of kexec kernel bootup,
OK, so that proves that the cc_blob table access is the culprit here.
That still means that kexec on SEV is likely to explode in the exact
same way should anyone attempt that.
> however the kernel will panic
> occasionally later. The test machine is the one with Intel Atom
> x6425RE cpu which encountered the page fault issue of missing efi
> config table.
>
Agree with Boris that this seems entirely unrelated.
> ...snip...
> [ 21.360763] nvme0n1: p1 p2 p3
> [ 21.364207] igc 0000:03:00.0: PTM enabled, 4ns granularity
> [ 21.421097] pps pps1: new PPS source ptp1
> [ 21.425396] igc 0000:03:00.0 (unnamed net_device) (uninitialized): PHC added
> [ 21.457005] igc 0000:03:00.0: 4.000 Gb/s available PCIe bandwidth
> (5.0 GT/s PCIe x1 link)
> [ 21.465210] igc 0000:03:00.0 eth1: MAC: ...snip...
> [ 21.473424] igc 0000:03:00.0 enp3s0: renamed from eth1
> [ 21.479446] BUG: kernel NULL pointer dereference, address: 0000000000000008
> [ 21.486405] #PF: supervisor read access in kernel mode
> [ 21.491519] mmc1: Failed to initialize a non-removable card
> [ 21.491538] #PF: error_code(0x0000) - not-present page
> [ 21.502229] PGD 0 P4D 0
> [ 21.504773] Oops: 0000 [#1] PREEMPT SMP NOPTI
> [ 21.509133] CPU: 3 PID: 402 Comm: systemd-udevd Not tainted 6.5.0-rc1+ #1
> [ 21.515905] Hardware name: ...snip...
Why are you snipping the hardware name?
^ permalink raw reply
* Re: [PATCH v2] x86/kexec: Add EFI config table identity mapping for kexec kernel
From: Tao Liu @ 2023-07-17 14:24 UTC (permalink / raw)
To: Borislav Petkov
Cc: tglx, mingo, dave.hansen, x86, hpa, ardb, linux-kernel, bhe,
dyoung, kexec, linux-efi
In-Reply-To: <20230717141409.GGZLVMsU6d/9mpJvMO@fat_crate.local>
On Mon, Jul 17, 2023 at 10:14 PM Borislav Petkov <bp@alien8.de> wrote:
>
> On Mon, Jul 17, 2023 at 09:53:06PM +0800, Tao Liu wrote:
> > ...snip...
> > [ 21.360763] nvme0n1: p1 p2 p3
> > [ 21.364207] igc 0000:03:00.0: PTM enabled, 4ns granularity
> > [ 21.421097] pps pps1: new PPS source ptp1
> > [ 21.425396] igc 0000:03:00.0 (unnamed net_device) (uninitialized): PHC added
> > [ 21.457005] igc 0000:03:00.0: 4.000 Gb/s available PCIe bandwidth
> > (5.0 GT/s PCIe x1 link)
> > [ 21.465210] igc 0000:03:00.0 eth1: MAC: ...snip...
> > [ 21.473424] igc 0000:03:00.0 enp3s0: renamed from eth1
> > [ 21.479446] BUG: kernel NULL pointer dereference, address: 0000000000000008
> > [ 21.486405] #PF: supervisor read access in kernel mode
> > [ 21.491519] mmc1: Failed to initialize a non-removable card
> > [ 21.491538] #PF: error_code(0x0000) - not-present page
> > [ 21.502229] PGD 0 P4D 0
> > [ 21.504773] Oops: 0000 [#1] PREEMPT SMP NOPTI
> > [ 21.509133] CPU: 3 PID: 402 Comm: systemd-udevd Not tainted 6.5.0-rc1+ #1
> > [ 21.515905] Hardware name: ...snip...
> > [ 21.522851] RIP: 0010:kernfs_dop_revalidate+0x2b/0x120
>
> So something's weird here - my patch should not cause a null ptr deref
> here.
>
> > [ 21.527995] Code: 1f 44 00 00 83 e6 40 0f 85 07 01 00 00 41 55 41
> > 54 55 53 48 8b 47 30 48 89 fb 48 85 c0 0f 84 a2 00 00 00 48 8b a87
>
> This looks weird too. There's no "<>" brackets denoting which byte it
> was exactly where RIP pointed to when the NULL ptr happened.
>
> Do
>
> make fs/kernfs/dir.s
>
> and upload dir.s and the dir.o file somewhere.
>
> In any case, my patch shouldn't be causing this. At least I don't see
> it.
>
> I'm testing a better version of the patch and it should not cause this
> thing even less.
>
OK, thanks for the help. I will re-make, test and update the info.
> > The stack trace may not be the same all the time, I didn't dive deep
> > into the root cause, but it looks to me the patch will cause an
> > unknown issue. Also I tested the patch on kernel-5.14.0-318.el9, it
>
> This is the upstream kernel mailing list so those Frankenstein kernels
> are all left to you.
>
> Good luck. :-)
>
OK, thanks!
Thanks,
Tao Liu
> --
> Regards/Gruss,
> Boris.
>
> https://people.kernel.org/tglx/notes-about-netiquette
>
^ permalink raw reply
* Re: [PATCH v2] x86/kexec: Add EFI config table identity mapping for kexec kernel
From: Borislav Petkov @ 2023-07-17 14:14 UTC (permalink / raw)
To: Tao Liu
Cc: tglx, mingo, dave.hansen, x86, hpa, ardb, linux-kernel, bhe,
dyoung, kexec, linux-efi
In-Reply-To: <CAO7dBbVMNKTSDi5eP4BseEUexsk0Mo0GWJpyHfOcp+tHs6cSUw@mail.gmail.com>
On Mon, Jul 17, 2023 at 09:53:06PM +0800, Tao Liu wrote:
> ...snip...
> [ 21.360763] nvme0n1: p1 p2 p3
> [ 21.364207] igc 0000:03:00.0: PTM enabled, 4ns granularity
> [ 21.421097] pps pps1: new PPS source ptp1
> [ 21.425396] igc 0000:03:00.0 (unnamed net_device) (uninitialized): PHC added
> [ 21.457005] igc 0000:03:00.0: 4.000 Gb/s available PCIe bandwidth
> (5.0 GT/s PCIe x1 link)
> [ 21.465210] igc 0000:03:00.0 eth1: MAC: ...snip...
> [ 21.473424] igc 0000:03:00.0 enp3s0: renamed from eth1
> [ 21.479446] BUG: kernel NULL pointer dereference, address: 0000000000000008
> [ 21.486405] #PF: supervisor read access in kernel mode
> [ 21.491519] mmc1: Failed to initialize a non-removable card
> [ 21.491538] #PF: error_code(0x0000) - not-present page
> [ 21.502229] PGD 0 P4D 0
> [ 21.504773] Oops: 0000 [#1] PREEMPT SMP NOPTI
> [ 21.509133] CPU: 3 PID: 402 Comm: systemd-udevd Not tainted 6.5.0-rc1+ #1
> [ 21.515905] Hardware name: ...snip...
> [ 21.522851] RIP: 0010:kernfs_dop_revalidate+0x2b/0x120
So something's weird here - my patch should not cause a null ptr deref
here.
> [ 21.527995] Code: 1f 44 00 00 83 e6 40 0f 85 07 01 00 00 41 55 41
> 54 55 53 48 8b 47 30 48 89 fb 48 85 c0 0f 84 a2 00 00 00 48 8b a87
This looks weird too. There's no "<>" brackets denoting which byte it
was exactly where RIP pointed to when the NULL ptr happened.
Do
make fs/kernfs/dir.s
and upload dir.s and the dir.o file somewhere.
In any case, my patch shouldn't be causing this. At least I don't see
it.
I'm testing a better version of the patch and it should not cause this
thing even less.
> The stack trace may not be the same all the time, I didn't dive deep
> into the root cause, but it looks to me the patch will cause an
> unknown issue. Also I tested the patch on kernel-5.14.0-318.el9, it
This is the upstream kernel mailing list so those Frankenstein kernels
are all left to you.
Good luck. :-)
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply
* Re: [PATCH v2] x86/kexec: Add EFI config table identity mapping for kexec kernel
From: Tao Liu @ 2023-07-17 13:53 UTC (permalink / raw)
To: Borislav Petkov
Cc: tglx, mingo, dave.hansen, x86, hpa, ardb, linux-kernel, bhe,
dyoung, kexec, linux-efi
In-Reply-To: <20230713100459.GEZK/MS69XbphJa+tN@fat_crate.local>
Hi Borislav,
On Thu, Jul 13, 2023 at 6:05 PM Borislav Petkov <bp@alien8.de> wrote:
>
> On Thu, Jun 01, 2023 at 03:20:44PM +0800, Tao Liu wrote:
> > arch/x86/kernel/machine_kexec_64.c | 35 ++++++++++++++++++++++++++----
> > 1 file changed, 31 insertions(+), 4 deletions(-)
>
> Ok, pls try this totally untested thing.
>
> Thx.
>
> ---
> diff --git a/arch/x86/boot/compressed/sev.c b/arch/x86/boot/compressed/sev.c
> index 09dc8c187b3c..fefe27b2af85 100644
> --- a/arch/x86/boot/compressed/sev.c
> +++ b/arch/x86/boot/compressed/sev.c
> @@ -404,13 +404,20 @@ void sev_enable(struct boot_params *bp)
> if (bp)
> bp->cc_blob_address = 0;
>
> + /* Check for the SME/SEV support leaf */
> + eax = 0x80000000;
> + ecx = 0;
> + native_cpuid(&eax, &ebx, &ecx, &edx);
> + if (eax < 0x8000001f)
> + return;
> +
> /*
> * Setup/preliminary detection of SNP. This will be sanity-checked
> * against CPUID/MSR values later.
> */
> snp = snp_init(bp);
>
> - /* Check for the SME/SEV support leaf */
> + /* Recheck the SME/SEV support leaf */
> eax = 0x80000000;
> ecx = 0;
> native_cpuid(&eax, &ebx, &ecx, &edx);
>
Thanks a lot for the patch above! Sorry for the late response. I have
compiled and tested it locally against 6.5.0-rc1, though it can pass
the early stage of kexec kernel bootup , however the kernel will panic
occasionally later. The test machine is the one with Intel Atom
x6425RE cpu which encountered the page fault issue of missing efi
config table.
...snip...
[ 21.360763] nvme0n1: p1 p2 p3
[ 21.364207] igc 0000:03:00.0: PTM enabled, 4ns granularity
[ 21.421097] pps pps1: new PPS source ptp1
[ 21.425396] igc 0000:03:00.0 (unnamed net_device) (uninitialized): PHC added
[ 21.457005] igc 0000:03:00.0: 4.000 Gb/s available PCIe bandwidth
(5.0 GT/s PCIe x1 link)
[ 21.465210] igc 0000:03:00.0 eth1: MAC: ...snip...
[ 21.473424] igc 0000:03:00.0 enp3s0: renamed from eth1
[ 21.479446] BUG: kernel NULL pointer dereference, address: 0000000000000008
[ 21.486405] #PF: supervisor read access in kernel mode
[ 21.491519] mmc1: Failed to initialize a non-removable card
[ 21.491538] #PF: error_code(0x0000) - not-present page
[ 21.502229] PGD 0 P4D 0
[ 21.504773] Oops: 0000 [#1] PREEMPT SMP NOPTI
[ 21.509133] CPU: 3 PID: 402 Comm: systemd-udevd Not tainted 6.5.0-rc1+ #1
[ 21.515905] Hardware name: ...snip...
[ 21.522851] RIP: 0010:kernfs_dop_revalidate+0x2b/0x120
[ 21.527995] Code: 1f 44 00 00 83 e6 40 0f 85 07 01 00 00 41 55 41
54 55 53 48 8b 47 30 48 89 fb 48 85 c0 0f 84 a2 00 00 00 48 8b a87
[ 21.546680] RSP: 0018:ffffb656405abbf0 EFLAGS: 00010282
[ 21.551898] RAX: ffff921c761a5d40 RBX: ffff921c76164000 RCX: 0000000000000001
[ 21.559018] RDX: ffff921c76164038 RSI: 0000000000000000 RDI: ffff921c76164000
[ 21.566137] RBP: 0000000000000000 R08: 0000000000000006 R09: ffff921c02272d80
[ 21.573254] R10: ffff8d909b919a89 R11: 0000000000000000 R12: ffff921c02272d80
[ 21.580367] R13: ffffb656405abca0 R14: 0000000000000000 R15: 0000000000000000
[ 21.587489] FS: 00007f75796bf540(0000) GS:ffff922360580000(0000)
knlGS:0000000000000000
[ 21.595557] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 21.601291] CR2: 0000000000000008 CR3: 000000011615c000 CR4: 0000000000350ee0
[ 21.608405] Call Trace:
[ 21.610864] <TASK>
[ 21.612983] ? __die+0x1f/0x70
[ 21.616053] ? page_fault_oops+0x75/0x170
[ 21.620062] ? xa_load+0x87/0xe0
[ 21.623299] ? exc_page_fault+0x67/0x140
[ 21.627225] ? asm_exc_page_fault+0x22/0x30
[ 21.631415] ? kernfs_dop_revalidate+0x2b/0x120
[ 21.635962] lookup_fast+0x75/0xf0
[ 21.639367] walk_component+0x1f/0x150
[ 21.643125] path_lookupat+0x6a/0x1a0
[ 21.646789] filename_lookup+0xd0/0x1d0
[ 21.650630] ? __check_object_size.part.0+0x5e/0x130
[ 21.655595] ? __check_object_size.part.0+0x5e/0x130
[ 21.660552] vfs_statx+0x8c/0x160
[ 21.663880] vfs_fstatat+0x51/0x70
[ 21.667286] __do_sys_newfstatat+0x26/0x60
[ 21.671388] ? syscall_trace_enter.isra.0+0x9a/0x1a0
[ 21.676349] do_syscall_64+0x59/0x90
[ 21.679926] ? exit_to_user_mode_prepare+0xbb/0xd0
[ 21.684719] ? syscall_exit_to_user_mode+0x12/0x30
[ 21.689507] ? do_syscall_64+0x68/0x90
[ 21.693262] entry_SYSCALL_64_after_hwframe+0x6e/0xd8
[ 21.698310] RIP: 0033:0x7f757a2ce12e
[ 21.701893] Code: 48 89 f2 b9 00 01 00 00 48 89 fe bf 9c ff ff ff
e9 07 00 00 00 0f 1f 80 00 00 00 00 f3 0f 1e fa 41 89 ca b8 06 019
[ 21.720570] RSP: 002b:00007ffc38e4ae98 EFLAGS: 00000202 ORIG_RAX:
0000000000000106
[ 21.728123] RAX: ffffffffffffffda RBX: 00007ffc38e4b250 RCX: 00007f757a2ce12e
[ 21.735242] RDX: 00007ffc38e4aef0 RSI: 00005566acdd2c20 RDI: 00000000ffffff9c
[ 21.742363] RBP: 00007ffc38e4afc0 R08: 0000000000000000 R09: 0000000000000000
[ 21.749484] R10: 0000000000000100 R11: 0000000000000202 R12: 0000000000000000
[ 21.756600] R13: 00007ffc38e4b038 R14: 00005566acdd2c20 R15: 00007ffc38e4b250
[ 21.763721] </TASK>
[ 21.765920] Modules linked in: i2c_algo_bit drm_buddy ttm intel_gtt
drm_display_helper drm_kms_helper nvme igc drm sdhci_pci crct10e
[ 21.799743] CR2: 0000000000000008
[ 21.803061] ---[ end trace 0000000000000000 ]---
[ 21.807679] RIP: 0010:kernfs_dop_revalidate+0x2b/0x120
[ 21.812819] Code: 1f 44 00 00 83 e6 40 0f 85 07 01 00 00 41 55 41
54 55 53 48 8b 47 30 48 89 fb 48 85 c0 0f 84 a2 00 00 00 48 8b a87
[ 21.831505] RSP: 0018:ffffb656405abbf0 EFLAGS: 00010282
[ 21.836724] RAX: ffff921c761a5d40 RBX: ffff921c76164000 RCX: 0000000000000001
[ 21.843844] RDX: ffff921c76164038 RSI: 0000000000000000 RDI: ffff921c76164000
[ 21.850963] RBP: 0000000000000000 R08: 0000000000000006 R09: ffff921c02272d80
[ 21.858082] R10: ffff8d909b919a89 R11: 0000000000000000 R12: ffff921c02272d80
[ 21.865201] R13: ffffb656405abca0 R14: 0000000000000000 R15: 0000000000000000
[ 21.872321] FS: 00007f75796bf540(0000) GS:ffff922360580000(0000)
knlGS:0000000000000000
[ 21.880390] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 21.886123] CR2: 0000000000000008 CR3: 000000011615c000 CR4: 0000000000350ee0
[ 21.893233] Kernel panic - not syncing: Fatal exception
[ 21.898486] Kernel Offset: 0x19e00000 from 0xffffffff81000000
(relocation range: 0xffffffff80000000-0xffffffffbfffffff)
[ 21.909231] ---[ end Kernel panic - not syncing: Fatal exception ]---
The stack trace may not be the same all the time, I didn't dive deep
into the root cause, but it looks to me the patch will cause an
unknown issue. Also I tested the patch on kernel-5.14.0-318.el9, it
will encounter a similar issue, because the timing for every panic is
nearly the same.
...snip...
[ 19.521883] nvme 0000:04:00.0: platform quirk: setting simple suspend
[ 19.522030] nvme nvme0: pci function 0000:04:00.0
[ 19.526540] pps pps0: new PPS source ptp0
[ 19.526641] igc 0000:02:00.0 (unnamed net_device) (uninitialized): PHC added
[ 19.550702] usbcore: registered new interface driver cdc_ncm
[ 19.551424] igc 0000:02:00.0: 4.000 Gb/s available PCIe bandwidth
(5.0 GT/s PCIe x1 link)
[ 19.551429] igc 0000:02:00.0 eth0: MAC: ...snip...
[ 19.551660] igc 0000:03:00.0: PTM enabled, 4ns granularity
[ 19.571901] BUG: unable to handle page fault for address: ffff90e3b676ac38
[ 19.571906] #PF: supervisor read access in kernel mode
[ 19.571907] #PF: error_code(0x0000) - not-present page
[ 19.571910] PGD 3f401067 P4D 3f401067 PUD 3f40c067 PMD 176711063
[ 19.571915] BAD
[ 19.571917] Oops: 0000 [#1] PREEMPT SMP NOPTI
[ 19.571920] CPU: 1 PID: 447 Comm: gzip Not tainted 5.14.0+ #2
[ 19.571923] Hardware name: ...snip...
[ 19.571924] RIP: 0010:vma_interval_tree_remove+0x16a/0x2c0
[ 19.571933] Code: e0 fc 48 83 fa 03 76 43 48 8b 48 10 48 8b 70 08
48 8b 50 b0 4c 8b 40 40 48 2b 50 a8 48 c1 ea 0c 4a 8d 54 02 ff 489
[ 19.571935] RSP: 0018:ffffb05d40a2bd20 EFLAGS: 00010282
[ 19.571938] RAX: ffff90e3550f2d08 RBX: ffff90e34bcc46e0 RCX: ffff90e3b676ac20
[ 19.571940] RDX: 0000000000000027 RSI: ffff90e355293df0 RDI: 0000000000000000
[ 19.571941] RBP: ffff90e35528a3a0 R08: 0000000000000000 R09: 0000000000000000
[ 19.571943] R10: ffffb05d40a2bd00 R11: 00007fffec14c000 R12: ffff90e35528a3f8
[ 19.571944] R13: ffffb05d40a2bda0 R14: 0000000000000000 R15: ffff90e355293000
[ 19.571946] FS: 0000000000000000(0000) GS:ffff90eaa0480000(0000)
knlGS:0000000000000000
[ 19.571949] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 19.571951] CR2: ffff90e3b6711b50 CR3: 0000000113ed8000 CR4: 0000000000350ee0
[ 19.571953] Call Trace:
[ 19.571956] <TASK>
[ 19.571959] unlink_file_vma+0x41/0x60
[ 19.571963] free_pgtables+0xa0/0xe0
[ 19.571966] exit_mmap+0xb3/0x1e0
[ 19.571972] mmput+0x58/0x140
[ 19.571976] exit_mm+0xb2/0x110
[ 19.571980] do_exit+0x210/0x4c0
[ 19.571982] do_group_exit+0x2d/0x90
[ 19.571985] __x64_sys_exit_group+0x14/0x20
[ 19.571988] do_syscall_64+0x59/0x90
[ 19.571993] ? exc_page_fault+0x64/0x140
[ 19.571996] entry_SYSCALL_64_after_hwframe+0x63/0xcd
[ 19.572000] RIP: 0033:0x7fac2abd3a4d
[ 19.572003] Code: Unable to access opcode bytes at RIP 0x7fac2abd3a23.
[ 19.572004] RSP: 002b:00007fffec0e5808 EFLAGS: 00000246 ORIG_RAX:
00000000000000e7
[ 19.572006] RAX: ffffffffffffffda RBX: 00007fac2acb19e0 RCX: 00007fac2abd3a4d
[ 19.572008] RDX: 00000000000000e7 RSI: ffffffffffffff80 RDI: 0000000000000000
[ 19.572009] RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000020
[ 19.572011] R10: 00007fffec0e56b0 R11: 0000000000000246 R12: 00007fac2acb19e0
[ 19.572012] R13: 00007fac2acb6f00 R14: 0000000000000001 R15: 00007fac2acb6ee8
[ 19.572015] </TASK>
[ 19.572016] Modules linked in: cdc_ncm nvme cqhci cdc_ether usbnet
nvme_core sdhci uas nvme_common ghash_clmulni_intel usb_storage e
[ 19.572040] CR2: ffff90e3b676ac38
[ 19.572043] ---[ end trace 4abd4ff8e3f54f71 ]---
[ 19.572044] RIP: 0010:vma_interval_tree_remove+0x16a/0x2c0
[ 19.572048] Code: e0 fc 48 83 fa 03 76 43 48 8b 48 10 48 8b 70 08
48 8b 50 b0 4c 8b 40 40 48 2b 50 a8 48 c1 ea 0c 4a 8d 54 02 ff 489
[ 19.572050] RSP: 0018:ffffb05d40a2bd20 EFLAGS: 00010282
[ 19.572052] RAX: ffff90e3550f2d08 RBX: ffff90e34bcc46e0 RCX: ffff90e3b676ac20
[ 19.572053] RDX: 0000000000000027 RSI: ffff90e355293df0 RDI: 0000000000000000
[ 19.572054] RBP: ffff90e35528a3a0 R08: 0000000000000000 R09: 0000000000000000
[ 19.572056] R10: ffffb05d40a2bd00 R11: 00007fffec14c000 R12: ffff90e35528a3f8
[ 19.572057] R13: ffffb05d40a2bda0 R14: 0000000000000000 R15: ffff90e355293000
[ 19.572058] FS: 0000000000000000(0000) GS:ffff90eaa0480000(0000)
knlGS:0000000000000000
[ 19.572060] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 19.572062] CR2: ffff90e3b6711b50 CR3: 0000000113ed8000 CR4: 0000000000350ee0
[ 19.572064] Kernel panic - not syncing: Fatal exception
[ 19.572840] BUG: unable to handle page fault for address: ffff90e3b6767b48
[ 19.971622] #PF: supervisor read access in kernel mode
[ 19.971624] #PF: error_code(0x0000) - not-present page
[ 19.971626] PGD 3f401067 P4D 3f401067 PUD 3f40c067 PMD 176711063
[ 19.971631] BAD
[ 19.971632] Oops: 0000 [#2] PREEMPT SMP NOPTI
[ 19.971634] CPU: 0 PID: 445 Comm: systemd-vconsol Tainted: G D
------- --- 5.14.0+ #2
[ 19.971638] Hardware name: ...snip...
[ 19.971639] RIP: 0010:__rb_insert_augmented+0x77/0x1b0
[ 19.971645] Code: 89 63 10 48 89 5f 08 4d 85 e4 74 0b 48 89 d8 48
83 c8 01 49 89 04 24 48 8b 03 48 89 07 48 89 3b 48 83 f8 03 76 5d8
[ 19.971648] RSP: 0018:ffffb05d408e7c50 EFLAGS: 00010282
[ 19.971650] RAX: ffff90e3b6767b38 RBX: ffff90e3550f1798 RCX: 0000000000000019
[ 19.971652] RDX: ffffffffad5180f0 RSI: ffff90e35527eb38 RDI: ffff90e35527eb38
[ 19.971653] RBP: ffff90e35527eb38 R08: ffff90e35527eae0 R09: 00000000000000e8
[ 19.971655] R10: 0000000008000075 R11: 0000000000000000 R12: 0000000000000000
[ 19.971656] R13: ffff90e34bcc6310 R14: ffff90e35527e750 R15: ffff90e35527eae0
[ 19.971658] FS: 00007fc4586d1380(0000) GS:ffff90eaa0400000(0000)
knlGS:0000000000000000
[ 19.971660] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 19.971662] CR2: ffff90e3b6711b38 CR3: 0000000115054000 CR4: 0000000000350ef0
[ 19.971664] Call Trace:
[ 19.971666] <TASK>
[ 19.971667] ? vmacache_find+0xb0/0xb0
[ 19.971672] dup_mmap+0x23d/0x520
[ 19.971677] dup_mm+0x60/0x100
[ 19.971680] copy_process+0xc09/0x1680
[ 19.971684] kernel_clone+0x98/0x3f0
[ 19.971688] __do_sys_clone+0x72/0xa0
[ 19.971692] do_syscall_64+0x59/0x90
[ 19.971695] ? syscall_exit_to_user_mode+0x12/0x30
[ 19.971698] ? do_syscall_64+0x68/0x90
[ 19.971701] ? syscall_exit_to_user_mode+0x12/0x30
[ 19.971703] ? do_syscall_64+0x68/0x90
[ 19.971706] ? do_syscall_64+0x68/0x90
[ 19.971708] ? exc_page_fault+0x64/0x140
[ 19.971710] entry_SYSCALL_64_after_hwframe+0x63/0xcd
[ 19.971714] RIP: 0033:0x7fc45930d9d7
[ 19.971716] Code: 00 00 00 f3 0f 1e fa 64 48 8b 04 25 10 00 00 00
45 31 c0 31 d2 31 f6 bf 11 00 20 01 4c 8d 90 d0 02 00 00 b8 38 000
[ 19.971718] RSP: 002b:00007ffca4fb03d8 EFLAGS: 00000246 ORIG_RAX:
0000000000000038
[ 19.971721] RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 00007fc45930d9d7
[ 19.971723] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000001200011
[ 19.971724] RBP: 0000000000000000 R08: 0000000000000000 R09: fffffffffffffe88
[ 19.971725] R10: 00007fc4586d1650 R11: 0000000000000246 R12: 0000000000000003
[ 19.971727] R13: 00007ffca4fb0590 R14: 0000000000000040 R15: 00007ffca4fb0510
[ 19.971730] </TASK>
[ 19.971731] Modules linked in: cdc_ncm nvme cqhci cdc_ether usbnet
nvme_core sdhci uas nvme_common ghash_clmulni_intel usb_storage e
[ 19.971749] CR2: ffff90e3b6767b48
[ 19.971750] ---[ end trace 4abd4ff8e3f54f72 ]---
[ 19.971751] BUG: unable to handle page fault for address: ffff90e3b674eef0
[ 19.971752] RIP: 0010:vma_interval_tree_remove+0x16a/0x2c0
[ 19.971753] #PF: supervisor read access in kernel mode
[ 19.971755] #PF: error_code(0x0000) - not-present page
[ 19.971756] Code: e0 fc 48 83 fa 03 76 43 48 8b 48 10 48 8b 70 08
48 8b 50 b0 4c 8b 40 40 48 2b 50 a8 48 c1 ea 0c 4a 8d 54 02 ff 489
[ 19.971757] PGD 3f401067 P4D 3f401067
[ 19.971758] RSP: 0018:ffffb05d40a2bd20 EFLAGS: 00010282
[ 19.971759] PUD 3f40c067
[ 19.971760]
[ 19.971761] PMD 176711063
[ 19.971761] RAX: ffff90e3550f2d08 RBX: ffff90e34bcc46e0 RCX: ffff90e3b676ac20
[ 19.971763] BAD
[ 19.971763] RDX: 0000000000000027 RSI: ffff90e355293df0 RDI: 0000000000000000
[ 19.971764] RBP: ffff90e35528a3a0 R08: 0000000000000000 R09: 0000000000000000
[ 19.971764] Oops: 0000 [#3] PREEMPT SMP NOPTI
[ 19.971766] R10: ffffb05d40a2bd00 R11: 00007fffec14c000 R12: ffff90e35528a3f8
[ 19.971768] R13: ffffb05d40a2bda0 R14: 0000000000000000 R15: ffff90e355293000
[ 19.971767] CPU: 2 PID: 409 Comm: systemd-udevd Tainted: G D
------- --- 5.14.0+ #2
[ 19.971769] FS: 00007fc4586d1380(0000) GS:ffff90eaa0400000(0000)
knlGS:0000000000000000
[ 19.971770] Hardware name: ...snip...
[ 19.971772] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 19.971774] CR2: ffff90e3b6711b38 CR3: 0000000115054000 CR4: 0000000000350ef0
[ 19.971772] RIP: 0010:inode_has_perm+0x33/0x50
[ 19.971778] Code: 89 c9 f6 46 0d 02 75 37 48 63 05 08 99 04 01 48
8b 57 78 8b 7c 02 04 48 8b 46 38 48 85 c0 74 0a 48 63 15 f8 98 041
[ 19.971780] RSP: 0018:ffffb05d4086fd08 EFLAGS: 00010282
[ 19.971782] RAX: ffff90e3b674eed0 RBX: ffff90e3b674eed0 RCX: ffffb05d4086fd10
[ 19.971784] RDX: 0000000000000010 RSI: ffff90e34be230b0 RDI: 0000000000000001
[ 19.971786] RBP: ffffb05d4086fd58 R08: 0000000000000010 R09: ffffb05d4086fd10
[ 19.971787] R10: 000000000000000c R11: 0000000000000000 R12: ffff90e34be230b0
[ 19.971789] R13: ffff90e34357b0c0 R14: ffff90e354e47cc0 R15: 0000000000000000
[ 19.971790] FS: 00007fd768238540(0000) GS:ffff90eaa0500000(0000)
knlGS:0000000000000000
[ 19.971793] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 19.971795] CR2: ffff90e3b6711a70 CR3: 0000000115064000 CR4: 0000000000350ee0
[ 19.971797] Call Trace:
[ 19.971798] <TASK>
[ 19.971799] selinux_inode_getattr+0x99/0xc0
[ 19.971805] security_inode_getattr+0x37/0x60
[ 19.971808] vfs_statx+0x9a/0x160
[ 19.971813] vfs_fstatat+0x51/0x70
[ 19.971816] __do_sys_newfstatat+0x26/0x60
[ 19.971819] ? __seccomp_filter+0x45/0x360
[ 19.971823] ? syscall_trace_enter.isra.0+0x9e/0x1d0
[ 19.971828] do_syscall_64+0x59/0x90
[ 19.971831] ? syscall_exit_to_user_mode+0x12/0x30
[ 19.971833] ? do_syscall_64+0x68/0x90
[ 19.971836] ? exit_to_user_mode_loop+0xb9/0x110
[ 19.971839] ? exit_to_user_mode_prepare+0xac/0xf0
[ 19.971842] ? syscall_exit_to_user_mode+0x12/0x30
[ 19.971844] ? do_syscall_64+0x68/0x90
[ 19.971847] ? do_syscall_64+0x68/0x90
[ 19.971849] ? sysvec_apic_timer_interrupt+0x3a/0x90
[ 19.971852] entry_SYSCALL_64_after_hwframe+0x63/0xcd
[ 19.971855] RIP: 0033:0x7fd768e4712e
[ 19.971857] Code: 48 89 f2 b9 00 01 00 00 48 89 fe bf 9c ff ff ff
e9 07 00 00 00 0f 1f 80 00 00 00 00 f3 0f 1e fa 41 89 ca b8 06 019
[ 19.971859] RSP: 002b:00007ffdb9f648a8 EFLAGS: 00000206 ORIG_RAX:
0000000000000106
[ 19.971862] RAX: ffffffffffffffda RBX: 000000000000000c RCX: 00007fd768e4712e
[ 19.971863] RDX: 00007ffdb9f649c0 RSI: 00007fd768ec0f35 RDI: 000000000000000c
[ 19.971865] RBP: 00007ffdb9f64a90 R08: 000000000000ffff R09: 0000000000001001
[ 19.971866] R10: 0000000000001000 R11: 0000000000000206 R12: 0000000000000007
[ 19.971868] R13: 0000000000000000 R14: 0000000000000006 R15: 0000557c0e1ef200
[ 19.971871] </TASK>
[ 19.971871] Modules linked in: cdc_ncm nvme cqhci cdc_ether usbnet
nvme_core sdhci uas nvme_common ghash_clmulni_intel usb_storage e
[ 19.971887] CR2: ffff90e3b674eef0
[ 19.971889] ---[ end trace 4abd4ff8e3f54f73 ]---
[ 19.971889] BUG: unable to handle page fault for address: ffff90e3b677f400
[ 19.971892] #PF: supervisor read access in kernel mode
[ 19.971890] RIP: 0010:vma_interval_tree_remove+0x16a/0x2c0
[ 19.971893] #PF: error_code(0x0000) - not-present page
[ 19.971895] PGD 3f401067
[ 19.971895] Code: e0 fc 48 83 fa 03 76 43 48 8b 48 10 48 8b 70 08
48 8b 50 b0 4c 8b 40 40 48 2b 50 a8 48 c1 ea 0c 4a 8d 54 02 ff 489
[ 19.971897] P4D 3f401067
[ 19.971897] RSP: 0018:ffffb05d40a2bd20 EFLAGS: 00010282
[ 19.971898] PUD 3f40c067 PMD 176711063
[ 19.971899]
[ 19.971900] RAX: ffff90e3550f2d08 RBX: ffff90e34bcc46e0 RCX: ffff90e3b676ac20
[ 19.971901] BAD
[ 19.971902] RDX: 0000000000000027 RSI: ffff90e355293df0 RDI: 0000000000000000
[ 19.971902] Oops: 0000 [#4] PREEMPT SMP NOPTI
[ 19.971904] RBP: ffff90e35528a3a0 R08: 0000000000000000 R09: 0000000000000000
[ 19.971905] R10: ffffb05d40a2bd00 R11: 00007fffec14c000 R12: ffff90e35528a3f8
[ 19.971905] CPU: 3 PID: 37 Comm: ksoftirqd/3 Tainted: G D
------- --- 5.14.0+ #2
[ 19.971906] R13: ffffb05d40a2bda0 R14: 0000000000000000 R15: ffff90e355293000
[ 19.971908] Hardware name: ...snip...
[ 19.971908] FS: 00007fd768238540(0000) GS:ffff90eaa0500000(0000)
knlGS:0000000000000000
[ 19.971911] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 19.971912] CR2: ffff90e3b6711a70 CR3: 0000000115064000 CR4: 0000000000350ee0
[ 19.971910] RIP: 0010:rcu_segcblist_accelerate+0xed/0x130
[ 19.971916] Code: 89 48 18 48 89 50 38 b8 01 00 00 00 c3 cc cc cc
cc 31 c0 c3 cc cc cc cc be 01 00 00 00 eb ae 0f 0b e9 2f ff ff ff4
[ 19.971918] RSP: 0018:ffffb05d40233e38 EFLAGS: 00010097
[ 19.971921] RAX: ffff90eaa05b1d58 RBX: ffff90eaa05b1cc0 RCX: ffff90e3b677f400
[ 19.971923] RDX: 00000000000002c4 RSI: 00000000000002c4 RDI: ffff90eaa05b1d58
[ 19.971924] RBP: ffffffffaf1e97c0 R08: 0000000000000002 R09: 000000004406f74b
[ 19.971926] R10: 00000000ad580200 R11: ffffffffaee060c0 R12: 00000000000002c4
[ 19.971927] R13: ffff90eaa05b1d58 R14: 0000000000000246 R15: 0000000000000008
[ 19.971929] FS: 0000000000000000(0000) GS:ffff90eaa0580000(0000)
knlGS:0000000000000000
[ 19.971932] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 19.971933] CR2: ffff90e3b6711bf8 CR3: 0000000102e74000 CR4: 0000000000350ee0
[ 19.971935] Call Trace:
[ 19.971937] <TASK>
[ 19.971937] rcu_accelerate_cbs+0x56/0x80
[ 19.971942] rcu_core+0x319/0x460
[ 19.971945] ? sched_clock_cpu+0x9/0xb0
[ 19.971949] __do_softirq+0xc7/0x2b3
[ 19.971954] ? find_next_bit+0x10/0x10
[ 19.971956] run_ksoftirqd+0x1e/0x30
[ 19.971959] smpboot_thread_fn+0xd5/0x1d0
[ 19.971962] kthread+0xd7/0x100
[ 19.971965] ? kthread_complete_and_exit+0x20/0x20
[ 19.971968] ret_from_fork+0x1f/0x30
[ 19.971973] </TASK>
[ 19.971974] Modules linked in: cdc_ncm nvme cqhci cdc_ether usbnet
nvme_core sdhci uas nvme_common ghash_clmulni_intel usb_storage e
[ 19.971990] CR2: ffff90e3b677f400
[ 19.971991] ---[ end trace 4abd4ff8e3f54f74 ]---
[ 19.971992] RIP: 0010:vma_interval_tree_remove+0x16a/0x2c0
[ 19.971996] Code: e0 fc 48 83 fa 03 76 43 48 8b 48 10 48 8b 70 08
48 8b 50 b0 4c 8b 40 40 48 2b 50 a8 48 c1 ea 0c 4a 8d 54 02 ff 489
[ 19.971998] RSP: 0018:ffffb05d40a2bd20 EFLAGS: 00010282
[ 19.972000] RAX: ffff90e3550f2d08 RBX: ffff90e34bcc46e0 RCX: ffff90e3b676ac20
[ 19.972001] RDX: 0000000000000027 RSI: ffff90e355293df0 RDI: 0000000000000000
[ 19.972003] RBP: ffff90e35528a3a0 R08: 0000000000000000 R09: 0000000000000000
[ 19.972004] R10: ffffb05d40a2bd00 R11: 00007fffec14c000 R12: ffff90e35528a3f8
[ 19.972005] R13: ffffb05d40a2bda0 R14: 0000000000000000 R15: ffff90e355293000
[ 19.972007] FS: 0000000000000000(0000) GS:ffff90eaa0580000(0000)
knlGS:0000000000000000
[ 19.972009] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 19.972010] CR2: ffff90e3b6711bf8 CR3: 0000000102e74000 CR4: 0000000000350ee0
[ 22.110997] Shutting down cpus with NMI
[ 22.114849] Kernel Offset: 0x2c200000 from 0xffffffff81000000
(relocation range: 0xffffffff80000000-0xffffffffbfffffff)
[ 22.125603] ---[ end Kernel panic - not syncing: Fatal exception ]---
Thanks,
Tao Liu
>
> --
> Regards/Gruss,
> Boris.
>
> https://people.kernel.org/tglx/notes-about-netiquette
>
^ permalink raw reply
* Re: [RFC PATCH v2] x86/boot: add .sbat section to the bzImage
From: Luca Boccassi @ 2023-07-14 9:25 UTC (permalink / raw)
To: Ard Biesheuvel
Cc: Peter Jones, Matthew Garrett, Emanuele Giuseppe Esposito, x86,
Thomas Gleixner, lennart, Ingo Molnar, Borislav Petkov,
Dave Hansen, H. Peter Anvin, Andrew Morton, Masahiro Yamada,
Alexander Potapenko, Nick Desaulniers, Vitaly Kuznetsov,
Daniel P . Berrangé, linux-kernel, linux-efi
In-Reply-To: <CAMj1kXG1Sk1G=3PCRmiHZ24qPdUYiGRkSbq57u1-KUbyorX8Lg@mail.gmail.com>
On Fri, 14 Jul 2023 at 09:52, Ard Biesheuvel <ardb@kernel.org> wrote:
>
> (cc Peter and Matthew)
>
> On Fri, 14 Jul 2023 at 00:32, Luca Boccassi <bluca@debian.org> wrote:
> >
> > On Thu, 13 Jul 2023 at 14:52, Ard Biesheuvel <ardb@kernel.org> wrote:
> > >
> > >
> > > Note that by Windows-crippled, I mean x86 PCs built by OEMs who care
> > > about nothing other than the Windows logo sticker. These PCs often don't
> > > allow secure boot keys to be modified by the owner of the machine, or
> > > secure boot to be disabled at all. This is why shim exists, not because
> > > UEFI secure boot is broken by design.
> >
> > AFAIK that's not only against the spec but also the logo
> > certification, which x86 OEMs are doing that and in which models?
> > Happy to flag that and inquire.
>
> Thanks. My Yoga C630 Snapdragon laptop definitely does not allow me to
> update the keys from the UI, but it does allow me to disable secure
> boot. It might work with SetVariable() directly but I've never tried.
That's not an x86 machine though? For Arm IIRC the logo certification
requirement was more lax there (or more locked down, depending on your
point of view), at least in the past. I am not sure what is the
current state.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox