diff options
Diffstat (limited to 'arch/x86/mm/init_64.c')
-rw-r--r-- | arch/x86/mm/init_64.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index 5ecb23a57d2f..d99bc6ac4884 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c | |||
@@ -741,8 +741,22 @@ unsigned long __init_refok init_memory_mapping(unsigned long start, | |||
741 | /* head if not big page alignment ? */ | 741 | /* head if not big page alignment ? */ |
742 | start_pfn = start >> PAGE_SHIFT; | 742 | start_pfn = start >> PAGE_SHIFT; |
743 | pos = start_pfn << PAGE_SHIFT; | 743 | pos = start_pfn << PAGE_SHIFT; |
744 | #ifdef CONFIG_X86_32 | ||
745 | /* | ||
746 | * Don't use a large page for the first 2/4MB of memory | ||
747 | * because there are often fixed size MTRRs in there | ||
748 | * and overlapping MTRRs into large pages can cause | ||
749 | * slowdowns. | ||
750 | */ | ||
751 | if (pos == 0) | ||
752 | end_pfn = 1<<(PMD_SHIFT - PAGE_SHIFT); | ||
753 | else | ||
754 | end_pfn = ((pos + (PMD_SIZE - 1))>>PMD_SHIFT) | ||
755 | << (PMD_SHIFT - PAGE_SHIFT); | ||
756 | #else /* CONFIG_X86_64 */ | ||
744 | end_pfn = ((pos + (PMD_SIZE - 1)) >> PMD_SHIFT) | 757 | end_pfn = ((pos + (PMD_SIZE - 1)) >> PMD_SHIFT) |
745 | << (PMD_SHIFT - PAGE_SHIFT); | 758 | << (PMD_SHIFT - PAGE_SHIFT); |
759 | #endif | ||
746 | if (end_pfn > (end >> PAGE_SHIFT)) | 760 | if (end_pfn > (end >> PAGE_SHIFT)) |
747 | end_pfn = end >> PAGE_SHIFT; | 761 | end_pfn = end >> PAGE_SHIFT; |
748 | if (start_pfn < end_pfn) { | 762 | if (start_pfn < end_pfn) { |
@@ -753,16 +767,22 @@ unsigned long __init_refok init_memory_mapping(unsigned long start, | |||
753 | /* big page (2M) range */ | 767 | /* big page (2M) range */ |
754 | start_pfn = ((pos + (PMD_SIZE - 1))>>PMD_SHIFT) | 768 | start_pfn = ((pos + (PMD_SIZE - 1))>>PMD_SHIFT) |
755 | << (PMD_SHIFT - PAGE_SHIFT); | 769 | << (PMD_SHIFT - PAGE_SHIFT); |
770 | #ifdef CONFIG_X86_32 | ||
771 | end_pfn = (end>>PMD_SHIFT) << (PMD_SHIFT - PAGE_SHIFT); | ||
772 | #else /* CONFIG_X86_64 */ | ||
756 | end_pfn = ((pos + (PUD_SIZE - 1))>>PUD_SHIFT) | 773 | end_pfn = ((pos + (PUD_SIZE - 1))>>PUD_SHIFT) |
757 | << (PUD_SHIFT - PAGE_SHIFT); | 774 | << (PUD_SHIFT - PAGE_SHIFT); |
758 | if (end_pfn > ((end>>PMD_SHIFT)<<(PMD_SHIFT - PAGE_SHIFT))) | 775 | if (end_pfn > ((end>>PMD_SHIFT)<<(PMD_SHIFT - PAGE_SHIFT))) |
759 | end_pfn = ((end>>PMD_SHIFT)<<(PMD_SHIFT - PAGE_SHIFT)); | 776 | end_pfn = ((end>>PMD_SHIFT)<<(PMD_SHIFT - PAGE_SHIFT)); |
777 | #endif | ||
778 | |||
760 | if (start_pfn < end_pfn) { | 779 | if (start_pfn < end_pfn) { |
761 | nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, | 780 | nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, |
762 | page_size_mask & (1<<PG_LEVEL_2M)); | 781 | page_size_mask & (1<<PG_LEVEL_2M)); |
763 | pos = end_pfn << PAGE_SHIFT; | 782 | pos = end_pfn << PAGE_SHIFT; |
764 | } | 783 | } |
765 | 784 | ||
785 | #ifdef CONFIG_X86_64 | ||
766 | /* big page (1G) range */ | 786 | /* big page (1G) range */ |
767 | start_pfn = ((pos + (PUD_SIZE - 1))>>PUD_SHIFT) | 787 | start_pfn = ((pos + (PUD_SIZE - 1))>>PUD_SHIFT) |
768 | << (PUD_SHIFT - PAGE_SHIFT); | 788 | << (PUD_SHIFT - PAGE_SHIFT); |
@@ -783,6 +803,7 @@ unsigned long __init_refok init_memory_mapping(unsigned long start, | |||
783 | page_size_mask & (1<<PG_LEVEL_2M)); | 803 | page_size_mask & (1<<PG_LEVEL_2M)); |
784 | pos = end_pfn << PAGE_SHIFT; | 804 | pos = end_pfn << PAGE_SHIFT; |
785 | } | 805 | } |
806 | #endif | ||
786 | 807 | ||
787 | /* tail is not big page (2M) alignment */ | 808 | /* tail is not big page (2M) alignment */ |
788 | start_pfn = pos>>PAGE_SHIFT; | 809 | start_pfn = pos>>PAGE_SHIFT; |