Commit e6f39a90 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'efi-fixes-for-v6.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi

Pull EFI fixes from Ard Biesheuvel:
 "The only notable change here is the patch that changes the way we deal
  with spurious errors from the EFI memory attribute protocol. This will
  be backported to v6.6, and is intended to ensure that we will not
  paint ourselves into a corner when we tighten this further in order to
  comply with MS requirements on signed EFI code.

  Note that this protocol does not currently exist in x86 production
  systems in the field, only in Microsoft's fork of OVMF, but it will be
  mandatory for Windows logo certification for x86 PCs in the future.

   - Tighten ELF relocation checks on the RISC-V EFI stub

   - Give up if the new EFI memory attributes protocol fails spuriously
     on x86

   - Take care not to place the kernel in the lowest 16 MB of DRAM on
     x86

   - Omit special purpose EFI memory from memblock

   - Some fixes for the CXL CPER reporting code

   - Make the PE/COFF layout of mixed-mode capable images comply with a
     strict interpretation of the spec"

* tag 'efi-fixes-for-v6.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi:
  x86/efistub: Use 1:1 file:memory mapping for PE/COFF .compat section
  cxl/trace: Remove unnecessary memcpy's
  cxl/cper: Fix errant CPER prints for CXL events
  efi: Don't add memblocks for soft-reserved memory
  efi: runtime: Fix potential overflow of soft-reserved region size
  efi/libstub: Add one kernel-doc comment
  x86/efistub: Avoid placing the kernel below LOAD_PHYSICAL_ADDR
  x86/efistub: Give up if memory attribute protocol returns an error
  riscv/efistub: Tighten ELF relocation check
  riscv/efistub: Ensure GP-relative addressing is not used
parents 5ddfc246 1ad55cec
Loading
Loading
Loading
Loading
+6 −8
Original line number Diff line number Diff line
@@ -106,8 +106,7 @@ extra_header_fields:
	.word	0				# MinorSubsystemVersion
	.long	0				# Win32VersionValue

	.long	setup_size + ZO__end + pecompat_vsize
						# SizeOfImage
	.long	setup_size + ZO__end		# SizeOfImage

	.long	salign				# SizeOfHeaders
	.long	0				# CheckSum
@@ -143,7 +142,7 @@ section_table:
	.ascii	".setup"
	.byte	0
	.byte	0
	.long	setup_size - salign 		# VirtualSize
	.long	pecompat_fstart - salign 	# VirtualSize
	.long	salign				# VirtualAddress
	.long	pecompat_fstart - salign	# SizeOfRawData
	.long	salign				# PointerToRawData
@@ -156,8 +155,8 @@ section_table:
#ifdef CONFIG_EFI_MIXED
	.asciz	".compat"

	.long	8				# VirtualSize
	.long	setup_size + ZO__end		# VirtualAddress
	.long	pecompat_fsize			# VirtualSize
	.long	pecompat_fstart			# VirtualAddress
	.long	pecompat_fsize			# SizeOfRawData
	.long	pecompat_fstart			# PointerToRawData

@@ -172,17 +171,16 @@ section_table:
	 * modes this image supports.
	 */
	.pushsection ".pecompat", "a", @progbits
	.balign	falign
	.set	pecompat_vsize, salign
	.balign	salign
	.globl	pecompat_fstart
pecompat_fstart:
	.byte	0x1				# Version
	.byte	8				# Size
	.word	IMAGE_FILE_MACHINE_I386		# PE machine type
	.long	setup_size + ZO_efi32_pe_entry	# Entrypoint
	.byte	0x0				# Sentinel
	.popsection
#else
	.set	pecompat_vsize, 0
	.set	pecompat_fstart, setup_size
#endif
	.ascii	".text"
+3 −3
Original line number Diff line number Diff line
@@ -24,6 +24,9 @@ SECTIONS
	.text		: { *(.text .text.*) }
	.text32		: { *(.text32) }

	.pecompat	: { *(.pecompat) }
	PROVIDE(pecompat_fsize = setup_size - pecompat_fstart);

	. = ALIGN(16);
	.rodata		: { *(.rodata*) }

@@ -36,9 +39,6 @@ SECTIONS
	. = ALIGN(16);
	.data		: { *(.data*) }

	.pecompat	: { *(.pecompat) }
	PROVIDE(pecompat_fsize = setup_size - pecompat_fstart);

	.signature	: {
		setup_sig = .;
		LONG(0x5a5aaa55)
+0 −26
Original line number Diff line number Diff line
@@ -680,32 +680,6 @@ static void ghes_defer_non_standard_event(struct acpi_hest_generic_data *gdata,
static DECLARE_RWSEM(cxl_cper_rw_sem);
static cxl_cper_callback cper_callback;

/* CXL Event record UUIDs are formatted as GUIDs and reported in section type */

/*
 * General Media Event Record
 * CXL rev 3.0 Section 8.2.9.2.1.1; Table 8-43
 */
#define CPER_SEC_CXL_GEN_MEDIA_GUID					\
	GUID_INIT(0xfbcd0a77, 0xc260, 0x417f,				\
		  0x85, 0xa9, 0x08, 0x8b, 0x16, 0x21, 0xeb, 0xa6)

/*
 * DRAM Event Record
 * CXL rev 3.0 section 8.2.9.2.1.2; Table 8-44
 */
#define CPER_SEC_CXL_DRAM_GUID						\
	GUID_INIT(0x601dcbb3, 0x9c06, 0x4eab,				\
		  0xb8, 0xaf, 0x4e, 0x9b, 0xfb, 0x5c, 0x96, 0x24)

/*
 * Memory Module Event Record
 * CXL rev 3.0 section 8.2.9.2.1.3; Table 8-45
 */
#define CPER_SEC_CXL_MEM_MODULE_GUID					\
	GUID_INIT(0xfe927475, 0xdd59, 0x4339,				\
		  0xa5, 0x86, 0x79, 0xba, 0xb1, 0x13, 0xb7, 0x74)

static void cxl_cper_post_event(enum cxl_event_type event_type,
				struct cxl_cper_event_rec *rec)
{
+3 −3
Original line number Diff line number Diff line
@@ -338,7 +338,7 @@ TRACE_EVENT(cxl_general_media,

	TP_fast_assign(
		CXL_EVT_TP_fast_assign(cxlmd, log, rec->hdr);
		memcpy(&__entry->hdr_uuid, &CXL_EVENT_GEN_MEDIA_UUID, sizeof(uuid_t));
		__entry->hdr_uuid = CXL_EVENT_GEN_MEDIA_UUID;

		/* General Media */
		__entry->dpa = le64_to_cpu(rec->phys_addr);
@@ -425,7 +425,7 @@ TRACE_EVENT(cxl_dram,

	TP_fast_assign(
		CXL_EVT_TP_fast_assign(cxlmd, log, rec->hdr);
		memcpy(&__entry->hdr_uuid, &CXL_EVENT_DRAM_UUID, sizeof(uuid_t));
		__entry->hdr_uuid = CXL_EVENT_DRAM_UUID;

		/* DRAM */
		__entry->dpa = le64_to_cpu(rec->phys_addr);
@@ -573,7 +573,7 @@ TRACE_EVENT(cxl_memory_module,

	TP_fast_assign(
		CXL_EVT_TP_fast_assign(cxlmd, log, rec->hdr);
		memcpy(&__entry->hdr_uuid, &CXL_EVENT_MEM_MODULE_UUID, sizeof(uuid_t));
		__entry->hdr_uuid = CXL_EVENT_MEM_MODULE_UUID;

		/* Memory Module Event */
		__entry->event_type = rec->event_type;
+1 −1
Original line number Diff line number Diff line
@@ -107,7 +107,7 @@ static int __init arm_enable_runtime_services(void)
		efi_memory_desc_t *md;

		for_each_efi_memory_desc(md) {
			int md_size = md->num_pages << EFI_PAGE_SHIFT;
			u64 md_size = md->num_pages << EFI_PAGE_SHIFT;
			struct resource *res;

			if (!(md->attribute & EFI_MEMORY_SP))
Loading