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 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux

Pull arm64 fixes from Catalin Marinas:

- Fix size alignment in __iommu_{alloc,free}_attrs

- Kernel memory mapping fix with CONFIG_DEBUG_RODATA for page sizes
other than 4KB and a fix of the mark_rodata_ro permissions

- dma_get_ops() simplification and behaviour alignment between DT and
ACPI

- function_graph trace fix for cpu_suspend() (CPUs returning from deep
sleep via a different path and confusing the tracer)

- Use of non-global mappings for UEFI run-time services to avoid a
(potentially theoretical) TLB conflict

- Crypto priority reduction of core AES cipher (the accelerated
asynchronous implementation is preferred when available)

- Reverting an old commit that removed BogoMIPS from /proc/cpuinfo on
arm64. Apparently, we had it for a relatively short time and libvirt
started checking for its presence

- Compiler warnings fixed (ptrace.h inclusion from compat.h,
smp_load_acquire with const argument)

* tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
arm64: restore bogomips information in /proc/cpuinfo
arm64: barriers: fix smp_load_acquire to work with const arguments
arm64: Fix R/O permissions in mark_rodata_ro
arm64: crypto: reduce priority of core AES cipher
arm64: use non-global mappings for UEFI runtime regions
arm64: kernel: pause/unpause function graph tracer in cpu_suspend()
arm64: do not include ptrace.h from compat.h
arm64: simplify dma_get_ops
arm64: mm: use correct mapping granularity under DEBUG_RODATA
arm64/dma-mapping: Fix sizes in __iommu_{alloc,free}_attrs

+61 -54
+1 -1
arch/arm64/crypto/aes-ce-cipher.c
··· 237 237 static struct crypto_alg aes_alg = { 238 238 .cra_name = "aes", 239 239 .cra_driver_name = "aes-ce", 240 - .cra_priority = 300, 240 + .cra_priority = 250, 241 241 .cra_flags = CRYPTO_ALG_TYPE_CIPHER, 242 242 .cra_blocksize = AES_BLOCK_SIZE, 243 243 .cra_ctxsize = sizeof(struct crypto_aes_ctx),
+10 -6
arch/arm64/include/asm/barrier.h
··· 64 64 65 65 #define smp_load_acquire(p) \ 66 66 ({ \ 67 - typeof(*p) ___p1; \ 67 + union { typeof(*p) __val; char __c[1]; } __u; \ 68 68 compiletime_assert_atomic_type(*p); \ 69 69 switch (sizeof(*p)) { \ 70 70 case 1: \ 71 71 asm volatile ("ldarb %w0, %1" \ 72 - : "=r" (___p1) : "Q" (*p) : "memory"); \ 72 + : "=r" (*(__u8 *)__u.__c) \ 73 + : "Q" (*p) : "memory"); \ 73 74 break; \ 74 75 case 2: \ 75 76 asm volatile ("ldarh %w0, %1" \ 76 - : "=r" (___p1) : "Q" (*p) : "memory"); \ 77 + : "=r" (*(__u16 *)__u.__c) \ 78 + : "Q" (*p) : "memory"); \ 77 79 break; \ 78 80 case 4: \ 79 81 asm volatile ("ldar %w0, %1" \ 80 - : "=r" (___p1) : "Q" (*p) : "memory"); \ 82 + : "=r" (*(__u32 *)__u.__c) \ 83 + : "Q" (*p) : "memory"); \ 81 84 break; \ 82 85 case 8: \ 83 86 asm volatile ("ldar %0, %1" \ 84 - : "=r" (___p1) : "Q" (*p) : "memory"); \ 87 + : "=r" (*(__u64 *)__u.__c) \ 88 + : "Q" (*p) : "memory"); \ 85 89 break; \ 86 90 } \ 87 - ___p1; \ 91 + __u.__val; \ 88 92 }) 89 93 90 94 #define read_barrier_depends() do { } while(0)
+1 -2
arch/arm64/include/asm/compat.h
··· 23 23 */ 24 24 #include <linux/types.h> 25 25 #include <linux/sched.h> 26 - #include <linux/ptrace.h> 27 26 28 27 #define COMPAT_USER_HZ 100 29 28 #ifdef __AARCH64EB__ ··· 233 234 return (u32)(unsigned long)uptr; 234 235 } 235 236 236 - #define compat_user_stack_pointer() (user_stack_pointer(current_pt_regs())) 237 + #define compat_user_stack_pointer() (user_stack_pointer(task_pt_regs(current))) 237 238 238 239 static inline void __user *arch_compat_alloc_user_space(long len) 239 240 {
+3 -10
arch/arm64/include/asm/dma-mapping.h
··· 18 18 19 19 #ifdef __KERNEL__ 20 20 21 - #include <linux/acpi.h> 22 21 #include <linux/types.h> 23 22 #include <linux/vmalloc.h> 24 23 ··· 25 26 #include <asm/xen/hypervisor.h> 26 27 27 28 #define DMA_ERROR_CODE (~(dma_addr_t)0) 28 - extern struct dma_map_ops *dma_ops; 29 29 extern struct dma_map_ops dummy_dma_ops; 30 30 31 31 static inline struct dma_map_ops *__generic_dma_ops(struct device *dev) 32 32 { 33 - if (unlikely(!dev)) 34 - return dma_ops; 35 - else if (dev->archdata.dma_ops) 33 + if (dev && dev->archdata.dma_ops) 36 34 return dev->archdata.dma_ops; 37 - else if (acpi_disabled) 38 - return dma_ops; 39 35 40 36 /* 41 - * When ACPI is enabled, if arch_set_dma_ops is not called, 42 - * we will disable device DMA capability by setting it 43 - * to dummy_dma_ops. 37 + * We expect no ISA devices, and all other DMA masters are expected to 38 + * have someone call arch_setup_dma_ops at device creation time. 44 39 */ 45 40 return &dummy_dma_ops; 46 41 }
+1 -1
arch/arm64/include/asm/mmu_context.h
··· 101 101 #define destroy_context(mm) do { } while(0) 102 102 void check_and_switch_context(struct mm_struct *mm, unsigned int cpu); 103 103 104 - #define init_new_context(tsk,mm) ({ atomic64_set(&mm->context.id, 0); 0; }) 104 + #define init_new_context(tsk,mm) ({ atomic64_set(&(mm)->context.id, 0); 0; }) 105 105 106 106 /* 107 107 * This is called when "tsk" is about to enter lazy TLB mode.
+1
arch/arm64/include/asm/pgtable.h
··· 81 81 82 82 #define PAGE_KERNEL __pgprot(_PAGE_DEFAULT | PTE_PXN | PTE_UXN | PTE_DIRTY | PTE_WRITE) 83 83 #define PAGE_KERNEL_RO __pgprot(_PAGE_DEFAULT | PTE_PXN | PTE_UXN | PTE_DIRTY | PTE_RDONLY) 84 + #define PAGE_KERNEL_ROX __pgprot(_PAGE_DEFAULT | PTE_UXN | PTE_DIRTY | PTE_RDONLY) 84 85 #define PAGE_KERNEL_EXEC __pgprot(_PAGE_DEFAULT | PTE_UXN | PTE_DIRTY | PTE_WRITE) 85 86 #define PAGE_KERNEL_EXEC_CONT __pgprot(_PAGE_DEFAULT | PTE_UXN | PTE_DIRTY | PTE_WRITE | PTE_CONT) 86 87
+5
arch/arm64/kernel/cpuinfo.c
··· 30 30 #include <linux/seq_file.h> 31 31 #include <linux/sched.h> 32 32 #include <linux/smp.h> 33 + #include <linux/delay.h> 33 34 34 35 /* 35 36 * In case the boot CPU is hotpluggable, we record its initial state and ··· 112 111 * "processor". Give glibc what it expects. 113 112 */ 114 113 seq_printf(m, "processor\t: %d\n", i); 114 + 115 + seq_printf(m, "BogoMIPS\t: %lu.%02lu\n", 116 + loops_per_jiffy / (500000UL/HZ), 117 + loops_per_jiffy / (5000UL/HZ) % 100); 115 118 116 119 /* 117 120 * Dump out the common processor features in a single line.
+5 -9
arch/arm64/kernel/efi.c
··· 224 224 { 225 225 efi_memory_desc_t *md; 226 226 227 + init_new_context(NULL, &efi_mm); 228 + 227 229 for_each_efi_memory_desc(&memmap, md) { 228 230 u64 paddr, npages, size; 229 231 pgprot_t prot; ··· 256 254 else 257 255 prot = PAGE_KERNEL; 258 256 259 - create_pgd_mapping(&efi_mm, paddr, md->virt_addr, size, prot); 257 + create_pgd_mapping(&efi_mm, paddr, md->virt_addr, size, 258 + __pgprot(pgprot_val(prot) | PTE_NG)); 260 259 } 261 260 return true; 262 261 } ··· 332 329 333 330 static void efi_set_pgd(struct mm_struct *mm) 334 331 { 335 - if (mm == &init_mm) 336 - cpu_set_reserved_ttbr0(); 337 - else 338 - cpu_switch_mm(mm->pgd, mm); 339 - 340 - local_flush_tlb_all(); 341 - if (icache_is_aivivt()) 342 - __local_flush_icache_all(); 332 + switch_mm(NULL, mm, NULL); 343 333 } 344 334 345 335 void efi_virtmap_load(void)
+10
arch/arm64/kernel/suspend.c
··· 1 + #include <linux/ftrace.h> 1 2 #include <linux/percpu.h> 2 3 #include <linux/slab.h> 3 4 #include <asm/cacheflush.h> ··· 72 71 local_dbg_save(flags); 73 72 74 73 /* 74 + * Function graph tracer state gets incosistent when the kernel 75 + * calls functions that never return (aka suspend finishers) hence 76 + * disable graph tracing during their execution. 77 + */ 78 + pause_graph_tracing(); 79 + 80 + /* 75 81 * mm context saved on the stack, it will be restored when 76 82 * the cpu comes out of reset through the identity mapped 77 83 * page tables, so that the thread address space is properly ··· 118 110 if (hw_breakpoint_restore) 119 111 hw_breakpoint_restore(NULL); 120 112 } 113 + 114 + unpause_graph_tracing(); 121 115 122 116 /* 123 117 * Restore pstate flags. OS lock and mdscr have been already
+17 -18
arch/arm64/mm/dma-mapping.c
··· 18 18 */ 19 19 20 20 #include <linux/gfp.h> 21 + #include <linux/acpi.h> 21 22 #include <linux/export.h> 22 23 #include <linux/slab.h> 23 24 #include <linux/genalloc.h> ··· 28 27 #include <linux/swiotlb.h> 29 28 30 29 #include <asm/cacheflush.h> 31 - 32 - struct dma_map_ops *dma_ops; 33 - EXPORT_SYMBOL(dma_ops); 34 30 35 31 static pgprot_t __get_dma_pgprot(struct dma_attrs *attrs, pgprot_t prot, 36 32 bool coherent) ··· 513 515 514 516 static int __init arm64_dma_init(void) 515 517 { 516 - int ret; 517 - 518 - dma_ops = &swiotlb_dma_ops; 519 - 520 - ret = atomic_pool_init(); 521 - 522 - return ret; 518 + return atomic_pool_init(); 523 519 } 524 520 arch_initcall(arm64_dma_init); 525 521 ··· 544 552 { 545 553 bool coherent = is_device_dma_coherent(dev); 546 554 int ioprot = dma_direction_to_prot(DMA_BIDIRECTIONAL, coherent); 555 + size_t iosize = size; 547 556 void *addr; 548 557 549 558 if (WARN(!dev, "cannot create IOMMU mapping for unknown device\n")) 550 559 return NULL; 560 + 561 + size = PAGE_ALIGN(size); 562 + 551 563 /* 552 564 * Some drivers rely on this, and we probably don't want the 553 565 * possibility of stale kernel data being read by devices anyway. ··· 562 566 struct page **pages; 563 567 pgprot_t prot = __get_dma_pgprot(attrs, PAGE_KERNEL, coherent); 564 568 565 - pages = iommu_dma_alloc(dev, size, gfp, ioprot, handle, 569 + pages = iommu_dma_alloc(dev, iosize, gfp, ioprot, handle, 566 570 flush_page); 567 571 if (!pages) 568 572 return NULL; ··· 570 574 addr = dma_common_pages_remap(pages, size, VM_USERMAP, prot, 571 575 __builtin_return_address(0)); 572 576 if (!addr) 573 - iommu_dma_free(dev, pages, size, handle); 577 + iommu_dma_free(dev, pages, iosize, handle); 574 578 } else { 575 579 struct page *page; 576 580 /* ··· 587 591 if (!addr) 588 592 return NULL; 589 593 590 - *handle = iommu_dma_map_page(dev, page, 0, size, ioprot); 594 + *handle = iommu_dma_map_page(dev, page, 0, iosize, ioprot); 591 595 if (iommu_dma_mapping_error(dev, *handle)) { 592 596 if (coherent) 593 597 __free_pages(page, get_order(size)); ··· 602 606 static void __iommu_free_attrs(struct device *dev, size_t size, void *cpu_addr, 603 607 dma_addr_t handle, struct dma_attrs *attrs) 604 608 { 609 + size_t iosize = size; 610 + 611 + size = PAGE_ALIGN(size); 605 612 /* 606 613 * @cpu_addr will be one of 3 things depending on how it was allocated: 607 614 * - A remapped array of pages from iommu_dma_alloc(), for all ··· 616 617 * Hence how dodgy the below logic looks... 617 618 */ 618 619 if (__in_atomic_pool(cpu_addr, size)) { 619 - iommu_dma_unmap_page(dev, handle, size, 0, NULL); 620 + iommu_dma_unmap_page(dev, handle, iosize, 0, NULL); 620 621 __free_from_pool(cpu_addr, size); 621 622 } else if (is_vmalloc_addr(cpu_addr)){ 622 623 struct vm_struct *area = find_vm_area(cpu_addr); 623 624 624 625 if (WARN_ON(!area || !area->pages)) 625 626 return; 626 - iommu_dma_free(dev, area->pages, size, &handle); 627 + iommu_dma_free(dev, area->pages, iosize, &handle); 627 628 dma_common_free_remap(cpu_addr, size, VM_USERMAP); 628 629 } else { 629 - iommu_dma_unmap_page(dev, handle, size, 0, NULL); 630 + iommu_dma_unmap_page(dev, handle, iosize, 0, NULL); 630 631 __free_pages(virt_to_page(cpu_addr), get_order(size)); 631 632 } 632 633 } ··· 983 984 void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, 984 985 struct iommu_ops *iommu, bool coherent) 985 986 { 986 - if (!acpi_disabled && !dev->archdata.dma_ops) 987 - dev->archdata.dma_ops = dma_ops; 987 + if (!dev->archdata.dma_ops) 988 + dev->archdata.dma_ops = &swiotlb_dma_ops; 988 989 989 990 dev->archdata.dma_coherent = coherent; 990 991 __iommu_setup_dma_ops(dev, dma_base, size, iommu);
+7 -7
arch/arm64/mm/mmu.c
··· 362 362 * for now. This will get more fine grained later once all memory 363 363 * is mapped 364 364 */ 365 - unsigned long kernel_x_start = round_down(__pa(_stext), SECTION_SIZE); 366 - unsigned long kernel_x_end = round_up(__pa(__init_end), SECTION_SIZE); 365 + unsigned long kernel_x_start = round_down(__pa(_stext), SWAPPER_BLOCK_SIZE); 366 + unsigned long kernel_x_end = round_up(__pa(__init_end), SWAPPER_BLOCK_SIZE); 367 367 368 368 if (end < kernel_x_start) { 369 369 create_mapping(start, __phys_to_virt(start), ··· 451 451 { 452 452 #ifdef CONFIG_DEBUG_RODATA 453 453 /* now that we are actually fully mapped, make the start/end more fine grained */ 454 - if (!IS_ALIGNED((unsigned long)_stext, SECTION_SIZE)) { 454 + if (!IS_ALIGNED((unsigned long)_stext, SWAPPER_BLOCK_SIZE)) { 455 455 unsigned long aligned_start = round_down(__pa(_stext), 456 - SECTION_SIZE); 456 + SWAPPER_BLOCK_SIZE); 457 457 458 458 create_mapping(aligned_start, __phys_to_virt(aligned_start), 459 459 __pa(_stext) - aligned_start, 460 460 PAGE_KERNEL); 461 461 } 462 462 463 - if (!IS_ALIGNED((unsigned long)__init_end, SECTION_SIZE)) { 463 + if (!IS_ALIGNED((unsigned long)__init_end, SWAPPER_BLOCK_SIZE)) { 464 464 unsigned long aligned_end = round_up(__pa(__init_end), 465 - SECTION_SIZE); 465 + SWAPPER_BLOCK_SIZE); 466 466 create_mapping(__pa(__init_end), (unsigned long)__init_end, 467 467 aligned_end - __pa(__init_end), 468 468 PAGE_KERNEL); ··· 475 475 { 476 476 create_mapping_late(__pa(_stext), (unsigned long)_stext, 477 477 (unsigned long)_etext - (unsigned long)_stext, 478 - PAGE_KERNEL_EXEC | PTE_RDONLY); 478 + PAGE_KERNEL_ROX); 479 479 480 480 } 481 481 #endif