1. 18 Feb, 2016 6 commits
    • Catalin Marinas's avatar
      arm64: Remove the get_thread_info() function · e950631e
      Catalin Marinas authored
      This function was introduced by previous commits implementing UAO.
      However, it can be replaced with task_thread_info() in
      uao_thread_switch() or get_fs() in do_page_fault() (the latter being
      called only on the current context, so no need for using the saved
      pt_regs).
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      e950631e
    • James Morse's avatar
      arm64: kernel: Don't toggle PAN on systems with UAO · 70544196
      James Morse authored
      If a CPU supports both Privileged Access Never (PAN) and User Access
      Override (UAO), we don't need to disable/re-enable PAN round all
      copy_to_user() like calls.
      
      UAO alternatives cause these calls to use the 'unprivileged' load/store
      instructions, which are overridden to be the privileged kind when
      fs==KERNEL_DS.
      
      This patch changes the copy_to_user() calls to have their PAN toggling
      depend on a new composite 'feature' ARM64_ALT_PAN_NOT_UAO.
      
      If both features are detected, PAN will be enabled, but the copy_to_user()
      alternatives will not be applied. This means PAN will be enabled all the
      time for these functions. If only PAN is detected, the toggling will be
      enabled as normal.
      
      This will save the time taken to disable/re-enable PAN, and allow us to
      catch copy_to_user() accesses that occur with fs==KERNEL_DS.
      
      Futex and swp-emulation code continue to hang their PAN toggling code on
      ARM64_HAS_PAN.
      Signed-off-by: default avatarJames Morse <james.morse@arm.com>
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      70544196
    • James Morse's avatar
      arm64: cpufeature: Test 'matches' pointer to find the end of the list · 644c2ae1
      James Morse authored
      CPU feature code uses the desc field as a test to find the end of the list,
      this means every entry must have a description. This generates noise for
      entries in the list that aren't really features, but combinations of them.
      e.g.
      > CPU features: detected feature: Privileged Access Never
      > CPU features: detected feature: PAN and not UAO
      
      These combination features are needed for corner cases with alternatives,
      where cpu features interact.
      
      Change all walkers of the arm64_features[] and arm64_hwcaps[] lists to test
      'matches' not 'desc', and only print 'desc' if it is non-NULL.
      Signed-off-by: default avatarJames Morse <james.morse@arm.com>
      Reviewed-by : Suzuki K Poulose <suzuki.poulose@arm.com>
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      644c2ae1
    • James Morse's avatar
      arm64: kernel: Add support for User Access Override · 57f4959b
      James Morse authored
      'User Access Override' is a new ARMv8.2 feature which allows the
      unprivileged load and store instructions to be overridden to behave in
      the normal way.
      
      This patch converts {get,put}_user() and friends to use ldtr*/sttr*
      instructions - so that they can only access EL0 memory, then enables
      UAO when fs==KERNEL_DS so that these functions can access kernel memory.
      
      This allows user space's read/write permissions to be checked against the
      page tables, instead of testing addr<USER_DS, then using the kernel's
      read/write permissions.
      Signed-off-by: default avatarJames Morse <james.morse@arm.com>
      [catalin.marinas@arm.com: move uao_thread_switch() above dsb()]
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      57f4959b
    • James Morse's avatar
      arm64: add ARMv8.2 id_aa64mmfr2 boiler plate · 406e3087
      James Morse authored
      ARMv8.2 adds a new feature register id_aa64mmfr2. This patch adds the
      cpu feature boiler plate used by the actual features in later patches.
      Signed-off-by: default avatarJames Morse <james.morse@arm.com>
      Reviewed-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      406e3087
    • James Morse's avatar
      arm64: cpufeature: Change read_cpuid() to use sysreg's mrs_s macro · 0f54b14e
      James Morse authored
      Older assemblers may not have support for newer feature registers. To get
      round this, sysreg.h provides a 'mrs_s' macro that takes a register
      encoding and generates the raw instruction.
      
      Change read_cpuid() to use mrs_s in all cases so that new registers
      don't have to be a special case. Including sysreg.h means we need to move
      the include and definition of read_cpuid() after the #ifndef __ASSEMBLY__
      to avoid syntax errors in vmlinux.lds.
      Signed-off-by: default avatarJames Morse <james.morse@arm.com>
      Acked-by: default avatarMark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      0f54b14e
  2. 16 Feb, 2016 31 commits
  3. 14 Feb, 2016 3 commits