ia64/xen-unstable
changeset 3191:a6c229307969
bitkeeper revision 1.1159.183.27 (41aa44f3iF3qcxWmwksREsxiA7dgDA)
Merge scramble.cl.cam.ac.uk:/auto/groups/xeno-xenod/BK/xen-2.0-testing.bk
into scramble.cl.cam.ac.uk:/auto/groups/xeno-xenod/BK/xen-unstable.bk
Merge scramble.cl.cam.ac.uk:/auto/groups/xeno-xenod/BK/xen-2.0-testing.bk
into scramble.cl.cam.ac.uk:/auto/groups/xeno-xenod/BK/xen-unstable.bk
line diff
1.1 --- a/linux-2.4.28-xen-sparse/arch/xen/kernel/ldt.c Sun Nov 28 20:49:53 2004 +0000 1.2 +++ b/linux-2.4.28-xen-sparse/arch/xen/kernel/ldt.c Sun Nov 28 21:36:51 2004 +0000 1.3 @@ -179,7 +179,7 @@ static int write_ldt(void * ptr, unsigne 1.4 { 1.5 struct mm_struct * mm = current->mm; 1.6 __u32 entry_1, entry_2, *lp; 1.7 - unsigned long phys_lp; 1.8 + unsigned long mach_lp; 1.9 int error; 1.10 struct modify_ldt_ldt_s ldt_info; 1.11 1.12 @@ -208,7 +208,7 @@ static int write_ldt(void * ptr, unsigne 1.13 } 1.14 1.15 lp = (__u32 *) ((ldt_info.entry_number << 3) + (char *) mm->context.ldt); 1.16 - phys_lp = arbitrary_virt_to_phys(lp); 1.17 + mach_lp = arbitrary_virt_to_machine(lp); 1.18 1.19 /* Allow LDTs to be cleared by the user. */ 1.20 if (ldt_info.base_addr == 0 && ldt_info.limit == 0) { 1.21 @@ -241,7 +241,7 @@ static int write_ldt(void * ptr, unsigne 1.22 1.23 /* Install the new entry ... */ 1.24 install: 1.25 - error = HYPERVISOR_update_descriptor(phys_lp, entry_1, entry_2); 1.26 + error = HYPERVISOR_update_descriptor(mach_lp, entry_1, entry_2); 1.27 1.28 out_unlock: 1.29 up(&mm->context.sem);
2.1 --- a/linux-2.4.28-xen-sparse/include/asm-xen/pgtable.h Sun Nov 28 20:49:53 2004 +0000 2.2 +++ b/linux-2.4.28-xen-sparse/include/asm-xen/pgtable.h Sun Nov 28 21:36:51 2004 +0000 2.3 @@ -350,7 +350,7 @@ static inline void make_pages_writable(v 2.4 } 2.5 } 2.6 2.7 -static inline unsigned long arbitrary_virt_to_phys(void *va) 2.8 +static inline unsigned long arbitrary_virt_to_machine(void *va) 2.9 { 2.10 pgd_t *pgd = pgd_offset_k((unsigned long)va); 2.11 pmd_t *pmd = pmd_offset(pgd, (unsigned long)va);
3.1 --- a/linux-2.6.9-xen-sparse/arch/xen/i386/kernel/ldt.c Sun Nov 28 20:49:53 2004 +0000 3.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/i386/kernel/ldt.c Sun Nov 28 21:36:51 2004 +0000 3.3 @@ -193,7 +193,7 @@ static int write_ldt(void __user * ptr, 3.4 { 3.5 struct mm_struct * mm = current->mm; 3.6 __u32 entry_1, entry_2, *lp; 3.7 - unsigned long phys_lp; 3.8 + unsigned long mach_lp; 3.9 int error; 3.10 struct user_desc ldt_info; 3.11 3.12 @@ -222,7 +222,7 @@ static int write_ldt(void __user * ptr, 3.13 } 3.14 3.15 lp = (__u32 *) ((ldt_info.entry_number << 3) + (char *) mm->context.ldt); 3.16 - phys_lp = arbitrary_virt_to_phys(lp); 3.17 + mach_lp = arbitrary_virt_to_machine(lp); 3.18 3.19 /* Allow LDTs to be cleared by the user. */ 3.20 if (ldt_info.base_addr == 0 && ldt_info.limit == 0) { 3.21 @@ -240,7 +240,7 @@ static int write_ldt(void __user * ptr, 3.22 3.23 /* Install the new entry ... */ 3.24 install: 3.25 - error = HYPERVISOR_update_descriptor(phys_lp, entry_1, entry_2); 3.26 + error = HYPERVISOR_update_descriptor(mach_lp, entry_1, entry_2); 3.27 3.28 out_unlock: 3.29 up(&mm->context.sem);
4.1 --- a/linux-2.6.9-xen-sparse/arch/xen/i386/kernel/setup.c Sun Nov 28 20:49:53 2004 +0000 4.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/i386/kernel/setup.c Sun Nov 28 21:36:51 2004 +0000 4.3 @@ -1389,10 +1389,11 @@ void __init setup_arch(char **cmdline_p) 4.4 init_mm.end_data = (unsigned long) _edata; 4.5 init_mm.brk = (PFN_UP(__pa(xen_start_info.pt_base)) + xen_start_info.nr_pt_frames) << PAGE_SHIFT; 4.6 4.7 - code_resource.start = virt_to_phys(_text); 4.8 - code_resource.end = virt_to_phys(_etext)-1; 4.9 - data_resource.start = virt_to_phys(_etext); 4.10 - data_resource.end = virt_to_phys(_edata)-1; 4.11 + /* XEN: This is nonsense: kernel may not even be contiguous in RAM. */ 4.12 + /*code_resource.start = virt_to_phys(_text);*/ 4.13 + /*code_resource.end = virt_to_phys(_etext)-1;*/ 4.14 + /*data_resource.start = virt_to_phys(_etext);*/ 4.15 + /*data_resource.end = virt_to_phys(_edata)-1;*/ 4.16 4.17 parse_cmdline_early(cmdline_p); 4.18
5.1 --- a/linux-2.6.9-xen-sparse/arch/xen/i386/mm/init.c Sun Nov 28 20:49:53 2004 +0000 5.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/i386/mm/init.c Sun Nov 28 21:36:51 2004 +0000 5.3 @@ -435,17 +435,24 @@ void zap_low_mappings (void) 5.4 void __init zone_sizes_init(void) 5.5 { 5.6 unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0}; 5.7 - unsigned int max_dma, high, low; 5.8 + unsigned int /*max_dma,*/ high, low; 5.9 5.10 - max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT; 5.11 + /* 5.12 + * XEN: Our notion of "DMA memory" is fake when running over Xen. 5.13 + * We simply put all RAM in the DMA zone so that those drivers which 5.14 + * needlessly specify GFP_DMA do not get starved of RAM unnecessarily. 5.15 + * Those drivers that *do* require lowmem are screwed anyway when 5.16 + * running over Xen! 5.17 + */ 5.18 + /*max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;*/ 5.19 low = max_low_pfn; 5.20 high = highend_pfn; 5.21 5.22 - if (low < max_dma) 5.23 + /*if (low < max_dma)*/ 5.24 zones_size[ZONE_DMA] = low; 5.25 - else { 5.26 - zones_size[ZONE_DMA] = max_dma; 5.27 - zones_size[ZONE_NORMAL] = low - max_dma; 5.28 + /*else*/ { 5.29 + /*zones_size[ZONE_DMA] = max_dma;*/ 5.30 + /*zones_size[ZONE_NORMAL] = low - max_dma;*/ 5.31 #ifdef CONFIG_HIGHMEM 5.32 zones_size[ZONE_HIGHMEM] = high - low; 5.33 #endif
6.1 --- a/linux-2.6.9-xen-sparse/arch/xen/i386/mm/ioremap.c Sun Nov 28 20:49:53 2004 +0000 6.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/i386/mm/ioremap.c Sun Nov 28 21:36:51 2004 +0000 6.3 @@ -36,6 +36,23 @@ void __init bt_iounmap(void *addr, unsig 6.4 6.5 #else 6.6 6.7 +/* 6.8 + * Is @address within a RAM page that is local to this virtual machine (i.e., 6.9 + * not an I/O page; not a RAM page belonging to another VM). See the comment 6.10 + * that accompanies pte_pfn() in pgtable-2level.h to understand why this works. 6.11 + */ 6.12 +static inline int is_local_ram(unsigned long address) 6.13 +{ 6.14 + unsigned long mfn = address >> PAGE_SHIFT; 6.15 + unsigned long pfn = mfn_to_pfn(mfn); 6.16 + if (pfn < max_mapnr) { 6.17 + if (pfn_to_mfn(pfn) == mfn) 6.18 + return 1; /* local ram */ 6.19 + printk("is_local_ram: ioremapping foreign ram (a bad idea).\n"); 6.20 + } 6.21 + return 0; /* i/o memory or foreign ram */ 6.22 +} 6.23 + 6.24 static inline void remap_area_pte(pte_t * pte, unsigned long address, unsigned long size, 6.25 unsigned long phys_addr, unsigned long flags) 6.26 { 6.27 @@ -140,19 +157,16 @@ void __iomem * __ioremap(unsigned long p 6.28 if (!size || last_addr < phys_addr) 6.29 return NULL; 6.30 6.31 - if (phys_addr >= 0x0 && last_addr < 0x100000) 6.32 - return isa_bus_to_virt(phys_addr); 6.33 - 6.34 /* 6.35 * Don't remap the low PCI/ISA area, it's always mapped.. 6.36 */ 6.37 - if (phys_addr >= 0xA0000 && last_addr < 0x100000) 6.38 - return (void __iomem *) phys_to_virt(phys_addr); 6.39 + if (phys_addr >= 0x0 && last_addr < 0x100000) 6.40 + return isa_bus_to_virt(phys_addr); 6.41 6.42 /* 6.43 * Don't allow anybody to remap normal RAM that we're using.. 6.44 */ 6.45 - if (machine_to_phys(phys_addr) < virt_to_phys(high_memory)) { 6.46 + if (is_local_ram(phys_addr)) { 6.47 char *t_addr, *t_end; 6.48 struct page *page; 6.49 6.50 @@ -219,7 +233,7 @@ void __iomem *ioremap_nocache (unsigned 6.51 /* Guaranteed to be > phys_addr, as per __ioremap() */ 6.52 last_addr = phys_addr + size - 1; 6.53 6.54 - if (machine_to_phys(last_addr) < virt_to_phys(high_memory)) { 6.55 + if (is_local_ram(last_addr)) { 6.56 struct page *ppage = virt_to_page(bus_to_virt(phys_addr)); 6.57 unsigned long npages; 6.58 6.59 @@ -256,7 +270,7 @@ void iounmap(volatile void __iomem *addr 6.60 return; 6.61 } 6.62 6.63 - if (p->flags && machine_to_phys(p->phys_addr) < virt_to_phys(high_memory)) { 6.64 + if (p->flags && is_local_ram(p->phys_addr)) { 6.65 change_page_attr(virt_to_page(bus_to_virt(p->phys_addr)), 6.66 p->size >> PAGE_SHIFT, 6.67 PAGE_KERNEL); 6.68 @@ -276,14 +290,11 @@ void __init *bt_ioremap(unsigned long ph 6.69 if (!size || last_addr < phys_addr) 6.70 return NULL; 6.71 6.72 - if (phys_addr >= 0x0 && last_addr < 0x100000) 6.73 - return isa_bus_to_virt(phys_addr); 6.74 - 6.75 /* 6.76 * Don't remap the low PCI/ISA area, it's always mapped.. 6.77 */ 6.78 - if (phys_addr >= 0xA0000 && last_addr < 0x100000) 6.79 - return phys_to_virt(phys_addr); 6.80 + if (phys_addr >= 0x0 && last_addr < 0x100000) 6.81 + return isa_bus_to_virt(phys_addr); 6.82 6.83 /* 6.84 * Mappings have to be page-aligned
7.1 --- a/linux-2.6.9-xen-sparse/arch/xen/i386/mm/pgtable.c Sun Nov 28 20:49:53 2004 +0000 7.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/i386/mm/pgtable.c Sun Nov 28 21:36:51 2004 +0000 7.3 @@ -195,7 +195,7 @@ void pte_ctor(void *pte, kmem_cache_t *c 7.4 7.5 clear_page(pte); 7.6 make_page_readonly(pte); 7.7 - queue_pte_pin(virt_to_phys(pte)); 7.8 + queue_pte_pin(__pa(pte)); 7.9 flush_page_update_queue(); 7.10 } 7.11 7.12 @@ -204,7 +204,7 @@ void pte_dtor(void *pte, kmem_cache_t *c 7.13 struct page *page = virt_to_page(pte); 7.14 ClearPageForeign(page); 7.15 7.16 - queue_pte_unpin(virt_to_phys(pte)); 7.17 + queue_pte_unpin(__pa(pte)); 7.18 make_page_writable(pte); 7.19 flush_page_update_queue(); 7.20 }
8.1 --- a/linux-2.6.9-xen-sparse/include/asm-xen/asm-i386/io.h Sun Nov 28 20:49:53 2004 +0000 8.2 +++ b/linux-2.6.9-xen-sparse/include/asm-xen/asm-i386/io.h Sun Nov 28 21:36:51 2004 +0000 8.3 @@ -146,8 +146,8 @@ extern void bt_iounmap(void *addr, unsig 8.4 * 8.5 * Allow them on x86 for legacy drivers, though. 8.6 */ 8.7 -#define virt_to_bus(_x) phys_to_machine(virt_to_phys(_x)) 8.8 -#define bus_to_virt(_x) phys_to_virt(machine_to_phys(_x)) 8.9 +#define virt_to_bus(_x) phys_to_machine(__pa(_x)) 8.10 +#define bus_to_virt(_x) __va(machine_to_phys(_x)) 8.11 8.12 /* 8.13 * readX/writeX() are used to access memory mapped devices. On some
9.1 --- a/linux-2.6.9-xen-sparse/include/asm-xen/asm-i386/pgtable.h Sun Nov 28 20:49:53 2004 +0000 9.2 +++ b/linux-2.6.9-xen-sparse/include/asm-xen/asm-i386/pgtable.h Sun Nov 28 21:36:51 2004 +0000 9.3 @@ -472,7 +472,7 @@ void make_page_writable(void *va); 9.4 void make_pages_readonly(void *va, unsigned int nr); 9.5 void make_pages_writable(void *va, unsigned int nr); 9.6 9.7 -static inline unsigned long arbitrary_virt_to_phys(void *va) 9.8 +static inline unsigned long arbitrary_virt_to_machine(void *va) 9.9 { 9.10 pgd_t *pgd = pgd_offset_k((unsigned long)va); 9.11 pmd_t *pmd = pmd_offset(pgd, (unsigned long)va);