Commit e28ddd0b authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull arm64 fixes from Catalin Marinas:

 - Do not return false if !preemptible() in current_in_efi(). EFI
   runtime services can now run with preemption enabled

 - Fix uninitialised variable in the arm MPAM driver, reported by sparse

 - Fix partial kasan_reset_tag() use in change_memory_common() when
   calculating page indices or comparing ranges

 - Save/restore TCR2_EL1 during suspend/resume, otherwise the E0POE bit
   is lost

* tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
  arm64: Fix cleared E0POE bit after cpu_suspend()/resume()
  arm64: mm: Fix incomplete tag reset in change_memory_common()
  arm_mpam: Stop using uninitialized variables in __ris_msmon_read()
  arm64/efi: Don't fail check current_in_efi() if preemptible
parents e55feea3 bdf3f417
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ void arch_efi_call_virt_teardown(void);
 * switching to the EFI runtime stack.
 */
#define current_in_efi()						\
	(!preemptible() && efi_rt_stack_top != NULL &&			\
	(efi_rt_stack_top != NULL &&					\
	 on_task_stack(current, READ_ONCE(efi_rt_stack_top[-1]), 1))

#define ARCH_EFI_IRQ_FLAGS_MASK (PSR_D_BIT | PSR_A_BIT | PSR_I_BIT | PSR_F_BIT)
+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
#ifndef __ASM_SUSPEND_H
#define __ASM_SUSPEND_H

#define NR_CTX_REGS 13
#define NR_CTX_REGS 14
#define NR_CALLEE_SAVED_REGS 12

/*
+4 −2
Original line number Diff line number Diff line
@@ -171,7 +171,8 @@ static int change_memory_common(unsigned long addr, int numpages,
	 */
	area = find_vm_area((void *)addr);
	if (!area ||
	    end > (unsigned long)kasan_reset_tag(area->addr) + area->size ||
	    ((unsigned long)kasan_reset_tag((void *)end) >
	     (unsigned long)kasan_reset_tag(area->addr) + area->size) ||
	    ((area->flags & (VM_ALLOC | VM_ALLOW_HUGE_VMAP)) != VM_ALLOC))
		return -EINVAL;

@@ -184,7 +185,8 @@ static int change_memory_common(unsigned long addr, int numpages,
	 */
	if (rodata_full && (pgprot_val(set_mask) == PTE_RDONLY ||
			    pgprot_val(clear_mask) == PTE_RDONLY)) {
		unsigned long idx = (start - (unsigned long)kasan_reset_tag(area->addr))
		unsigned long idx = ((unsigned long)kasan_reset_tag((void *)start) -
				     (unsigned long)kasan_reset_tag(area->addr))
				    >> PAGE_SHIFT;
		for (; numpages; idx++, numpages--) {
			ret = __change_memory_common((u64)page_address(area->pages[idx]),
+8 −0
Original line number Diff line number Diff line
@@ -110,6 +110,10 @@ SYM_FUNC_START(cpu_do_suspend)
	 * call stack.
	 */
	str	x18, [x0, #96]
alternative_if ARM64_HAS_TCR2
	mrs	x2, REG_TCR2_EL1
	str	x2, [x0, #104]
alternative_else_nop_endif
	ret
SYM_FUNC_END(cpu_do_suspend)

@@ -144,6 +148,10 @@ SYM_FUNC_START(cpu_do_resume)
	msr	tcr_el1, x8
	msr	vbar_el1, x9
	msr	mdscr_el1, x10
alternative_if ARM64_HAS_TCR2
	ldr	x2, [x0, #104]
	msr	REG_TCR2_EL1, x2
alternative_else_nop_endif

	msr	sctlr_el1, x12
	set_this_cpu_offset x13
+4 −3
Original line number Diff line number Diff line
@@ -1072,7 +1072,7 @@ static void __ris_msmon_read(void *arg)
	u64 now;
	bool nrdy = false;
	bool config_mismatch;
	bool overflow;
	bool overflow = false;
	struct mon_read *m = arg;
	struct mon_cfg *ctx = m->ctx;
	bool reset_on_next_read = false;
@@ -1176,10 +1176,11 @@ static void __ris_msmon_read(void *arg)
	}
	mpam_mon_sel_unlock(msc);

	if (nrdy) {
	if (nrdy)
		m->err = -EBUSY;

	if (m->err)
		return;
	}

	*m->val += now;
}