* 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;
* below. The preprocessor will warn if the two definitions aren't identical.
*/
#define _PAGE_PRESENT 0x001
+#define _PAGE_IO 0x200
#ifndef __ASSEMBLY__
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)}; })
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)
#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); \
#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))
((_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;
#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)
* 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); \
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)
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) });
}
#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
#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)
#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))