Skip to content

Commit e28ddd0

Browse files
committed
Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
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
2 parents e55feea + bdf3f41 commit e28ddd0

5 files changed

Lines changed: 18 additions & 7 deletions

File tree

arch/arm64/include/asm/efi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ void arch_efi_call_virt_teardown(void);
4545
* switching to the EFI runtime stack.
4646
*/
4747
#define current_in_efi() \
48-
(!preemptible() && efi_rt_stack_top != NULL && \
48+
(efi_rt_stack_top != NULL && \
4949
on_task_stack(current, READ_ONCE(efi_rt_stack_top[-1]), 1))
5050

5151
#define ARCH_EFI_IRQ_FLAGS_MASK (PSR_D_BIT | PSR_A_BIT | PSR_I_BIT | PSR_F_BIT)

arch/arm64/include/asm/suspend.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#ifndef __ASM_SUSPEND_H
33
#define __ASM_SUSPEND_H
44

5-
#define NR_CTX_REGS 13
5+
#define NR_CTX_REGS 14
66
#define NR_CALLEE_SAVED_REGS 12
77

88
/*

arch/arm64/mm/pageattr.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ static int change_memory_common(unsigned long addr, int numpages,
171171
*/
172172
area = find_vm_area((void *)addr);
173173
if (!area ||
174-
end > (unsigned long)kasan_reset_tag(area->addr) + area->size ||
174+
((unsigned long)kasan_reset_tag((void *)end) >
175+
(unsigned long)kasan_reset_tag(area->addr) + area->size) ||
175176
((area->flags & (VM_ALLOC | VM_ALLOW_HUGE_VMAP)) != VM_ALLOC))
176177
return -EINVAL;
177178

@@ -184,7 +185,8 @@ static int change_memory_common(unsigned long addr, int numpages,
184185
*/
185186
if (rodata_full && (pgprot_val(set_mask) == PTE_RDONLY ||
186187
pgprot_val(clear_mask) == PTE_RDONLY)) {
187-
unsigned long idx = (start - (unsigned long)kasan_reset_tag(area->addr))
188+
unsigned long idx = ((unsigned long)kasan_reset_tag((void *)start) -
189+
(unsigned long)kasan_reset_tag(area->addr))
188190
>> PAGE_SHIFT;
189191
for (; numpages; idx++, numpages--) {
190192
ret = __change_memory_common((u64)page_address(area->pages[idx]),

arch/arm64/mm/proc.S

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ SYM_FUNC_START(cpu_do_suspend)
110110
* call stack.
111111
*/
112112
str x18, [x0, #96]
113+
alternative_if ARM64_HAS_TCR2
114+
mrs x2, REG_TCR2_EL1
115+
str x2, [x0, #104]
116+
alternative_else_nop_endif
113117
ret
114118
SYM_FUNC_END(cpu_do_suspend)
115119

@@ -144,6 +148,10 @@ SYM_FUNC_START(cpu_do_resume)
144148
msr tcr_el1, x8
145149
msr vbar_el1, x9
146150
msr mdscr_el1, x10
151+
alternative_if ARM64_HAS_TCR2
152+
ldr x2, [x0, #104]
153+
msr REG_TCR2_EL1, x2
154+
alternative_else_nop_endif
147155

148156
msr sctlr_el1, x12
149157
set_this_cpu_offset x13

drivers/resctrl/mpam_devices.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,7 +1072,7 @@ static void __ris_msmon_read(void *arg)
10721072
u64 now;
10731073
bool nrdy = false;
10741074
bool config_mismatch;
1075-
bool overflow;
1075+
bool overflow = false;
10761076
struct mon_read *m = arg;
10771077
struct mon_cfg *ctx = m->ctx;
10781078
bool reset_on_next_read = false;
@@ -1176,10 +1176,11 @@ static void __ris_msmon_read(void *arg)
11761176
}
11771177
mpam_mon_sel_unlock(msc);
11781178

1179-
if (nrdy) {
1179+
if (nrdy)
11801180
m->err = -EBUSY;
1181+
1182+
if (m->err)
11811183
return;
1182-
}
11831184

11841185
*m->val += now;
11851186
}

0 commit comments

Comments
 (0)