[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-3.1-testing] xen, x86: Track foreign and I/O mappings with a new pte flag, and do
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1206016187 0 # Node ID f289580cf7a871ccb0d2cb37bd212d323c299a06 # Parent b0a5b418d4a2e5a9a6cfd35b5fc522512770113e xen, x86: Track foreign and I/O mappings with a new pte flag, and do not subject such ptes to conversions to/from pseudophysical addresses. Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx> linux-2.6.18-xen changeset: 488:de57c3f218fb5c23bb767d2192e9beb1b4d09681 linux-2.6.18-xen date: Thu Mar 20 11:35:25 2008 +0000 --- linux-2.6-xen-sparse/arch/i386/mm/ioremap-xen.c | 2 linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/page.h | 21 ++++++---- linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-2level.h | 6 +- linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-3level.h | 6 +- linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable.h | 5 +- linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/page.h | 11 +++-- linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/pgtable.h | 11 +++-- 7 files changed, 41 insertions(+), 21 deletions(-) diff -r b0a5b418d4a2 -r f289580cf7a8 linux-2.6-xen-sparse/arch/i386/mm/ioremap-xen.c --- a/linux-2.6-xen-sparse/arch/i386/mm/ioremap-xen.c Thu Mar 20 12:27:11 2008 +0000 +++ b/linux-2.6-xen-sparse/arch/i386/mm/ioremap-xen.c Thu Mar 20 12:29:47 2008 +0000 @@ -76,7 +76,7 @@ static int __direct_remap_pfn_range(stru * Fill in the machine address: PTE ptr is done later by * apply_to_page_range(). */ - v->val = __pte_val(pfn_pte_ma(mfn, prot)); + v->val = __pte_val(pfn_pte_ma(mfn, prot)) | _PAGE_IO; mfn++; address += PAGE_SIZE; diff -r b0a5b418d4a2 -r f289580cf7a8 linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/page.h --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/page.h Thu Mar 20 12:27:11 2008 +0000 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/page.h Thu Mar 20 12:29:47 2008 +0000 @@ -27,6 +27,7 @@ * below. The preprocessor will warn if the two definitions aren't identical. */ #define _PAGE_PRESENT 0x001 +#define _PAGE_IO 0x200 #ifndef __ASSEMBLY__ @@ -82,8 +83,9 @@ typedef struct { unsigned long long pgpr typedef struct { unsigned long long pgprot; } pgprot_t; #define pgprot_val(x) ((x).pgprot) #include <asm/maddr.h> -#define __pte(x) ({ unsigned long long _x = (x); \ - if (_x & _PAGE_PRESENT) _x = pte_phys_to_machine(_x); \ +#define __pte(x) ({ unsigned long long _x = (x); \ + if ((_x & (_PAGE_PRESENT|_PAGE_IO)) == _PAGE_PRESENT) \ + _x = pte_phys_to_machine(_x); \ ((pte_t) {(unsigned long)(_x), (unsigned long)(_x>>32)}); }) #define __pgd(x) ({ unsigned long long _x = (x); \ (pgd_t) {((_x) & _PAGE_PRESENT) ? pte_phys_to_machine(_x) : (_x)}; }) @@ -96,7 +98,8 @@ static inline unsigned long long pte_val static inline unsigned long long pte_val(pte_t x) { unsigned long long ret = __pte_val(x); - if (x.pte_low & _PAGE_PRESENT) ret = pte_machine_to_phys(ret); + if ((x.pte_low & (_PAGE_PRESENT|_PAGE_IO)) == _PAGE_PRESENT) + ret = pte_machine_to_phys(ret); return ret; } #define __pmd_val(x) ((x).pmd) @@ -127,11 +130,13 @@ typedef struct { unsigned long pgprot; } #include <asm/maddr.h> #define boot_pte_t pte_t /* or would you rather have a typedef */ #define __pte_val(x) ((x).pte_low) -#define pte_val(x) (__pte_val(x) & _PAGE_PRESENT ? \ - machine_to_phys(__pte_val(x)) : \ - __pte_val(x)) -#define __pte(x) ({ unsigned long _x = (x); \ - (pte_t) {((_x) & _PAGE_PRESENT) ? phys_to_machine(_x) : (_x)}; }) +#define pte_val(x) ((__pte_val(x) & (_PAGE_PRESENT|_PAGE_IO)) \ + == _PAGE_PRESENT ? \ + machine_to_phys(__pte_val(x)) : \ + __pte_val(x)) +#define __pte(x) ({ unsigned long _x = (x); \ + (pte_t)(((_x) & (_PAGE_PRESENT|_PAGE_IO)) == _PAGE_PRESENT ? \ + phys_to_machine(_x) : (_x)); }) #define __pmd_val(x) __pud_val((x).pud) #define __pud_val(x) __pgd_val((x).pgd) #define __pgd(x) ({ unsigned long _x = (x); \ diff -r b0a5b418d4a2 -r f289580cf7a8 linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-2level.h --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-2level.h Thu Mar 20 12:27:11 2008 +0000 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-2level.h Thu Mar 20 12:29:47 2008 +0000 @@ -71,8 +71,10 @@ static inline pte_t ptep_get_and_clear(s #define __pte_mfn(_pte) ((_pte).pte_low >> PAGE_SHIFT) #define pte_mfn(_pte) ((_pte).pte_low & _PAGE_PRESENT ? \ __pte_mfn(_pte) : pfn_to_mfn(__pte_mfn(_pte))) -#define pte_pfn(_pte) ((_pte).pte_low & _PAGE_PRESENT ? \ - mfn_to_local_pfn(__pte_mfn(_pte)) : __pte_mfn(_pte)) +#define pte_pfn(_pte) ((_pte).pte_low & _PAGE_IO ? max_mapnr : \ + (_pte).pte_low & _PAGE_PRESENT ? \ + mfn_to_local_pfn(__pte_mfn(_pte)) : \ + __pte_mfn(_pte)) #define pte_page(_pte) pfn_to_page(pte_pfn(_pte)) diff -r b0a5b418d4a2 -r f289580cf7a8 linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-3level.h --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-3level.h Thu Mar 20 12:27:11 2008 +0000 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-3level.h Thu Mar 20 12:29:47 2008 +0000 @@ -170,8 +170,10 @@ static inline int pte_same(pte_t a, pte_ ((_pte).pte_high << (32-PAGE_SHIFT))) #define pte_mfn(_pte) ((_pte).pte_low & _PAGE_PRESENT ? \ __pte_mfn(_pte) : pfn_to_mfn(__pte_mfn(_pte))) -#define pte_pfn(_pte) ((_pte).pte_low & _PAGE_PRESENT ? \ - mfn_to_local_pfn(__pte_mfn(_pte)) : __pte_mfn(_pte)) +#define pte_pfn(_pte) ((_pte).pte_low & _PAGE_IO ? max_mapnr : \ + (_pte).pte_low & _PAGE_PRESENT ? \ + mfn_to_local_pfn(__pte_mfn(_pte)) : \ + __pte_mfn(_pte)) extern unsigned long long __supported_pte_mask; diff -r b0a5b418d4a2 -r f289580cf7a8 linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable.h --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable.h Thu Mar 20 12:27:11 2008 +0000 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable.h Thu Mar 20 12:29:47 2008 +0000 @@ -133,9 +133,12 @@ void paging_init(void); #define _PAGE_NX 0 #endif +/* Mapped page is I/O or foreign and has no associated page struct. */ +#define _PAGE_IO 0x200 + #define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED | _PAGE_DIRTY) #define _KERNPG_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY) -#define _PAGE_CHG_MASK (PTE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY) +#define _PAGE_CHG_MASK (PTE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_IO) #define PAGE_NONE \ __pgprot(_PAGE_PROTNONE | _PAGE_ACCESSED) diff -r b0a5b418d4a2 -r f289580cf7a8 linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/page.h --- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/page.h Thu Mar 20 12:27:11 2008 +0000 +++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/page.h Thu Mar 20 12:29:47 2008 +0000 @@ -15,6 +15,7 @@ * below. The preprocessor will warn if the two definitions aren't identical. */ #define _PAGE_PRESENT 0x001 +#define _PAGE_IO 0x200 #define arch_free_page(_page,_order) \ ({ int foreign = PageForeign(_page); \ @@ -97,9 +98,10 @@ typedef struct { unsigned long pgprot; } typedef struct { unsigned long pgprot; } pgprot_t; #define __pte_val(x) ((x).pte) -#define pte_val(x) ((__pte_val(x) & _PAGE_PRESENT) ? \ - pte_machine_to_phys(__pte_val(x)) : \ - __pte_val(x)) +#define pte_val(x) ((__pte_val(x) & (_PAGE_PRESENT|_PAGE_IO)) \ + == _PAGE_PRESENT ? \ + pte_machine_to_phys(__pte_val(x)) : \ + __pte_val(x)) #define __pmd_val(x) ((x).pmd) static inline unsigned long pmd_val(pmd_t x) @@ -133,7 +135,8 @@ static inline unsigned long pgd_val(pgd_ static inline pte_t __pte(unsigned long x) { - if (x & _PAGE_PRESENT) x = pte_phys_to_machine(x); + if ((x & (_PAGE_PRESENT|_PAGE_IO)) == _PAGE_PRESENT) + x = pte_phys_to_machine(x); return ((pte_t) { (x) }); } diff -r b0a5b418d4a2 -r f289580cf7a8 linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/pgtable.h --- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/pgtable.h Thu Mar 20 12:27:11 2008 +0000 +++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/pgtable.h Thu Mar 20 12:29:47 2008 +0000 @@ -169,6 +169,9 @@ static inline void pgd_clear (pgd_t * pg #define _PAGE_PROTNONE 0x080 /* If not present */ #define _PAGE_NX (1UL<<_PAGE_BIT_NX) +/* Mapped page is I/O or foreign and has no associated page struct. */ +#define _PAGE_IO 0x200 + #if CONFIG_XEN_COMPAT <= 0x030002 extern unsigned int __kernel_page_user; #else @@ -178,7 +181,7 @@ extern unsigned int __kernel_page_user; #define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED | _PAGE_DIRTY) #define _KERNPG_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY | __kernel_page_user) -#define _PAGE_CHG_MASK (PTE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY) +#define _PAGE_CHG_MASK (PTE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_IO) #define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_ACCESSED) #define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED | _PAGE_NX) @@ -269,8 +272,10 @@ static inline unsigned long pud_bad(pud_ #define __pte_mfn(_pte) (((_pte).pte & PTE_MASK) >> PAGE_SHIFT) #define pte_mfn(_pte) ((_pte).pte & _PAGE_PRESENT ? \ __pte_mfn(_pte) : pfn_to_mfn(__pte_mfn(_pte))) -#define pte_pfn(_pte) ((_pte).pte & _PAGE_PRESENT ? \ - mfn_to_local_pfn(__pte_mfn(_pte)) : __pte_mfn(_pte)) +#define pte_pfn(_pte) ((_pte).pte & _PAGE_IO ? end_pfn : \ + (_pte).pte & _PAGE_PRESENT ? \ + mfn_to_local_pfn(__pte_mfn(_pte)) : \ + __pte_mfn(_pte)) #define pte_page(x) pfn_to_page(pte_pfn(x)) _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |