aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/xen
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/xen')
-rw-r--r--drivers/xen/Kconfig17
-rw-r--r--drivers/xen/balloon.c23
2 files changed, 40 insertions, 0 deletions
diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig
index b812462083fc..94d96809e686 100644
--- a/drivers/xen/Kconfig
+++ b/drivers/xen/Kconfig
@@ -55,6 +55,23 @@ config XEN_BALLOON_MEMORY_HOTPLUG
55 55
56 In that case step 3 should be omitted. 56 In that case step 3 should be omitted.
57 57
58config XEN_BALLOON_MEMORY_HOTPLUG_LIMIT
59 int "Hotplugged memory limit (in GiB) for a PV guest"
60 default 512 if X86_64
61 default 4 if X86_32
62 range 0 64 if X86_32
63 depends on XEN_HAVE_PVMMU
64 depends on XEN_BALLOON_MEMORY_HOTPLUG
65 help
66 Maxmium amount of memory (in GiB) that a PV guest can be
67 expanded to when using memory hotplug.
68
69 A PV guest can have more memory than this limit if is
70 started with a larger maximum.
71
72 This value is used to allocate enough space in internal
73 tables needed for physical memory administration.
74
58config XEN_SCRUB_PAGES 75config XEN_SCRUB_PAGES
59 bool "Scrub pages before returning them to system" 76 bool "Scrub pages before returning them to system"
60 depends on XEN_BALLOON 77 depends on XEN_BALLOON
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index 0b52d92cb2e5..fd933695f232 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -229,6 +229,29 @@ static enum bp_state reserve_additional_memory(long credit)
229 balloon_hotplug = round_up(balloon_hotplug, PAGES_PER_SECTION); 229 balloon_hotplug = round_up(balloon_hotplug, PAGES_PER_SECTION);
230 nid = memory_add_physaddr_to_nid(hotplug_start_paddr); 230 nid = memory_add_physaddr_to_nid(hotplug_start_paddr);
231 231
232#ifdef CONFIG_XEN_HAVE_PVMMU
233 /*
234 * add_memory() will build page tables for the new memory so
235 * the p2m must contain invalid entries so the correct
236 * non-present PTEs will be written.
237 *
238 * If a failure occurs, the original (identity) p2m entries
239 * are not restored since this region is now known not to
240 * conflict with any devices.
241 */
242 if (!xen_feature(XENFEAT_auto_translated_physmap)) {
243 unsigned long pfn, i;
244
245 pfn = PFN_DOWN(hotplug_start_paddr);
246 for (i = 0; i < balloon_hotplug; i++) {
247 if (!set_phys_to_machine(pfn + i, INVALID_P2M_ENTRY)) {
248 pr_warn("set_phys_to_machine() failed, no memory added\n");
249 return BP_ECANCELED;
250 }
251 }
252 }
253#endif
254
232 rc = add_memory(nid, hotplug_start_paddr, balloon_hotplug << PAGE_SHIFT); 255 rc = add_memory(nid, hotplug_start_paddr, balloon_hotplug << PAGE_SHIFT);
233 256
234 if (rc) { 257 if (rc) {