Skip to content
Snippets Groups Projects
  1. Jan 23, 2020
    • Andrew Murray's avatar
      KVM: arm64: Write arch.mdcr_el2 changes since last vcpu_load on VHE · 4942dc66
      Andrew Murray authored
      
      On VHE systems arch.mdcr_el2 is written to mdcr_el2 at vcpu_load time to
      set options for self-hosted debug and the performance monitors
      extension.
      
      Unfortunately the value of arch.mdcr_el2 is not calculated until
      kvm_arm_setup_debug() in the run loop after the vcpu has been loaded.
      This means that the initial brief iterations of the run loop use a zero
      value of mdcr_el2 - until the vcpu is preempted. This also results in a
      delay between changes to vcpu->guest_debug taking effect.
      
      Fix this by writing to mdcr_el2 in kvm_arm_setup_debug() on VHE systems
      when a change to arch.mdcr_el2 has been detected.
      
      Fixes: d5a21bcc ("KVM: arm64: Move common VHE/non-VHE trap config in separate functions")
      Cc: <stable@vger.kernel.org> # 4.17.x-
      Suggested-by: default avatarJames Morse <james.morse@arm.com>
      Acked-by: default avatarWill Deacon <will@kernel.org>
      Reviewed-by: default avatarMarc Zyngier <maz@kernel.org>
      Signed-off-by: default avatarAndrew Murray <andrew.murray@arm.com>
      Signed-off-by: Catalin Mar...
      4942dc66
  2. Jun 19, 2019
  3. Feb 20, 2019
  4. Dec 18, 2018
    • Mark Rutland's avatar
      arm64: KVM: Consistently advance singlestep when emulating instructions · bd7d95ca
      Mark Rutland authored
      
      When we emulate a guest instruction, we don't advance the hardware
      singlestep state machine, and thus the guest will receive a software
      step exception after a next instruction which is not emulated by the
      host.
      
      We bodge around this in an ad-hoc fashion. Sometimes we explicitly check
      whether userspace requested a single step, and fake a debug exception
      from within the kernel. Other times, we advance the HW singlestep state
      rely on the HW to generate the exception for us. Thus, the observed step
      behaviour differs for host and guest.
      
      Let's make this simpler and consistent by always advancing the HW
      singlestep state machine when we skip an instruction. Thus we can rely
      on the hardware to generate the singlestep exception for us, and never
      need to explicitly check for an active-pending step, nor do we need to
      fake a debug exception from the guest.
      
      Cc: Peter Maydell <peter.maydell@linaro.org>
      Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Reviewed-by: default avatarChristoffer Dall <christoffer.dall@arm.com>
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
      bd7d95ca
  5. May 25, 2018
    • Dave Martin's avatar
      KVM: arm64: Repurpose vcpu_arch.debug_flags for general-purpose flags · fa89d31c
      Dave Martin authored
      
      In struct vcpu_arch, the debug_flags field is used to store
      debug-related flags about the vcpu state.
      
      Since we are about to add some more flags related to FPSIMD and
      SVE, it makes sense to add them to the existing flags field rather
      than adding new fields.  Since there is only one debug_flags flag
      defined so far, there is plenty of free space for expansion.
      
      In preparation for adding more flags, this patch renames the
      debug_flags field to simply "flags", and updates comments
      appropriately.
      
      The flag definitions are also moved to <asm/kvm_host.h>, since
      their presence in <asm/kvm_asm.h> was for purely historical
      reasons:  these definitions are not used from asm any more, and not
      very likely to be as more Hyp asm is migrated to C.
      
      KVM_ARM64_DEBUG_DIRTY_SHIFT has not been used since commit
      1ea66d27 ("arm64: KVM: Move away from the assembly version of
      the world switch"), so this patch gets rid of that too.
      
      No functional change.
      
      Signed-off-by: default avatarDave Martin <Dave.Martin@arm.com>
      Reviewed-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
      Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Acked-by: default avatarChristoffer Dall <christoffer.dall@arm.com>
      [maz: fixed minor conflict]
      Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
      fa89d31c
  6. Mar 19, 2018
  7. Nov 29, 2017
  8. Feb 03, 2017
    • Will Deacon's avatar
      arm64: KVM: Save/restore the host SPE state when entering/leaving a VM · f85279b4
      Will Deacon authored
      
      The SPE buffer is virtually addressed, using the page tables of the CPU
      MMU. Unusually, this means that the EL0/1 page table may be live whilst
      we're executing at EL2 on non-VHE configurations. When VHE is in use,
      we can use the same property to profile the guest behind its back.
      
      This patch adds the relevant disabling and flushing code to KVM so that
      the host can make use of SPE without corrupting guest memory, and any
      attempts by a guest to use SPE will result in a trap.
      
      Acked-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
      Cc: Alex Bennée <alex.bennee@linaro.org>
      Cc: Christoffer Dall <christoffer.dall@linaro.org>
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      f85279b4
  9. Jul 21, 2015