aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/include/asm/pgtable_64.h1
-rw-r--r--arch/x86/xen/mmu.c27
2 files changed, 13 insertions, 15 deletions
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
index 5be9063545d2..3874693c0e53 100644
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -19,6 +19,7 @@ extern pud_t level3_ident_pgt[512];
19extern pmd_t level2_kernel_pgt[512]; 19extern pmd_t level2_kernel_pgt[512];
20extern pmd_t level2_fixmap_pgt[512]; 20extern pmd_t level2_fixmap_pgt[512];
21extern pmd_t level2_ident_pgt[512]; 21extern pmd_t level2_ident_pgt[512];
22extern pte_t level1_fixmap_pgt[512];
22extern pgd_t init_level4_pgt[]; 23extern pgd_t init_level4_pgt[];
23 24
24#define swapper_pg_dir init_level4_pgt 25#define swapper_pg_dir init_level4_pgt
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index e8a1201c3293..16fb0099b7f2 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -1866,12 +1866,11 @@ static void __init check_pt_base(unsigned long *pt_base, unsigned long *pt_end,
1866 * 1866 *
1867 * We can construct this by grafting the Xen provided pagetable into 1867 * We can construct this by grafting the Xen provided pagetable into
1868 * head_64.S's preconstructed pagetables. We copy the Xen L2's into 1868 * head_64.S's preconstructed pagetables. We copy the Xen L2's into
1869 * level2_ident_pgt, level2_kernel_pgt and level2_fixmap_pgt. This 1869 * level2_ident_pgt, and level2_kernel_pgt. This means that only the
1870 * means that only the kernel has a physical mapping to start with - 1870 * kernel has a physical mapping to start with - but that's enough to
1871 * but that's enough to get __va working. We need to fill in the rest 1871 * get __va working. We need to fill in the rest of the physical
1872 * of the physical mapping once some sort of allocator has been set 1872 * mapping once some sort of allocator has been set up. NOTE: for
1873 * up. 1873 * PVH, the page tables are native.
1874 * NOTE: for PVH, the page tables are native.
1875 */ 1874 */
1876void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) 1875void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn)
1877{ 1876{
@@ -1902,8 +1901,11 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn)
1902 /* L3_i[0] -> level2_ident_pgt */ 1901 /* L3_i[0] -> level2_ident_pgt */
1903 convert_pfn_mfn(level3_ident_pgt); 1902 convert_pfn_mfn(level3_ident_pgt);
1904 /* L3_k[510] -> level2_kernel_pgt 1903 /* L3_k[510] -> level2_kernel_pgt
1905 * L3_i[511] -> level2_fixmap_pgt */ 1904 * L3_k[511] -> level2_fixmap_pgt */
1906 convert_pfn_mfn(level3_kernel_pgt); 1905 convert_pfn_mfn(level3_kernel_pgt);
1906
1907 /* L3_k[511][506] -> level1_fixmap_pgt */
1908 convert_pfn_mfn(level2_fixmap_pgt);
1907 } 1909 }
1908 /* We get [511][511] and have Xen's version of level2_kernel_pgt */ 1910 /* We get [511][511] and have Xen's version of level2_kernel_pgt */
1909 l3 = m2v(pgd[pgd_index(__START_KERNEL_map)].pgd); 1911 l3 = m2v(pgd[pgd_index(__START_KERNEL_map)].pgd);
@@ -1913,21 +1915,15 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn)
1913 addr[1] = (unsigned long)l3; 1915 addr[1] = (unsigned long)l3;
1914 addr[2] = (unsigned long)l2; 1916 addr[2] = (unsigned long)l2;
1915 /* Graft it onto L4[272][0]. Note that we creating an aliasing problem: 1917 /* Graft it onto L4[272][0]. Note that we creating an aliasing problem:
1916 * Both L4[272][0] and L4[511][511] have entries that point to the same 1918 * Both L4[272][0] and L4[511][510] have entries that point to the same
1917 * L2 (PMD) tables. Meaning that if you modify it in __va space 1919 * L2 (PMD) tables. Meaning that if you modify it in __va space
1918 * it will be also modified in the __ka space! (But if you just 1920 * it will be also modified in the __ka space! (But if you just
1919 * modify the PMD table to point to other PTE's or none, then you 1921 * modify the PMD table to point to other PTE's or none, then you
1920 * are OK - which is what cleanup_highmap does) */ 1922 * are OK - which is what cleanup_highmap does) */
1921 copy_page(level2_ident_pgt, l2); 1923 copy_page(level2_ident_pgt, l2);
1922 /* Graft it onto L4[511][511] */ 1924 /* Graft it onto L4[511][510] */
1923 copy_page(level2_kernel_pgt, l2); 1925 copy_page(level2_kernel_pgt, l2);
1924 1926
1925 /* Get [511][510] and graft that in level2_fixmap_pgt */
1926 l3 = m2v(pgd[pgd_index(__START_KERNEL_map + PMD_SIZE)].pgd);
1927 l2 = m2v(l3[pud_index(__START_KERNEL_map + PMD_SIZE)].pud);
1928 copy_page(level2_fixmap_pgt, l2);
1929 /* Note that we don't do anything with level1_fixmap_pgt which
1930 * we don't need. */
1931 if (!xen_feature(XENFEAT_auto_translated_physmap)) { 1927 if (!xen_feature(XENFEAT_auto_translated_physmap)) {
1932 /* Make pagetable pieces RO */ 1928 /* Make pagetable pieces RO */
1933 set_page_prot(init_level4_pgt, PAGE_KERNEL_RO); 1929 set_page_prot(init_level4_pgt, PAGE_KERNEL_RO);
@@ -1937,6 +1933,7 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn)
1937 set_page_prot(level2_ident_pgt, PAGE_KERNEL_RO); 1933 set_page_prot(level2_ident_pgt, PAGE_KERNEL_RO);
1938 set_page_prot(level2_kernel_pgt, PAGE_KERNEL_RO); 1934 set_page_prot(level2_kernel_pgt, PAGE_KERNEL_RO);
1939 set_page_prot(level2_fixmap_pgt, PAGE_KERNEL_RO); 1935 set_page_prot(level2_fixmap_pgt, PAGE_KERNEL_RO);
1936 set_page_prot(level1_fixmap_pgt, PAGE_KERNEL_RO);
1940 1937
1941 /* Pin down new L4 */ 1938 /* Pin down new L4 */
1942 pin_pagetable_pfn(MMUEXT_PIN_L4_TABLE, 1939 pin_pagetable_pfn(MMUEXT_PIN_L4_TABLE,