2017-11-01 15:08:43 +01:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
2008-10-22 22:26:29 -07:00
|
|
|
#ifndef _ASM_X86_BOOTPARAM_H
|
|
|
|
#define _ASM_X86_BOOTPARAM_H
|
2007-07-11 12:18:35 -07:00
|
|
|
|
2024-01-12 10:44:36 +01:00
|
|
|
#include <asm/setup_data.h>
|
2019-11-12 14:46:39 +01:00
|
|
|
|
2013-01-27 10:43:28 -08:00
|
|
|
/* ram_size flags */
|
|
|
|
#define RAMDISK_IMAGE_START_MASK 0x07FF
|
|
|
|
#define RAMDISK_PROMPT_FLAG 0x8000
|
|
|
|
#define RAMDISK_LOAD_FLAG 0x4000
|
|
|
|
|
|
|
|
/* loadflags */
|
|
|
|
#define LOADED_HIGH (1<<0)
|
2015-04-01 12:49:52 +02:00
|
|
|
#define KASLR_FLAG (1<<1)
|
2013-01-27 10:43:28 -08:00
|
|
|
#define QUIET_FLAG (1<<5)
|
|
|
|
#define KEEP_SEGMENTS (1<<6)
|
|
|
|
#define CAN_USE_HEAP (1<<7)
|
|
|
|
|
|
|
|
/* xloadflags */
|
|
|
|
#define XLF_KERNEL_64 (1<<0)
|
|
|
|
#define XLF_CAN_BE_LOADED_ABOVE_4G (1<<1)
|
|
|
|
#define XLF_EFI_HANDOVER_32 (1<<2)
|
|
|
|
#define XLF_EFI_HANDOVER_64 (1<<3)
|
2013-12-20 18:02:20 +08:00
|
|
|
#define XLF_EFI_KEXEC (1<<4)
|
2019-05-24 15:38:08 +08:00
|
|
|
#define XLF_5LEVEL (1<<5)
|
|
|
|
#define XLF_5LEVEL_ENABLED (1<<6)
|
2024-02-27 16:19:14 +01:00
|
|
|
#define XLF_MEM_ENCRYPTION (1<<7)
|
2013-01-27 10:43:28 -08:00
|
|
|
|
2025-03-10 11:42:56 +01:00
|
|
|
#ifndef __ASSEMBLER__
|
2013-01-27 10:43:28 -08:00
|
|
|
|
2007-07-11 12:18:35 -07:00
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/screen_info.h>
|
|
|
|
#include <linux/apm_bios.h>
|
|
|
|
#include <linux/edd.h>
|
2007-07-18 17:19:30 -07:00
|
|
|
#include <asm/ist.h>
|
2007-07-11 12:18:35 -07:00
|
|
|
#include <video/edid.h>
|
|
|
|
|
|
|
|
struct setup_header {
|
2007-10-22 10:56:19 +10:00
|
|
|
__u8 setup_sects;
|
|
|
|
__u16 root_flags;
|
|
|
|
__u32 syssize;
|
|
|
|
__u16 ram_size;
|
|
|
|
__u16 vid_mode;
|
|
|
|
__u16 root_dev;
|
|
|
|
__u16 boot_flag;
|
|
|
|
__u16 jump;
|
|
|
|
__u32 header;
|
|
|
|
__u16 version;
|
|
|
|
__u32 realmode_swtch;
|
2017-02-21 19:36:39 +01:00
|
|
|
__u16 start_sys_seg;
|
2007-10-22 10:56:19 +10:00
|
|
|
__u16 kernel_version;
|
|
|
|
__u8 type_of_loader;
|
|
|
|
__u8 loadflags;
|
|
|
|
__u16 setup_move_size;
|
|
|
|
__u32 code32_start;
|
|
|
|
__u32 ramdisk_image;
|
|
|
|
__u32 ramdisk_size;
|
|
|
|
__u32 bootsect_kludge;
|
|
|
|
__u16 heap_end_ptr;
|
2009-05-07 16:54:11 -07:00
|
|
|
__u8 ext_loader_ver;
|
|
|
|
__u8 ext_loader_type;
|
2007-10-22 10:56:19 +10:00
|
|
|
__u32 cmd_line_ptr;
|
|
|
|
__u32 initrd_addr_max;
|
|
|
|
__u32 kernel_alignment;
|
|
|
|
__u8 relocatable_kernel;
|
2013-01-27 10:43:28 -08:00
|
|
|
__u8 min_alignment;
|
|
|
|
__u16 xloadflags;
|
2007-10-22 10:56:19 +10:00
|
|
|
__u32 cmdline_size;
|
|
|
|
__u32 hardware_subarch;
|
|
|
|
__u64 hardware_subarch_data;
|
2008-03-28 10:49:44 +08:00
|
|
|
__u32 payload_offset;
|
|
|
|
__u32 payload_length;
|
|
|
|
__u64 setup_data;
|
2011-08-27 09:35:45 +01:00
|
|
|
__u64 pref_address;
|
|
|
|
__u32 init_size;
|
2012-07-19 10:23:48 +01:00
|
|
|
__u32 handover_offset;
|
x86/boot: Introduce kernel_info
The relationships between the headers are analogous to the various data
sections:
setup_header = .data
boot_params/setup_data = .bss
What is missing from the above list? That's right:
kernel_info = .rodata
We have been (ab)using .data for things that could go into .rodata or .bss for
a long time, for lack of alternatives and -- especially early on -- inertia.
Also, the BIOS stub is responsible for creating boot_params, so it isn't
available to a BIOS-based loader (setup_data is, though).
setup_header is permanently limited to 144 bytes due to the reach of the
2-byte jump field, which doubles as a length field for the structure, combined
with the size of the "hole" in struct boot_params that a protected-mode loader
or the BIOS stub has to copy it into. It is currently 119 bytes long, which
leaves us with 25 very precious bytes. This isn't something that can be fixed
without revising the boot protocol entirely, breaking backwards compatibility.
boot_params proper is limited to 4096 bytes, but can be arbitrarily extended
by adding setup_data entries. It cannot be used to communicate properties of
the kernel image, because it is .bss and has no image-provided content.
kernel_info solves this by providing an extensible place for information about
the kernel image. It is readonly, because the kernel cannot rely on a
bootloader copying its contents anywhere, but that is OK; if it becomes
necessary it can still contain data items that an enabled bootloader would be
expected to copy into a setup_data chunk.
Do not bump setup_header version in arch/x86/boot/header.S because it
will be followed by additional changes coming into the Linux/x86 boot
protocol.
Suggested-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Ross Philipson <ross.philipson@oracle.com>
Reviewed-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: ard.biesheuvel@linaro.org
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: dave.hansen@linux.intel.com
Cc: eric.snowberg@oracle.com
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Juergen Gross <jgross@suse.com>
Cc: kanth.ghatraju@oracle.com
Cc: linux-doc@vger.kernel.org
Cc: linux-efi <linux-efi@vger.kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: rdunlap@infradead.org
Cc: ross.philipson@oracle.com
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: x86-ml <x86@kernel.org>
Cc: xen-devel@lists.xenproject.org
Link: https://lkml.kernel.org/r/20191112134640.16035-2-daniel.kiper@oracle.com
2019-11-12 14:46:38 +01:00
|
|
|
__u32 kernel_info_offset;
|
2007-07-11 12:18:35 -07:00
|
|
|
} __attribute__((packed));
|
|
|
|
|
|
|
|
struct sys_desc_table {
|
2007-10-22 10:56:19 +10:00
|
|
|
__u16 length;
|
|
|
|
__u8 table[14];
|
2007-07-11 12:18:35 -07:00
|
|
|
};
|
|
|
|
|
2010-06-18 17:46:53 -04:00
|
|
|
/* Gleaned from OFW's set-parameters in cpu/x86/pc/linux.fth */
|
|
|
|
struct olpc_ofw_header {
|
|
|
|
__u32 ofw_magic; /* OFW signature */
|
|
|
|
__u32 ofw_version;
|
|
|
|
__u32 cif_handler; /* callback into OFW */
|
|
|
|
__u32 irq_desc_table;
|
|
|
|
} __attribute__((packed));
|
|
|
|
|
2007-07-11 12:18:35 -07:00
|
|
|
struct efi_info {
|
2008-01-30 13:31:19 +01:00
|
|
|
__u32 efi_loader_signature;
|
2007-10-22 10:56:19 +10:00
|
|
|
__u32 efi_systab;
|
|
|
|
__u32 efi_memdesc_size;
|
|
|
|
__u32 efi_memdesc_version;
|
|
|
|
__u32 efi_memmap;
|
|
|
|
__u32 efi_memmap_size;
|
2008-01-30 13:31:19 +01:00
|
|
|
__u32 efi_systab_hi;
|
|
|
|
__u32 efi_memmap_hi;
|
2007-07-11 12:18:35 -07:00
|
|
|
};
|
|
|
|
|
2017-01-29 12:56:13 +01:00
|
|
|
/*
|
|
|
|
* This is the maximum number of entries in struct boot_params::e820_table
|
|
|
|
* (the zeropage), which is part of the x86 boot protocol ABI:
|
|
|
|
*/
|
|
|
|
#define E820_MAX_ENTRIES_ZEROPAGE 128
|
|
|
|
|
2017-11-27 09:11:46 +01:00
|
|
|
/*
|
|
|
|
* Smallest compatible version of jailhouse_setup_data required by this kernel.
|
|
|
|
*/
|
|
|
|
#define JAILHOUSE_SETUP_REQUIRED_VERSION 1
|
|
|
|
|
2007-07-11 12:18:35 -07:00
|
|
|
/* The so-called "zeropage" */
|
|
|
|
struct boot_params {
|
|
|
|
struct screen_info screen_info; /* 0x000 */
|
|
|
|
struct apm_bios_info apm_bios_info; /* 0x040 */
|
x86, intel_txt: Intel TXT boot support
This patch adds kernel configuration and boot support for Intel Trusted
Execution Technology (Intel TXT).
Intel's technology for safer computing, Intel Trusted Execution
Technology (Intel TXT), defines platform-level enhancements that
provide the building blocks for creating trusted platforms.
Intel TXT was formerly known by the code name LaGrande Technology (LT).
Intel TXT in Brief:
o Provides dynamic root of trust for measurement (DRTM)
o Data protection in case of improper shutdown
o Measurement and verification of launched environment
Intel TXT is part of the vPro(TM) brand and is also available some
non-vPro systems. It is currently available on desktop systems based on
the Q35, X38, Q45, and Q43 Express chipsets (e.g. Dell Optiplex 755, HP
dc7800, etc.) and mobile systems based on the GM45, PM45, and GS45
Express chipsets.
For more information, see http://www.intel.com/technology/security/.
This site also has a link to the Intel TXT MLE Developers Manual, which
has been updated for the new released platforms.
A much more complete description of how these patches support TXT, how to
configure a system for it, etc. is in the Documentation/intel_txt.txt file
in this patch.
This patch provides the TXT support routines for complete functionality,
documentation for TXT support and for the changes to the boot_params structure,
and boot detection of a TXT launch. Attempts to shutdown (reboot, Sx) the system
will result in platform resets; subsequent patches will support these shutdown modes
properly.
Documentation/intel_txt.txt | 210 +++++++++++++++++++++
Documentation/x86/zero-page.txt | 1
arch/x86/include/asm/bootparam.h | 3
arch/x86/include/asm/fixmap.h | 3
arch/x86/include/asm/tboot.h | 197 ++++++++++++++++++++
arch/x86/kernel/Makefile | 1
arch/x86/kernel/setup.c | 4
arch/x86/kernel/tboot.c | 379 +++++++++++++++++++++++++++++++++++++++
security/Kconfig | 30 +++
9 files changed, 827 insertions(+), 1 deletion(-)
Signed-off-by: Joseph Cihula <joseph.cihula@intel.com>
Signed-off-by: Shane Wang <shane.wang@intel.com>
Signed-off-by: Gang Wei <gang.wei@intel.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-30 19:30:59 -07:00
|
|
|
__u8 _pad2[4]; /* 0x054 */
|
|
|
|
__u64 tboot_addr; /* 0x058 */
|
2007-07-18 17:19:30 -07:00
|
|
|
struct ist_info ist_info; /* 0x060 */
|
2018-11-20 08:25:29 +01:00
|
|
|
__u64 acpi_rsdp_addr; /* 0x070 */
|
|
|
|
__u8 _pad3[8]; /* 0x078 */
|
2007-10-22 10:56:19 +10:00
|
|
|
__u8 hd0_info[16]; /* obsolete! */ /* 0x080 */
|
|
|
|
__u8 hd1_info[16]; /* obsolete! */ /* 0x090 */
|
2015-07-20 18:23:50 +02:00
|
|
|
struct sys_desc_table sys_desc_table; /* obsolete! */ /* 0x0a0 */
|
2010-06-18 17:46:53 -04:00
|
|
|
struct olpc_ofw_header olpc_ofw_header; /* 0x0b0 */
|
2013-01-27 10:43:28 -08:00
|
|
|
__u32 ext_ramdisk_image; /* 0x0c0 */
|
|
|
|
__u32 ext_ramdisk_size; /* 0x0c4 */
|
|
|
|
__u32 ext_cmd_line_ptr; /* 0x0c8 */
|
x86/boot: Add a pointer to Confidential Computing blob in bootparams
The previously defined Confidential Computing blob is provided to the
kernel via a setup_data structure or EFI config table entry. Currently,
these are both checked for by boot/compressed kernel to access the CPUID
table address within it for use with SEV-SNP CPUID enforcement.
To also enable that enforcement for the run-time kernel, similar
access to the CPUID table is needed early on while it's still using
the identity-mapped page table set up by boot/compressed, where global
pointers need to be accessed via fixup_pointer().
This isn't much of an issue for accessing setup_data, and the EFI config
table helper code currently used in boot/compressed *could* be used in
this case as well since they both rely on identity-mapping. However, it
has some reliance on EFI helpers/string constants that would need to be
accessed via fixup_pointer(), and fixing it up while making it shareable
between boot/compressed and run-time kernel is fragile and introduces a
good bit of ugliness.
Instead, add a boot_params->cc_blob_address pointer that the
boot/compressed kernel can initialize so that the run-time kernel can
access the CC blob from there instead of re-scanning the EFI config
table.
Also document these in Documentation/x86/zero-page.rst. While there,
add missing documentation for the acpi_rsdp_addr field, which serves a
similar purpose in providing the run-time kernel a pointer to the ACPI
RSDP table so that it does not need to [re-]scan the EFI configuration
table.
[ bp: Fix typos, massage commit message. ]
Signed-off-by: Michael Roth <michael.roth@amd.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lore.kernel.org/r/20220307213356.2797205-34-brijesh.singh@amd.com
2022-02-24 10:56:13 -06:00
|
|
|
__u8 _pad4[112]; /* 0x0cc */
|
|
|
|
__u32 cc_blob_address; /* 0x13c */
|
2007-07-11 12:18:35 -07:00
|
|
|
struct edid_info edid_info; /* 0x140 */
|
|
|
|
struct efi_info efi_info; /* 0x1c0 */
|
2007-10-22 10:56:19 +10:00
|
|
|
__u32 alt_mem_k; /* 0x1e0 */
|
|
|
|
__u32 scratch; /* Scratch field! */ /* 0x1e4 */
|
|
|
|
__u8 e820_entries; /* 0x1e8 */
|
|
|
|
__u8 eddbuf_entries; /* 0x1e9 */
|
|
|
|
__u8 edd_mbr_sig_buf_entries; /* 0x1ea */
|
2012-04-13 21:08:26 +02:00
|
|
|
__u8 kbd_status; /* 0x1eb */
|
2017-02-06 11:22:43 +00:00
|
|
|
__u8 secure_boot; /* 0x1ec */
|
|
|
|
__u8 _pad5[2]; /* 0x1ed */
|
2013-01-27 10:43:28 -08:00
|
|
|
/*
|
|
|
|
* The sentinel is set to a nonzero value (0xff) in header.S.
|
|
|
|
*
|
|
|
|
* A bootloader is supposed to only take setup_header and put
|
|
|
|
* it into a clean boot_params buffer. If it turns out that
|
|
|
|
* it is clumsy or too generous with the buffer, it most
|
|
|
|
* probably will pick up the sentinel variable too. The fact
|
|
|
|
* that this variable then is still 0xff will let kernel
|
|
|
|
* know that some variables in boot_params are invalid and
|
|
|
|
* kernel should zero out certain portions of boot_params.
|
|
|
|
*/
|
|
|
|
__u8 sentinel; /* 0x1ef */
|
|
|
|
__u8 _pad6[1]; /* 0x1f0 */
|
2007-07-11 12:18:35 -07:00
|
|
|
struct setup_header hdr; /* setup header */ /* 0x1f1 */
|
2007-10-22 10:56:19 +10:00
|
|
|
__u8 _pad7[0x290-0x1f1-sizeof(struct setup_header)];
|
|
|
|
__u32 edd_mbr_sig_buffer[EDD_MBR_SIG_MAX]; /* 0x290 */
|
2017-01-29 12:56:13 +01:00
|
|
|
struct boot_e820_entry e820_table[E820_MAX_ENTRIES_ZEROPAGE]; /* 0x2d0 */
|
2007-10-22 10:56:19 +10:00
|
|
|
__u8 _pad8[48]; /* 0xcd0 */
|
2007-07-11 12:18:35 -07:00
|
|
|
struct edd_info eddbuf[EDDMAXNR]; /* 0xd00 */
|
2007-10-22 10:56:19 +10:00
|
|
|
__u8 _pad9[276]; /* 0xeec */
|
2007-07-11 12:18:35 -07:00
|
|
|
} __attribute__((packed));
|
|
|
|
|
2016-04-13 17:04:31 -07:00
|
|
|
/**
|
|
|
|
* enum x86_hardware_subarch - x86 hardware subarchitecture
|
|
|
|
*
|
|
|
|
* The x86 hardware_subarch and hardware_subarch_data were added as of the x86
|
|
|
|
* boot protocol 2.07 to help distinguish and support custom x86 boot
|
|
|
|
* sequences. This enum represents accepted values for the x86
|
|
|
|
* hardware_subarch. Custom x86 boot sequences (not X86_SUBARCH_PC) do not
|
|
|
|
* have or simply *cannot* make use of natural stubs like BIOS or EFI, the
|
|
|
|
* hardware_subarch can be used on the Linux entry path to revector to a
|
|
|
|
* subarchitecture stub when needed. This subarchitecture stub can be used to
|
|
|
|
* set up Linux boot parameters or for special care to account for nonstandard
|
|
|
|
* handling of page tables.
|
|
|
|
*
|
|
|
|
* These enums should only ever be used by x86 code, and the code that uses
|
2021-03-18 15:28:01 +01:00
|
|
|
* it should be well contained and compartmentalized.
|
2016-04-13 17:04:31 -07:00
|
|
|
*
|
|
|
|
* KVM and Xen HVM do not have a subarch as these are expected to follow
|
|
|
|
* standard x86 boot entries. If there is a genuine need for "hypervisor" type
|
|
|
|
* that should be considered separately in the future. Future guest types
|
|
|
|
* should seriously consider working with standard x86 boot stubs such as
|
|
|
|
* the BIOS or EFI boot stubs.
|
|
|
|
*
|
|
|
|
* WARNING: this enum is only used for legacy hacks, for platform features that
|
|
|
|
* are not easily enumerated or discoverable. You should not ever use
|
|
|
|
* this for new features.
|
|
|
|
*
|
|
|
|
* @X86_SUBARCH_PC: Should be used if the hardware is enumerable using standard
|
|
|
|
* PC mechanisms (PCI, ACPI) and doesn't need a special boot flow.
|
2017-08-16 19:31:57 +02:00
|
|
|
* @X86_SUBARCH_LGUEST: Used for x86 hypervisor demo, lguest, deprecated
|
2016-04-13 17:04:31 -07:00
|
|
|
* @X86_SUBARCH_XEN: Used for Xen guest types which follow the PV boot path,
|
|
|
|
* which start at asm startup_xen() entry point and later jump to the C
|
|
|
|
* xen_start_kernel() entry point. Both domU and dom0 type of guests are
|
2021-03-18 15:28:01 +01:00
|
|
|
* currently supported through this PV boot path.
|
2016-04-13 17:04:31 -07:00
|
|
|
* @X86_SUBARCH_INTEL_MID: Used for Intel MID (Mobile Internet Device) platform
|
|
|
|
* systems which do not have the PCI legacy interfaces.
|
2020-07-25 17:41:22 -07:00
|
|
|
* @X86_SUBARCH_CE4100: Used for Intel CE media processor (CE4100) SoC
|
2016-04-13 17:04:31 -07:00
|
|
|
* for settop boxes and media devices, the use of a subarch for CE4100
|
|
|
|
* is more of a hack...
|
|
|
|
*/
|
|
|
|
enum x86_hardware_subarch {
|
2009-08-28 14:52:47 -07:00
|
|
|
X86_SUBARCH_PC = 0,
|
|
|
|
X86_SUBARCH_LGUEST,
|
|
|
|
X86_SUBARCH_XEN,
|
2013-10-17 15:35:29 -07:00
|
|
|
X86_SUBARCH_INTEL_MID,
|
2010-11-09 12:08:04 -08:00
|
|
|
X86_SUBARCH_CE4100,
|
2009-08-28 14:52:47 -07:00
|
|
|
X86_NR_SUBARCHS,
|
|
|
|
};
|
|
|
|
|
2025-03-10 11:42:56 +01:00
|
|
|
#endif /* __ASSEMBLER__ */
|
2009-08-28 14:52:47 -07:00
|
|
|
|
2008-10-22 22:26:29 -07:00
|
|
|
#endif /* _ASM_X86_BOOTPARAM_H */
|