/* * This is called by __cpu_suspend() to save the state, and do whatever * flushing is required to ensure that when the CPU goes to sleep we have * the necessary data available when the caches are not searched. */ void __cpu_suspend_save(u32 *ptr, u32 ptrsz, u32 sp, u32 *save_ptr) { u32 *ctx = ptr; *save_ptr = virt_to_phys(ptr); /* This must correspond to the LDM in cpu_resume() assembly */ *ptr++ = virt_to_phys(idmap_pgd); *ptr++ = sp; *ptr++ = virt_to_phys(cpu_do_resume); cpu_do_suspend(ptr); flush_cache_louis(); /* * flush_cache_louis does not guarantee that * save_ptr and ptr are cleaned to main memory, * just up to the Level of Unification Inner Shareable. * Since the context pointer and context itself * are to be retrieved with the MMU off that * data must be cleaned from all cache levels * to main memory using "area" cache primitives. */ __cpuc_flush_dcache_area(ctx, ptrsz); __cpuc_flush_dcache_area(save_ptr, sizeof(*save_ptr)); outer_clean_range(*save_ptr, *save_ptr + ptrsz); outer_clean_range(virt_to_phys(save_ptr), virt_to_phys(save_ptr) + sizeof(*save_ptr)); }
/* * This is called by __cpu_suspend_enter() to save the state, and do whatever * flushing is required to ensure that when the CPU goes to sleep we have * the necessary data available when the caches are not searched. * * ptr: CPU context virtual address * save_ptr: address of the location where the context physical address * must be saved */ void notrace __cpu_suspend_save(struct cpu_suspend_ctx *ptr, phys_addr_t *save_ptr) { *save_ptr = virt_to_phys(ptr); cpu_do_suspend(ptr); /* * Only flush the context that must be retrieved with the MMU * off. VA primitives ensure the flush is applied to all * cache levels so context is pushed to DRAM. */ __flush_dcache_area(ptr, sizeof(*ptr)); __flush_dcache_area(save_ptr, sizeof(*save_ptr)); }
/* * This is called by __cpu_suspend() to save the state, and do whatever * flushing is required to ensure that when the CPU goes to sleep we have * the necessary data available when the caches are not searched. * * @ptr: CPU context virtual address * @save_ptr: address of the location where the context physical address * must be saved */ void __cpu_suspend_save(struct cpu_suspend_ctx *ptr, u64 *save_ptr) { *save_ptr = virt_to_phys(ptr); ptr->ttbr0_el1 = virt_to_phys(idmap_pg_dir); cpu_do_suspend(ptr); /* * Only flush the context that must be retrieved with the MMU * off. VA primitives ensure the flush is applied to all * cache levels so context is pushed to DRAM. */ __flush_dcache_area(ptr, sizeof(*ptr)); __flush_dcache_area(save_ptr, sizeof(*save_ptr)); }
/* * This is called by __cpu_suspend() to save the state, and do whatever * flushing is required to ensure that when the CPU goes to sleep we have * the necessary data available when the caches are not searched. */ void __cpu_suspend_save(u32 *ptr, u32 ptrsz, u32 sp, u32 *save_ptr) { *save_ptr = virt_to_phys(ptr); /* This must correspond to the LDM in cpu_resume() assembly */ *ptr++ = virt_to_phys(idmap_pgd); *ptr++ = sp; *ptr++ = virt_to_phys(cpu_do_resume); cpu_do_suspend(ptr); flush_cache_all(); outer_clean_range(*save_ptr, *save_ptr + ptrsz); outer_clean_range(virt_to_phys(save_ptr), virt_to_phys(save_ptr) + sizeof(*save_ptr)); }
/* * This is called by __cpu_suspend() to save the state, and do whatever * flushing is required to ensure that when the CPU goes to sleep we have * the necessary data available when the caches are not searched. * * @arg: Argument to pass to suspend operations * @ptr: CPU context virtual address * @save_ptr: address of the location where the context physical address * must be saved */ int __cpu_suspend_finisher(unsigned long arg, struct cpu_suspend_ctx *ptr, phys_addr_t *save_ptr) { int cpu = smp_processor_id(); *save_ptr = stack_page1_virt_to_phys(ptr); cpu_do_suspend(ptr); /* * Only flush the context that must be retrieved with the MMU * off. VA primitives ensure the flush is applied to all * cache levels so context is pushed to DRAM. */ __flush_dcache_area(ptr, sizeof(*ptr)); __flush_dcache_area(save_ptr, sizeof(*save_ptr)); return cpu_ops[cpu]->cpu_suspend(arg); }
/* * This is called by __cpu_suspend() to save the state, and do whatever * flushing is required to ensure that when the CPU goes to sleep we have * the necessary data available when the caches are not searched. */ void __cpu_suspend_save(u32 *ptr, u32 ptrsz, u32 sp, u32 *save_ptr) { #if defined(CONFIG_ARCH_JAVA) u32 *save_ptr_v = ptr; #endif *save_ptr = virt_to_phys(ptr); /* This must correspond to the LDM in cpu_resume() assembly */ *ptr++ = virt_to_phys(idmap_pgd); *ptr++ = sp; *ptr++ = virt_to_phys(cpu_do_resume); cpu_do_suspend(ptr); #if defined(CONFIG_ARCH_JAVA) __cpuc_flush_dcache_area(save_ptr_v, ptrsz); __cpuc_flush_dcache_area(save_ptr, sizeof(ptr)); #else flush_cache_all(); outer_clean_range(*save_ptr, *save_ptr + ptrsz); outer_clean_range(virt_to_phys(save_ptr), virt_to_phys(save_ptr) + sizeof(*save_ptr)); #endif }