Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1600745

[PATCH v3 18/21] xen/balloon: decorate PV-only parts with #ifdef CONFIG_XEN_PV

From Vitaly Kuznetsov <vkuznets@redhat.com>
Newsgroups linux.kernel
Subject [PATCH v3 18/21] xen/balloon: decorate PV-only parts with #ifdef CONFIG_XEN_PV
Date 2017-03-14 18:40 +0100
Message-ID <tkYAq-3tR-29@gated-at.bofh.it> (permalink)
References <tkYAp-3tR-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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>
---
 drivers/xen/balloon.c | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index a6d4378..50dcb68 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;
 }
-- 
2.9.3

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 00/21] x86/xen: untangle PV and PVHVM guest support code Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-03-14 18:40 +0100
  [PATCH v3 03/21] x86/xen: add CONFIG_XEN_PV to Kconfig Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-03-14 18:40 +0100
    Re: [PATCH v3 03/21] x86/xen: add CONFIG_XEN_PV to Kconfig Juergen Gross <jgross@suse.com> - 2017-03-15 10:40 +0100
  [PATCH v3 18/21] xen/balloon: decorate PV-only parts with #ifdef CONFIG_XEN_PV Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-03-14 18:40 +0100
  [PATCH v3 20/21] x86/xen: enable PVHVM-only builds Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-03-14 18:40 +0100
  [PATCH v3 17/21] x86/xen: create stubs for HVM-only builds in page.h Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-03-14 18:40 +0100
  [PATCH v3 16/21] x86/xen: define startup_xen for XEN PV only Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-03-14 18:40 +0100
  [PATCH v3 14/21] x86/xen: split suspend.c for PV and PVHVM guests Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-03-14 18:40 +0100
  [PATCH v3 09/21] x86/xen: split xen_cpu_die() Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-03-14 18:40 +0100
  [PATCH v3 19/21] xen: create xen_create/destroy_contiguous_region() stubs for PVHVM only builds Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-03-14 18:40 +0100
  [PATCH v3 04/21] x86/xen: split off enlighten_pvh.c Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-03-14 18:40 +0100
  [PATCH v3 01/21] x86/xen: separate PV and HVM hypervisors Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-03-14 18:40 +0100
    Re: [PATCH v3 01/21] x86/xen: separate PV and HVM hypervisors Juergen Gross <jgross@suse.com> - 2017-03-15 10:50 +0100
  [PATCH v3 07/21] x86/xen: split xen_smp_intr_init()/xen_smp_intr_free() Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-03-14 18:40 +0100
  [PATCH v3 12/21] x86/xen: split off mmu_hvm.c Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-03-14 18:40 +0100
  [PATCH v3 21/21] x86/xen: rename some PV-only functions in smp_pv.c Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-03-14 18:40 +0100
  [PATCH v3 11/21] x86/xen: split off smp_pv.c Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-03-14 18:40 +0100
  [PATCH v3 08/21] x86/xen: split xen_smp_prepare_boot_cpu() Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-03-14 18:50 +0100
  [PATCH v3 02/21] x86/xen: globalize have_vcpu_info_placement Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-03-14 18:50 +0100
  [PATCH v3 10/21] x86/xen: split off smp_hvm.c Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-03-14 18:50 +0100
  Re: [PATCH v3 00/21] x86/xen: untangle PV and PVHVM guest support  code Juergen Gross <jgross@suse.com> - 2017-03-15 10:50 +0100
    Re: [PATCH v3 00/21] x86/xen: untangle PV and PVHVM guest support  code Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2017-03-15 18:00 +0100

csiph-web