ia64/xen-unstable

view xen/arch/ia64/xenmem.c @ 6538:84ee014ebd41

Merge xen-vtx-unstable.hg
author adsharma@los-vmm.sc.intel.com
date Wed Aug 17 12:34:38 2005 -0800 (2005-08-17)
parents 23979fb12c49 f294acb25858
children 99914b54f7bf
line source
1 /*
2 * Xen memory allocator routines
3 *
4 * Copyright (C) 2005 Hewlett-Packard Co
5 * Dan Magenheimer <dan.magenheimer@hp.com>
6 * Copyright (C) 2005 Intel Corp.
7 *
8 * Routines used by ia64 machines with contiguous (or virtually contiguous)
9 * memory.
10 */
12 #include <linux/config.h>
13 #include <asm/pgtable.h>
14 #include <xen/mm.h>
16 extern struct page *zero_page_memmap_ptr;
17 struct pfn_info *frame_table;
18 unsigned long frame_table_size;
19 unsigned long max_page;
21 struct page *mem_map;
22 #define MAX_DMA_ADDRESS ~0UL // FIXME???
24 #ifdef CONFIG_VIRTUAL_MEM_MAP
25 static unsigned long num_dma_physpages;
26 #endif
28 /*
29 * Set up the page tables.
30 */
31 #ifdef CONFIG_VTI
32 unsigned long *mpt_table;
33 unsigned long *mpt_table_size;
34 #endif
36 void
37 paging_init (void)
38 {
39 struct pfn_info *pg;
41 #ifdef CONFIG_VTI
42 unsigned int mpt_order;
43 /* Create machine to physical mapping table
44 * NOTE: similar to frame table, later we may need virtually
45 * mapped mpt table if large hole exists. Also MAX_ORDER needs
46 * to be changed in common code, which only support 16M by far
47 */
48 mpt_table_size = max_page * sizeof(unsigned long);
49 mpt_order = get_order(mpt_table_size);
50 ASSERT(mpt_order <= MAX_ORDER);
51 if ((mpt_table = alloc_xenheap_pages(mpt_order)) == NULL)
52 panic("Not enough memory to bootstrap Xen.\n");
54 printk("machine to physical table: 0x%lx\n", (u64)mpt_table);
55 memset(mpt_table, INVALID_M2P_ENTRY, mpt_table_size);
57 /* Any more setup here? On VMX enabled platform,
58 * there's no need to keep guest linear pg table,
59 * and read only mpt table. MAP cache is not used
60 * in this stage, and later it will be in region 5.
61 * IO remap is in region 6 with identity mapping.
62 */
63 /* HV_tlb_init(); */
65 #else // CONFIG_VTI
67 /* Allocate and map the machine-to-phys table */
68 if ((pg = alloc_domheap_pages(NULL, 10, 0)) == NULL)
69 panic("Not enough memory to bootstrap Xen.\n");
70 memset(page_to_virt(pg), 0x55, 16UL << 20);
71 #endif // CONFIG_VTI
73 /* Other mapping setup */
75 zero_page_memmap_ptr = virt_to_page(ia64_imva(empty_zero_page));
76 }
78 /* FIXME: postpone support to machines with big holes between physical memorys.
79 * Current hack allows only efi memdesc upto 4G place. (See efi.c)
80 */
81 #ifndef CONFIG_VIRTUAL_MEM_MAP
82 #define FT_ALIGN_SIZE (16UL << 20)
83 void __init init_frametable(void)
84 {
85 unsigned long i, pfn;
86 frame_table_size = max_page * sizeof(struct pfn_info);
87 frame_table_size = (frame_table_size + PAGE_SIZE - 1) & PAGE_MASK;
89 /* Request continuous trunk from boot allocator, since HV
90 * address is identity mapped */
91 pfn = alloc_boot_pages(
92 frame_table_size >> PAGE_SHIFT, FT_ALIGN_SIZE >> PAGE_SHIFT);
93 if (pfn == 0)
94 panic("Not enough memory for frame table.\n");
96 frame_table = __va(pfn << PAGE_SHIFT);
97 memset(frame_table, 0, frame_table_size);
98 printk("size of frame_table: %lukB\n",
99 frame_table_size >> 10);
100 }
101 #endif