ia64/xen-unstable
changeset 3192:baab27569c9e
bitkeeper revision 1.1159.187.31 (41aae997XDuKlMRBqUZZiaPiGiIgMg)
Fix ioremap() to check for local non-highmem.
Fix ioremap() to check for local non-highmem.
author | kaf24@scramble.cl.cam.ac.uk |
---|---|
date | Mon Nov 29 09:19:19 2004 +0000 (2004-11-29) |
parents | 586eb58cb4b4 |
children | 2e33efd5b908 9c26a1d2b093 |
files | linux-2.6.9-xen-sparse/arch/xen/i386/mm/ioremap.c |
line diff
1.1 --- a/linux-2.6.9-xen-sparse/arch/xen/i386/mm/ioremap.c Sun Nov 28 21:35:44 2004 +0000 1.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/i386/mm/ioremap.c Mon Nov 29 09:19:19 2004 +0000 1.3 @@ -37,20 +37,17 @@ void __init bt_iounmap(void *addr, unsig 1.4 #else 1.5 1.6 /* 1.7 - * Is @address within a RAM page that is local to this virtual machine (i.e., 1.8 - * not an I/O page; not a RAM page belonging to another VM). See the comment 1.9 - * that accompanies pte_pfn() in pgtable-2level.h to understand why this works. 1.10 + * Does @address reside within a non-highmem page that is local to this virtual 1.11 + * machine (i.e., not an I/O page, nor a memory page belonging to another VM). 1.12 + * See the comment that accompanies pte_pfn() in pgtable-2level.h to understand 1.13 + * why this works. 1.14 */ 1.15 -static inline int is_local_ram(unsigned long address) 1.16 +static inline int is_local_lowmem(unsigned long address) 1.17 { 1.18 + extern unsigned long max_low_pfn; 1.19 unsigned long mfn = address >> PAGE_SHIFT; 1.20 unsigned long pfn = mfn_to_pfn(mfn); 1.21 - if (pfn < max_mapnr) { 1.22 - if (pfn_to_mfn(pfn) == mfn) 1.23 - return 1; /* local ram */ 1.24 - printk("is_local_ram: ioremapping foreign ram (a bad idea).\n"); 1.25 - } 1.26 - return 0; /* i/o memory or foreign ram */ 1.27 + return ((pfn < max_low_pfn) && (pfn_to_mfn(pfn) == mfn)); 1.28 } 1.29 1.30 static inline void remap_area_pte(pte_t * pte, unsigned long address, unsigned long size, 1.31 @@ -166,7 +163,7 @@ void __iomem * __ioremap(unsigned long p 1.32 /* 1.33 * Don't allow anybody to remap normal RAM that we're using.. 1.34 */ 1.35 - if (is_local_ram(phys_addr)) { 1.36 + if (is_local_lowmem(phys_addr)) { 1.37 char *t_addr, *t_end; 1.38 struct page *page; 1.39 1.40 @@ -233,7 +230,7 @@ void __iomem *ioremap_nocache (unsigned 1.41 /* Guaranteed to be > phys_addr, as per __ioremap() */ 1.42 last_addr = phys_addr + size - 1; 1.43 1.44 - if (is_local_ram(last_addr)) { 1.45 + if (is_local_lowmem(last_addr)) { 1.46 struct page *ppage = virt_to_page(bus_to_virt(phys_addr)); 1.47 unsigned long npages; 1.48 1.49 @@ -270,7 +267,7 @@ void iounmap(volatile void __iomem *addr 1.50 return; 1.51 } 1.52 1.53 - if (p->flags && is_local_ram(p->phys_addr)) { 1.54 + if (p->flags && is_local_lowmem(p->phys_addr)) { 1.55 change_page_attr(virt_to_page(bus_to_virt(p->phys_addr)), 1.56 p->size >> PAGE_SHIFT, 1.57 PAGE_KERNEL);