1. 09 1月, 2018 3 次提交
  2. 05 1月, 2018 1 次提交
  3. 23 12月, 2017 7 次提交
  4. 11 12月, 2017 12 次提交
  5. 07 12月, 2017 2 次提交
    • W
      arm64: SW PAN: Update saved ttbr0 value on enter_lazy_tlb · d96cc49b
      Will Deacon 提交于
      enter_lazy_tlb is called when a kernel thread rides on the back of
      another mm, due to a context switch or an explicit call to unuse_mm
      where a call to switch_mm is elided.
      
      In these cases, it's important to keep the saved ttbr value up to date
      with the active mm, otherwise we can end up with a stale value which
      points to a potentially freed page table.
      
      This patch implements enter_lazy_tlb for arm64, so that the saved ttbr0
      is kept up-to-date with the active mm for kernel threads.
      
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Vinayak Menon <vinmenon@codeaurora.org>
      Cc: <stable@vger.kernel.org>
      Fixes: 39bc88e5 ("arm64: Disable TTBR0_EL1 during normal kernel execution")
      Reviewed-by: NCatalin Marinas <catalin.marinas@arm.com>
      Reviewed-by: NMark Rutland <mark.rutland@arm.com>
      Reported-by: NVinayak Menon <vinmenon@codeaurora.org>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      d96cc49b
    • W
      arm64: SW PAN: Point saved ttbr0 at the zero page when switching to init_mm · 0adbdfde
      Will Deacon 提交于
      update_saved_ttbr0 mandates that mm->pgd is not swapper, since swapper
      contains kernel mappings and should never be installed into ttbr0. However,
      this means that callers must avoid passing the init_mm to update_saved_ttbr0
      which in turn can cause the saved ttbr0 value to be out-of-date in the context
      of the idle thread. For example, EFI runtime services may leave the saved ttbr0
      pointing at the EFI page table, and kernel threads may end up with stale
      references to freed page tables.
      
      This patch changes update_saved_ttbr0 so that the init_mm points the saved
      ttbr0 value to the empty zero page, which always exists and never contains
      valid translations. EFI and switch can then call into update_saved_ttbr0
      unconditionally.
      
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Vinayak Menon <vinmenon@codeaurora.org>
      Cc: <stable@vger.kernel.org>
      Fixes: 39bc88e5 ("arm64: Disable TTBR0_EL1 during normal kernel execution")
      Reviewed-by: NCatalin Marinas <catalin.marinas@arm.com>
      Reviewed-by: NMark Rutland <mark.rutland@arm.com>
      Reported-by: NVinayak Menon <vinmenon@codeaurora.org>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      0adbdfde
  6. 05 12月, 2017 1 次提交
  7. 01 12月, 2017 2 次提交
    • A
      arm64: ftrace: emit ftrace-mod.o contents through code · be0f272b
      Ard Biesheuvel 提交于
      When building the arm64 kernel with both CONFIG_ARM64_MODULE_PLTS and
      CONFIG_DYNAMIC_FTRACE enabled, the ftrace-mod.o object file is built
      with the kernel and contains a trampoline that is linked into each
      module, so that modules can be loaded far away from the kernel and
      still reach the ftrace entry point in the core kernel with an ordinary
      relative branch, as is emitted by the compiler instrumentation code
      dynamic ftrace relies on.
      
      In order to be able to build out of tree modules, this object file
      needs to be included into the linux-headers or linux-devel packages,
      which is undesirable, as it makes arm64 a special case (although a
      precedent does exist for 32-bit PPC).
      
      Given that the trampoline essentially consists of a PLT entry, let's
      not bother with a source or object file for it, and simply patch it
      in whenever the trampoline is being populated, using the existing
      PLT support routines.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      be0f272b
    • A
      arm64: module-plts: factor out PLT generation code for ftrace · 7e8b9c1d
      Ard Biesheuvel 提交于
      To allow the ftrace trampoline code to reuse the PLT entry routines,
      factor it out and move it into asm/module.h.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      7e8b9c1d
  8. 30 11月, 2017 1 次提交
  9. 29 11月, 2017 3 次提交
  10. 16 11月, 2017 1 次提交
  11. 15 11月, 2017 1 次提交
  12. 07 11月, 2017 2 次提交
  13. 06 11月, 2017 4 次提交
    • D
      KVM: arm/arm64: fix the incompatible matching for external abort · a2b83133
      Dongjiu Geng 提交于
      kvm_vcpu_dabt_isextabt() tries to match a full fault syndrome, but
      calls kvm_vcpu_trap_get_fault_type() that only returns the fault class,
      thus reducing the scope of the check. This doesn't cause any observable
      bug yet as we end-up matching a closely related syndrome for which we
      return the same value.
      
      Using kvm_vcpu_trap_get_fault() instead fixes it for good.
      Signed-off-by: NDongjiu Geng <gengdongjiu@huawei.com>
      Acked-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NChristoffer Dall <christoffer.dall@linaro.org>
      a2b83133
    • M
      KVM: arm/arm64: Unify 32bit fault injection · 74a64a98
      Marc Zyngier 提交于
      Both arm and arm64 implementations are capable of injecting
      faults, and yet have completely divergent implementations,
      leading to different bugs and reduced maintainability.
      
      Let's elect the arm64 version as the canonical one
      and move it into aarch32.c, which is common to both
      architectures.
      Reviewed-by: NChristoffer Dall <christoffer.dall@linaro.org>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NChristoffer Dall <christoffer.dall@linaro.org>
      74a64a98
    • C
      KVM: arm/arm64: Move timer save/restore out of the hyp code · 688c50aa
      Christoffer Dall 提交于
      As we are about to be lazy with saving and restoring the timer
      registers, we prepare by moving all possible timer configuration logic
      out of the hyp code.  All virtual timer registers can be programmed from
      EL1 and since the arch timer is always a level triggered interrupt we
      can safely do this with interrupts disabled in the host kernel on the
      way to the guest without taking vtimer interrupts in the host kernel
      (yet).
      
      The downside is that the cntvoff register can only be programmed from
      hyp mode, so we jump into hyp mode and back to program it.  This is also
      safe, because the host kernel doesn't use the virtual timer in the KVM
      code.  It may add a little performance performance penalty, but only
      until following commits where we move this operation to vcpu load/put.
      Signed-off-by: NChristoffer Dall <cdall@linaro.org>
      Reviewed-by: NMarc Zyngier <marc.zyngier@arm.com>
      688c50aa
    • C
      arm64: Use physical counter for in-kernel reads when booted in EL2 · e6d68b00
      Christoffer Dall 提交于
      Using the physical counter allows KVM to retain the offset between the
      virtual and physical counter as long as it is actively running a VCPU.
      
      As soon as a VCPU is released, another thread is scheduled or we start
      running userspace applications, we reset the offset to 0, so that
      userspace accessing the virtual timer can still read the virtual counter
      and get the same view of time as the kernel.
      
      This opens up potential improvements for KVM performance, but we have to
      make a few adjustments to preserve system consistency.
      
      Currently get_cycles() is hardwired to arch_counter_get_cntvct() on
      arm64, but as we move to using the physical timer for the in-kernel
      time-keeping on systems that boot in EL2, we should use the same counter
      for get_cycles() as for other in-kernel timekeeping operations.
      
      Similarly, implementations of arch_timer_set_next_event_phys() is
      modified to use the counter specific to the timer being programmed.
      
      VHE kernels or kernels continuing to use the virtual timer are
      unaffected.
      
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Acked-by: NCatalin Marinas <catalin.marinas@arm.com>
      Acked-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NChristoffer Dall <cdall@linaro.org>
      e6d68b00