2011-02-04 22:19:54 +01:00
|
|
|
Index: xen-4.0.2-testing/xen/arch/x86/mm.c
|
2010-03-02 01:46:56 +01:00
|
|
|
===================================================================
|
2011-02-04 22:19:54 +01:00
|
|
|
--- xen-4.0.2-testing.orig/xen/arch/x86/mm.c
|
|
|
|
+++ xen-4.0.2-testing/xen/arch/x86/mm.c
|
2010-01-16 01:12:54 +01:00
|
|
|
@@ -154,6 +154,8 @@ unsigned long __read_mostly pdx_group_va
|
|
|
|
int opt_allow_hugepage;
|
|
|
|
boolean_param("allowhugepage", opt_allow_hugepage);
|
|
|
|
|
|
|
|
+bool_t __read_mostly mpt_valid;
|
|
|
|
+
|
|
|
|
#define l1_disallow_mask(d) \
|
|
|
|
((d != dom_io) && \
|
|
|
|
(rangeset_is_empty((d)->iomem_caps) && \
|
2011-02-04 22:19:54 +01:00
|
|
|
Index: xen-4.0.2-testing/xen/arch/x86/traps.c
|
2010-03-02 01:46:56 +01:00
|
|
|
===================================================================
|
2011-02-04 22:19:54 +01:00
|
|
|
--- xen-4.0.2-testing.orig/xen/arch/x86/traps.c
|
|
|
|
+++ xen-4.0.2-testing/xen/arch/x86/traps.c
|
|
|
|
@@ -1354,6 +1354,7 @@ asmlinkage void do_early_page_fault(stru
|
2008-04-26 11:41:49 +02:00
|
|
|
unsigned long *stk = (unsigned long *)regs;
|
|
|
|
printk("Early fatal page fault at %04x:%p (cr2=%p, ec=%04x)\n",
|
|
|
|
regs->cs, _p(regs->eip), _p(cr2), regs->error_code);
|
|
|
|
+ show_page_walk(cr2);
|
|
|
|
printk("Stack dump: ");
|
|
|
|
while ( ((long)stk & ((PAGE_SIZE - 1) & ~(BYTES_PER_LONG - 1))) != 0 )
|
|
|
|
printk("%p ", _p(*stk++));
|
2011-02-04 22:19:54 +01:00
|
|
|
Index: xen-4.0.2-testing/xen/arch/x86/x86_32/mm.c
|
2010-03-02 01:46:56 +01:00
|
|
|
===================================================================
|
2011-02-04 22:19:54 +01:00
|
|
|
--- xen-4.0.2-testing.orig/xen/arch/x86/x86_32/mm.c
|
|
|
|
+++ xen-4.0.2-testing/xen/arch/x86/x86_32/mm.c
|
2010-01-16 01:12:54 +01:00
|
|
|
@@ -122,6 +122,8 @@ void __init paging_init(void)
|
|
|
|
#undef CNT
|
|
|
|
#undef MFN
|
2008-04-26 11:41:49 +02:00
|
|
|
|
|
|
|
+ mpt_valid = 1;
|
|
|
|
+
|
2010-01-16 01:12:54 +01:00
|
|
|
/* Create page tables for ioremap()/map_domain_page_global(). */
|
|
|
|
for ( i = 0; i < (IOREMAP_MBYTES >> (L2_PAGETABLE_SHIFT - 20)); i++ )
|
|
|
|
{
|
2011-02-04 22:19:54 +01:00
|
|
|
Index: xen-4.0.2-testing/xen/arch/x86/x86_32/traps.c
|
2010-03-02 01:46:56 +01:00
|
|
|
===================================================================
|
2011-02-04 22:19:54 +01:00
|
|
|
--- xen-4.0.2-testing.orig/xen/arch/x86/x86_32/traps.c
|
|
|
|
+++ xen-4.0.2-testing/xen/arch/x86/x86_32/traps.c
|
2010-01-16 01:12:54 +01:00
|
|
|
@@ -161,7 +161,8 @@ void show_page_walk(unsigned long addr)
|
2008-04-26 11:41:49 +02:00
|
|
|
l3t += (cr3 & 0xFE0UL) >> 3;
|
|
|
|
l3e = l3t[l3_table_offset(addr)];
|
|
|
|
mfn = l3e_get_pfn(l3e);
|
|
|
|
- pfn = mfn_valid(mfn) ? get_gpfn_from_mfn(mfn) : INVALID_M2P_ENTRY;
|
|
|
|
+ pfn = mfn_valid(mfn) && mpt_valid ?
|
|
|
|
+ get_gpfn_from_mfn(mfn) : INVALID_M2P_ENTRY;
|
|
|
|
printk(" L3[0x%03lx] = %"PRIpte" %08lx\n",
|
|
|
|
l3_table_offset(addr), l3e_get_intpte(l3e), pfn);
|
|
|
|
unmap_domain_page(l3t);
|
2010-01-16 01:12:54 +01:00
|
|
|
@@ -172,7 +173,8 @@ void show_page_walk(unsigned long addr)
|
2008-04-26 11:41:49 +02:00
|
|
|
l2t = map_domain_page(mfn);
|
|
|
|
l2e = l2t[l2_table_offset(addr)];
|
|
|
|
mfn = l2e_get_pfn(l2e);
|
|
|
|
- pfn = mfn_valid(mfn) ? get_gpfn_from_mfn(mfn) : INVALID_M2P_ENTRY;
|
|
|
|
+ pfn = mfn_valid(mfn) && mpt_valid ?
|
|
|
|
+ get_gpfn_from_mfn(mfn) : INVALID_M2P_ENTRY;
|
|
|
|
printk(" L2[0x%03lx] = %"PRIpte" %08lx %s\n",
|
|
|
|
l2_table_offset(addr), l2e_get_intpte(l2e), pfn,
|
|
|
|
(l2e_get_flags(l2e) & _PAGE_PSE) ? "(PSE)" : "");
|
2010-01-16 01:12:54 +01:00
|
|
|
@@ -185,7 +187,8 @@ void show_page_walk(unsigned long addr)
|
2008-04-26 11:41:49 +02:00
|
|
|
l1t = map_domain_page(mfn);
|
|
|
|
l1e = l1t[l1_table_offset(addr)];
|
|
|
|
mfn = l1e_get_pfn(l1e);
|
|
|
|
- pfn = mfn_valid(mfn) ? get_gpfn_from_mfn(mfn) : INVALID_M2P_ENTRY;
|
|
|
|
+ pfn = mfn_valid(mfn) && mpt_valid ?
|
|
|
|
+ get_gpfn_from_mfn(mfn) : INVALID_M2P_ENTRY;
|
|
|
|
printk(" L1[0x%03lx] = %"PRIpte" %08lx\n",
|
|
|
|
l1_table_offset(addr), l1e_get_intpte(l1e), pfn);
|
|
|
|
unmap_domain_page(l1t);
|
2011-02-04 22:19:54 +01:00
|
|
|
Index: xen-4.0.2-testing/xen/arch/x86/x86_64/mm.c
|
2010-03-02 01:46:56 +01:00
|
|
|
===================================================================
|
2011-02-04 22:19:54 +01:00
|
|
|
--- xen-4.0.2-testing.orig/xen/arch/x86/x86_64/mm.c
|
|
|
|
+++ xen-4.0.2-testing/xen/arch/x86/x86_64/mm.c
|
|
|
|
@@ -731,6 +731,8 @@ void __init paging_init(void)
|
2010-01-16 01:12:54 +01:00
|
|
|
#undef CNT
|
|
|
|
#undef MFN
|
2008-04-26 11:41:49 +02:00
|
|
|
|
|
|
|
+ mpt_valid = 1;
|
|
|
|
+
|
|
|
|
/* Create user-accessible L2 directory to map the MPT for compat guests. */
|
|
|
|
BUILD_BUG_ON(l4_table_offset(RDWR_MPT_VIRT_START) !=
|
|
|
|
l4_table_offset(HIRO_COMPAT_MPT_VIRT_START));
|
2011-02-04 22:19:54 +01:00
|
|
|
Index: xen-4.0.2-testing/xen/arch/x86/x86_64/traps.c
|
2010-03-02 01:46:56 +01:00
|
|
|
===================================================================
|
2011-02-04 22:19:54 +01:00
|
|
|
--- xen-4.0.2-testing.orig/xen/arch/x86/x86_64/traps.c
|
|
|
|
+++ xen-4.0.2-testing/xen/arch/x86/x86_64/traps.c
|
2009-05-04 18:38:09 +02:00
|
|
|
@@ -176,7 +176,8 @@ void show_page_walk(unsigned long addr)
|
2008-04-26 11:41:49 +02:00
|
|
|
l4t = mfn_to_virt(mfn);
|
|
|
|
l4e = l4t[l4_table_offset(addr)];
|
|
|
|
mfn = l4e_get_pfn(l4e);
|
|
|
|
- pfn = mfn_valid(mfn) ? get_gpfn_from_mfn(mfn) : INVALID_M2P_ENTRY;
|
|
|
|
+ pfn = mfn_valid(mfn) && mpt_valid ?
|
|
|
|
+ get_gpfn_from_mfn(mfn) : INVALID_M2P_ENTRY;
|
|
|
|
printk(" L4[0x%03lx] = %"PRIpte" %016lx\n",
|
|
|
|
l4_table_offset(addr), l4e_get_intpte(l4e), pfn);
|
2010-01-16 01:12:54 +01:00
|
|
|
if ( !(l4e_get_flags(l4e) & _PAGE_PRESENT) ||
|
|
|
|
@@ -186,7 +187,8 @@ void show_page_walk(unsigned long addr)
|
2008-04-26 11:41:49 +02:00
|
|
|
l3t = mfn_to_virt(mfn);
|
|
|
|
l3e = l3t[l3_table_offset(addr)];
|
|
|
|
mfn = l3e_get_pfn(l3e);
|
|
|
|
- pfn = mfn_valid(mfn) ? get_gpfn_from_mfn(mfn) : INVALID_M2P_ENTRY;
|
|
|
|
+ pfn = mfn_valid(mfn) && mpt_valid ?
|
|
|
|
+ get_gpfn_from_mfn(mfn) : INVALID_M2P_ENTRY;
|
2008-08-18 00:24:29 +02:00
|
|
|
printk(" L3[0x%03lx] = %"PRIpte" %016lx%s\n",
|
|
|
|
l3_table_offset(addr), l3e_get_intpte(l3e), pfn,
|
|
|
|
(l3e_get_flags(l3e) & _PAGE_PSE) ? " (PSE)" : "");
|
2010-01-16 01:12:54 +01:00
|
|
|
@@ -198,7 +200,8 @@ void show_page_walk(unsigned long addr)
|
2008-04-26 11:41:49 +02:00
|
|
|
l2t = mfn_to_virt(mfn);
|
|
|
|
l2e = l2t[l2_table_offset(addr)];
|
|
|
|
mfn = l2e_get_pfn(l2e);
|
|
|
|
- pfn = mfn_valid(mfn) ? get_gpfn_from_mfn(mfn) : INVALID_M2P_ENTRY;
|
|
|
|
+ pfn = mfn_valid(mfn) && mpt_valid ?
|
|
|
|
+ get_gpfn_from_mfn(mfn) : INVALID_M2P_ENTRY;
|
|
|
|
printk(" L2[0x%03lx] = %"PRIpte" %016lx %s\n",
|
|
|
|
l2_table_offset(addr), l2e_get_intpte(l2e), pfn,
|
|
|
|
(l2e_get_flags(l2e) & _PAGE_PSE) ? "(PSE)" : "");
|
2010-01-16 01:12:54 +01:00
|
|
|
@@ -210,7 +213,8 @@ void show_page_walk(unsigned long addr)
|
2008-04-26 11:41:49 +02:00
|
|
|
l1t = mfn_to_virt(mfn);
|
|
|
|
l1e = l1t[l1_table_offset(addr)];
|
|
|
|
mfn = l1e_get_pfn(l1e);
|
|
|
|
- pfn = mfn_valid(mfn) ? get_gpfn_from_mfn(mfn) : INVALID_M2P_ENTRY;
|
|
|
|
+ pfn = mfn_valid(mfn) && mpt_valid ?
|
|
|
|
+ get_gpfn_from_mfn(mfn) : INVALID_M2P_ENTRY;
|
|
|
|
printk(" L1[0x%03lx] = %"PRIpte" %016lx\n",
|
|
|
|
l1_table_offset(addr), l1e_get_intpte(l1e), pfn);
|
|
|
|
}
|
2011-02-04 22:19:54 +01:00
|
|
|
Index: xen-4.0.2-testing/xen/include/asm-x86/mm.h
|
2010-03-02 01:46:56 +01:00
|
|
|
===================================================================
|
2011-02-04 22:19:54 +01:00
|
|
|
--- xen-4.0.2-testing.orig/xen/include/asm-x86/mm.h
|
|
|
|
+++ xen-4.0.2-testing/xen/include/asm-x86/mm.h
|
2010-01-16 01:12:54 +01:00
|
|
|
@@ -443,6 +443,8 @@ TYPE_SAFE(unsigned long,mfn);
|
|
|
|
#define SHARED_M2P_ENTRY (~0UL - 1UL)
|
|
|
|
#define SHARED_M2P(_e) ((_e) == SHARED_M2P_ENTRY)
|
2008-04-26 11:41:49 +02:00
|
|
|
|
2010-01-16 01:12:54 +01:00
|
|
|
+extern bool_t mpt_valid;
|
|
|
|
+
|
2008-04-26 11:41:49 +02:00
|
|
|
#ifdef CONFIG_COMPAT
|
|
|
|
#define compat_machine_to_phys_mapping ((unsigned int *)RDWR_COMPAT_MPT_VIRT_START)
|
2010-01-16 01:12:54 +01:00
|
|
|
#define set_gpfn_from_mfn(mfn, pfn) ({ \
|