提交 2f7acb20 编写于 作者: J Jeremy Fitzhardinge

xen: make sure xen_max_p2m_pfn is up to date

Keep xen_max_p2m_pfn up to date with the end of the extra memory
we're adding.  It is possible that it will be too high since memory
may be truncated by a "mem=" option on the kernel command line, but
that won't matter.
Signed-off-by: NJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
上级 698bb8d1
...@@ -195,7 +195,7 @@ DEFINE_PER_CPU(unsigned long, xen_current_cr3); /* actual vcpu cr3 */ ...@@ -195,7 +195,7 @@ DEFINE_PER_CPU(unsigned long, xen_current_cr3); /* actual vcpu cr3 */
* 512 and 1024 entries respectively. * 512 and 1024 entries respectively.
*/ */
static unsigned long max_p2m_pfn __read_mostly; unsigned long xen_max_p2m_pfn __read_mostly;
#define P2M_PER_PAGE (PAGE_SIZE / sizeof(unsigned long)) #define P2M_PER_PAGE (PAGE_SIZE / sizeof(unsigned long))
#define P2M_MID_PER_PAGE (PAGE_SIZE / sizeof(unsigned long *)) #define P2M_MID_PER_PAGE (PAGE_SIZE / sizeof(unsigned long *))
...@@ -293,7 +293,7 @@ void xen_build_mfn_list_list(void) ...@@ -293,7 +293,7 @@ void xen_build_mfn_list_list(void)
p2m_top_mfn_init(p2m_top_mfn); p2m_top_mfn_init(p2m_top_mfn);
} }
for (pfn = 0; pfn < max_p2m_pfn; pfn += P2M_PER_PAGE) { for (pfn = 0; pfn < xen_max_p2m_pfn; pfn += P2M_PER_PAGE) {
unsigned topidx = p2m_top_index(pfn); unsigned topidx = p2m_top_index(pfn);
unsigned mididx = p2m_mid_index(pfn); unsigned mididx = p2m_mid_index(pfn);
unsigned long **mid; unsigned long **mid;
...@@ -335,7 +335,7 @@ void xen_setup_mfn_list_list(void) ...@@ -335,7 +335,7 @@ void xen_setup_mfn_list_list(void)
HYPERVISOR_shared_info->arch.pfn_to_mfn_frame_list_list = HYPERVISOR_shared_info->arch.pfn_to_mfn_frame_list_list =
virt_to_mfn(p2m_top_mfn); virt_to_mfn(p2m_top_mfn);
HYPERVISOR_shared_info->arch.max_pfn = max_p2m_pfn; HYPERVISOR_shared_info->arch.max_pfn = xen_max_p2m_pfn;
} }
/* Set up p2m_top to point to the domain-builder provided p2m pages */ /* Set up p2m_top to point to the domain-builder provided p2m pages */
...@@ -345,7 +345,7 @@ void __init xen_build_dynamic_phys_to_machine(void) ...@@ -345,7 +345,7 @@ void __init xen_build_dynamic_phys_to_machine(void)
unsigned long max_pfn = min(MAX_DOMAIN_PAGES, xen_start_info->nr_pages); unsigned long max_pfn = min(MAX_DOMAIN_PAGES, xen_start_info->nr_pages);
unsigned pfn; unsigned pfn;
max_p2m_pfn = max_pfn; xen_max_p2m_pfn = max_pfn;
p2m_missing = extend_brk(PAGE_SIZE, PAGE_SIZE); p2m_missing = extend_brk(PAGE_SIZE, PAGE_SIZE);
p2m_init(p2m_missing); p2m_init(p2m_missing);
......
...@@ -64,6 +64,8 @@ static __init void xen_add_extra_mem(unsigned long pages) ...@@ -64,6 +64,8 @@ static __init void xen_add_extra_mem(unsigned long pages)
"XEN EXTRA"); "XEN EXTRA");
xen_extra_mem_size += size; xen_extra_mem_size += size;
xen_max_p2m_pfn = PFN_DOWN(xen_extra_mem_start + xen_extra_mem_size);
} }
static unsigned long __init xen_release_chunk(phys_addr_t start_addr, static unsigned long __init xen_release_chunk(phys_addr_t start_addr,
......
...@@ -30,6 +30,7 @@ void xen_setup_machphys_mapping(void); ...@@ -30,6 +30,7 @@ void xen_setup_machphys_mapping(void);
pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn); pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn);
void xen_ident_map_ISA(void); void xen_ident_map_ISA(void);
void xen_reserve_top(void); void xen_reserve_top(void);
extern unsigned long xen_max_p2m_pfn;
char * __init xen_memory_setup(void); char * __init xen_memory_setup(void);
void __init xen_arch_setup(void); void __init xen_arch_setup(void);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册