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

Merge tag 'efi-next-for-v5.17' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi

Pull EFI updates from Ard Biesheuvel:

 - support taking the measurement of the initrd when loaded via the
   LoadFile2 protocol

 - kobject API cleanup from Greg

 - some header file whitespace fixes

* tag 'efi-next-for-v5.17' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi:
  efi: use default_groups in kobj_type
  efi/libstub: measure loaded initrd info into the TPM
  efi/libstub: consolidate initrd handling across architectures
  efi/libstub: x86/mixed: increase supported argument count
  efi/libstub: add prototype of efi_tcg2_protocol::hash_log_extend_event()
  include/linux/efi.h: Remove unneeded whitespaces before tabs
parents f6921211 42f4046b
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -26,8 +26,6 @@ SYM_FUNC_START(__efi64_thunk)
	push	%rbp
	push	%rbx

	leaq	1f(%rip), %rbp

	movl	%ds, %eax
	push	%rax
	movl	%es, %eax
@@ -35,6 +33,11 @@ SYM_FUNC_START(__efi64_thunk)
	movl	%ss, %eax
	push	%rax

	/* Copy args passed on stack */
	movq	0x30(%rsp), %rbp
	movq	0x38(%rsp), %rbx
	movq	0x40(%rsp), %rax

	/*
	 * Convert x86-64 ABI params to i386 ABI
	 */
@@ -44,13 +47,18 @@ SYM_FUNC_START(__efi64_thunk)
	movl	%ecx, 0x8(%rsp)
	movl	%r8d, 0xc(%rsp)
	movl	%r9d, 0x10(%rsp)
	movl	%ebp, 0x14(%rsp)
	movl	%ebx, 0x18(%rsp)
	movl	%eax, 0x1c(%rsp)

	leaq	0x14(%rsp), %rbx
	leaq	0x20(%rsp), %rbx
	sgdt	(%rbx)

	addq	$16, %rbx
	sidt	(%rbx)

	leaq	1f(%rip), %rbp

	/*
	 * Switch to IDT and GDT with 32-bit segments. This is the firmware GDT
	 * and IDT that was installed when the kernel started executing. The
+10 −4
Original line number Diff line number Diff line
@@ -46,13 +46,14 @@ extern unsigned long efi_mixed_mode_stack_pa;

#define __efi_nargs(...) __efi_nargs_(__VA_ARGS__)
#define __efi_nargs_(...) __efi_nargs__(0, ##__VA_ARGS__,	\
	__efi_arg_sentinel(9), __efi_arg_sentinel(8),		\
	__efi_arg_sentinel(7), __efi_arg_sentinel(6),		\
	__efi_arg_sentinel(5), __efi_arg_sentinel(4),		\
	__efi_arg_sentinel(3), __efi_arg_sentinel(2),		\
	__efi_arg_sentinel(1), __efi_arg_sentinel(0))
#define __efi_nargs__(_0, _1, _2, _3, _4, _5, _6, _7, n, ...)	\
#define __efi_nargs__(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, n, ...)	\
	__take_second_arg(n,					\
		({ BUILD_BUG_ON_MSG(1, "__efi_nargs limit exceeded"); 8; }))
		({ BUILD_BUG_ON_MSG(1, "__efi_nargs limit exceeded"); 10; }))
#define __efi_arg_sentinel(n) , n

/*
@@ -176,8 +177,9 @@ extern u64 efi_setup;
extern efi_status_t __efi64_thunk(u32, ...);

#define efi64_thunk(...) ({						\
	__efi_nargs_check(efi64_thunk, 6, __VA_ARGS__);			\
	__efi64_thunk(__VA_ARGS__);					\
	u64 __pad[3]; /* must have space for 3 args on the stack */	\
	__efi_nargs_check(efi64_thunk, 9, __VA_ARGS__);			\
	__efi64_thunk(__VA_ARGS__, __pad);				\
})

static inline bool efi_is_mixed(void)
@@ -306,6 +308,10 @@ static inline u32 efi64_convert_status(efi_status_t status)
#define __efi64_argmap_query_mode(gop, mode, size, info)		\
	((gop), (mode), efi64_zero_upper(size), efi64_zero_upper(info))

/* TCG2 protocol */
#define __efi64_argmap_hash_log_extend_event(prot, fl, addr, size, ev)	\
	((prot), (fl), 0ULL, (u64)(addr), 0ULL, (u64)(size), 0ULL, ev)

/*
 * The macros below handle the plumbing for the argument mapping. To add a
 * mapping for a specific EFI method, simply define a macro
+12 −2
Original line number Diff line number Diff line
@@ -36,6 +36,17 @@ SYM_CODE_START(__efi64_thunk)
	movq	efi_mixed_mode_stack_pa(%rip), %rsp
	push	%rax

	/*
	 * Copy args passed via the stack
	 */
	subq	$0x24, %rsp
	movq	0x18(%rax), %rbp
	movq	0x20(%rax), %rbx
	movq	0x28(%rax), %rax
	movl	%ebp, 0x18(%rsp)
	movl	%ebx, 0x1c(%rsp)
	movl	%eax, 0x20(%rsp)

	/*
	 * Calculate the physical address of the kernel text.
	 */
@@ -47,7 +58,6 @@ SYM_CODE_START(__efi64_thunk)
	subq	%rax, %rbp
	subq	%rax, %rbx

	subq	$28, %rsp
	movl	%ebx, 0x0(%rsp)		/* return address */
	movl	%esi, 0x4(%rsp)
	movl	%edx, 0x8(%rsp)
@@ -60,7 +70,7 @@ SYM_CODE_START(__efi64_thunk)
	pushq	%rdi			/* EFI runtime service address */
	lretq

1:	movq	24(%rsp), %rsp
1:	movq	0x20(%rsp), %rsp
	pop	%rbx
	pop	%rbp
	retq
+2 −1
Original line number Diff line number Diff line
@@ -352,11 +352,12 @@ static struct attribute *def_attrs[] = {
	&efivar_attr_raw_var.attr,
	NULL,
};
ATTRIBUTE_GROUPS(def);

static struct kobj_type efivar_ktype = {
	.release = efivar_release,
	.sysfs_ops = &efivar_attr_ops,
	.default_attrs = def_attrs,
	.default_groups = def_groups,
};

static ssize_t efivar_create(struct file *filp, struct kobject *kobj,
+3 −1
Original line number Diff line number Diff line
@@ -146,6 +146,8 @@ static struct attribute *esre1_attrs[] = {
	&esre_last_attempt_status.attr,
	NULL
};
ATTRIBUTE_GROUPS(esre1);

static void esre_release(struct kobject *kobj)
{
	struct esre_entry *entry = to_entry(kobj);
@@ -157,7 +159,7 @@ static void esre_release(struct kobject *kobj)
static struct kobj_type esre1_ktype = {
	.release = esre_release,
	.sysfs_ops = &esre_attr_ops,
	.default_attrs = esre1_attrs,
	.default_groups = esre1_groups,
};


Loading