| @@ -355,10 +355,8 @@ static pteval_t pte_pfn_to_mfn(pteval_t val) · 354 unmodified lines |
| 355 | pteval_t flags = val & PTE_FLAGS_MASK; | 355 | pteval_t flags = val & PTE_FLAGS_MASK; |
| 356 | unsigned long mfn; | 356 | unsigned long mfn; |
| 357 | | 357 | |
| 358 | if (!xen_feature(XENFEAT_auto_translated_physmap)) | 358 | mfn = __pfn_to_mfn(pfn); |
| 359 | mfn = __pfn_to_mfn(pfn); | 359 | |
| 360 | else | | |
| 361 | mfn = pfn; | | |
| 362 | /* | 360 | /* |
| 363 | * If there's no mfn for the pfn, then just create an | 361 | * If there's no mfn for the pfn, then just create an |
| 364 | * empty non-present pte. Unfortunately this loses | 362 | * empty non-present pte. Unfortunately this loses |
| @@ -647,9 +645,6 @@ static int __xen_pgd_walk(struct mm_struct *mm, pgd_t *pgd, · 282 unmodified lines |
| 647 | limit--; | 645 | limit--; |
| 648 | BUG_ON(limit >= FIXADDR_TOP); | 646 | BUG_ON(limit >= FIXADDR_TOP); |
| 649 | | 647 | |
| 650 | if (xen_feature(XENFEAT_auto_translated_physmap)) | | |
| 651 | return 0; | | |
| 652 | | | |
| 653 | /* | 648 | /* |
| 654 | * 64-bit has a great big hole in the middle of the address | 649 | * 64-bit has a great big hole in the middle of the address |
| 655 | * space, which contains the Xen mappings. On 32-bit these | 650 | * space, which contains the Xen mappings. On 32-bit these |
| @@ -1289,9 +1284,6 @@ static void __init xen_pagetable_cleanhighmap(void) · 633 unmodified lines |
| 1289 | | 1284 | |
| 1290 | static void __init xen_pagetable_p2m_setup(void) | 1285 | static void __init xen_pagetable_p2m_setup(void) |
| 1291 | { | 1286 | { |
| 1292 | if (xen_feature(XENFEAT_auto_translated_physmap)) | | |
| 1293 | return; | | |
| 1294 | | | |
| 1295 | xen_vmalloc_p2m_tree(); | 1287 | xen_vmalloc_p2m_tree(); |
| 1296 | | 1288 | |
| 1297 | #ifdef CONFIG_X86_64 | 1289 | #ifdef CONFIG_X86_64 |
| @@ -1314,8 +1306,7 @@ static void __init xen_pagetable_init(void) · 16 unmodified lines |
| 1314 | xen_build_mfn_list_list(); | 1306 | xen_build_mfn_list_list(); |
| 1315 | | 1307 | |
| 1316 | /* Remap memory freed due to conflicts with E820 map */ | 1308 | /* Remap memory freed due to conflicts with E820 map */ |
| 1317 | if (!xen_feature(XENFEAT_auto_translated_physmap)) | 1309 | xen_remap_memory(); |
| 1318 | xen_remap_memory(); | | |
| 1319 | | 1310 | |
| 1320 | xen_setup_shared_info(); | 1311 | xen_setup_shared_info(); |
| 1321 | } | 1312 | } |
| @@ -1925,21 +1916,20 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) · 603 unmodified lines |
| 1925 | /* Zap identity mapping */ | 1916 | /* Zap identity mapping */ |
| 1926 | init_level4_pgt[0] = __pgd(0); | 1917 | init_level4_pgt[0] = __pgd(0); |
| 1927 | | 1918 | |
| 1928 | if (!xen_feature(XENFEAT_auto_translated_physmap)) { | 1919 | /* Pre-constructed entries are in pfn, so convert to mfn */ |
| 1929 | /* Pre-constructed entries are in pfn, so convert to mfn */ | 1920 | /* L4[272] -> level3_ident_pgt */ |
| 1930 | /* L4[272] -> level3_ident_pgt | 1921 | /* L4[511] -> level3_kernel_pgt */ |
| 1931 | * L4[511] -> level3_kernel_pgt */ | 1922 | convert_pfn_mfn(init_level4_pgt); |
| 1932 | convert_pfn_mfn(init_level4_pgt); | | |
| 1933 | | 1923 | |
| 1934 | /* L3_i[0] -> level2_ident_pgt */ | 1924 | /* L3_i[0] -> level2_ident_pgt */ |
| 1935 | convert_pfn_mfn(level3_ident_pgt); | 1925 | convert_pfn_mfn(level3_ident_pgt); |
| 1936 | /* L3_k[510] -> level2_kernel_pgt | 1926 | /* L3_k[510] -> level2_kernel_pgt */ |
| 1937 | * L3_k[511] -> level2_fixmap_pgt */ | 1927 | /* L3_k[511] -> level2_fixmap_pgt */ |
| 1938 | convert_pfn_mfn(level3_kernel_pgt); | 1928 | convert_pfn_mfn(level3_kernel_pgt); |
| | 1929 | |
| | 1930 | /* L3_k[511][506] -> level1_fixmap_pgt */ |
| | 1931 | convert_pfn_mfn(level2_fixmap_pgt); |
| 1939 | | 1932 | |
| 1940 | /* L3_k[511][506] -> level1_fixmap_pgt */ | | |
| 1941 | convert_pfn_mfn(level2_fixmap_pgt); | | |
| 1942 | } | | |
| 1943 | /* We get [511][511] and have Xen's version of level2_kernel_pgt */ | 1933 | /* We get [511][511] and have Xen's version of level2_kernel_pgt */ |
| 1944 | l3 = m2v(pgd[pgd_index(__START_KERNEL_map)].pgd); | 1934 | l3 = m2v(pgd[pgd_index(__START_KERNEL_map)].pgd); |
| 1945 | l2 = m2v(l3[pud_index(__START_KERNEL_map)].pud); | 1935 | l2 = m2v(l3[pud_index(__START_KERNEL_map)].pud); |
| @@ -1962,34 +1952,30 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) · 16 unmodified lines |
| 1962 | if (i && i < pgd_index(__START_KERNEL_map)) | 1952 | if (i && i < pgd_index(__START_KERNEL_map)) |
| 1963 | init_level4_pgt[i] = ((pgd_t *)xen_start_info->pt_base)[i]; | 1953 | init_level4_pgt[i] = ((pgd_t *)xen_start_info->pt_base)[i]; |
| 1964 | | 1954 | |
| 1965 | if (!xen_feature(XENFEAT_auto_translated_physmap)) { | 1955 | /* Make pagetable pieces RO */ |
| 1966 | /* Make pagetable pieces RO */ | 1956 | set_page_prot(init_level4_pgt, PAGE_KERNEL_RO); |
| 1967 | set_page_prot(init_level4_pgt, PAGE_KERNEL_RO); | 1957 | set_page_prot(level3_ident_pgt, PAGE_KERNEL_RO); |
| 1968 | set_page_prot(level3_ident_pgt, PAGE_KERNEL_RO); | 1958 | set_page_prot(level3_kernel_pgt, PAGE_KERNEL_RO); |
| 1969 | set_page_prot(level3_kernel_pgt, PAGE_KERNEL_RO); | 1959 | set_page_prot(level3_user_vsyscall, PAGE_KERNEL_RO); |
| 1970 | set_page_prot(level3_user_vsyscall, PAGE_KERNEL_RO); | 1960 | set_page_prot(level2_ident_pgt, PAGE_KERNEL_RO); |
| 1971 | set_page_prot(level2_ident_pgt, PAGE_KERNEL_RO); | 1961 | set_page_prot(level2_kernel_pgt, PAGE_KERNEL_RO); |
| 1972 | set_page_prot(level2_kernel_pgt, PAGE_KERNEL_RO); | 1962 | set_page_prot(level2_fixmap_pgt, PAGE_KERNEL_RO); |
| 1973 | set_page_prot(level2_fixmap_pgt, PAGE_KERNEL_RO); | 1963 | set_page_prot(level1_fixmap_pgt, PAGE_KERNEL_RO); |
| 1974 | set_page_prot(level1_fixmap_pgt, PAGE_KERNEL_RO); | 1964 | |
| 1975 | | 1965 | /* Pin down new L4 */ |
| 1976 | /* Pin down new L4 */ | 1966 | pin_pagetable_pfn(MMUEXT_PIN_L4_TABLE, |
| 1977 | pin_pagetable_pfn(MMUEXT_PIN_L4_TABLE, | 1967 | PFN_DOWN(__pa_symbol(init_level4_pgt))); |
| 1978 | PFN_DOWN(__pa_symbol(init_level4_pgt))); | 1968 | |
| 1979 | | 1969 | /* Unpin Xen-provided one */ |
| 1980 | /* Unpin Xen-provided one */ | 1970 | pin_pagetable_pfn(MMUEXT_UNPIN_TABLE, PFN_DOWN(__pa(pgd))); |
| 1981 | pin_pagetable_pfn(MMUEXT_UNPIN_TABLE, PFN_DOWN(__pa(pgd))); | | |
| 1982 | | 1971 | |
| 1983 | /* | 1972 | /* |
| 1984 | * At this stage there can be no user pgd, and no page | 1973 | * At this stage there can be no user pgd, and no page structure to |
| 1985 | * structure to attach it to, so make sure we just set kernel | 1974 | * attach it to, so make sure we just set kernel pgd. |
| 1986 | * pgd. | 1975 | */ |
| 1987 | */ | 1976 | xen_mc_batch(); |
| 1988 | xen_mc_batch(); | 1977 | __xen_write_cr3(true, __pa(init_level4_pgt)); |
| 1989 | __xen_write_cr3(true, __pa(init_level4_pgt)); | 1978 | xen_mc_issue(PARAVIRT_LAZY_CPU); |
| 1990 | xen_mc_issue(PARAVIRT_LAZY_CPU); | | |
| 1991 | } else | | |
| 1992 | native_write_cr3(__pa(init_level4_pgt)); | | |
| 1993 | | 1979 | |
| 1994 | /* We can't that easily rip out L3 and L2, as the Xen pagetables are | 1980 | /* We can't that easily rip out L3 and L2, as the Xen pagetables are |
| 1995 | * set out this way: [L4], [L1], [L2], [L3], [L1], [L1] ... for | 1981 | * set out this way: [L4], [L1], [L2], [L3], [L1], [L1] ... for |
| @@ -2403,9 +2389,6 @@ static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot) · 407 unmodified lines |
| 2403 | | 2389 | |
| 2404 | static void __init xen_post_allocator_init(void) | 2390 | static void __init xen_post_allocator_init(void) |
| 2405 | { | 2391 | { |
| 2406 | if (xen_feature(XENFEAT_auto_translated_physmap)) | | |
| 2407 | return; | | |
| 2408 | | | |
| 2409 | pv_mmu_ops.set_pte = xen_set_pte; | 2392 | pv_mmu_ops.set_pte = xen_set_pte; |
| 2410 | pv_mmu_ops.set_pmd = xen_set_pmd; | 2393 | pv_mmu_ops.set_pmd = xen_set_pmd; |
| 2411 | pv_mmu_ops.set_pud = xen_set_pud; | 2394 | pv_mmu_ops.set_pud = xen_set_pud; |
| @@ -2511,9 +2494,6 @@ void __init xen_init_mmu_ops(void) · 99 unmodified lines |
| 2511 | { | 2494 | { |
| 2512 | x86_init.paging.pagetable_init = xen_pagetable_init; | 2495 | x86_init.paging.pagetable_init = xen_pagetable_init; |
| 2513 | | 2496 | |
| 2514 | if (xen_feature(XENFEAT_auto_translated_physmap)) | | |
| 2515 | return; | | |
| 2516 | | | |
| 2517 | pv_mmu_ops = xen_mmu_ops; | 2497 | pv_mmu_ops = xen_mmu_ops; |
| 2518 | | 2498 | |
| 2519 | memset(dummy_mapping, 0xff, PAGE_SIZE); | 2499 | memset(dummy_mapping, 0xff, PAGE_SIZE); |
| @@ -2650,9 +2630,6 @@ int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order, · 130 unmodified lines |
| 2650 | * this function are redundant and can be ignored. | 2630 | * this function are redundant and can be ignored. |
| 2651 | */ | 2631 | */ |
| 2652 | | 2632 | |
| 2653 | if (xen_feature(XENFEAT_auto_translated_physmap)) | | |
| 2654 | return 0; | | |
| 2655 | | | |
| 2656 | if (unlikely(order > MAX_CONTIG_ORDER)) | 2633 | if (unlikely(order > MAX_CONTIG_ORDER)) |
| 2657 | return -ENOMEM; | 2634 | return -ENOMEM; |
| 2658 | | 2635 | |
| @@ -2689,9 +2666,6 @@ void xen_destroy_contiguous_region(phys_addr_t pstart, unsigned int order) · 30 unmodified lines |
| 2689 | int success; | 2666 | int success; |
| 2690 | unsigned long vstart; | 2667 | unsigned long vstart; |
| 2691 | | 2668 | |
| 2692 | if (xen_feature(XENFEAT_auto_translated_physmap)) | | |
| 2693 | return; | | |
| 2694 | | | |
| 2695 | if (unlikely(order > MAX_CONTIG_ORDER)) | 2669 | if (unlikely(order > MAX_CONTIG_ORDER)) |
| 2696 | return; | 2670 | return; |
| 2697 | | 2671 | |