Beispiel #1
0
void setup_arch(void) {  
  setup_memory_map();

  finish_e820_parsing();

  max_pfn = e820_end_of_ram_pfn();

  /* preallocate 4k for mptable mpc */
  /*
  early_reserve_e820_mpc_new();
  */
  
  /* update e820 for memory not covered by WB MTRRs */
  /*
  mtrr_bp_init();
  if (mtrr_trim_uncached_memory(max_pfn)) {
    max_pfn = e820_end_of_ram_pfn();
  }
  */

  /* max_low_pfn get updated here */
  find_low_pfn_range();

  printk(KERN_DEBUG "initial memory mapped : 0 - %08lx\n",
         max_pfn_mapped<<PAGE_SHIFT);

  max_low_pfn_mapped = init_memory_mapping(0, max_low_pfn<<PAGE_SHIFT);
  max_pfn_mapped = max_low_pfn_mapped;

  initmem_init(0, max_pfn);
}
Beispiel #2
0
static int __init balloon_init(void)
{
	unsigned long pfn, extra_pfn_end;
	struct page *page;

	if (!xen_pv_domain())
		return -ENODEV;

	pr_info("xen_balloon: Initialising balloon driver.\n");

	balloon_stats.current_pages = min(xen_start_info->nr_pages, max_pfn);
	balloon_stats.target_pages  = balloon_stats.current_pages;
	balloon_stats.balloon_low   = 0;
	balloon_stats.balloon_high  = 0;

	init_timer(&balloon_timer);
	balloon_timer.data = 0;
	balloon_timer.function = balloon_alarm;

	register_balloon(&balloon_sysdev);

	/*
	 * Initialise the balloon with excess memory space.  We need
	 * to make sure we don't add memory which doesn't exist or
	 * logically exist.  The E820 map can be trimmed to be smaller
	 * than the amount of physical memory due to the mem= command
	 * line parameter.  And if this is a 32-bit non-HIGHMEM kernel
	 * on a system with memory which requires highmem to access,
	 * don't try to use it.
	 */
	extra_pfn_end = min(min(max_pfn, e820_end_of_ram_pfn()),
			    (unsigned long)PFN_DOWN(xen_extra_mem_start + xen_extra_mem_size));
	for (pfn = PFN_UP(xen_extra_mem_start);
	     pfn < extra_pfn_end;
	     pfn++) {
		page = pfn_to_page(pfn);
		/* totalram_pages and totalhigh_pages do not include the boot-time
		   balloon extension, so don't subtract from it. */
		__balloon_append(page);
	}

	target_watch.callback = watch_target;
	xenstore_notifier.notifier_call = balloon_init_watcher;

	register_xenstore_notifier(&xenstore_notifier);

	return 0;
}