Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'for-linus-6.12-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip

Pull xen updates from Juergen Gross:

- fix a boot problem as a Xen dom0 on some AMD systems

- fix Xen PVH boot problems with KASAN enabled

- fix for a build warning

- fixes to swiotlb-xen

* tag 'for-linus-6.12-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
xen/swiotlb: fix allocated size
xen/swiotlb: add alignment check for dma buffers
xen/pci: Avoid -Wflex-array-member-not-at-end warning
xen/xenbus: Convert to use ERR_CAST()
xen, pvh: fix unbootable VMs by inlining memset() in xen_prepare_pvh()
x86/cpu: fix unbootable VMs by inlining memcmp() in hypervisor_cpuid_base()
xen, pvh: fix unbootable VMs (PVH + KASAN - AMD_MEM_ENCRYPT)
xen: tolerate ACPI NVS memory overlapping with Xen allocated memory
xen: allow mapping ACPI data using a different physical address
xen: add capability to remap non-RAM pages to different PFNs
xen: move max_pfn in xen_memory_setup() out of function scope
xen: move checks for e820 conflicts further up
xen: introduce generic helper checking for memory map conflicts
xen: use correct end address of kernel for conflict checking

+312 -66
+8
arch/x86/include/asm/acpi.h
··· 174 174 void x86_default_set_root_pointer(u64 addr); 175 175 u64 x86_default_get_root_pointer(void); 176 176 177 + #ifdef CONFIG_XEN_PV 178 + /* A Xen PV domain needs a special acpi_os_ioremap() handling. */ 179 + extern void __iomem * (*acpi_os_ioremap)(acpi_physical_address phys, 180 + acpi_size size); 181 + void __iomem *x86_acpi_os_ioremap(acpi_physical_address phys, acpi_size size); 182 + #define acpi_os_ioremap acpi_os_ioremap 183 + #endif 184 + 177 185 #else /* !CONFIG_ACPI */ 178 186 179 187 #define acpi_lapic 0
+6 -1
arch/x86/include/asm/cpuid.h
··· 196 196 for_each_possible_hypervisor_cpuid_base(base) { 197 197 cpuid(base, &eax, &signature[0], &signature[1], &signature[2]); 198 198 199 - if (!memcmp(sig, signature, 12) && 199 + /* 200 + * This must not compile to "call memcmp" because it's called 201 + * from PVH early boot code before instrumentation is set up 202 + * and memcmp() itself may be instrumented. 203 + */ 204 + if (!__builtin_memcmp(sig, signature, 12) && 200 205 (leaves == 0 || ((eax - base) >= leaves))) 201 206 return base; 202 207 }
+11
arch/x86/kernel/acpi/boot.c
··· 1778 1778 { 1779 1779 return boot_params.acpi_rsdp_addr; 1780 1780 } 1781 + 1782 + #ifdef CONFIG_XEN_PV 1783 + void __iomem *x86_acpi_os_ioremap(acpi_physical_address phys, acpi_size size) 1784 + { 1785 + return ioremap_cache(phys, size); 1786 + } 1787 + 1788 + void __iomem * (*acpi_os_ioremap)(acpi_physical_address phys, acpi_size size) = 1789 + x86_acpi_os_ioremap; 1790 + EXPORT_SYMBOL_GPL(acpi_os_ioremap); 1791 + #endif
+1
arch/x86/kernel/jailhouse.c
··· 12 12 #include <linux/kernel.h> 13 13 #include <linux/reboot.h> 14 14 #include <linux/serial_8250.h> 15 + #include <linux/acpi.h> 15 16 #include <asm/apic.h> 16 17 #include <asm/io_apic.h> 17 18 #include <asm/acpi.h>
+1
arch/x86/kernel/mmconf-fam10h_64.c
··· 9 9 #include <linux/pci.h> 10 10 #include <linux/dmi.h> 11 11 #include <linux/range.h> 12 + #include <linux/acpi.h> 12 13 13 14 #include <asm/pci-direct.h> 14 15 #include <linux/sort.h>
+1
arch/x86/kernel/smpboot.c
··· 60 60 #include <linux/stackprotector.h> 61 61 #include <linux/cpuhotplug.h> 62 62 #include <linux/mc146818rtc.h> 63 + #include <linux/acpi.h> 63 64 64 65 #include <asm/acpi.h> 65 66 #include <asm/cacheinfo.h>
+1
arch/x86/kernel/x86_init.c
··· 8 8 #include <linux/ioport.h> 9 9 #include <linux/export.h> 10 10 #include <linux/pci.h> 11 + #include <linux/acpi.h> 11 12 12 13 #include <asm/acpi.h> 13 14 #include <asm/bios_ebda.h>
+1
arch/x86/platform/pvh/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 OBJECT_FILES_NON_STANDARD_head.o := y 3 + KASAN_SANITIZE := n 3 4 4 5 obj-$(CONFIG_PVH) += enlighten.o 5 6 obj-$(CONFIG_PVH) += head.o
+5 -1
arch/x86/platform/pvh/enlighten.c
··· 130 130 BUG(); 131 131 } 132 132 133 - memset(&pvh_bootparams, 0, sizeof(pvh_bootparams)); 133 + /* 134 + * This must not compile to "call memset" because memset() may be 135 + * instrumented. 136 + */ 137 + __builtin_memset(&pvh_bootparams, 0, sizeof(pvh_bootparams)); 134 138 135 139 hypervisor_specific_init(xen_guest); 136 140
+1 -4
arch/x86/xen/mmu_pv.c
··· 2018 2018 2019 2019 void __init xen_pt_check_e820(void) 2020 2020 { 2021 - if (xen_is_e820_reserved(xen_pt_base, xen_pt_size)) { 2022 - xen_raw_console_write("Xen hypervisor allocated page table memory conflicts with E820 map\n"); 2023 - BUG(); 2024 - } 2021 + xen_chk_is_e820_usable(xen_pt_base, xen_pt_size, "page table"); 2025 2022 } 2026 2023 2027 2024 static unsigned char dummy_mapping[PAGE_SIZE] __page_aligned_bss;
+98
arch/x86/xen/p2m.c
··· 70 70 #include <linux/memblock.h> 71 71 #include <linux/slab.h> 72 72 #include <linux/vmalloc.h> 73 + #include <linux/acpi.h> 73 74 74 75 #include <asm/cache.h> 75 76 #include <asm/setup.h> ··· 81 80 #include <asm/xen/hypervisor.h> 82 81 #include <xen/balloon.h> 83 82 #include <xen/grant_table.h> 83 + #include <xen/hvc-console.h> 84 84 85 85 #include "xen-ops.h" 86 86 ··· 792 790 kunmap_ops, count) ?: ret; 793 791 794 792 return ret; 793 + } 794 + 795 + /* Remapped non-RAM areas */ 796 + #define NR_NONRAM_REMAP 4 797 + static struct nonram_remap { 798 + phys_addr_t maddr; 799 + phys_addr_t paddr; 800 + size_t size; 801 + } xen_nonram_remap[NR_NONRAM_REMAP] __ro_after_init; 802 + static unsigned int nr_nonram_remap __ro_after_init; 803 + 804 + /* 805 + * Do the real remapping of non-RAM regions as specified in the 806 + * xen_nonram_remap[] array. 807 + * In case of an error just crash the system. 808 + */ 809 + void __init xen_do_remap_nonram(void) 810 + { 811 + unsigned int i; 812 + unsigned int remapped = 0; 813 + const struct nonram_remap *remap = xen_nonram_remap; 814 + unsigned long pfn, mfn, end_pfn; 815 + 816 + for (i = 0; i < nr_nonram_remap; i++) { 817 + end_pfn = PFN_UP(remap->paddr + remap->size); 818 + pfn = PFN_DOWN(remap->paddr); 819 + mfn = PFN_DOWN(remap->maddr); 820 + while (pfn < end_pfn) { 821 + if (!set_phys_to_machine(pfn, mfn)) 822 + panic("Failed to set p2m mapping for pfn=%lx mfn=%lx\n", 823 + pfn, mfn); 824 + 825 + pfn++; 826 + mfn++; 827 + remapped++; 828 + } 829 + 830 + remap++; 831 + } 832 + 833 + pr_info("Remapped %u non-RAM page(s)\n", remapped); 834 + } 835 + 836 + #ifdef CONFIG_ACPI 837 + /* 838 + * Xen variant of acpi_os_ioremap() taking potentially remapped non-RAM 839 + * regions into account. 840 + * Any attempt to map an area crossing a remap boundary will produce a 841 + * WARN() splat. 842 + * phys is related to remap->maddr on input and will be rebased to remap->paddr. 843 + */ 844 + static void __iomem *xen_acpi_os_ioremap(acpi_physical_address phys, 845 + acpi_size size) 846 + { 847 + unsigned int i; 848 + const struct nonram_remap *remap = xen_nonram_remap; 849 + 850 + for (i = 0; i < nr_nonram_remap; i++) { 851 + if (phys + size > remap->maddr && 852 + phys < remap->maddr + remap->size) { 853 + WARN_ON(phys < remap->maddr || 854 + phys + size > remap->maddr + remap->size); 855 + phys += remap->paddr - remap->maddr; 856 + break; 857 + } 858 + } 859 + 860 + return x86_acpi_os_ioremap(phys, size); 861 + } 862 + #endif /* CONFIG_ACPI */ 863 + 864 + /* 865 + * Add a new non-RAM remap entry. 866 + * In case of no free entry found, just crash the system. 867 + */ 868 + void __init xen_add_remap_nonram(phys_addr_t maddr, phys_addr_t paddr, 869 + unsigned long size) 870 + { 871 + BUG_ON((maddr & ~PAGE_MASK) != (paddr & ~PAGE_MASK)); 872 + 873 + if (nr_nonram_remap == NR_NONRAM_REMAP) { 874 + xen_raw_console_write("Number of required E820 entry remapping actions exceed maximum value\n"); 875 + BUG(); 876 + } 877 + 878 + #ifdef CONFIG_ACPI 879 + /* Switch to the Xen acpi_os_ioremap() variant. */ 880 + if (nr_nonram_remap == 0) 881 + acpi_os_ioremap = xen_acpi_os_ioremap; 882 + #endif 883 + 884 + xen_nonram_remap[nr_nonram_remap].maddr = maddr; 885 + xen_nonram_remap[nr_nonram_remap].paddr = paddr; 886 + xen_nonram_remap[nr_nonram_remap].size = size; 887 + 888 + nr_nonram_remap++; 795 889 } 796 890 797 891 #ifdef CONFIG_XEN_DEBUG_FS
+157 -45
arch/x86/xen/setup.c
··· 15 15 #include <linux/cpuidle.h> 16 16 #include <linux/cpufreq.h> 17 17 #include <linux/memory_hotplug.h> 18 + #include <linux/acpi.h> 18 19 19 20 #include <asm/elf.h> 20 21 #include <asm/vdso.h> 21 22 #include <asm/e820/api.h> 22 23 #include <asm/setup.h> 23 - #include <asm/acpi.h> 24 24 #include <asm/numa.h> 25 25 #include <asm/idtentry.h> 26 26 #include <asm/xen/hypervisor.h> ··· 45 45 46 46 /* E820 map used during setting up memory. */ 47 47 static struct e820_table xen_e820_table __initdata; 48 + 49 + /* Number of initially usable memory pages. */ 50 + static unsigned long ini_nr_pages __initdata; 48 51 49 52 /* 50 53 * Buffer used to remap identity mapped pages. We only need the virtual space. ··· 215 212 * as a fallback if the remapping fails. 216 213 */ 217 214 static void __init xen_set_identity_and_release_chunk(unsigned long start_pfn, 218 - unsigned long end_pfn, unsigned long nr_pages) 215 + unsigned long end_pfn) 219 216 { 220 217 unsigned long pfn, end; 221 218 int ret; ··· 223 220 WARN_ON(start_pfn > end_pfn); 224 221 225 222 /* Release pages first. */ 226 - end = min(end_pfn, nr_pages); 223 + end = min(end_pfn, ini_nr_pages); 227 224 for (pfn = start_pfn; pfn < end; pfn++) { 228 225 unsigned long mfn = pfn_to_mfn(pfn); 229 226 ··· 344 341 * to Xen and not remapped. 345 342 */ 346 343 static unsigned long __init xen_set_identity_and_remap_chunk( 347 - unsigned long start_pfn, unsigned long end_pfn, unsigned long nr_pages, 348 - unsigned long remap_pfn) 344 + unsigned long start_pfn, unsigned long end_pfn, unsigned long remap_pfn) 349 345 { 350 346 unsigned long pfn; 351 347 unsigned long i = 0; 352 348 unsigned long n = end_pfn - start_pfn; 353 349 354 350 if (remap_pfn == 0) 355 - remap_pfn = nr_pages; 351 + remap_pfn = ini_nr_pages; 356 352 357 353 while (i < n) { 358 354 unsigned long cur_pfn = start_pfn + i; ··· 360 358 unsigned long remap_range_size; 361 359 362 360 /* Do not remap pages beyond the current allocation */ 363 - if (cur_pfn >= nr_pages) { 361 + if (cur_pfn >= ini_nr_pages) { 364 362 /* Identity map remaining pages */ 365 363 set_phys_range_identity(cur_pfn, cur_pfn + size); 366 364 break; 367 365 } 368 - if (cur_pfn + size > nr_pages) 369 - size = nr_pages - cur_pfn; 366 + if (cur_pfn + size > ini_nr_pages) 367 + size = ini_nr_pages - cur_pfn; 370 368 371 369 remap_range_size = xen_find_pfn_range(&remap_pfn); 372 370 if (!remap_range_size) { 373 371 pr_warn("Unable to find available pfn range, not remapping identity pages\n"); 374 372 xen_set_identity_and_release_chunk(cur_pfn, 375 - cur_pfn + left, nr_pages); 373 + cur_pfn + left); 376 374 break; 377 375 } 378 376 /* Adjust size to fit in current e820 RAM region */ ··· 399 397 } 400 398 401 399 static unsigned long __init xen_count_remap_pages( 402 - unsigned long start_pfn, unsigned long end_pfn, unsigned long nr_pages, 400 + unsigned long start_pfn, unsigned long end_pfn, 403 401 unsigned long remap_pages) 404 402 { 405 - if (start_pfn >= nr_pages) 403 + if (start_pfn >= ini_nr_pages) 406 404 return remap_pages; 407 405 408 - return remap_pages + min(end_pfn, nr_pages) - start_pfn; 406 + return remap_pages + min(end_pfn, ini_nr_pages) - start_pfn; 409 407 } 410 408 411 - static unsigned long __init xen_foreach_remap_area(unsigned long nr_pages, 409 + static unsigned long __init xen_foreach_remap_area( 412 410 unsigned long (*func)(unsigned long start_pfn, unsigned long end_pfn, 413 - unsigned long nr_pages, unsigned long last_val)) 411 + unsigned long last_val)) 414 412 { 415 413 phys_addr_t start = 0; 416 414 unsigned long ret_val = 0; ··· 438 436 end_pfn = PFN_UP(entry->addr); 439 437 440 438 if (start_pfn < end_pfn) 441 - ret_val = func(start_pfn, end_pfn, nr_pages, 442 - ret_val); 439 + ret_val = func(start_pfn, end_pfn, ret_val); 443 440 start = end; 444 441 } 445 442 } ··· 495 494 set_pte_mfn(buf, mfn_save, PAGE_KERNEL); 496 495 497 496 pr_info("Remapped %ld page(s)\n", remapped); 497 + 498 + xen_do_remap_nonram(); 498 499 } 499 500 500 501 static unsigned long __init xen_get_pages_limit(void) ··· 570 567 } 571 568 } 572 569 573 - bool __init xen_is_e820_reserved(phys_addr_t start, phys_addr_t size) 570 + static bool __init xen_is_e820_reserved(phys_addr_t start, phys_addr_t size) 574 571 { 575 572 struct e820_entry *entry; 576 573 unsigned mapcnt; ··· 625 622 } 626 623 627 624 return 0; 625 + } 626 + 627 + /* 628 + * Swap a non-RAM E820 map entry with RAM above ini_nr_pages. 629 + * Note that the E820 map is modified accordingly, but the P2M map isn't yet. 630 + * The adaption of the P2M must be deferred until page allocation is possible. 631 + */ 632 + static void __init xen_e820_swap_entry_with_ram(struct e820_entry *swap_entry) 633 + { 634 + struct e820_entry *entry; 635 + unsigned int mapcnt; 636 + phys_addr_t mem_end = PFN_PHYS(ini_nr_pages); 637 + phys_addr_t swap_addr, swap_size, entry_end; 638 + 639 + swap_addr = PAGE_ALIGN_DOWN(swap_entry->addr); 640 + swap_size = PAGE_ALIGN(swap_entry->addr - swap_addr + swap_entry->size); 641 + entry = xen_e820_table.entries; 642 + 643 + for (mapcnt = 0; mapcnt < xen_e820_table.nr_entries; mapcnt++) { 644 + entry_end = entry->addr + entry->size; 645 + if (entry->type == E820_TYPE_RAM && entry->size >= swap_size && 646 + entry_end - swap_size >= mem_end) { 647 + /* Reduce RAM entry by needed space (whole pages). */ 648 + entry->size -= swap_size; 649 + 650 + /* Add new entry at the end of E820 map. */ 651 + entry = xen_e820_table.entries + 652 + xen_e820_table.nr_entries; 653 + xen_e820_table.nr_entries++; 654 + 655 + /* Fill new entry (keep size and page offset). */ 656 + entry->type = swap_entry->type; 657 + entry->addr = entry_end - swap_size + 658 + swap_addr - swap_entry->addr; 659 + entry->size = swap_entry->size; 660 + 661 + /* Convert old entry to RAM, align to pages. */ 662 + swap_entry->type = E820_TYPE_RAM; 663 + swap_entry->addr = swap_addr; 664 + swap_entry->size = swap_size; 665 + 666 + /* Remember PFN<->MFN relation for P2M update. */ 667 + xen_add_remap_nonram(swap_addr, entry_end - swap_size, 668 + swap_size); 669 + 670 + /* Order E820 table and merge entries. */ 671 + e820__update_table(&xen_e820_table); 672 + 673 + return; 674 + } 675 + 676 + entry++; 677 + } 678 + 679 + xen_raw_console_write("No suitable area found for required E820 entry remapping action\n"); 680 + BUG(); 681 + } 682 + 683 + /* 684 + * Look for non-RAM memory types in a specific guest physical area and move 685 + * those away if possible (ACPI NVS only for now). 686 + */ 687 + static void __init xen_e820_resolve_conflicts(phys_addr_t start, 688 + phys_addr_t size) 689 + { 690 + struct e820_entry *entry; 691 + unsigned int mapcnt; 692 + phys_addr_t end; 693 + 694 + if (!size) 695 + return; 696 + 697 + end = start + size; 698 + entry = xen_e820_table.entries; 699 + 700 + for (mapcnt = 0; mapcnt < xen_e820_table.nr_entries; mapcnt++) { 701 + if (entry->addr >= end) 702 + return; 703 + 704 + if (entry->addr + entry->size > start && 705 + entry->type == E820_TYPE_NVS) 706 + xen_e820_swap_entry_with_ram(entry); 707 + 708 + entry++; 709 + } 710 + } 711 + 712 + /* 713 + * Check for an area in physical memory to be usable for non-movable purposes. 714 + * An area is considered to usable if the used E820 map lists it to be RAM or 715 + * some other type which can be moved to higher PFNs while keeping the MFNs. 716 + * In case the area is not usable, crash the system with an error message. 717 + */ 718 + void __init xen_chk_is_e820_usable(phys_addr_t start, phys_addr_t size, 719 + const char *component) 720 + { 721 + xen_e820_resolve_conflicts(start, size); 722 + 723 + if (!xen_is_e820_reserved(start, size)) 724 + return; 725 + 726 + xen_raw_console_write("Xen hypervisor allocated "); 727 + xen_raw_console_write(component); 728 + xen_raw_console_write(" memory conflicts with E820 map\n"); 729 + BUG(); 628 730 } 629 731 630 732 /* ··· 791 683 **/ 792 684 char * __init xen_memory_setup(void) 793 685 { 794 - unsigned long max_pfn, pfn_s, n_pfns; 686 + unsigned long pfn_s, n_pfns; 795 687 phys_addr_t mem_end, addr, size, chunk_size; 796 688 u32 type; 797 689 int rc; ··· 803 695 int op; 804 696 805 697 xen_parse_512gb(); 806 - max_pfn = xen_get_pages_limit(); 807 - max_pfn = min(max_pfn, xen_start_info->nr_pages); 808 - mem_end = PFN_PHYS(max_pfn); 698 + ini_nr_pages = min(xen_get_pages_limit(), xen_start_info->nr_pages); 699 + mem_end = PFN_PHYS(ini_nr_pages); 809 700 810 701 memmap.nr_entries = ARRAY_SIZE(xen_e820_table.entries); 811 702 set_xen_guest_handle(memmap.buffer, xen_e820_table.entries); ··· 854 747 /* Make sure the Xen-supplied memory map is well-ordered. */ 855 748 e820__update_table(&xen_e820_table); 856 749 750 + /* 751 + * Check whether the kernel itself conflicts with the target E820 map. 752 + * Failing now is better than running into weird problems later due 753 + * to relocating (and even reusing) pages with kernel text or data. 754 + */ 755 + xen_chk_is_e820_usable(__pa_symbol(_text), 756 + __pa_symbol(_end) - __pa_symbol(_text), 757 + "kernel"); 758 + 759 + /* 760 + * Check for a conflict of the xen_start_info memory with the target 761 + * E820 map. 762 + */ 763 + xen_chk_is_e820_usable(__pa(xen_start_info), sizeof(*xen_start_info), 764 + "xen_start_info"); 765 + 766 + /* 767 + * Check for a conflict of the hypervisor supplied page tables with 768 + * the target E820 map. 769 + */ 770 + xen_pt_check_e820(); 771 + 857 772 max_pages = xen_get_max_pages(); 858 773 859 774 /* How many extra pages do we need due to remapping? */ 860 - max_pages += xen_foreach_remap_area(max_pfn, xen_count_remap_pages); 775 + max_pages += xen_foreach_remap_area(xen_count_remap_pages); 861 776 862 - if (max_pages > max_pfn) 863 - extra_pages += max_pages - max_pfn; 777 + if (max_pages > ini_nr_pages) 778 + extra_pages += max_pages - ini_nr_pages; 864 779 865 780 /* 866 781 * Clamp the amount of extra memory to a EXTRA_MEM_RATIO ··· 891 762 * Make sure we have no memory above max_pages, as this area 892 763 * isn't handled by the p2m management. 893 764 */ 894 - maxmem_pages = EXTRA_MEM_RATIO * min(max_pfn, PFN_DOWN(MAXMEM)); 895 - extra_pages = min3(maxmem_pages, extra_pages, max_pages - max_pfn); 765 + maxmem_pages = EXTRA_MEM_RATIO * min(ini_nr_pages, PFN_DOWN(MAXMEM)); 766 + extra_pages = min3(maxmem_pages, extra_pages, max_pages - ini_nr_pages); 896 767 i = 0; 897 768 addr = xen_e820_table.entries[0].addr; 898 769 size = xen_e820_table.entries[0].size; ··· 948 819 949 820 e820__update_table(e820_table); 950 821 951 - /* 952 - * Check whether the kernel itself conflicts with the target E820 map. 953 - * Failing now is better than running into weird problems later due 954 - * to relocating (and even reusing) pages with kernel text or data. 955 - */ 956 - if (xen_is_e820_reserved(__pa_symbol(_text), 957 - __pa_symbol(__bss_stop) - __pa_symbol(_text))) { 958 - xen_raw_console_write("Xen hypervisor allocated kernel memory conflicts with E820 map\n"); 959 - BUG(); 960 - } 961 - 962 - /* 963 - * Check for a conflict of the hypervisor supplied page tables with 964 - * the target E820 map. 965 - */ 966 - xen_pt_check_e820(); 967 - 968 822 xen_reserve_xen_mfnlist(); 969 823 970 824 /* Check for a conflict of the initrd with the target E820 map. */ ··· 975 863 * Set identity map on non-RAM pages and prepare remapping the 976 864 * underlying RAM. 977 865 */ 978 - xen_foreach_remap_area(max_pfn, xen_set_identity_and_remap_chunk); 866 + xen_foreach_remap_area(xen_set_identity_and_remap_chunk); 979 867 980 868 pr_info("Released %ld page(s)\n", xen_released_pages); 981 869
+5 -1
arch/x86/xen/xen-ops.h
··· 47 47 #ifdef CONFIG_X86_64 48 48 void __init xen_relocate_p2m(void); 49 49 #endif 50 + void __init xen_do_remap_nonram(void); 51 + void __init xen_add_remap_nonram(phys_addr_t maddr, phys_addr_t paddr, 52 + unsigned long size); 50 53 51 - bool __init xen_is_e820_reserved(phys_addr_t start, phys_addr_t size); 54 + void __init xen_chk_is_e820_usable(phys_addr_t start, phys_addr_t size, 55 + const char *component); 52 56 unsigned long __ref xen_chk_extra_mem(unsigned long pfn); 53 57 void __init xen_inv_extra_mem(void); 54 58 void __init xen_remap_memory(void);
+5 -9
drivers/xen/pci.c
··· 44 44 } 45 45 #endif 46 46 if (pci_seg_supported) { 47 - struct { 48 - struct physdev_pci_device_add add; 49 - uint32_t pxm; 50 - } add_ext = { 51 - .add.seg = pci_domain_nr(pci_dev->bus), 52 - .add.bus = pci_dev->bus->number, 53 - .add.devfn = pci_dev->devfn 54 - }; 55 - struct physdev_pci_device_add *add = &add_ext.add; 47 + DEFINE_RAW_FLEX(struct physdev_pci_device_add, add, optarr, 1); 48 + 49 + add->seg = pci_domain_nr(pci_dev->bus); 50 + add->bus = pci_dev->bus->number; 51 + add->devfn = pci_dev->devfn; 56 52 57 53 #ifdef CONFIG_ACPI 58 54 acpi_handle handle;
+8 -2
drivers/xen/swiotlb-xen.c
··· 78 78 { 79 79 unsigned long next_bfn, xen_pfn = XEN_PFN_DOWN(p); 80 80 unsigned int i, nr_pages = XEN_PFN_UP(xen_offset_in_page(p) + size); 81 + phys_addr_t algn = 1ULL << (get_order(size) + PAGE_SHIFT); 81 82 82 83 next_bfn = pfn_to_bfn(xen_pfn); 84 + 85 + /* If buffer is physically aligned, ensure DMA alignment. */ 86 + if (IS_ALIGNED(p, algn) && 87 + !IS_ALIGNED((phys_addr_t)next_bfn << XEN_PAGE_SHIFT, algn)) 88 + return 1; 83 89 84 90 for (i = 1; i < nr_pages; i++) 85 91 if (pfn_to_bfn(++xen_pfn) != ++next_bfn) ··· 147 141 void *ret; 148 142 149 143 /* Align the allocation to the Xen page size */ 150 - size = 1UL << (order + XEN_PAGE_SHIFT); 144 + size = ALIGN(size, XEN_PAGE_SIZE); 151 145 152 146 ret = (void *)__get_free_pages(flags, get_order(size)); 153 147 if (!ret) ··· 179 173 int order = get_order(size); 180 174 181 175 /* Convert the size to actually allocated. */ 182 - size = 1UL << (order + XEN_PAGE_SHIFT); 176 + size = ALIGN(size, XEN_PAGE_SIZE); 183 177 184 178 if (WARN_ON_ONCE(dma_handle + size - 1 > dev->coherent_dma_mask) || 185 179 WARN_ON_ONCE(range_straddles_page_boundary(phys, size)))
+3 -3
drivers/xen/xenbus/xenbus_xs.c
··· 427 427 428 428 path = join(dir, node); 429 429 if (IS_ERR(path)) 430 - return (char **)path; 430 + return ERR_CAST(path); 431 431 432 432 strings = xs_single(t, XS_DIRECTORY, path, &len); 433 433 kfree(path); 434 434 if (IS_ERR(strings)) 435 - return (char **)strings; 435 + return ERR_CAST(strings); 436 436 437 437 return split(strings, len, num); 438 438 } ··· 465 465 466 466 path = join(dir, node); 467 467 if (IS_ERR(path)) 468 - return (void *)path; 468 + return ERR_CAST(path); 469 469 470 470 ret = xs_single(t, XS_READ, path, len); 471 471 kfree(path);