]> Git Repo - linux.git/commitdiff
Merge tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64...
authorLinus Torvalds <[email protected]>
Tue, 15 Dec 2020 00:24:30 +0000 (16:24 -0800)
committerLinus Torvalds <[email protected]>
Tue, 15 Dec 2020 00:24:30 +0000 (16:24 -0800)
Pull arm64 updates from Catalin Marinas:

 - Expose tag address bits in siginfo. The original arm64 ABI did not
   expose any of the bits 63:56 of a tagged address in siginfo. In the
   presence of user ASAN or MTE, this information may be useful. The
   implementation is generic to other architectures supporting tags
   (like SPARC ADI, subject to wiring up the arch code). The user will
   have to opt in via sigaction(SA_EXPOSE_TAGBITS) so that the extra
   bits, if available, become visible in si_addr.

 - Default to 32-bit wide ZONE_DMA. Previously, ZONE_DMA was set to the
   lowest 1GB to cope with the Raspberry Pi 4 limitations, to the
   detriment of other platforms. With these changes, the kernel scans
   the Device Tree dma-ranges and the ACPI IORT information before
   deciding on a smaller ZONE_DMA.

 - Strengthen READ_ONCE() to acquire when CONFIG_LTO=y. When building
   with LTO, there is an increased risk of the compiler converting an
   address dependency headed by a READ_ONCE() invocation into a control
   dependency and consequently allowing for harmful reordering by the
   CPU.

 - Add CPPC FFH support using arm64 AMU counters.

 - set_fs() removal on arm64. This renders the User Access Override
   (UAO) ARMv8 feature unnecessary.

 - Perf updates: PMU driver for the ARM DMC-620 memory controller, sysfs
   identifier file for SMMUv3, stop event counters support for i.MX8MP,
   enable the perf events-based hard lockup detector.

 - Reorganise the kernel VA space slightly so that 52-bit VA
   configurations can use more virtual address space.

 - Improve the robustness of the arm64 memory offline event notifier.

 - Pad the Image header to 64K following the EFI header definition
   updated recently to increase the section alignment to 64K.

 - Support CONFIG_CMDLINE_EXTEND on arm64.

 - Do not use tagged PC in the kernel (TCR_EL1.TBID1==1), freeing up 8
   bits for PtrAuth.

 - Switch to vmapped shadow call stacks.

 - Miscellaneous clean-ups.

* tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: (78 commits)
  perf/imx_ddr: Add system PMU identifier for userspace
  bindings: perf: imx-ddr: add compatible string
  arm64: Fix build failure when HARDLOCKUP_DETECTOR_PERF is enabled
  arm64: mte: fix prctl(PR_GET_TAGGED_ADDR_CTRL) if TCF0=NONE
  arm64: mark __system_matches_cap as __maybe_unused
  arm64: uaccess: remove vestigal UAO support
  arm64: uaccess: remove redundant PAN toggling
  arm64: uaccess: remove addr_limit_user_check()
  arm64: uaccess: remove set_fs()
  arm64: uaccess cleanup macro naming
  arm64: uaccess: split user/kernel routines
  arm64: uaccess: refactor __{get,put}_user
  arm64: uaccess: simplify __copy_user_flushcache()
  arm64: uaccess: rename privileged uaccess routines
  arm64: sdei: explicitly simulate PAN/UAO entry
  arm64: sdei: move uaccess logic to arch/arm64/
  arm64: head.S: always initialize PSTATE
  arm64: head.S: cleanup SCTLR_ELx initialization
  arm64: head.S: rename el2_setup -> init_kernel_el
  arm64: add C wrappers for SET_PSTATE_*()
  ...

1  2 
arch/arm64/Kconfig
arch/arm64/include/asm/sysreg.h
arch/arm64/kernel/process.c
drivers/of/address.c

diff --combined arch/arm64/Kconfig
index a6b5b7ef40aea08f036e58d2684f87f378773644,984ca3a6d2a0a212a042b9271d6df008962e3afc..e5bcb49952683e0dc8d7134beb70470a0ba443e2
@@@ -81,7 -81,6 +81,7 @@@ config ARM6
        select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
        select ARCH_WANT_FRAME_POINTERS
        select ARCH_WANT_HUGE_PMD_SHARE if ARM64_4K_PAGES || (ARM64_16K_PAGES && !ARM64_VA_BITS_36)
 +      select ARCH_WANT_LD_ORPHAN_WARN
        select ARCH_HAS_UBSAN_SANITIZE_ALL
        select ARM_AMBA
        select ARM_ARCH_TIMER
        select HAVE_NMI
        select HAVE_PATA_PLATFORM
        select HAVE_PERF_EVENTS
+       select HAVE_PERF_EVENTS_NMI if ARM64_PSEUDO_NMI && HW_PERF_EVENTS
+       select HAVE_HARDLOCKUP_DETECTOR_PERF if PERF_EVENTS && HAVE_PERF_EVENTS_NMI
        select HAVE_PERF_REGS
        select HAVE_PERF_USER_STACK_DUMP
        select HAVE_REGS_AND_STACK_ACCESS_API
        select PCI_SYSCALL if PCI
        select POWER_RESET
        select POWER_SUPPLY
-       select SET_FS
        select SPARSE_IRQ
        select SWIOTLB
        select SYSCTL_EXCEPTION_TRACE
@@@ -332,16 -332,16 +333,16 @@@ config BROKEN_GAS_INS
  config KASAN_SHADOW_OFFSET
        hex
        depends on KASAN
-       default 0xdfffa00000000000 if (ARM64_VA_BITS_48 || ARM64_VA_BITS_52) && !KASAN_SW_TAGS
-       default 0xdfffd00000000000 if ARM64_VA_BITS_47 && !KASAN_SW_TAGS
-       default 0xdffffe8000000000 if ARM64_VA_BITS_42 && !KASAN_SW_TAGS
-       default 0xdfffffd000000000 if ARM64_VA_BITS_39 && !KASAN_SW_TAGS
-       default 0xdffffffa00000000 if ARM64_VA_BITS_36 && !KASAN_SW_TAGS
-       default 0xefff900000000000 if (ARM64_VA_BITS_48 || ARM64_VA_BITS_52) && KASAN_SW_TAGS
-       default 0xefffc80000000000 if ARM64_VA_BITS_47 && KASAN_SW_TAGS
-       default 0xeffffe4000000000 if ARM64_VA_BITS_42 && KASAN_SW_TAGS
-       default 0xefffffc800000000 if ARM64_VA_BITS_39 && KASAN_SW_TAGS
-       default 0xeffffff900000000 if ARM64_VA_BITS_36 && KASAN_SW_TAGS
+       default 0xdfff800000000000 if (ARM64_VA_BITS_48 || ARM64_VA_BITS_52) && !KASAN_SW_TAGS
+       default 0xdfffc00000000000 if ARM64_VA_BITS_47 && !KASAN_SW_TAGS
+       default 0xdffffe0000000000 if ARM64_VA_BITS_42 && !KASAN_SW_TAGS
+       default 0xdfffffc000000000 if ARM64_VA_BITS_39 && !KASAN_SW_TAGS
+       default 0xdffffff800000000 if ARM64_VA_BITS_36 && !KASAN_SW_TAGS
+       default 0xefff800000000000 if (ARM64_VA_BITS_48 || ARM64_VA_BITS_52) && KASAN_SW_TAGS
+       default 0xefffc00000000000 if ARM64_VA_BITS_47 && KASAN_SW_TAGS
+       default 0xeffffe0000000000 if ARM64_VA_BITS_42 && KASAN_SW_TAGS
+       default 0xefffffc000000000 if ARM64_VA_BITS_39 && KASAN_SW_TAGS
+       default 0xeffffff800000000 if ARM64_VA_BITS_36 && KASAN_SW_TAGS
        default 0xffffffffffffffff
  
  source "arch/arm64/Kconfig.platforms"
@@@ -1389,6 -1389,9 +1390,9 @@@ config ARM64_PA
         The feature is detected at runtime, and will remain as a 'nop'
         instruction if the cpu does not implement the feature.
  
+ config AS_HAS_LDAPR
+       def_bool $(as-instr,.arch_extension rcpc)
  config ARM64_LSE_ATOMICS
        bool
        default ARM64_USE_LSE_ATOMICS
@@@ -1426,27 -1429,6 +1430,6 @@@ endmen
  
  menu "ARMv8.2 architectural features"
  
- config ARM64_UAO
-       bool "Enable support for User Access Override (UAO)"
-       default y
-       help
-         User Access Override (UAO; part of the ARMv8.2 Extensions)
-         causes the 'unprivileged' variant of the load/store instructions to
-         be overridden to be privileged.
-         This option changes get_user() and friends to use the 'unprivileged'
-         variant of the load/store instructions. This ensures that user-space
-         really did have access to the supplied memory. When addr_limit is
-         set to kernel memory the UAO bit will be set, allowing privileged
-         access to kernel memory.
-         Choosing this option will cause copy_to_user() et al to use user-space
-         memory permissions.
-         The feature is detected at runtime, the kernel will use the
-         regular load/store instructions if the cpu does not implement the
-         feature.
  config ARM64_PMEM
        bool "Enable support for persistent memory"
        select ARCH_HAS_PMEM_API
@@@ -1847,15 -1829,36 +1830,36 @@@ config CMDLIN
          entering them here. As a minimum, you should specify the the
          root device (e.g. root=/dev/nfs).
  
+ choice
+       prompt "Kernel command line type" if CMDLINE != ""
+       default CMDLINE_FROM_BOOTLOADER
+       help
+         Choose how the kernel will handle the provided default kernel
+         command line string.
+ config CMDLINE_FROM_BOOTLOADER
+       bool "Use bootloader kernel arguments if available"
+       help
+         Uses the command-line options passed by the boot loader. If
+         the boot loader doesn't provide any, the default kernel command
+         string provided in CMDLINE will be used.
+ config CMDLINE_EXTEND
+       bool "Extend bootloader kernel arguments"
+       help
+         The command-line arguments provided by the boot loader will be
+         appended to the default kernel command string.
  config CMDLINE_FORCE
        bool "Always use the default kernel command string"
-       depends on CMDLINE != ""
        help
          Always use the default kernel command string, even if the boot
          loader passes other arguments to the kernel.
          This is useful if you cannot or don't want to change the
          command-line options your boot loader passes to the kernel.
  
+ endchoice
  config EFI_STUB
        bool
  
index 801861d054268a6aeefdda02c204ab2e5f37fec6,9e53ca349d2f79366b1ce1902e5bd0bb5392bb66..cf7922f238080b437f1e4887bad85817637b7f12
  #define SET_PSTATE_SSBS(x)            __emit_inst(0xd500401f | PSTATE_SSBS | ((!!x) << PSTATE_Imm_shift))
  #define SET_PSTATE_TCO(x)             __emit_inst(0xd500401f | PSTATE_TCO | ((!!x) << PSTATE_Imm_shift))
  
+ #define set_pstate_pan(x)             asm volatile(SET_PSTATE_PAN(x))
+ #define set_pstate_uao(x)             asm volatile(SET_PSTATE_UAO(x))
+ #define set_pstate_ssbs(x)            asm volatile(SET_PSTATE_SSBS(x))
  #define __SYS_BARRIER_INSN(CRm, op2, Rt) \
        __emit_inst(0xd5000000 | sys_insn(0, 3, 3, (CRm), (op2)) | ((Rt) & 0x1f))
  
  #define SYS_CONTEXTIDR_EL1            sys_reg(3, 0, 13, 0, 1)
  #define SYS_TPIDR_EL1                 sys_reg(3, 0, 13, 0, 4)
  
 +#define SYS_SCXTNUM_EL1                       sys_reg(3, 0, 13, 0, 7)
 +
  #define SYS_CNTKCTL_EL1                       sys_reg(3, 0, 14, 1, 0)
  
  #define SYS_CCSIDR_EL1                        sys_reg(3, 1, 0, 0, 0)
  #define SYS_TPIDR_EL0                 sys_reg(3, 3, 13, 0, 2)
  #define SYS_TPIDRRO_EL0                       sys_reg(3, 3, 13, 0, 3)
  
 +#define SYS_SCXTNUM_EL0                       sys_reg(3, 3, 13, 0, 7)
 +
  /* Definitions for system register interface to AMU for ARMv8.4 onwards */
  #define SYS_AM_EL0(crm, op2)          sys_reg(3, 3, 13, (crm), (op2))
  #define SYS_AMCR_EL0                  SYS_AM_EL0(2, 0)
  #define ENDIAN_SET_EL2                0
  #endif
  
+ #define INIT_SCTLR_EL2_MMU_OFF \
+       (SCTLR_EL2_RES1 | ENDIAN_SET_EL2)
  /* SCTLR_EL1 specific flags. */
  #define SCTLR_EL1_ATA0                (BIT(42))
  
  #define ENDIAN_SET_EL1                0
  #endif
  
- #define SCTLR_EL1_SET (SCTLR_ELx_M    | SCTLR_ELx_C    | SCTLR_ELx_SA   |\
-                        SCTLR_EL1_SA0  | SCTLR_EL1_SED  | SCTLR_ELx_I    |\
-                        SCTLR_EL1_DZE  | SCTLR_EL1_UCT                   |\
-                        SCTLR_EL1_NTWE | SCTLR_ELx_IESB | SCTLR_EL1_SPAN |\
-                        SCTLR_ELx_ITFSB| SCTLR_ELx_ATA  | SCTLR_EL1_ATA0 |\
-                        ENDIAN_SET_EL1 | SCTLR_EL1_UCI  | SCTLR_EL1_RES1)
+ #define INIT_SCTLR_EL1_MMU_OFF \
+       (ENDIAN_SET_EL1 | SCTLR_EL1_RES1)
+ #define INIT_SCTLR_EL1_MMU_ON \
+       (SCTLR_ELx_M    | SCTLR_ELx_C    | SCTLR_ELx_SA   | SCTLR_EL1_SA0   | \
+        SCTLR_EL1_SED  | SCTLR_ELx_I    | SCTLR_EL1_DZE  | SCTLR_EL1_UCT   | \
+        SCTLR_EL1_NTWE | SCTLR_ELx_IESB | SCTLR_EL1_SPAN | SCTLR_ELx_ITFSB | \
+        SCTLR_ELx_ATA  | SCTLR_EL1_ATA0 | ENDIAN_SET_EL1 | SCTLR_EL1_UCI   | \
+        SCTLR_EL1_RES1)
  
  /* MAIR_ELx memory attributes (used by Linux) */
  #define MAIR_ATTR_DEVICE_nGnRnE               UL(0x00)
index ed919f633ed8ec1eb326525c7da8830485ee2eb7,3834cfafbbc273ac235fec8ea15fd51f2409f7f4..6616486a58fe0bd62a05bae78268e5cd54a1a26e
@@@ -126,7 -126,7 +126,7 @@@ void noinstr arch_cpu_idle(void
         * tricks
         */
        cpu_do_idle();
 -      local_irq_enable();
 +      raw_local_irq_enable();
  }
  
  #ifdef CONFIG_HOTPLUG_CPU
@@@ -422,16 -422,15 +422,15 @@@ int copy_thread(unsigned long clone_fla
                if (clone_flags & CLONE_SETTLS)
                        p->thread.uw.tp_value = tls;
        } else {
+               /*
+                * A kthread has no context to ERET to, so ensure any buggy
+                * ERET is treated as an illegal exception return.
+                *
+                * When a user task is created from a kthread, childregs will
+                * be initialized by start_thread() or start_compat_thread().
+                */
                memset(childregs, 0, sizeof(struct pt_regs));
-               childregs->pstate = PSR_MODE_EL1h;
-               if (IS_ENABLED(CONFIG_ARM64_UAO) &&
-                   cpus_have_const_cap(ARM64_HAS_UAO))
-                       childregs->pstate |= PSR_UAO_BIT;
-               spectre_v4_enable_task_mitigation(p);
-               if (system_uses_irq_prio_masking())
-                       childregs->pmr_save = GIC_PRIO_IRQON;
+               childregs->pstate = PSR_MODE_EL1h | PSR_IL_BIT;
  
                p->thread.cpu_context.x19 = stack_start;
                p->thread.cpu_context.x20 = stk_sz;
@@@ -461,17 -460,6 +460,6 @@@ static void tls_thread_switch(struct ta
        write_sysreg(*task_user_tls(next), tpidr_el0);
  }
  
- /* Restore the UAO state depending on next's addr_limit */
- void uao_thread_switch(struct task_struct *next)
- {
-       if (IS_ENABLED(CONFIG_ARM64_UAO)) {
-               if (task_thread_info(next)->addr_limit == KERNEL_DS)
-                       asm(ALTERNATIVE("nop", SET_PSTATE_UAO(1), ARM64_HAS_UAO));
-               else
-                       asm(ALTERNATIVE("nop", SET_PSTATE_UAO(0), ARM64_HAS_UAO));
-       }
- }
  /*
   * Force SSBS state on context-switch, since it may be lost after migrating
   * from a CPU which treats the bit as RES0 in a heterogeneous system.
@@@ -554,7 -542,6 +542,6 @@@ __notrace_funcgraph struct task_struct 
        hw_breakpoint_thread_switch(next);
        contextidr_thread_switch(next);
        entry_task_switch(next);
-       uao_thread_switch(next);
        ssbs_thread_switch(next);
        erratum_1418040_thread_switch(prev, next);
  
diff --combined drivers/of/address.c
index 1c3257a2d4e37e6677deba228b2102d0f2dc5b38,09c0af7fd1c4480d6bd9f17bb4051bd49b514d0e..73ddf2540f3fe6f088ddc10d665d72a678745599
  }
  #endif /* CONFIG_HAS_DMA */
  
+ /**
+  * of_dma_get_max_cpu_address - Gets highest CPU address suitable for DMA
+  * @np: The node to start searching from or NULL to start from the root
+  *
+  * Gets the highest CPU physical address that is addressable by all DMA masters
+  * in the sub-tree pointed by np, or the whole tree if NULL is passed. If no
+  * DMA constrained device is found, it returns PHYS_ADDR_MAX.
+  */
+ phys_addr_t __init of_dma_get_max_cpu_address(struct device_node *np)
+ {
+       phys_addr_t max_cpu_addr = PHYS_ADDR_MAX;
+       struct of_range_parser parser;
+       phys_addr_t subtree_max_addr;
+       struct device_node *child;
+       struct of_range range;
+       const __be32 *ranges;
+       u64 cpu_end = 0;
+       int len;
+       if (!np)
+               np = of_root;
+       ranges = of_get_property(np, "dma-ranges", &len);
+       if (ranges && len) {
+               of_dma_range_parser_init(&parser, np);
+               for_each_of_range(&parser, &range)
+                       if (range.cpu_addr + range.size > cpu_end)
+                               cpu_end = range.cpu_addr + range.size - 1;
+               if (max_cpu_addr > cpu_end)
+                       max_cpu_addr = cpu_end;
+       }
+       for_each_available_child_of_node(np, child) {
+               subtree_max_addr = of_dma_get_max_cpu_address(child);
+               if (max_cpu_addr > subtree_max_addr)
+                       max_cpu_addr = subtree_max_addr;
+       }
+       return max_cpu_addr;
+ }
  /**
   * of_dma_is_coherent - Check if device is coherent
   * @np:       device node
   */
  bool of_dma_is_coherent(struct device_node *np)
  {
 -      struct device_node *node = of_node_get(np);
 +      struct device_node *node;
  
        if (IS_ENABLED(CONFIG_OF_DMA_DEFAULT_COHERENT))
                return true;
  
 +      node = of_node_get(np);
 +
        while (node) {
                if (of_property_read_bool(node, "dma-coherent")) {
                        of_node_put(node);
This page took 0.105152 seconds and 4 git commands to generate.