Skip to content

Commit 9c987a3

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: - add TLB invalidation for page table tear-down which was missed when support for CONFIG_HAVE_RCU_TABLE_FREE was added (assuming page table freeing was always deferred) - use UEFI for system and reset poweroff if available - fix asm label placement in relation to the alignment statement * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: arm64: put __boot_cpu_mode label after alignment instead of before efi/arm64: use UEFI for system reset and poweroff arm64: Invalidate the TLB corresponding to intermediate page table levels
2 parents e6c2d9c + 947bb75 commit 9c987a3

File tree

5 files changed

+34
-1
lines changed

5 files changed

+34
-1
lines changed

arch/arm64/include/asm/tlb.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ static inline void tlb_flush(struct mmu_gather *tlb)
4848
static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte,
4949
unsigned long addr)
5050
{
51+
__flush_tlb_pgtable(tlb->mm, addr);
5152
pgtable_page_dtor(pte);
5253
tlb_remove_entry(tlb, pte);
5354
}
@@ -56,6 +57,7 @@ static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte,
5657
static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp,
5758
unsigned long addr)
5859
{
60+
__flush_tlb_pgtable(tlb->mm, addr);
5961
tlb_remove_entry(tlb, virt_to_page(pmdp));
6062
}
6163
#endif
@@ -64,6 +66,7 @@ static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp,
6466
static inline void __pud_free_tlb(struct mmu_gather *tlb, pud_t *pudp,
6567
unsigned long addr)
6668
{
69+
__flush_tlb_pgtable(tlb->mm, addr);
6770
tlb_remove_entry(tlb, virt_to_page(pudp));
6871
}
6972
#endif

arch/arm64/include/asm/tlbflush.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,19 @@ static inline void flush_tlb_kernel_range(unsigned long start, unsigned long end
143143
flush_tlb_all();
144144
}
145145

146+
/*
147+
* Used to invalidate the TLB (walk caches) corresponding to intermediate page
148+
* table levels (pgd/pud/pmd).
149+
*/
150+
static inline void __flush_tlb_pgtable(struct mm_struct *mm,
151+
unsigned long uaddr)
152+
{
153+
unsigned long addr = uaddr >> 12 | ((unsigned long)ASID(mm) << 48);
154+
155+
dsb(ishst);
156+
asm("tlbi vae1is, %0" : : "r" (addr));
157+
dsb(ish);
158+
}
146159
/*
147160
* On AArch64, the cache coherency is handled via the set_pte_at() function.
148161
*/

arch/arm64/kernel/efi.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,3 +354,12 @@ void efi_virtmap_unload(void)
354354
efi_set_pgd(current->active_mm);
355355
preempt_enable();
356356
}
357+
358+
/*
359+
* UpdateCapsule() depends on the system being shutdown via
360+
* ResetSystem().
361+
*/
362+
bool efi_poweroff_required(void)
363+
{
364+
return efi_enabled(EFI_RUNTIME_SERVICES);
365+
}

arch/arm64/kernel/head.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,8 +585,8 @@ ENDPROC(set_cpu_boot_mode_flag)
585585
* zeroing of .bss would clobber it.
586586
*/
587587
.pushsection .data..cacheline_aligned
588-
ENTRY(__boot_cpu_mode)
589588
.align L1_CACHE_SHIFT
589+
ENTRY(__boot_cpu_mode)
590590
.long BOOT_CPU_MODE_EL2
591591
.long 0
592592
.popsection

arch/arm64/kernel/process.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <stdarg.h>
2222

2323
#include <linux/compat.h>
24+
#include <linux/efi.h>
2425
#include <linux/export.h>
2526
#include <linux/sched.h>
2627
#include <linux/kernel.h>
@@ -150,6 +151,13 @@ void machine_restart(char *cmd)
150151
local_irq_disable();
151152
smp_send_stop();
152153

154+
/*
155+
* UpdateCapsule() depends on the system being reset via
156+
* ResetSystem().
157+
*/
158+
if (efi_enabled(EFI_RUNTIME_SERVICES))
159+
efi_reboot(reboot_mode, NULL);
160+
153161
/* Now call the architecture specific reboot code. */
154162
if (arm_pm_restart)
155163
arm_pm_restart(reboot_mode, cmd);

0 commit comments

Comments
 (0)