diff options
author | Vitaly Kuznetsov <vkuznets@redhat.com> | 2017-03-14 20:35:53 +0300 |
---|---|---|
committer | Juergen Gross <jgross@suse.com> | 2017-05-02 12:09:56 +0300 |
commit | 4fee9ad84e9648a3cb07586501d283d3aef9f923 (patch) | |
tree | a8d5e512be092c4711541e82c33e37f5f884b99c /drivers/xen/balloon.c | |
parent | 3d4ebdb26f6f3573d68d7957f66a89e9401fc4b1 (diff) | |
download | linux-4fee9ad84e9648a3cb07586501d283d3aef9f923.tar.xz |
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: Vitaly Kuznetsov <vkuznets@redhat.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Diffstat (limited to 'drivers/xen/balloon.c')
-rw-r--r-- | drivers/xen/balloon.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index a6d4378eb8d9..50dcb68d8070 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c @@ -709,6 +709,7 @@ void free_xenballooned_pages(int nr_pages, struct page **pages) } EXPORT_SYMBOL(free_xenballooned_pages); +#ifdef CONFIG_XEN_PV static void __init balloon_add_region(unsigned long start_pfn, unsigned long pages) { @@ -732,19 +733,22 @@ static void __init balloon_add_region(unsigned long start_pfn, balloon_stats.total_pages += extra_pfn_end - start_pfn; } +#endif static int __init balloon_init(void) { - int i; - if (!xen_domain()) return -ENODEV; pr_info("Initialising balloon driver\n"); +#ifdef CONFIG_XEN_PV balloon_stats.current_pages = xen_pv_domain() ? min(xen_start_info->nr_pages - xen_released_pages, max_pfn) : get_num_physpages(); +#else + balloon_stats.current_pages = get_num_physpages(); +#endif balloon_stats.target_pages = balloon_stats.current_pages; balloon_stats.balloon_low = 0; balloon_stats.balloon_high = 0; @@ -761,14 +765,20 @@ static int __init balloon_init(void) register_sysctl_table(xen_root); #endif - /* - * Initialize the balloon with pages from the extra memory - * regions (see arch/x86/xen/setup.c). - */ - for (i = 0; i < XEN_EXTRA_MEM_MAX_REGIONS; i++) - if (xen_extra_mem[i].n_pfns) - balloon_add_region(xen_extra_mem[i].start_pfn, - xen_extra_mem[i].n_pfns); +#ifdef CONFIG_XEN_PV + { + int i; + + /* + * Initialize the balloon with pages from the extra memory + * regions (see arch/x86/xen/setup.c). + */ + for (i = 0; i < XEN_EXTRA_MEM_MAX_REGIONS; i++) + if (xen_extra_mem[i].n_pfns) + balloon_add_region(xen_extra_mem[i].start_pfn, + xen_extra_mem[i].n_pfns); + } +#endif return 0; } |