# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID f7cdd99d11065bf684002bce8415eda97f09e5df
# Parent 98a6eb458c783cbbb8f19e5713a4ad8a1ea830c6
Fix MPT mapping for x86/64. Also i386 no longer needs
4MB mapping for PAE, as xenlinux can handle faults when
accessing unmapped sections of the table.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
diff -r 98a6eb458c78 -r f7cdd99d1106 xen/arch/x86/x86_32/mm.c
--- a/xen/arch/x86/x86_32/mm.c Thu Aug 25 16:25:26 2005
+++ b/xen/arch/x86/x86_32/mm.c Thu Aug 25 17:15:41 2005
@@ -93,15 +93,10 @@
/*
* Allocate and map the machine-to-phys table and create read-only mapping
- * of MPT for guest-OS use. Without PAE we'll end up with one 4MB page,
- * with PAE we'll allocate 2MB pages depending on the amount of memory
- * installed, but at least 4MB to cover 4GB address space. This is needed
- * to make PCI I/O memory address lookups work in guests.
+ * of MPT for guest-OS use.
*/
mpt_size = (max_page * 4) + (1UL << L2_PAGETABLE_SHIFT) - 1UL;
mpt_size &= ~((1UL << L2_PAGETABLE_SHIFT) - 1UL);
- if ( mpt_size < (4 << 20) )
- mpt_size = 4 << 20;
for ( i = 0; i < (mpt_size >> L2_PAGETABLE_SHIFT); i++ )
{
if ( (pg = alloc_domheap_pages(NULL, PAGETABLE_ORDER, 0)) == NULL )
diff -r 98a6eb458c78 -r f7cdd99d1106 xen/arch/x86/x86_64/mm.c
--- a/xen/arch/x86/x86_64/mm.c Thu Aug 25 16:25:26 2005
+++ b/xen/arch/x86/x86_64/mm.c Thu Aug 25 17:15:41 2005
@@ -74,7 +74,7 @@
void __init paging_init(void)
{
- unsigned long i;
+ unsigned long i, mpt_size;
l3_pgentry_t *l3_ro_mpt;
l2_pgentry_t *l2_ro_mpt;
struct pfn_info *pg;
@@ -98,16 +98,17 @@
* Allocate and map the machine-to-phys table.
* This also ensures L3 is present for fixmaps.
*/
- for ( i = 0; i < max_page; i += ((1UL << L2_PAGETABLE_SHIFT) / 4) )
- {
- pg = alloc_domheap_pages(NULL, PAGETABLE_ORDER, 0);
- if ( pg == NULL )
+ mpt_size = (max_page * 4) + (1UL << L2_PAGETABLE_SHIFT) - 1UL;
+ mpt_size &= ~((1UL << L2_PAGETABLE_SHIFT) - 1UL);
+ for ( i = 0; i < (mpt_size >> L2_PAGETABLE_SHIFT); i++ )
+ {
+ if ( (pg = alloc_domheap_pages(NULL, PAGETABLE_ORDER, 0)) == NULL )
panic("Not enough memory for m2p table\n");
map_pages_to_xen(
- RDWR_MPT_VIRT_START + i*8, page_to_pfn(pg),
+ RDWR_MPT_VIRT_START + (i << L2_PAGETABLE_SHIFT), page_to_pfn(pg),
1UL << PAGETABLE_ORDER,
PAGE_HYPERVISOR);
- memset((void *)(RDWR_MPT_VIRT_START + i*8), 0x55,
+ memset((void *)(RDWR_MPT_VIRT_START + (i << L2_PAGETABLE_SHIFT)), 0x55,
1UL << L2_PAGETABLE_SHIFT);
*l2_ro_mpt++ = l2e_from_page(
pg, _PAGE_GLOBAL|_PAGE_PSE|_PAGE_USER|_PAGE_PRESENT);
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|