Skip to content

Commit

Permalink
ARM: kexec: fix kexec for Keystone 2
Browse files Browse the repository at this point in the history
Provide kexec with the boot view of memory by overriding the normal
kexec translation functions added in a previous patch.  We also need to
fix a call to memblock in machine_kexec_prepare() so that we provide it
with a running-view physical address rather than a boot- view physical
address.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Russell King <[email protected]>
Cc: Keerthy <[email protected]>
Cc: Pratyush Anand <[email protected]>
Cc: Vitaly Andrianov <[email protected]>
Cc: Eric Biederman <[email protected]>
Cc: Dave Young <[email protected]>
Cc: Baoquan He <[email protected]>
Cc: Vivek Goyal <[email protected]>
Cc: Simon Horman <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Russell King authored and torvalds committed Aug 2, 2016
1 parent 51d5d12 commit 0719392
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
24 changes: 24 additions & 0 deletions arch/arm/include/asm/kexec.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,30 @@ static inline void crash_setup_regs(struct pt_regs *newregs,
/* Function pointer to optional machine-specific reinitialization */
extern void (*kexec_reinit)(void);

static inline unsigned long phys_to_boot_phys(phys_addr_t phys)
{
return phys_to_idmap(phys);
}
#define phys_to_boot_phys phys_to_boot_phys

static inline phys_addr_t boot_phys_to_phys(unsigned long entry)
{
return idmap_to_phys(entry);
}
#define boot_phys_to_phys boot_phys_to_phys

static inline unsigned long page_to_boot_pfn(struct page *page)
{
return page_to_pfn(page) + (arch_phys_to_idmap_offset >> PAGE_SHIFT);
}
#define page_to_boot_pfn page_to_boot_pfn

static inline struct page *boot_pfn_to_page(unsigned long boot_pfn)
{
return pfn_to_page(boot_pfn - (arch_phys_to_idmap_offset >> PAGE_SHIFT));
}
#define boot_pfn_to_page boot_pfn_to_page

#endif /* __ASSEMBLY__ */

#endif /* CONFIG_KEXEC */
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/kernel/machine_kexec.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ int machine_kexec_prepare(struct kimage *image)
for (i = 0; i < image->nr_segments; i++) {
current_segment = &image->segment[i];

if (!memblock_is_region_memory(current_segment->mem,
if (!memblock_is_region_memory(idmap_to_phys(current_segment->mem),
current_segment->memsz))
return -EINVAL;

Expand Down

0 comments on commit 0719392

Please sign in to comment.