mirror of
https://github.com/torvalds/linux.git
synced 2024-11-16 09:02:00 +00:00
ARM: suspend: use idmap_pgd instead of suspend_pgd
The ARM CPU suspend code requires cpu_resume_mmu to be identity mapped in order to re-enable the MMU when coming out of suspend. Currently, this is accomplished by maintaining a suspend_pgd with the relevant mapping put in place at init time. This patch replaces the use of suspend_pgd with the new idmap_pgd. cpu_resume_mmu is placed in the .idmap.text section so that it is included in the identity map. Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Acked-by: Dave Martin <dave.martin@linaro.org> Tested-by: Lorenzo Pieralisi <Lorenzo.Pieralisi@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
This commit is contained in:
parent
8903826d0c
commit
e6eadc6787
@ -54,6 +54,7 @@ ENDPROC(cpu_suspend_abort)
|
|||||||
* r0 = control register value
|
* r0 = control register value
|
||||||
*/
|
*/
|
||||||
.align 5
|
.align 5
|
||||||
|
.pushsection .idmap.text,"ax"
|
||||||
ENTRY(cpu_resume_mmu)
|
ENTRY(cpu_resume_mmu)
|
||||||
ldr r3, =cpu_resume_after_mmu
|
ldr r3, =cpu_resume_after_mmu
|
||||||
mcr p15, 0, r0, c1, c0, 0 @ turn on MMU, I-cache, etc
|
mcr p15, 0, r0, c1, c0, 0 @ turn on MMU, I-cache, etc
|
||||||
@ -62,6 +63,7 @@ ENTRY(cpu_resume_mmu)
|
|||||||
mov r0, r0
|
mov r0, r0
|
||||||
mov pc, r3 @ jump to virtual address
|
mov pc, r3 @ jump to virtual address
|
||||||
ENDPROC(cpu_resume_mmu)
|
ENDPROC(cpu_resume_mmu)
|
||||||
|
.popsection
|
||||||
cpu_resume_after_mmu:
|
cpu_resume_after_mmu:
|
||||||
bl cpu_init @ restore the und/abt/irq banked regs
|
bl cpu_init @ restore the und/abt/irq banked regs
|
||||||
mov r0, #0 @ return zero on success
|
mov r0, #0 @ return zero on success
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
|
|
||||||
|
#include <asm/idmap.h>
|
||||||
#include <asm/pgalloc.h>
|
#include <asm/pgalloc.h>
|
||||||
#include <asm/pgtable.h>
|
#include <asm/pgtable.h>
|
||||||
#include <asm/memory.h>
|
#include <asm/memory.h>
|
||||||
#include <asm/suspend.h>
|
#include <asm/suspend.h>
|
||||||
#include <asm/tlbflush.h>
|
#include <asm/tlbflush.h>
|
||||||
|
|
||||||
static pgd_t *suspend_pgd;
|
|
||||||
|
|
||||||
extern int __cpu_suspend(unsigned long, int (*)(unsigned long));
|
extern int __cpu_suspend(unsigned long, int (*)(unsigned long));
|
||||||
extern void cpu_resume_mmu(void);
|
extern void cpu_resume_mmu(void);
|
||||||
|
|
||||||
@ -21,7 +20,7 @@ void __cpu_suspend_save(u32 *ptr, u32 ptrsz, u32 sp, u32 *save_ptr)
|
|||||||
*save_ptr = virt_to_phys(ptr);
|
*save_ptr = virt_to_phys(ptr);
|
||||||
|
|
||||||
/* This must correspond to the LDM in cpu_resume() assembly */
|
/* This must correspond to the LDM in cpu_resume() assembly */
|
||||||
*ptr++ = virt_to_phys(suspend_pgd);
|
*ptr++ = virt_to_phys(idmap_pgd);
|
||||||
*ptr++ = sp;
|
*ptr++ = sp;
|
||||||
*ptr++ = virt_to_phys(cpu_do_resume);
|
*ptr++ = virt_to_phys(cpu_do_resume);
|
||||||
|
|
||||||
@ -42,7 +41,7 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
|
|||||||
struct mm_struct *mm = current->active_mm;
|
struct mm_struct *mm = current->active_mm;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!suspend_pgd)
|
if (!idmap_pgd)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -59,14 +58,3 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init cpu_suspend_init(void)
|
|
||||||
{
|
|
||||||
suspend_pgd = pgd_alloc(&init_mm);
|
|
||||||
if (suspend_pgd) {
|
|
||||||
unsigned long addr = virt_to_phys(cpu_resume_mmu);
|
|
||||||
identity_mapping_add(suspend_pgd, addr, addr + SECTION_SIZE);
|
|
||||||
}
|
|
||||||
return suspend_pgd ? 0 : -ENOMEM;
|
|
||||||
}
|
|
||||||
core_initcall(cpu_suspend_init);
|
|
||||||
|
Loading…
Reference in New Issue
Block a user