Add support for obtaining the maximum memory size from the hypervisor.
This will make it possible to support ballooning.
Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
* DEALINGS IN THE SOFTWARE.
*/
+#include <mini-os/os.h>
#include <mini-os/balloon.h>
+#include <mini-os/lib.h>
+#include <xen/xen.h>
+#include <xen/memory.h>
+
+unsigned long nr_max_pages;
+
+void get_max_pages(void)
+{
+ long ret;
+ domid_t domid = DOMID_SELF;
+
+ ret = HYPERVISOR_memory_op(XENMEM_maximum_reservation, &domid);
+ if ( ret < 0 )
+ {
+ printk("Could not get maximum pfn\n");
+ return;
+ }
+
+ nr_max_pages = ret;
+ printk("Maximum memory size: %ld pages\n", nr_max_pages);
+}
#ifdef CONFIG_BALLOON
+extern unsigned long nr_max_pages;
+
+void get_max_pages(void);
+
#else /* CONFIG_BALLOON */
+static inline void get_max_pages(void) { }
+
#endif /* CONFIG_BALLOON */
#endif /* _BALLOON_H_ */
#include <mini-os/hypervisor.h>
#include <xen/memory.h>
#include <mini-os/mm.h>
+#include <mini-os/balloon.h>
#include <mini-os/types.h>
#include <mini-os/lib.h>
#include <mini-os/xmalloc.h>
printk("MM: Init\n");
+ get_max_pages();
arch_init_mm(&start_pfn, &max_pfn);
/*
* now we can initialise the page allocator