diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-05-19 18:06:48 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-05-19 18:06:48 -0400 |
commit | 9e856e4b475502270f2cfdd7b289075c1924786b (patch) | |
tree | 0c28c99505aea81dcbe968219ffee6caeda6b933 | |
parent | 1fbbed4137de93e02fc62776b8bf08a2d9ae1141 (diff) | |
parent | c71e6d804c88168ecf02aaf14e1fd5773d683b5f (diff) |
Merge tag 'for-linus-4.12b-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip
Pull xen fixes from Juergen Gross:
"Some fixes for the new Xen 9pfs frontend and some minor cleanups"
* tag 'for-linus-4.12b-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
xen: make xen_flush_tlb_all() static
xen: cleanup pvh leftovers from pv-only sources
xen/9pfs: p9_trans_xen_init and p9_trans_xen_exit can be static
xen/9pfs: fix return value check in xen_9pfs_front_probe()
-rw-r--r-- | arch/x86/xen/enlighten_pv.c | 15 | ||||
-rw-r--r-- | arch/x86/xen/mmu.c | 2 | ||||
-rw-r--r-- | arch/x86/xen/mmu_pv.c | 102 | ||||
-rw-r--r-- | net/9p/trans_xen.c | 8 |
4 files changed, 47 insertions, 80 deletions
diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c index 7cd442690f9d..f33eef4ebd12 100644 --- a/arch/x86/xen/enlighten_pv.c +++ b/arch/x86/xen/enlighten_pv.c | |||
@@ -142,9 +142,7 @@ static void __init xen_banner(void) | |||
142 | struct xen_extraversion extra; | 142 | struct xen_extraversion extra; |
143 | HYPERVISOR_xen_version(XENVER_extraversion, &extra); | 143 | HYPERVISOR_xen_version(XENVER_extraversion, &extra); |
144 | 144 | ||
145 | pr_info("Booting paravirtualized kernel %son %s\n", | 145 | pr_info("Booting paravirtualized kernel on %s\n", pv_info.name); |
146 | xen_feature(XENFEAT_auto_translated_physmap) ? | ||
147 | "with PVH extensions " : "", pv_info.name); | ||
148 | printk(KERN_INFO "Xen version: %d.%d%s%s\n", | 146 | printk(KERN_INFO "Xen version: %d.%d%s%s\n", |
149 | version >> 16, version & 0xffff, extra.extraversion, | 147 | version >> 16, version & 0xffff, extra.extraversion, |
150 | xen_feature(XENFEAT_mmu_pt_update_preserve_ad) ? " (preserve-AD)" : ""); | 148 | xen_feature(XENFEAT_mmu_pt_update_preserve_ad) ? " (preserve-AD)" : ""); |
@@ -957,15 +955,10 @@ static void xen_write_msr(unsigned int msr, unsigned low, unsigned high) | |||
957 | 955 | ||
958 | void xen_setup_shared_info(void) | 956 | void xen_setup_shared_info(void) |
959 | { | 957 | { |
960 | if (!xen_feature(XENFEAT_auto_translated_physmap)) { | 958 | set_fixmap(FIX_PARAVIRT_BOOTMAP, xen_start_info->shared_info); |
961 | set_fixmap(FIX_PARAVIRT_BOOTMAP, | ||
962 | xen_start_info->shared_info); | ||
963 | 959 | ||
964 | HYPERVISOR_shared_info = | 960 | HYPERVISOR_shared_info = |
965 | (struct shared_info *)fix_to_virt(FIX_PARAVIRT_BOOTMAP); | 961 | (struct shared_info *)fix_to_virt(FIX_PARAVIRT_BOOTMAP); |
966 | } else | ||
967 | HYPERVISOR_shared_info = | ||
968 | (struct shared_info *)__va(xen_start_info->shared_info); | ||
969 | 962 | ||
970 | #ifndef CONFIG_SMP | 963 | #ifndef CONFIG_SMP |
971 | /* In UP this is as good a place as any to set up shared info */ | 964 | /* In UP this is as good a place as any to set up shared info */ |
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c index 5e375a5e815f..3be06f3caf3c 100644 --- a/arch/x86/xen/mmu.c +++ b/arch/x86/xen/mmu.c | |||
@@ -42,7 +42,7 @@ xmaddr_t arbitrary_virt_to_machine(void *vaddr) | |||
42 | } | 42 | } |
43 | EXPORT_SYMBOL_GPL(arbitrary_virt_to_machine); | 43 | EXPORT_SYMBOL_GPL(arbitrary_virt_to_machine); |
44 | 44 | ||
45 | void xen_flush_tlb_all(void) | 45 | static void xen_flush_tlb_all(void) |
46 | { | 46 | { |
47 | struct mmuext_op *op; | 47 | struct mmuext_op *op; |
48 | struct multicall_space mcs; | 48 | struct multicall_space mcs; |
diff --git a/arch/x86/xen/mmu_pv.c b/arch/x86/xen/mmu_pv.c index 7397d8b8459d..1f386d7fdf70 100644 --- a/arch/x86/xen/mmu_pv.c +++ b/arch/x86/xen/mmu_pv.c | |||
@@ -355,10 +355,8 @@ static pteval_t pte_pfn_to_mfn(pteval_t val) | |||
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, | |||
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) | |||
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) | |||
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) | |||
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) | |||
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) | |||
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) | |||
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, | |||
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) | |||
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 | ||
diff --git a/net/9p/trans_xen.c b/net/9p/trans_xen.c index 71e85643b3f9..6ad3e043c617 100644 --- a/net/9p/trans_xen.c +++ b/net/9p/trans_xen.c | |||
@@ -454,8 +454,8 @@ static int xen_9pfs_front_probe(struct xenbus_device *dev, | |||
454 | goto error_xenbus; | 454 | goto error_xenbus; |
455 | } | 455 | } |
456 | priv->tag = xenbus_read(xbt, dev->nodename, "tag", NULL); | 456 | priv->tag = xenbus_read(xbt, dev->nodename, "tag", NULL); |
457 | if (!priv->tag) { | 457 | if (IS_ERR(priv->tag)) { |
458 | ret = -EINVAL; | 458 | ret = PTR_ERR(priv->tag); |
459 | goto error_xenbus; | 459 | goto error_xenbus; |
460 | } | 460 | } |
461 | ret = xenbus_transaction_end(xbt, 0); | 461 | ret = xenbus_transaction_end(xbt, 0); |
@@ -525,7 +525,7 @@ static struct xenbus_driver xen_9pfs_front_driver = { | |||
525 | .otherend_changed = xen_9pfs_front_changed, | 525 | .otherend_changed = xen_9pfs_front_changed, |
526 | }; | 526 | }; |
527 | 527 | ||
528 | int p9_trans_xen_init(void) | 528 | static int p9_trans_xen_init(void) |
529 | { | 529 | { |
530 | if (!xen_domain()) | 530 | if (!xen_domain()) |
531 | return -ENODEV; | 531 | return -ENODEV; |
@@ -537,7 +537,7 @@ int p9_trans_xen_init(void) | |||
537 | } | 537 | } |
538 | module_init(p9_trans_xen_init); | 538 | module_init(p9_trans_xen_init); |
539 | 539 | ||
540 | void p9_trans_xen_exit(void) | 540 | static void p9_trans_xen_exit(void) |
541 | { | 541 | { |
542 | v9fs_unregister_trans(&p9_xen_trans); | 542 | v9fs_unregister_trans(&p9_xen_trans); |
543 | return xenbus_unregister_driver(&xen_9pfs_front_driver); | 543 | return xenbus_unregister_driver(&xen_9pfs_front_driver); |