Skip to content

Commit 3e51d43

Browse files
Marc Zyngierchazy
authored andcommitted
arm64: KVM: Move kvm_vcpu_get_condition out of emulate.c
In order to make emulate.c more generic, move the arch-specific manupulation bits out of emulate.c. Signed-off-by: Marc Zyngier <[email protected]> Signed-off-by: Christoffer Dall <[email protected]>
1 parent cb96408 commit 3e51d43

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

arch/arm64/include/asm/kvm_emulate.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,16 @@ static inline u32 kvm_vcpu_get_hsr(const struct kvm_vcpu *vcpu)
147147
return vcpu->arch.fault.esr_el2;
148148
}
149149

150+
static inline int kvm_vcpu_get_condition(const struct kvm_vcpu *vcpu)
151+
{
152+
u32 esr = kvm_vcpu_get_hsr(vcpu);
153+
154+
if (esr & ESR_ELx_CV)
155+
return (esr & ESR_ELx_COND_MASK) >> ESR_ELx_COND_SHIFT;
156+
157+
return -1;
158+
}
159+
150160
static inline unsigned long kvm_vcpu_get_hfar(const struct kvm_vcpu *vcpu)
151161
{
152162
return vcpu->arch.fault.far_el2;

arch/arm64/kvm/emulate.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
*/
2323

2424
#include <linux/kvm_host.h>
25-
#include <asm/esr.h>
2625
#include <asm/kvm_emulate.h>
2726

2827
/*
@@ -52,16 +51,6 @@ static const unsigned short cc_map[16] = {
5251
0 /* NV */
5352
};
5453

55-
static int kvm_vcpu_get_condition(const struct kvm_vcpu *vcpu)
56-
{
57-
u32 esr = kvm_vcpu_get_hsr(vcpu);
58-
59-
if (esr & ESR_ELx_CV)
60-
return (esr & ESR_ELx_COND_MASK) >> ESR_ELx_COND_SHIFT;
61-
62-
return -1;
63-
}
64-
6554
/*
6655
* Check if a trapped instruction should have been executed or not.
6756
*/

0 commit comments

Comments
 (0)