Skip to content

Commit

Permalink
arm64: KVM: Move kvm_vcpu_get_condition out of emulate.c
Browse files Browse the repository at this point in the history
In order to make emulate.c more generic, move the arch-specific
manupulation bits out of emulate.c.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
  • Loading branch information
Marc Zyngier authored and Christoffer Dall committed Sep 8, 2016
1 parent cb96408 commit 3e51d43
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
10 changes: 10 additions & 0 deletions arch/arm64/include/asm/kvm_emulate.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,16 @@ static inline u32 kvm_vcpu_get_hsr(const struct kvm_vcpu *vcpu)
return vcpu->arch.fault.esr_el2;
}

static inline int kvm_vcpu_get_condition(const struct kvm_vcpu *vcpu)
{
u32 esr = kvm_vcpu_get_hsr(vcpu);

if (esr & ESR_ELx_CV)
return (esr & ESR_ELx_COND_MASK) >> ESR_ELx_COND_SHIFT;

return -1;
}

static inline unsigned long kvm_vcpu_get_hfar(const struct kvm_vcpu *vcpu)
{
return vcpu->arch.fault.far_el2;
Expand Down
11 changes: 0 additions & 11 deletions arch/arm64/kvm/emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
*/

#include <linux/kvm_host.h>
#include <asm/esr.h>
#include <asm/kvm_emulate.h>

/*
Expand Down Expand Up @@ -52,16 +51,6 @@ static const unsigned short cc_map[16] = {
0 /* NV */
};

static int kvm_vcpu_get_condition(const struct kvm_vcpu *vcpu)
{
u32 esr = kvm_vcpu_get_hsr(vcpu);

if (esr & ESR_ELx_CV)
return (esr & ESR_ELx_COND_MASK) >> ESR_ELx_COND_SHIFT;

return -1;
}

/*
* Check if a trapped instruction should have been executed or not.
*/
Expand Down

0 comments on commit 3e51d43

Please sign in to comment.