Commit 4fee9ad8 authored by Vitaly Kuznetsov's avatar Vitaly Kuznetsov Committed by Juergen Gross

xen/balloon: decorate PV-only parts with #ifdef CONFIG_XEN_PV

Balloon driver uses several PV-only concepts (xen_start_info,
xen_extra_mem,..) and it seems the simpliest solution to make HVM-only
build happy is to decorate these parts with #ifdefs.
Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
Reviewed-by: default avatarJuergen Gross <jgross@suse.com>
Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
parent 3d4ebdb2
...@@ -709,6 +709,7 @@ void free_xenballooned_pages(int nr_pages, struct page **pages) ...@@ -709,6 +709,7 @@ void free_xenballooned_pages(int nr_pages, struct page **pages)
} }
EXPORT_SYMBOL(free_xenballooned_pages); EXPORT_SYMBOL(free_xenballooned_pages);
#ifdef CONFIG_XEN_PV
static void __init balloon_add_region(unsigned long start_pfn, static void __init balloon_add_region(unsigned long start_pfn,
unsigned long pages) unsigned long pages)
{ {
...@@ -732,19 +733,22 @@ static void __init balloon_add_region(unsigned long start_pfn, ...@@ -732,19 +733,22 @@ static void __init balloon_add_region(unsigned long start_pfn,
balloon_stats.total_pages += extra_pfn_end - start_pfn; balloon_stats.total_pages += extra_pfn_end - start_pfn;
} }
#endif
static int __init balloon_init(void) static int __init balloon_init(void)
{ {
int i;
if (!xen_domain()) if (!xen_domain())
return -ENODEV; return -ENODEV;
pr_info("Initialising balloon driver\n"); pr_info("Initialising balloon driver\n");
#ifdef CONFIG_XEN_PV
balloon_stats.current_pages = xen_pv_domain() balloon_stats.current_pages = xen_pv_domain()
? min(xen_start_info->nr_pages - xen_released_pages, max_pfn) ? min(xen_start_info->nr_pages - xen_released_pages, max_pfn)
: get_num_physpages(); : get_num_physpages();
#else
balloon_stats.current_pages = get_num_physpages();
#endif
balloon_stats.target_pages = balloon_stats.current_pages; balloon_stats.target_pages = balloon_stats.current_pages;
balloon_stats.balloon_low = 0; balloon_stats.balloon_low = 0;
balloon_stats.balloon_high = 0; balloon_stats.balloon_high = 0;
...@@ -761,6 +765,10 @@ static int __init balloon_init(void) ...@@ -761,6 +765,10 @@ static int __init balloon_init(void)
register_sysctl_table(xen_root); register_sysctl_table(xen_root);
#endif #endif
#ifdef CONFIG_XEN_PV
{
int i;
/* /*
* Initialize the balloon with pages from the extra memory * Initialize the balloon with pages from the extra memory
* regions (see arch/x86/xen/setup.c). * regions (see arch/x86/xen/setup.c).
...@@ -769,6 +777,8 @@ static int __init balloon_init(void) ...@@ -769,6 +777,8 @@ static int __init balloon_init(void)
if (xen_extra_mem[i].n_pfns) if (xen_extra_mem[i].n_pfns)
balloon_add_region(xen_extra_mem[i].start_pfn, balloon_add_region(xen_extra_mem[i].start_pfn,
xen_extra_mem[i].n_pfns); xen_extra_mem[i].n_pfns);
}
#endif
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment