Commit d69ad12c authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'x86-build-2024-03-11' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 build updates from Ingo Molnar:

 - Reduce <asm/bootparam.h> dependencies

 - Simplify <asm/efi.h>

 - Unify *_setup_data definitions into <asm/setup_data.h>

 - Reduce the size of <asm/bootparam.h>

* tag 'x86-build-2024-03-11' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86: Do not include <asm/bootparam.h> in several files
  x86/efi: Implement arch_ima_efi_boot_mode() in source file
  x86/setup: Move internal setup_data structures into setup_data.h
  x86/setup: Move UAPI setup structures into setup_data.h
parents 73f0d1d7 103bf75f
...@@ -53,6 +53,9 @@ REALMODE_CFLAGS += -fno-stack-protector ...@@ -53,6 +53,9 @@ REALMODE_CFLAGS += -fno-stack-protector
REALMODE_CFLAGS += -Wno-address-of-packed-member REALMODE_CFLAGS += -Wno-address-of-packed-member
REALMODE_CFLAGS += $(cc_stack_align4) REALMODE_CFLAGS += $(cc_stack_align4)
REALMODE_CFLAGS += $(CLANG_FLAGS) REALMODE_CFLAGS += $(CLANG_FLAGS)
ifdef CONFIG_CC_IS_CLANG
REALMODE_CFLAGS += -Wno-gnu
endif
export REALMODE_CFLAGS export REALMODE_CFLAGS
# BITS is used as extension for files which are available in a 32 bit # BITS is used as extension for files which are available in a 32 bit
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#include "../string.h" #include "../string.h"
#include "efi.h" #include "efi.h"
#include <asm/bootparam.h>
#include <linux/numa.h> #include <linux/numa.h>
/* /*
......
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
#include "misc.h" #include "misc.h"
#include <asm/bootparam.h>
static unsigned long fs; static unsigned long fs;
static inline void set_fs(unsigned long seg) static inline void set_fs(unsigned long seg)
{ {
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
#include "misc.h" #include "misc.h"
#include <asm/bootparam.h>
/** /**
* efi_get_type - Given a pointer to boot_params, determine the type of EFI environment. * efi_get_type - Given a pointer to boot_params, determine the type of EFI environment.
* *
......
...@@ -97,15 +97,6 @@ typedef struct { ...@@ -97,15 +97,6 @@ typedef struct {
u32 tables; u32 tables;
} efi_system_table_32_t; } efi_system_table_32_t;
/* kexec external ABI */
struct efi_setup_data {
u64 fw_vendor;
u64 __unused;
u64 tables;
u64 smbios;
u64 reserved[8];
};
struct efi_unaccepted_memory { struct efi_unaccepted_memory {
u32 version; u32 version;
u32 unit_size; u32 unit_size;
......
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
#include "misc.h" #include "misc.h"
#include <asm/bootparam.h>
#include <asm/e820/types.h> #include <asm/e820/types.h>
#include <asm/processor.h> #include <asm/processor.h>
#include "pgtable.h" #include "pgtable.h"
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
*/ */
#include "misc.h" #include "misc.h"
#include <asm/bootparam.h>
#include <asm/pgtable_types.h> #include <asm/pgtable_types.h>
#include <asm/sev.h> #include <asm/sev.h>
#include <asm/trapnr.h> #include <asm/trapnr.h>
......
...@@ -143,15 +143,6 @@ extern void efi_free_boot_services(void); ...@@ -143,15 +143,6 @@ extern void efi_free_boot_services(void);
void arch_efi_call_virt_setup(void); void arch_efi_call_virt_setup(void);
void arch_efi_call_virt_teardown(void); void arch_efi_call_virt_teardown(void);
/* kexec external ABI */
struct efi_setup_data {
u64 fw_vendor;
u64 __unused;
u64 tables;
u64 smbios;
u64 reserved[8];
};
extern u64 efi_setup; extern u64 efi_setup;
#ifdef CONFIG_EFI #ifdef CONFIG_EFI
...@@ -418,8 +409,9 @@ extern int __init efi_memmap_split_count(efi_memory_desc_t *md, ...@@ -418,8 +409,9 @@ extern int __init efi_memmap_split_count(efi_memory_desc_t *md,
extern void __init efi_memmap_insert(struct efi_memory_map *old_memmap, extern void __init efi_memmap_insert(struct efi_memory_map *old_memmap,
void *buf, struct efi_mem_range *mem); void *buf, struct efi_mem_range *mem);
#define arch_ima_efi_boot_mode \ extern enum efi_secureboot_mode __x86_ima_efi_boot_mode(void);
({ extern struct boot_params boot_params; boot_params.secure_boot; })
#define arch_ima_efi_boot_mode __x86_ima_efi_boot_mode()
#ifdef CONFIG_EFI_RUNTIME_MAP #ifdef CONFIG_EFI_RUNTIME_MAP
int efi_get_runtime_map_size(void); int efi_get_runtime_map_size(void);
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include <asm/page.h> #include <asm/page.h>
#include <asm/ptrace.h> #include <asm/ptrace.h>
#include <asm/bootparam.h>
struct kimage; struct kimage;
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include <linux/numa.h> #include <linux/numa.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/memtype.h> #include <asm/memtype.h>
#include <asm/x86_init.h>
struct pci_sysdata { struct pci_sysdata {
int domain; /* PCI domain */ int domain; /* PCI domain */
...@@ -124,16 +123,4 @@ cpumask_of_pcibus(const struct pci_bus *bus) ...@@ -124,16 +123,4 @@ cpumask_of_pcibus(const struct pci_bus *bus)
} }
#endif #endif
struct pci_setup_rom {
struct setup_data data;
uint16_t vendor;
uint16_t devid;
uint64_t pcilen;
unsigned long segment;
unsigned long bus;
unsigned long device;
unsigned long function;
uint8_t romdata[];
};
#endif /* _ASM_X86_PCI_H */ #endif /* _ASM_X86_PCI_H */
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ASM_X86_SETUP_DATA_H
#define _ASM_X86_SETUP_DATA_H
#include <uapi/asm/setup_data.h>
#ifndef __ASSEMBLY__
struct pci_setup_rom {
struct setup_data data;
uint16_t vendor;
uint16_t devid;
uint64_t pcilen;
unsigned long segment;
unsigned long bus;
unsigned long device;
unsigned long function;
uint8_t romdata[];
};
/* kexec external ABI */
struct efi_setup_data {
u64 fw_vendor;
u64 __unused;
u64 tables;
u64 smbios;
u64 reserved[8];
};
#endif /* __ASSEMBLY__ */
#endif /* _ASM_X86_SETUP_DATA_H */
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include <asm/insn.h> #include <asm/insn.h>
#include <asm/sev-common.h> #include <asm/sev-common.h>
#include <asm/bootparam.h>
#include <asm/coco.h> #include <asm/coco.h>
#define GHCB_PROTOCOL_MIN 1ULL #define GHCB_PROTOCOL_MIN 1ULL
...@@ -22,6 +21,8 @@ ...@@ -22,6 +21,8 @@
#define VMGEXIT() { asm volatile("rep; vmmcall\n\r"); } #define VMGEXIT() { asm volatile("rep; vmmcall\n\r"); }
struct boot_params;
enum es_result { enum es_result {
ES_OK, /* All good */ ES_OK, /* All good */
ES_UNSUPPORTED, /* Requested operation not supported */ ES_UNSUPPORTED, /* Requested operation not supported */
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
#ifndef _ASM_X86_PLATFORM_H #ifndef _ASM_X86_PLATFORM_H
#define _ASM_X86_PLATFORM_H #define _ASM_X86_PLATFORM_H
#include <asm/bootparam.h>
struct ghcb; struct ghcb;
struct mpc_bus; struct mpc_bus;
struct mpc_cpu; struct mpc_cpu;
......
...@@ -2,21 +2,7 @@ ...@@ -2,21 +2,7 @@
#ifndef _ASM_X86_BOOTPARAM_H #ifndef _ASM_X86_BOOTPARAM_H
#define _ASM_X86_BOOTPARAM_H #define _ASM_X86_BOOTPARAM_H
/* setup_data/setup_indirect types */ #include <asm/setup_data.h>
#define SETUP_NONE 0
#define SETUP_E820_EXT 1
#define SETUP_DTB 2
#define SETUP_PCI 3
#define SETUP_EFI 4
#define SETUP_APPLE_PROPERTIES 5
#define SETUP_JAILHOUSE 6
#define SETUP_CC_BLOB 7
#define SETUP_IMA 8
#define SETUP_RNG_SEED 9
#define SETUP_ENUM_MAX SETUP_RNG_SEED
#define SETUP_INDIRECT (1<<31)
#define SETUP_TYPE_MAX (SETUP_ENUM_MAX | SETUP_INDIRECT)
/* ram_size flags */ /* ram_size flags */
#define RAMDISK_IMAGE_START_MASK 0x07FF #define RAMDISK_IMAGE_START_MASK 0x07FF
...@@ -48,22 +34,6 @@ ...@@ -48,22 +34,6 @@
#include <asm/ist.h> #include <asm/ist.h>
#include <video/edid.h> #include <video/edid.h>
/* extensible setup data list node */
struct setup_data {
__u64 next;
__u32 type;
__u32 len;
__u8 data[];
};
/* extensible setup indirect data node */
struct setup_indirect {
__u32 type;
__u32 reserved; /* Reserved, must be set to zero. */
__u64 len;
__u64 addr;
};
struct setup_header { struct setup_header {
__u8 setup_sects; __u8 setup_sects;
__u16 root_flags; __u16 root_flags;
...@@ -136,51 +106,11 @@ struct efi_info { ...@@ -136,51 +106,11 @@ struct efi_info {
*/ */
#define E820_MAX_ENTRIES_ZEROPAGE 128 #define E820_MAX_ENTRIES_ZEROPAGE 128
/*
* The E820 memory region entry of the boot protocol ABI:
*/
struct boot_e820_entry {
__u64 addr;
__u64 size;
__u32 type;
} __attribute__((packed));
/* /*
* Smallest compatible version of jailhouse_setup_data required by this kernel. * Smallest compatible version of jailhouse_setup_data required by this kernel.
*/ */
#define JAILHOUSE_SETUP_REQUIRED_VERSION 1 #define JAILHOUSE_SETUP_REQUIRED_VERSION 1
/*
* The boot loader is passing platform information via this Jailhouse-specific
* setup data structure.
*/
struct jailhouse_setup_data {
struct {
__u16 version;
__u16 compatible_version;
} __attribute__((packed)) hdr;
struct {
__u16 pm_timer_address;
__u16 num_cpus;
__u64 pci_mmconfig_base;
__u32 tsc_khz;
__u32 apic_khz;
__u8 standard_ioapic;
__u8 cpu_ids[255];
} __attribute__((packed)) v1;
struct {
__u32 flags;
} __attribute__((packed)) v2;
} __attribute__((packed));
/*
* IMA buffer setup data information from the previous kernel during kexec
*/
struct ima_setup_data {
__u64 addr;
__u64 size;
} __attribute__((packed));
/* The so-called "zeropage" */ /* The so-called "zeropage" */
struct boot_params { struct boot_params {
struct screen_info screen_info; /* 0x000 */ struct screen_info screen_info; /* 0x000 */
......
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef _UAPI_ASM_X86_SETUP_DATA_H
#define _UAPI_ASM_X86_SETUP_DATA_H
/* setup_data/setup_indirect types */
#define SETUP_NONE 0
#define SETUP_E820_EXT 1
#define SETUP_DTB 2
#define SETUP_PCI 3
#define SETUP_EFI 4
#define SETUP_APPLE_PROPERTIES 5
#define SETUP_JAILHOUSE 6
#define SETUP_CC_BLOB 7
#define SETUP_IMA 8
#define SETUP_RNG_SEED 9
#define SETUP_ENUM_MAX SETUP_RNG_SEED
#define SETUP_INDIRECT (1<<31)
#define SETUP_TYPE_MAX (SETUP_ENUM_MAX | SETUP_INDIRECT)
#ifndef __ASSEMBLY__
#include <linux/types.h>
/* extensible setup data list node */
struct setup_data {
__u64 next;
__u32 type;
__u32 len;
__u8 data[];
};
/* extensible setup indirect data node */
struct setup_indirect {
__u32 type;
__u32 reserved; /* Reserved, must be set to zero. */
__u64 len;
__u64 addr;
};
/*
* The E820 memory region entry of the boot protocol ABI:
*/
struct boot_e820_entry {
__u64 addr;
__u64 size;
__u32 type;
} __attribute__((packed));
/*
* The boot loader is passing platform information via this Jailhouse-specific
* setup data structure.
*/
struct jailhouse_setup_data {
struct {
__u16 version;
__u16 compatible_version;
} __attribute__((packed)) hdr;
struct {
__u16 pm_timer_address;
__u16 num_cpus;
__u64 pci_mmconfig_base;
__u32 tsc_khz;
__u32 apic_khz;
__u8 standard_ioapic;
__u8 cpu_ids[255];
} __attribute__((packed)) v1;
struct {
__u32 flags;
} __attribute__((packed)) v2;
} __attribute__((packed));
/*
* IMA buffer setup data information from the previous kernel during kexec
*/
struct ima_setup_data {
__u64 addr;
__u64 size;
} __attribute__((packed));
#endif /* __ASSEMBLY__ */
#endif /* _UAPI_ASM_X86_SETUP_DATA_H */
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/memblock.h> #include <linux/memblock.h>
#include <asm/bootparam.h>
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/hardirq.h> #include <asm/hardirq.h>
#include <asm/nmi.h> #include <asm/nmi.h>
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
* and is included directly into both code-bases. * and is included directly into both code-bases.
*/ */
#include <asm/setup_data.h>
#ifndef __BOOT_COMPRESSED #ifndef __BOOT_COMPRESSED
#define error(v) pr_err(v) #define error(v) pr_err(v)
#define has_cpuflag(f) boot_cpu_has(f) #define has_cpuflag(f) boot_cpu_has(f)
......
...@@ -950,3 +950,8 @@ umode_t efi_attr_is_visible(struct kobject *kobj, struct attribute *attr, int n) ...@@ -950,3 +950,8 @@ umode_t efi_attr_is_visible(struct kobject *kobj, struct attribute *attr, int n)
} }
return attr->mode; return attr->mode;
} }
enum efi_secureboot_mode __x86_ima_efi_boot_mode(void)
{
return boot_params.secure_boot;
}
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <xen/hvc-console.h> #include <xen/hvc-console.h>
#include <asm/bootparam.h>
#include <asm/io_apic.h> #include <asm/io_apic.h>
#include <asm/hypervisor.h> #include <asm/hypervisor.h>
#include <asm/e820/api.h> #include <asm/e820/api.h>
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include <xen/hvc-console.h> #include <xen/hvc-console.h>
#include <asm/bootparam.h>
#include <asm/io_apic.h> #include <asm/io_apic.h>
#include <asm/hypervisor.h> #include <asm/hypervisor.h>
#include <asm/e820/api.h> #include <asm/e820/api.h>
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
#include <linux/screen_info.h> #include <linux/screen_info.h>
#include <linux/init.h> #include <linux/init.h>
#include <asm/bootparam.h>
#include <asm/setup.h> #include <asm/setup.h>
#include <xen/interface/xen.h> #include <xen/interface/xen.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment