KVM
|
#include <linux/kvm_host.h>
#include <linux/hw_breakpoint.h>
#include <asm/debug-monitors.h>
#include <asm/kvm_asm.h>
#include <asm/kvm_arm.h>
#include <asm/kvm_emulate.h>
#include "trace.h"
Go to the source code of this file.
Macros | |
#define | MDSCR_EL1_DEBUG_MASK |
Functions | |
static | DEFINE_PER_CPU (u64, mdcr_el2) |
static void | save_guest_debug_regs (struct kvm_vcpu *vcpu) |
static void | restore_guest_debug_regs (struct kvm_vcpu *vcpu) |
void | kvm_arm_init_debug (void) |
static void | kvm_arm_setup_mdcr_el2 (struct kvm_vcpu *vcpu) |
void | kvm_arm_vcpu_init_debug (struct kvm_vcpu *vcpu) |
void | kvm_arm_reset_debug_ptr (struct kvm_vcpu *vcpu) |
void | kvm_arm_setup_debug (struct kvm_vcpu *vcpu) |
void | kvm_arm_clear_debug (struct kvm_vcpu *vcpu) |
void | kvm_arch_vcpu_load_debug_state_flags (struct kvm_vcpu *vcpu) |
void | kvm_arch_vcpu_put_debug_state_flags (struct kvm_vcpu *vcpu) |
#define MDSCR_EL1_DEBUG_MASK |
|
static |
void kvm_arch_vcpu_load_debug_state_flags | ( | struct kvm_vcpu * | vcpu | ) |
void kvm_arch_vcpu_put_debug_state_flags | ( | struct kvm_vcpu * | vcpu | ) |
void kvm_arm_clear_debug | ( | struct kvm_vcpu * | vcpu | ) |
Definition at line 280 of file debug.c.
void kvm_arm_init_debug | ( | void | ) |
kvm_arm_init_debug - grab what we need for debug
Currently the sole task of this function is to retrieve the initial value of mdcr_el2 so we can preserve MDCR_EL2.HPMN which has presumably been set-up by some knowledgeable bootcode.
It is called once per-cpu during CPU hyp initialisation.
Definition at line 78 of file debug.c.
void kvm_arm_reset_debug_ptr | ( | struct kvm_vcpu * | vcpu | ) |
void kvm_arm_setup_debug | ( | struct kvm_vcpu * | vcpu | ) |
kvm_arm_setup_debug - set up debug related stuff
@vcpu: the vcpu pointer
This is called before each entry into the hypervisor to setup any debug related registers.
Additionally, KVM only traps guest accesses to the debug registers if the guest is not actively using them (see the DEBUG_DIRTY flag on vcpu->arch.iflags). Since the guest must not interfere with the hardware state when debugging the guest, we must ensure that trapping is enabled whenever we are debugging the guest using the debug registers.
Definition at line 169 of file debug.c.
|
static |
kvm_arm_setup_mdcr_el2 - configure vcpu mdcr_el2 value
@vcpu: the vcpu pointer
This ensures we will trap access to:
Definition at line 96 of file debug.c.
void kvm_arm_vcpu_init_debug | ( | struct kvm_vcpu * | vcpu | ) |
|
static |
|
static |
save/restore_guest_debug_regs
For some debug operations we need to tweak some guest registers. As a result we need to save the state of those registers before we make those modifications.
Guest access to MDSCR_EL1 is trapped by the hypervisor and handled after we have restored the preserved value to the main context.
When single-step is enabled by userspace, we tweak PSTATE.SS on every guest entry. Preserve PSTATE.SS so we can restore the original value for the vcpu after the single-step is disabled.
Definition at line 40 of file debug.c.