Skip to content

Commit

Permalink
xen/p2m: An early bootup variant of set_phys_to_machine
Browse files Browse the repository at this point in the history
During early bootup we can't use alloc_page, so to allocate
leaf pages in the P2M we need to use extend_brk. For that
we are utilizing the early_alloc_p2m and early_alloc_p2m_middle
functions to do the job for us. This function follows the
same logic as set_phys_to_machine.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
  • Loading branch information
Konrad Rzeszutek Wilk committed Apr 6, 2012
1 parent d509685 commit 940713b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions arch/x86/include/asm/xen/page.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ extern unsigned long machine_to_phys_nr;

extern unsigned long get_phys_to_machine(unsigned long pfn);
extern bool set_phys_to_machine(unsigned long pfn, unsigned long mfn);
extern bool __init early_set_phys_to_machine(unsigned long pfn, unsigned long mfn);
extern bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn);
extern unsigned long set_phys_range_identity(unsigned long pfn_s,
unsigned long pfn_e);
Expand Down
15 changes: 15 additions & 0 deletions arch/x86/xen/p2m.c
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,21 @@ static bool __init early_alloc_p2m(unsigned long pfn)
}
return true;
}
bool __init early_set_phys_to_machine(unsigned long pfn, unsigned long mfn)
{
if (unlikely(!__set_phys_to_machine(pfn, mfn))) {
if (!early_alloc_p2m(pfn))
return false;

if (!early_alloc_p2m_middle(pfn, false /* boundary crossover OK!*/))
return false;

if (!__set_phys_to_machine(pfn, mfn))
return false;
}

return true;
}
unsigned long __init set_phys_range_identity(unsigned long pfn_s,
unsigned long pfn_e)
{
Expand Down

0 comments on commit 940713b

Please sign in to comment.